Refactor: split renderer
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] 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
- [x] 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
What is the current behavior?
将以renderMain为入口的渲染逻辑抽取为独立包,作为schema渲染引擎可以独立使用
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Other information
Summary by CodeRabbit
-
New Features
- Introduced a new Vue component
CanvasEmptyto guide users in building pages. - Enhanced
CanvasContainer.vuefor improved mouse event handling within the canvas. - Added new functions for managing canvas state and data sources, improving modularity and functionality.
- New README documentation for the
tiny-engine-rendererto assist users with integration. - Updated JSON schema with new data sources and detailed definitions for better data management.
- New constants added for standardized identifiers in the rendering process.
- Added new alias mapping for
@opentiny/tiny-engine-rendererto streamline development.
- Introduced a new Vue component
-
Bug Fixes
- Improved error handling in various functions to ensure robustness.
-
Documentation
- New ESLint configuration and
.gitignorefile to enhance code quality and streamline version control. - Updated README files to provide comprehensive usage examples and integration instructions for the
tiny-engine-renderer.
- New ESLint configuration and
-
Chores
- Introduced a new
package.jsonfor the@opentiny/tiny-engine-rendererpackage, setting up scripts and dependencies.
- Introduced a new
[!IMPORTANT]
Review skipped
Draft detected.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Walkthrough
This pull request introduces several changes across multiple files, primarily focusing on the integration of a new renderer package, @opentiny/tiny-engine-renderer. Key updates include the addition of path mappings in configuration files, enhancements to JSON schemas, and modifications to component imports and logic. New functions and constants are introduced, and several existing functions are updated to utilize the new API structure. Additionally, new configuration files for ESLint and Vite are created to support the renderer package.
Changes
| File | Change Summary |
|---|---|
jsconfig.json |
Added path mapping for @opentiny/tiny-engine-renderer to packages/renderer/src/index.js. |
mockServer/src/mock/get/app-center/v1/apps/schema/918.json |
Updated JSON schema with new data sources and enhanced definitions for existing entries. |
packages/build/vite-config/src/vite-plugins/devAliasPlugin.js |
Added alias mapping for @opentiny/tiny-engine-renderer. |
packages/canvas/container/src/container.js |
Updated import from local JSON to BuiltinBundle from the new renderer package. |
packages/canvas/render/src/lowcode.js |
Changed import of api to use the new renderer package and updated method access. |
packages/canvas/render/src/runner.js |
Updated import path for Main component to the new renderer package. |
packages/canvas/render/src/supportUmdBlock.js |
Modified to use api from the new renderer package for managing block data. |
packages/renderer/.eslintrc.cjs |
Introduced new ESLint configuration for the renderer package. |
packages/renderer/.gitignore |
Added new .gitignore file for the renderer package. |
packages/renderer/package.json |
Created new package.json for the renderer package, including dependencies and scripts. |
packages/renderer/src/CanvasEmpty.vue |
Added new Vue component for empty canvas state. |
packages/renderer/src/RenderMain.js |
Updated exports to include new utility functions for the renderer. |
packages/renderer/src/builtin/CanvasCollection.js |
Refactored to use api.getController() for controller access. |
packages/renderer/src/builtin/CanvasCollection.vue |
Updated to fetch data using api.getController(). |
packages/renderer/src/constants.js |
Added new constants: NODE_UID, NODE_TAG, NODE_LOOP. |
packages/renderer/src/context.js |
Introduced canvasFlag variable and related getter/setter functions. |
packages/renderer/src/index.js |
Created new entry point for the renderer package with exports. |
packages/renderer/src/render.js |
Added new functions and updated existing ones for better modularity. |
packages/renderer/vite.config.js |
Introduced new Vite configuration file for the renderer package. |
packages/canvas/container/src/CanvasContainer.vue |
Enhanced mouse event handling with new utility functions. |
packages/plugins/materials/src/composable/useMaterial.js |
Updated material initialization to use BuiltinBundle. |
packages/renderer/README.md |
Added documentation for the tiny-engine-renderer with usage examples. |
packages/renderer/README.zh-CN.md |
Created a new README file for the tiny-engine-renderer in Chinese. |
packages/canvas/package.json |
Updated version and dependencies in the @opentiny/tiny-engine-canvas package. |
Suggested labels
enhancement, ospp-2024
Suggested reviewers
- hexqi
- rhlin
🐰 In the world of code, so bright and new,
A renderer's path has come into view.
With components and schemas, all neatly aligned,
The canvas awaits, with magic designed.
So hop to the changes, let’s build and create,
For in this new structure, we celebrate fate! 🎉
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 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.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 generate unit testing code.@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.
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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.