Skip to content

feat: remove webComponent I18n host #1438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2025

Conversation

chilingling
Copy link
Member

@chilingling chilingling commented May 27, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

修复问题:#1433 (升级到 vue 3.5 版本之后,画布空白,不显示)

  • 移除 webComponent 版本的 i18n host 组件

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • None.
  • Bug Fixes

    • None.
  • Refactor

    • Simplified rendering logic by removing the i18n host wrapper and related web components from canvas and i18n modules.
    • Updated i18n handling to use direct Vue composition API instead of a dedicated i18n host component.
    • Removed custom i18n web components and centralized i18n creation within the core i18n module.
    • Adjusted locale initialization and reactive locale updates in i18n components.
  • Chores

    • Removed the dependency on "@opentiny/tiny-engine-webcomponent-core" across multiple packages.
    • Cleaned up import maps and build configurations to reflect dependency removals.
    • Streamlined npm scripts in the i18n package.
    • Updated documentation titles and HTML page titles to reflect i18n changes.
    • Deleted obsolete i18n-related test components and files.

Copy link
Contributor

coderabbitai bot commented May 27, 2025

Walkthrough

The changes remove all references to @opentiny/tiny-engine-webcomponent-core and related web component infrastructure from multiple packages. The i18n provider component (I18nHost) and its custom element registration are deleted. Rendering logic and templates are simplified to use direct Vue components and context. Build scripts, import maps, and dependencies are updated accordingly.

Changes

File(s) / Path(s) Change Summary
packages/canvas/package.json
packages/design-core/package.json
packages/i18n/package.json
Removed @opentiny/tiny-engine-webcomponent-core from dependencies; cleaned up npm scripts in i18n.
packages/common/js/import-map.json Deleted import map entry for @opentiny/tiny-engine-webcomponent-core.
packages/i18n/src/I18nHost.vue Deleted the I18nHost Vue component, which provided i18n context and locale/message management.
packages/i18n/src/App.vue Removed <tiny-i18n-host> and web component usage; simplified to direct Vue components and context.
packages/i18n/src/lib.ts Removed custom element definition and registration for 'tiny-i18n-host'; refactored i18n creation and exports.
packages/i18n/src/i18n.ts
packages/i18n/src/test/TestWebcomponent.vue
Deleted i18n setup file and test web component using i18n injection.
packages/i18n/vite.config.ts Removed @opentiny/tiny-engine-webcomponent-core from externals and globals in build config; typed format parameter.
packages/i18n/README.md Changed README title from "lowcode-webcomponent" to "TinyEngine i18n host."
packages/i18n/index.html Changed HTML title from "Tiny Vue WebComponent" to "Tiny Vue i18n".
packages/canvas/render/src/canvas-function/custom-renderer.ts Simplified renderer logic by removing the i18n host wrapper and rendering components directly.

Sequence Diagram(s)

sequenceDiagram
    participant AppVue
    participant VueComponents
    participant i18n

    AppVue->>i18n: Provide i18n context via provide()
    AppVue->>VueComponents: Render TestVueUse and TestVueInject
    VueComponents->>i18n: Inject and use i18n instance
Loading

Poem

A hop, a skip, the web components gone,
No more wrappers, we render on!
I18n flows with context clear,
Simpler paths for all to cheer.
Dependencies trimmed, the code feels light—
The garden’s clean, and all is right!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06cedd5 and 6e5f122.

📒 Files selected for processing (8)
  • packages/i18n/README.md (1 hunks)
  • packages/i18n/index.html (1 hunks)
  • packages/i18n/package.json (1 hunks)
  • packages/i18n/src/App.vue (1 hunks)
  • packages/i18n/src/i18n.ts (0 hunks)
  • packages/i18n/src/lib.ts (1 hunks)
  • packages/i18n/src/test/TestWebcomponent.vue (0 hunks)
  • packages/i18n/vite.config.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/i18n/src/test/TestWebcomponent.vue
  • packages/i18n/src/i18n.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/i18n/README.md
  • packages/i18n/index.html
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/i18n/vite.config.ts
  • packages/i18n/package.json
  • packages/i18n/src/App.vue
  • packages/i18n/src/lib.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request label May 27, 2025
@chilingling chilingling marked this pull request as ready for review May 27, 2025 13:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/i18n/package.json (1)

7-7: Update package description to reflect webcomponent removal.

The package description still mentions "webcomponent vue i18n host" but the webcomponent functionality has been removed. Consider updating the description to reflect the current functionality.

-  "description": "webcomponent vue i18n host",
+  "description": "vue i18n host",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3204abc and 06cedd5.

