-
Notifications
You must be signed in to change notification settings - Fork 338
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
feat: add capability of add custom metaComponents #528
feat: add capability of add custom metaComponents #528
Conversation
Warning Rate limit exceeded@chilingling has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 59 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent changes introduce new configurators and meta components for TinyEngine, enhancing customizability and functionality. Key updates include the addition of Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant App as Application
participant TinyEngine as TinyEngine
participant MetaInput as MetaInput Component
participant InputConfigurator as InputConfigurator
App->>TinyEngine: Initialize with metaComponents and configurators
TinyEngine->>MetaInput: Register MetaInput component
TinyEngine->>InputConfigurator: Register InputConfigurator component
App->>MetaInput: Use MetaInput in form
MetaInput->>App: Return input value
App->>InputConfigurator: Use InputConfigurator for settings
InputConfigurator->>App: Return configured input settings
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Outside diff range and nitpick comments (3)
packages/entry/README.md (1)
3-3
: Please remove the extra blank lines to adhere to markdown best practices.packages/common/index.js (1)
Line range hint
102-104
: Consider replacingforEach
withfor...of
for better performance and readability.- props.options.forEach((item) => { + for (const item of props.options) { map[item.value] = item - }) + }packages/design-core/vite.config.js (1)
Line range hint
3-3
: Use thenode:
protocol when importing Node.js built-in modules to avoid confusion with npm packages.- import { fileURLToPath } from 'node:url' + import { fileURLToPath } from 'url'
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (20)
- designer-demo/src/MetaInput.vue (1 hunks)
- designer-demo/src/main.js (1 hunks)
- designer-demo/src/registerCustomMetaComponents.js (1 hunks)
- packages/common/component/ConfigItem.vue (2 hunks)
- packages/common/index.js (1 hunks)
- packages/design-core/public/mock/bundle.json (1 hunks)
- packages/design-core/src/init.js (2 hunks)
- packages/design-core/src/registerMetaComponents.js (1 hunks)
- packages/design-core/vite.config.js (1 hunks)
- packages/entry/README.md (1 hunks)
- packages/entry/src/index.js (1 hunks)
- packages/entry/src/metaComponents.js (1 hunks)
- packages/meta-components/README.md (1 hunks)
- packages/meta-components/package.json (1 hunks)
- packages/meta-components/src/index.js (1 hunks)
- packages/meta-components/src/meta-input/MetaInput.vue (1 hunks)
- packages/meta-components/src/meta-input/index.js (1 hunks)
- packages/meta-components/src/meta-select/MetaSelect.vue (1 hunks)
- packages/meta-components/src/meta-select/index.js (1 hunks)
- packages/meta-components/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (7)
- designer-demo/src/main.js
- packages/design-core/public/mock/bundle.json
- packages/entry/src/index.js
- packages/meta-components/README.md
- packages/meta-components/package.json
- packages/meta-components/src/meta-input/index.js
- packages/meta-components/src/meta-select/index.js
Additional context used
Markdownlint
packages/entry/README.md
3-3: Expected: 1; Actual: 2
Multiple consecutive blank lines
Biome
packages/meta-components/vite.config.js
[error] 14-14: A Node.js builtin module should be imported with the node: protocol.
packages/common/index.js
[error] 102-104: Prefer for...of instead of forEach.
packages/design-core/vite.config.js
[error] 3-3: A Node.js builtin module should be imported with the node: protocol.
Additional comments not posted (15)
packages/meta-components/src/index.js (2)
1-1
: Export statement forMetaInput
is correctly implemented.
2-2
: Export statement forMetaSelect
is correctly implemented.designer-demo/src/registerCustomMetaComponents.js (3)
1-1
: Import statement foraddMetaComponents
is correctly implemented.
2-2
: Import statement forMetaInput
is correctly implemented.
4-11
: FunctionregisterCustomMetaComponents
correctly registersMetaInput
with a custom name.packages/entry/src/metaComponents.js (2)
3-8
: FunctionaddMetaComponents
correctly handles an array of components and adds them to the map.
11-13
: FunctiongetMetaComponent
correctly retrieves a component by name from the map.packages/design-core/src/registerMetaComponents.js (4)
1-1
: Import statement forMetaComponents
is correctly implemented.
2-2
: Import statement foraddMetaComponents
is correctly implemented.
4-4
: Import statement fordefaultMetaComponents
is correctly implemented.
9-14
: FunctionregisterMetaComponents
correctly registers both other components and default meta components.designer-demo/src/MetaInput.vue (1)
11-51
: LGTM! TheMetaInput
component is well-defined with proper props validation and emits.packages/meta-components/src/meta-input/MetaInput.vue (1)
16-60
: Well-implemented enhancements with thesuffix
slot and dynamic property updates usingwatchEffect
.packages/design-core/src/init.js (1)
28-28
: Correct placement ofregisterMetaComponents
ensures all meta components are available at runtime.packages/meta-components/src/meta-select/MetaSelect.vue (1)
50-110
: TheMetaSelect
component is well-structured to handle complex selection scenarios with excellent use of Vue's reactivity system.
There was a problem hiding this 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
Outside diff range and nitpick comments (1)
designer-demo/src/metaComponents.js (1)
7-7
: Consider aligning the naming convention for custom components to match the existing pattern used for other meta components.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- designer-demo/src/main.js (1 hunks)
- designer-demo/src/metaComponents.js (1 hunks)
- packages/design-core/src/init.js (2 hunks)
- packages/design-core/src/registerMetaComponents.js (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- designer-demo/src/main.js
- packages/design-core/src/init.js
- packages/design-core/src/registerMetaComponents.js
Additional comments not posted (1)
designer-demo/src/metaComponents.js (1)
1-1
: Consider removing the commented-out import if it's not used elsewhere in the code.Verification successful
Consider removing the commented-out import of
addMetaComponents
indesigner-demo/src/metaComponents.js
as it is not used in this file.
designer-demo/src/metaComponents.js
: Commented-out import statement.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if `addMetaComponents` is used in the project. rg --type js 'addMetaComponents'Length of output: 678
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/common/component/ConfigItem.vue (2 hunks)
- packages/meta-components/vite.config.js (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- packages/common/component/ConfigItem.vue
- packages/meta-components/vite.config.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
根据讨论,需要区分配置组件和meta(元)的概念,避免混淆,要把 meta -> configurator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/design-core/vite.config.js (1)
Line range hint
3-3
: Correct the import statement for Node.js built-in modules.- import path from 'path' + import path from 'node:path'This change ensures compliance with the latest Node.js module resolution enhancements where built-in modules should be imported with the
node:
protocol.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (20)
- designer-demo/package.json (1 hunks)
- designer-demo/src/MyInputConfigurator.vue (1 hunks)
- designer-demo/src/configurators.js (1 hunks)
- designer-demo/src/main.js (1 hunks)
- packages/builtinComponent/src/meta/CanvasCol.json (5 hunks)
- packages/builtinComponent/src/meta/CanvasRow.json (5 hunks)
- packages/builtinComponent/src/meta/CanvasRowColContainer.json (1 hunks)
- packages/canvas/src/components/builtin/builtin.json (3 hunks)
- packages/configurator/README.md (1 hunks)
- packages/configurator/package.json (1 hunks)
- packages/configurator/src/index.js (1 hunks)
- packages/configurator/src/input-configurator/InputConfigurator.vue (1 hunks)
- packages/configurator/src/input-configurator/index.js (1 hunks)
- packages/configurator/src/select-configurator/SelectConfigurator.vue (1 hunks)
- packages/configurator/src/select-configurator/index.js (1 hunks)
- packages/configurator/vite.config.js (1 hunks)
- packages/design-core/public/mock/bundle.json (125 hunks)
- packages/design-core/src/init.js (2 hunks)
- packages/design-core/src/registerMetaComponents.js (1 hunks)
- packages/design-core/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (5)
- designer-demo/src/configurators.js
- packages/builtinComponent/src/meta/CanvasRowColContainer.json
- packages/configurator/src/index.js
- packages/configurator/src/input-configurator/index.js
- packages/configurator/src/select-configurator/index.js
Files skipped from review as they are similar to previous changes (4)
- designer-demo/src/main.js
- packages/design-core/public/mock/bundle.json
- packages/design-core/src/init.js
- packages/design-core/src/registerMetaComponents.js
Additional context used
Biome
packages/design-core/vite.config.js
[error] 3-3: A Node.js builtin module should be imported with the node: protocol.
Additional comments not posted (10)
packages/configurator/README.md (1)
1-3
: Ensure the description accurately reflects the functionalities of the meta component configurators introduced in this PR.designer-demo/package.json (1)
14-15
: Confirm the versioning and necessity of the newly added dependencies for proper integration with the TinyEngine modules.Verification successful
The newly added dependencies related to the
@opentiny/tiny-engine
modules are indeed used extensively throughout the project. This confirms their necessity and proper integration.
- The dependencies are referenced in various configuration files, scripts, and source code files.
- They are used in multiple packages and modules within the project, indicating their importance and widespread usage.
This thorough usage across the project validates the addition of these dependencies.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the newly added dependencies are correctly versioned and necessary. # Test: Check the package versions and their usage in the project. cat designer-demo/package.json | grep '@opentiny/tiny-engine'Length of output: 310
Script:
#!/bin/bash # Description: Verify the usage of the newly added dependencies in the project files. # Test: Search for the usage of @opentiny/tiny-engine dependencies in the project. rg '@opentiny/tiny-engine' --glob '!node_modules/*'Length of output: 94490
packages/configurator/package.json (1)
1-28
: Review the entire package configuration to ensure all dependencies, scripts, and metadata are correctly set up and aligned with the project standards.Verification successful
The package.json file for the configurator package is correctly configured with the necessary metadata, scripts, and dependencies.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the package configuration in package.json. # Test: Check the dependencies, scripts, and metadata for correctness. cat packages/configurator/package.jsonLength of output: 722
packages/configurator/vite.config.js (1)
13-34
: Ensure the Vite configuration is optimized for the package's needs, particularly the plugins and rollup options.Verification successful
The Vite configuration for the configurator package includes standard plugins for Vue and Vue JSX, and the rollup options are appropriately set for a library build. The configuration appears optimized for the package's needs.
- Plugins: vue(), vueJsx()
- Rollup options: banner, external dependencies
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the Vite configuration is optimized. # Test: Review the plugins and rollup options in the configuration. cat packages/configurator/vite.config.jsLength of output: 1085
designer-demo/src/MyInputConfigurator.vue (1)
1-51
: Review the implementation of the MyInputConfigurator component to ensure it follows Vue best practices and aligns with the project's component architecture.Verification successful
The implementation of the
MyInputConfigurator
component follows Vue best practices and aligns with the project's component architecture. The props, emits, and setup function are correctly implemented.
- The props are defined with appropriate types and default values.
- The emits array correctly lists the 'update:modelValue' event.
- The setup function uses the
ref
function to create a reactive value and defines achange
function to emit the updated value.- The template binds the value to the
tiny-input
component and listens for theupdate:modelValue
event.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the Vue component implementation. # Test: Review the component definition, props, emits, and setup function. cat designer-demo/src/MyInputConfigurator.vueLength of output: 1168
packages/configurator/src/input-configurator/InputConfigurator.vue (1)
1-60
: Review the implementation of the InputConfigurator component to ensure it follows Vue best practices and aligns with the project's component architecture.packages/configurator/src/select-configurator/SelectConfigurator.vue (1)
50-109
: Ensure proper localization and reactive state management in Vue component.This Vue component is well-structured with clear prop definitions, emits, and reactive state management. The use of localization and computed properties for dynamic updates is commendable.
packages/builtinComponent/src/meta/CanvasRow.json (1)
37-37
: Update CanvasRow component configuration to use new configurators.The configuration updates to use
InputConfigurator
andSelectConfigurator
for various properties are correctly implemented. This ensures that the component can utilize the newly introduced configurators effectively.Also applies to: 53-53, 69-69, 85-85, 109-109
packages/builtinComponent/src/meta/CanvasCol.json (1)
59-59
: Update CanvasCol component configuration to use new configurators.The configuration updates to use
InputConfigurator
andSelectConfigurator
for various properties are correctly implemented. This ensures that the component can utilize the newly introduced configurators effectively.Also applies to: 75-75, 91-91, 107-107, 131-131
packages/canvas/src/components/builtin/builtin.json (1)
97-97
: Ensure consistent use of configurators in built-in components.The updates to use
InputConfigurator
for properties likename
,text
, andsrc
in various built-in components are correctly implemented. This ensures that the components can utilize the newly introduced configurators effectively.Also applies to: 259-259, 402-402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/configurator/package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/configurator/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- designer-demo/src/MyInputConfigurator.vue (1 hunks)
- packages/common/component/ConfigItem.vue (2 hunks)
- packages/configurator/README.md (1 hunks)
- packages/design-core/src/init.js (2 hunks)
- packages/design-core/src/registerConfigurators.js (1 hunks)
- packages/entry/README.md (1 hunks)
- packages/entry/src/configurators.js (1 hunks)
- packages/entry/src/index.js (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/configurator/README.md
Files skipped from review as they are similar to previous changes (4)
- designer-demo/src/MyInputConfigurator.vue
- packages/common/component/ConfigItem.vue
- packages/design-core/src/init.js
- packages/entry/src/index.js
Additional context used
Markdownlint
packages/entry/README.md
3-3: Expected: 1; Actual: 2
Multiple consecutive blank lines
Additional comments not posted (2)
packages/entry/src/configurators.js (1)
11-13
: This function correctly retrieves a configurator by name. Well done!packages/design-core/src/registerConfigurators.js (1)
8-11
: Ensure thataddConfigurator
is used correctly and that there are no duplicate names between the meta components and the user-provided configurators.Verification successful
The verification process has confirmed that there are no duplicate names between the meta components and the user-provided configurators. The only duplicate found was
MetaComponents
, which is not an actual component name but rather a reference to the collection itself.
- No duplicate names were found between the meta components and the user-provided configurators.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify no duplicate names between meta components and user-provided configurators. # Test: Search for duplicate names. Expect: No duplicates. rg --type javascript $'addConfigurator'Length of output: 73
Script:
#!/bin/bash # Correcting the search for `addConfigurator` usage in JavaScript files. rg 'addConfigurator' --glob '*.js' # Extracting names from MetaComponents and configurators to check for duplicates. # Assuming MetaComponents is defined in a file, we need to locate it first. meta_components_file=$(rg 'MetaComponents' --files-with-matches --glob '*.js') configurators_file=$(rg 'registerConfigurators' --files-with-matches --glob '*.js') # Extracting names from MetaComponents meta_names=$(rg 'MetaComponents' "$meta_components_file" | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n') # Extracting names from configurators configurator_names=$(rg 'configurators' "$configurators_file" | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n') # Checking for duplicates echo "$meta_names" | sort | uniq -d echo "$configurator_names" | sort | uniq -dLength of output: 1842
Script:
#!/bin/bash # Correcting the search for `addConfigurator` usage in JavaScript files. rg 'addConfigurator' --glob '*.js' # Extracting names from MetaComponents and configurators to check for duplicates. # Assuming MetaComponents is defined in multiple files, we need to handle each file separately. meta_components_files=$(rg 'MetaComponents' --files-with-matches --glob '*.js') configurators_files=$(rg 'registerConfigurators' --files-with-matches --glob '*.js') # Extracting names from MetaComponents meta_names=$(echo "$meta_components_files" | xargs -I {} rg 'MetaComponents' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n') # Extracting names from configurators configurator_names=$(echo "$configurators_files" | xargs -I {} rg 'configurators' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n') # Checking for duplicates echo "$meta_names" | sort | uniq -d echo "$configurator_names" | sort | uniq -dLength of output: 1822
Script:
#!/bin/bash # Correcting the search for `addConfigurator` usage in JavaScript files. rg 'addConfigurator' --glob '*.js' # Extracting names from MetaComponents and configurators to check for duplicates. # Assuming MetaComponents is defined in multiple files, we need to handle each file separately. meta_components_files=$(rg 'MetaComponents' --files-with-matches --glob '*.js') configurators_files=$(rg 'registerConfigurators' --files-with-matches --glob '*.js') # Extracting names from MetaComponents meta_names=$(echo "$meta_components_files" | xargs -I {} rg 'MetaComponents' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n' | grep -oP '\w+') # Extracting names from configurators configurator_names=$(echo "$configurators_files" | xargs -I {} rg 'configurators' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n' | grep -oP '\w+') # Checking for duplicates echo "$meta_names" | sort | uniq -d echo "$configurator_names" | sort | uniq -dLength of output: 1824
* feat(metaComponent): add capability of add custom metaComponents * feat: metaComponents pass to init fun register * fix: refactor code by code review * feat: rename metaComponent to configurator * fix(configurator): add base info to package.json * feat: rename metaxxx to configurator * fix: rename metaxxx to configurators * fix: refactor code by review
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
MetaInput
component for customizable input fields.MyInputConfigurator
for configuring input settings.MetaSelect
component for customizable select dropdowns.InputConfigurator
andSelectConfigurator
for property panel customization.Updates
Documentation
meta-components
andconfigurator
packages.