📒 Files selected for processing (9)
  • packages/canvas/package.json (0 hunks)
  • packages/canvas/render/src/canvas-function/custom-renderer.ts (1 hunks)
  • packages/common/js/import-map.json (0 hunks)
  • packages/design-core/package.json (0 hunks)
  • packages/i18n/package.json (1 hunks)
  • packages/i18n/src/App.vue (1 hunks)
  • packages/i18n/src/I18nHost.vue (0 hunks)
  • packages/i18n/src/lib.ts (0 hunks)
  • packages/i18n/vite.config.ts (1 hunks)
💤 Files with no reviewable changes (5)
  • packages/common/js/import-map.json
  • packages/i18n/src/lib.ts
  • packages/i18n/src/I18nHost.vue
  • packages/design-core/package.json
  • packages/canvas/package.json
🧰 Additional context used
🧠 Learnings (1)
packages/canvas/render/src/canvas-function/custom-renderer.ts (1)
Learnt from: rhlin
PR: opentiny/tiny-engine#1011
File: packages/canvas/render/src/canvas-function/custom-renderer.ts:28-32
Timestamp: 2025-01-14T07:11:44.138Z
Learning: The locale and webComponent wrapper in `packages/canvas/render/src/canvas-function/custom-renderer.ts` are part of migrated code and will be improved in a future PR.
🧬 Code Graph Analysis (1)
packages/canvas/render/src/canvas-function/custom-renderer.ts (1)
packages/canvas/render/src/render.ts (1)
  • renderer (228-321)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (5)
packages/i18n/vite.config.ts (1)

42-48: LGTM! Consistent removal of webcomponent dependency from build configuration.

The changes correctly remove both the external dependency and its corresponding global variable mapping for @opentiny/tiny-engine-webcomponent-core, maintaining consistency in the Vite build configuration.

packages/i18n/package.json (1)

9-10:

✅ Verification successful

Verify if removed scripts are still needed.

The removal of lint, format, and publish:npm scripts may impact development workflow and CI/CD processes. Please verify that these scripts are not required elsewhere in the build pipeline.


🏁 Script executed:

#!/bin/bash
# Description: Check if removed scripts are referenced in CI/CD files or other scripts
# Expected: Find any references to the removed scripts that might break workflows

echo "Searching for references to removed scripts..."
rg -i "lint|format|publish:npm" --type yaml --type json --type js --type ts .github/ scripts/ || echo "No CI/CD references found"

# Check for package.json files that might depend on these scripts
rg -A 5 -B 5 "packages/i18n.*lint|packages/i18n.*format|packages/i18n.*publish" --type json

Length of output: 1187


🏁 Script executed:

#!/bin/bash
# Refined search for direct invocations of the removed scripts in CI/CD and helper scripts

echo "Searching for direct invocations of removed scripts in .github workflows..."
rg -i 'npm\s+run\s+(lint|format|publish:npm)' .github/ || echo "No direct npm run invocations found in .github/"
rg -i 'yarn\s+(lint|format|publish:npm)' .github/ || echo "No yarn invocations found in .github/"
rg -i 'pnpm\s+run\s+(lint|format|publish:npm)' .github/ || echo "No pnpm invocations found in .github/"

echo "Searching for direct invocations of removed scripts in scripts/ directory..."
rg -i 'npm\s+run\s+(lint|format|publish:npm)' scripts/ || echo "No npm run invocations found in scripts/"
rg -i 'yarn\s+(lint|format|publish:npm)' scripts/ || echo "No yarn invocations found in scripts/"
rg -i 'pnpm\s+run\s+(lint|format|publish:npm)' scripts/ || echo "No pnpm invocations found in scripts/"

Length of output: 1193


Removed scripts are not referenced elsewhere
No CI/CD workflows or helper scripts invoke lint, format, or publish:npm in packages/i18n. The removal is safe.

packages/canvas/render/src/canvas-function/custom-renderer.ts (1)

28-32: LGTM! Simplified rendering logic by removing web component wrapper.

The direct rendering approach correctly maintains the original logic while removing the tiny-i18n-host wrapper. This should resolve the Vue 3.5 compatibility issues mentioned in the PR objectives.

Based on retrieved learnings, this migrated code will be further improved in future PRs, which is appropriate for maintaining the current functionality while addressing the immediate compatibility concern.

packages/i18n/src/App.vue (2)

9-12: LGTM! Simplified template by removing web component wrapper.

The direct rendering of Vue components instead of using the tiny-i18n-host web component wrapper correctly addresses the Vue 3.5 compatibility issue.


28-28: Verify if locale change from 'en_US' to 'zh_CN' is intentional.

The default locale was changed from 'en_US' to 'zh_CN'. Please confirm if this change is intentional or if it should remain 'en_US' for consistency.

@hexqi hexqi added this to the v2.6.0 milestone May 28, 2025
@hexqi hexqi merged commit 770a0bf into opentiny:develop May 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants