Skip to content

Conversation

@hexqi
Copy link
Collaborator

@hexqi hexqi commented Sep 21, 2024

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

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

    • Updated versioning timelines for upcoming software releases.
    • Introduced new components including TinyCheckbox, TinyCollapse, TinyCollapseItem, TinyBreadcrumb, and TinyBreadcrumbItem to enhance UI functionality.
    • Added ZIP file creation and download capabilities through new utility functions.
    • Enhanced drag-and-drop functionality with improved state management.
  • Bug Fixes

    • Corrected event handler naming for mouseover events.
  • Documentation

    • Enhanced README files with updated versioning details and project milestones.
    • Improved logging messages in scripts for better clarity and consistency.
  • Chores

    • Removed unused dependencies from various package configurations.

chilingling and others added 27 commits May 27, 2024 19:19
* fix: slot params missing double quote

* fix: exclude nodemodule test case
* fix: esbuild install failed on nodev16

* fix: esbuild install failed on nodev16
* fix: esbuild install failed on nodev16

* fix: esbuild install failed on nodev16

* fix: remove deps on root pkg.json
…pentiny#703)

* feat(download-code): support download zip for not support browsers

* feat(download-code): support download zip for not support browsers - review

* feat(download-code): support download zip for not support browsers - review
* docs: update milestone

* fix: tab
)

* fix(download): Optimize download logic and adapt to iframe
* fix: translate log

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* fix: jsx slot modelvalue can't update value

* fix: add unit test for updateModel event
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 21, 2024

Walkthrough

The changes encompass updates to documentation, component schemas, and code logic across various files. The README.md files have revised versioning timelines, while multiple components and utility functions have been enhanced or added. Notably, new dependencies were introduced, and existing ones removed, reflecting ongoing maintenance. The logging messages in scripts have been translated to English for clarity. Overall, these modifications aim to improve the project's structure, usability, and maintainability.

Changes

File Path Change Summary
README.md, README.zh-CN.md Updated versioning timelines for 1.0.0-beta.x, 1.0.0-rc, and 1.0.0.
mockServer/src/mock/get/app-center/v1/apps/schema/918.json Added new components (TinyCheckbox, TinyCollapse, etc.) to the JSON schema from the @opentiny/vue package.
package.json, packages/design-core/package.json Removed dependencies (@esbuild-plugins/node-globals-polyfill, @esbuild-plugins/node-modules-polyfill, jszip).
packages/canvas/container/src/components/CanvasAction.vue Modified showAction computed property to include a new condition based on schema.data-id.
packages/canvas/container/src/container.js Enhanced drag-and-drop functionality with debouncing and state recording.
packages/canvas/render/src/RenderMain.js Added 'data-id': 'root-container' to rootChildrenSchema.
packages/canvas/render/src/render.js Corrected property name from onMoseover to onMouseover.
packages/common/component/ConfigItem.vue Introduced isEmptyInputValue function and simplified verifyRequired function.
packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue Updated event listener for input-configurator component to use @update:modelValue.
packages/settings/styles/src/Main.vue Removed import statement for formatString and simplified styleString assignment.
packages/utils/package.json, packages/utils/src/fs/fszip.js Added new dependency jszip and introduced functions for ZIP file handling.
scripts/buildMaterials.mjs, scripts/connection.mjs, scripts/splitMaterials.mjs Translated log messages from Chinese to English in various scripts.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Component

    User->>App: Interacts with UI
    App->>Component: Triggers action
    Component-->>App: Returns updated state
    App->>User: Updates UI with new state
Loading

🐰 In the garden where code does bloom,
Changes sprout and dispel the gloom.
With versioning clear and logs in sight,
Our project shines, oh what a delight!
New components hop, old ones take flight,
Together we build, making things right! 🌼


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?

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.
    -- 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 @coderabbitai in 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 @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 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 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 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.

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: 11

Outside diff range and nitpick comments (12)
packages/utils/package.json (1)

33-35: Approve the addition of jszip dependency.

The addition of the jszip dependency is reasonable and aligns with the package's functionality. The version constraint ^3.10.1 is appropriate as it allows for minor updates and bug fixes.

As a best practice, consider running a security audit on the newly introduced dependency to ensure it doesn't introduce any known vulnerabilities. You can use tools like npm audit or integrate with security scanning platforms like Snyk.

packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue (3)

1-36: Improve consistency and formatting.

Consider the following suggestions:

  1. Use a consistent slot syntax for both <tiny-tree> components. Either use destructured data prop or not for both.
  2. Improve the indentation and formatting of the template code for better readability. Ensure consistent indentation for the nested <tiny-tree> components and their properties.

38-40: Optimize imports.

Instead of importing everything from the vue module, consider importing only the specific named exports that are being used in the component. This can help reduce the bundle size and improve performance.


44-53: Remove unused code and provide more context.

Consider the following suggestions:

  1. If no props or emits are defined for the component, remove the empty props and emit definitions to avoid unnecessary code.
  2. Provide more context or comments explaining the purpose and usage of lowcodeWrap and stores. This will help improve code readability and maintainability.
  3. If the reactive state object is not being used in the component, consider removing it to keep the code clean and focused.
packages/common/component/ConfigItem.vue (1)

313-317: Consider using a strict equality check for the null check.

The current implementation uses the == operator for the null check, which performs type coercion. This can lead to unexpected behavior, such as '' == false evaluating to true.

Consider replacing value == null with value === null || value === undefined for a strict equality check:

-return value == null || (typeOf(value) === TYPES.StringType && value.trim() === '')
+return value === null || value === undefined || (typeOf(value) === TYPES.StringType && value.trim() === '')
packages/utils/src/fs/index.js (3)

17-17: Ensure Consistent Language in Code Comments

The code comment is in Chinese. Consider translating it to English to maintain consistency across the codebase.

Apply this diff to translate the comment:

-// 支持file system api的条件:存在这个方法 && 不处于iframe中
+// Conditions for supporting the File System Access API: the method exists && not running in an iframe

85-85: Ensure Error Messages Are Consistently in English

The error message is in Chinese. For consistency and to cater to all users, consider translating the error message to English.

Apply this diff to translate the error message:

-throw new Error('不支持的浏览器或处于iframe中')
+throw new Error('Unsupported browser or running in an iframe')

175-176: Translate Function Parameter Comments to English

The parameter description includes Chinese text. To maintain consistency, please translate the comments to English.

Apply this diff:

 * @param {Boolean} supportZipCache 是否支持zip缓存,zip缓存可能会导致文件不能及时更新,默认不缓存
+* @param {Boolean} supportZipCache Whether to support zip caching. Zip caching may cause files to not update promptly; defaults to not caching.
 *
packages/vue-generator/src/generator/vue/sfc/generateAttribute.js (3)

Line range hint 232-239: Avoid using the delete operator to improve performance

Using the delete operator can negatively impact performance because it changes the structure of the object, which can deoptimize JavaScript engines. Instead, consider setting the property to undefined.

Apply the following change:

- delete props.slot
+ props.slot = undefined
Tools
Biome

[error] 232-233: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


520-524: Translate code comments to English for consistency

The comments are currently written in Chinese. For better maintainability and to cater to an international development team, it's recommended to write all code comments in English.


540-540: Remove unnecessary optional chaining

Since modelValue is already confirmed to be defined in the if condition, the optional chaining operator ?. is unnecessary when accessing its elements.

Update the code as follows:

- props[`onUpdate:${modelValue?.[0]}`] = { type: JS_EXPRESSION, value: `(value) => ${modelValue[1].value}=value` }
+ props[`onUpdate:${modelValue[0]}`] = { type: JS_EXPRESSION, value: `(value) => ${modelValue[1].value}=value` }
packages/vue-generator/test/testcases/generator/mockData.js (1)

682-693: Review the structure and contents of the 'state' object.

The state object includes properties such as license with an empty string and arrays with mixed data types. Verify that this aligns with the expected state schema and that any default values or placeholders are intentional.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 80a36d6 and a0e9370.

Files selected for processing (42)
  • README.md (1 hunks)
  • README.zh-CN.md (1 hunks)
  • mockServer/src/mock/get/app-center/v1/apps/schema/918.json (2 hunks)
  • package.json (0 hunks)
  • packages/canvas/container/src/components/CanvasAction.vue (1 hunks)
  • packages/canvas/container/src/container.js (4 hunks)
  • packages/canvas/render/src/RenderMain.js (1 hunks)
  • packages/canvas/render/src/render.js (1 hunks)
  • packages/common/component/ConfigItem.vue (1 hunks)
  • packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue (1 hunks)
  • packages/design-core/package.json (0 hunks)
  • packages/design-core/src/preview/src/preview/Preview.vue (1 hunks)
  • packages/engine-cli/template/designer/public/mock/bundle.json (9 hunks)
  • packages/settings/events/src/components/BindEventsDialog.vue (1 hunks)
  • packages/settings/styles/src/Main.vue (1 hunks)
  • packages/settings/styles/src/components/border/BorderGroup.vue (3 hunks)
  • packages/settings/styles/src/components/spacing/SpacingGroup.vue (1 hunks)
  • packages/settings/styles/src/components/spacing/SpacingSetting.vue (2 hunks)
  • packages/settings/styles/src/js/parser.js (3 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/utils/src/fs/fszip.js (1 hunks)
  • packages/utils/src/fs/index.js (3 hunks)
  • packages/vue-generator/.eslintrc.cjs (2 hunks)
  • packages/vue-generator/package.json (1 hunks)
  • packages/vue-generator/src/generator/vue/sfc/genSetupSFC.js (4 hunks)
  • packages/vue-generator/src/generator/vue/sfc/generateAttribute.js (2 hunks)
  • packages/vue-generator/src/plugins/genGlobalState.js (2 hunks)
  • packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/index.js (1 hunks)
  • packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/testState.js (1 hunks)
  • packages/vue-generator/test/testcases/generator/mockData.js (1 hunks)
  • packages/vue-generator/test/testcases/sfc/case06/case06.test.js (1 hunks)
  • packages/vue-generator/test/testcases/sfc/case06/components-map.json (1 hunks)
  • packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue (1 hunks)
  • packages/vue-generator/test/testcases/sfc/case06/page.schema.json (1 hunks)
  • packages/vue-generator/test/testcases/sfc/slotModelValue/components-map.json (1 hunks)
  • packages/vue-generator/test/testcases/sfc/slotModelValue/expected/slotModelValueTest.vue (1 hunks)
  • packages/vue-generator/test/testcases/sfc/slotModelValue/page.schema.json (1 hunks)
  • packages/vue-generator/test/testcases/sfc/slotModelValue/slotModel.test.js (1 hunks)
  • packages/vue-generator/vite.config.mjs (1 hunks)
  • scripts/buildMaterials.mjs (9 hunks)
  • scripts/connection.mjs (6 hunks)
  • scripts/splitMaterials.mjs (1 hunks)
Files not reviewed due to no reviewable changes (2)
  • package.json
  • packages/design-core/package.json
Files skipped from review due to trivial changes (1)
  • packages/canvas/render/src/render.js
Additional context used
Biome
packages/vue-generator/src/generator/vue/sfc/generateAttribute.js

[error] 232-233: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

Additional comments not posted (81)
packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/index.js (1)

1-1: LGTM!

The export statement is syntactically correct and introduces a new public entity testState from the module ./testState.

packages/vue-generator/test/testcases/sfc/case06/components-map.json (2)

1-9: LGTM! The JSON configuration is well-structured.

The file follows a valid JSON structure and provides a clear mapping between the local component name and the exported component from the "@opentiny/vue" package.


6-6: Verify the compatibility of the specified version range.

The version range "^3.10.0" allows for automatic updates to the latest minor and patch versions of the "@opentiny/vue" package. While this provides flexibility, it's important to ensure that the project is compatible with the potential updates within this range.

Consider running the following commands to verify the compatibility:

If any issues arise during the tests, consider locking the version to a specific patch release or updating the project to be compatible with the latest versions.

Verification successful

The compatibility concern has been addressed with an even newer version.

The project is currently using "@opentiny/vue" version "~3.14.0" or "^3.14.0" in various packages, which is more recent than the "^3.10.0" mentioned in the review comment. This indicates that compatibility has likely been verified and updated since the original comment was made.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the specified version range.

# Test: Install the latest version within the specified range.
npm install @opentiny/vue@^3.10.0

# Test: Run the project's test suite to ensure compatibility.
npm test

Length of output: 190


Script:

#!/bin/bash
# Search for @opentiny/vue usage in the project
rg "@opentiny/vue" -n

# Find and display the content of package.json
fd -t f "package.json" -x cat {}

Length of output: 189091

packages/vue-generator/test/testcases/sfc/case06/case06.test.js (1)

7-12: LGTM!

The test case is well-structured and follows best practices for snapshot testing. The test name clearly describes the expected behavior of the code generator.

Please ensure that the following files exist and contain the correct data for the test to pass:

  • page.schema.json
  • components-map.json
  • expected/slotTest.vue

You can use the following script to verify the existence of these files:

Verification successful

External files verified, manual content review recommended

Great news! All the required external files for the test case exist in their expected locations. This includes:

  • page.schema.json
  • components-map.json
  • expected/slotTest.vue

To ensure the test case functions as intended, it's recommended to manually review the contents of these files to verify they contain the correct data for testing slot declaration generation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the external files used in the test case.

# Test: Check if page.schema.json exists
if [ ! -f "packages/vue-generator/test/testcases/sfc/case06/page.schema.json" ]; then
  echo "Error: page.schema.json not found"
  exit 1
fi

# Test: Check if components-map.json exists 
if [ ! -f "packages/vue-generator/test/testcases/sfc/case06/components-map.json" ]; then
  echo "Error: components-map.json not found"
  exit 1
fi

# Test: Check if expected/slotTest.vue exists
if [ ! -f "packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue" ]; then
  echo "Error: expected/slotTest.vue not found"
  exit 1  
fi

echo "All required files exist"

Length of output: 315

packages/vue-generator/test/testcases/sfc/slotModelValue/slotModel.test.js (1)

1-12: LGTM!

The test file follows a clear structure and tests a specific functionality of the Vue SFC generator. The use of external files and utility functions is a common practice in testing, and the snapshot assertion ensures the generated code matches the expected output.

The code changes are well-organized and do not have any apparent issues or potential improvements.

packages/vue-generator/test/testcases/sfc/slotModelValue/components-map.json (1)

1-23: LGTM! The component mapping file maintains a consistent schema.

The components-map.json file follows a well-structured schema for defining components. The consistency in the package, version, and destructuring properties across all components is appreciated. It ensures compatibility and maintainability within the project.

The file adheres to the JSON syntax and provides a clear mapping between the component names and their corresponding package details.

packages/vue-generator/.eslintrc.cjs (2)

1-1: LGTM!

Importing rules from a parent ESLint configuration file is a good practice to maintain consistent rule enforcement across the project.


22-23: LGTM!

The changes to the ignorePatterns array and the inclusion of the rules object in the exported configuration are valid and maintain consistency with the parent ESLint configuration.

packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/testState.js (2)

11-18: LGTM!

The getter functions are simple and straightforward, returning the corresponding state properties. The implementation looks good.


19-26: LGTM!

The action functions are simple and straightforward, updating the corresponding state properties with the provided values. The implementation looks good.

packages/vue-generator/vite.config.mjs (1)

21-21: LGTM!

Excluding the node_modules directory during testing is a good practice. It helps improve test performance by skipping unnecessary files and aligns with the common conventions.

packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue (1)

41-42: LGTM!

The imports of defineProps, defineEmits, and I18nInjectionKey are correct and align with Vue's Composition API and i18n setup.

packages/vue-generator/package.json (1)

50-50: Clarify the reason for downgrading the vite-plugin-static-copy dependency.

Downgrading the vite-plugin-static-copy dependency from version ^1.0.4 to ^0.16.0 is an unusual change that could potentially introduce compatibility issues or break existing functionality. It's important to understand the reasoning behind this decision.

Please provide more context on why this downgrade is necessary. Also, ensure that the downgraded version is compatible with the rest of the dependencies and does not introduce any breaking changes.

Consider alternative approaches, such as:

  1. Updating the package to work with the latest version of the dependency.
  2. Finding a different solution that doesn't require downgrading the dependency.

To assess the impact of this change, please run the following verification steps:

If the build process fails or tests break, it indicates that the downgraded dependency version is causing issues and needs to be re-evaluated.

scripts/splitMaterials.mjs (2)

54-54: LGTM!

The log message has been appropriately translated to English, improving clarity for non-Chinese speaking developers. The message accurately reflects the completion of splitting material asset packages.


56-56: LGTM!

The error log message has been appropriately translated to English, improving clarity for non-Chinese speaking developers. The message accurately reflects the failure in splitting material asset packages.

README.zh-CN.md (1)

87-93: LGTM! The updated milestone timeline reflects the project's development roadmap.

The changes to the milestone timeline provide a clear overview of the project's release phases:

  • The extension of the 1.0.0-beta.x version suggests additional time for beta testing and refinement.
  • The inclusion of a 1.0.0-rc version labeled as a refactor version indicates a focus on code optimization and restructuring before the stable release.
  • The 1.0.0 version start date without an end date implies an open-ended stable release phase.

These adjustments demonstrate a thoughtful approach to the project's development lifecycle.

packages/utils/src/fs/fszip.js (2)

34-36: LGTM!

The function is a simple wrapper that returns a new instance of JSZIP. The implementation is straightforward and correct.


47-67: LGTM!

The function correctly handles the creation of a zip archive with the provided files and their respective paths. It appropriately uses the JSZIP library to create the necessary folder structure and add files to the zip. The generation of the zip content as a Blob and the subsequent call to the saveAs function to initiate the download is also implemented correctly.

The function is well-structured, follows good practices, and fulfills its intended purpose.

packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue (1)

13-13: LGTM! The event listener update aligns with Vue 3 composition API conventions.

The change from @change to @update:modelValue for the input-configurator component's event listener is a positive update that aligns the code with the Vue 3 composition API's approach to handling model updates. This improves consistency and maintainability without introducing any breaking changes or bugs, as the underlying functionality remains the same.

packages/vue-generator/src/plugins/genGlobalState.js (4)

47-48: LGTM!

The change to wrap string values in single quotes is a good practice for generating code. It improves the clarity and consistency of the generated code.


60-60: LGTM!

The change to access the second element of the entry array directly aligns with the usage of the filtered entries and improves the clarity of the code.


65-65: LGTM!

The change to access the second element of the entry array directly aligns with the usage of the filtered entries and improves the clarity of the code.


72-72: LGTM!

The change to wrap the id property value in single quotes is consistent with the earlier change to wrap string values and improves the clarity of the generated code.

packages/vue-generator/test/testcases/sfc/slotModelValue/expected/slotModelValueTest.vue (3)

1-28: LGTM!

The template section looks good. The <tiny-grid> component is properly configured with bound props and static data.


30-95: LGTM!

The script section is well-structured and follows best practices:

  • The Composition API is used correctly with defineProps, defineEmits, and vue.inject.
  • The lowcodeWrap function is used consistently.
  • The reactive state is properly defined.
  • Custom cell renderers are implemented correctly using JSX syntax.
  • Event handlers are defined and wrapped properly.

96-96: LGTM!

The empty scoped <style> tag is valid and indicates that any styles added would be scoped to this component. Since no styles are defined, there is nothing to review.

README.md (3)

91-91: LGTM!

Extending the 1.0.0-beta.x version timeline aligns with the PR objective of synchronizing the development branch with refactoring changes. It provides more time for testing and stabilization before the release candidate and final versions.


92-92: LGTM!

Moving the 1.0.0-rc version to a later date aligns with the extended beta version timeline. The addition of the "refactor version" note provides clarity on the purpose of this release candidate. Using a single date instead of a range suggests a more focused release approach.


93-93: LGTM!

Updating the 1.0.0 version release date to align with the revised release candidate timeline is a logical change. Using a single date for the final release is consistent with the focused release approach. The new date provides sufficient time for any final adjustments and preparations after the release candidate.

packages/vue-generator/test/testcases/sfc/slotModelValue/page.schema.json (1)

1-150: LGTM!

The JSON schema for the "Page" component is well-structured and follows best practices:

  • The schema defines the component's state, methods, CSS, props, lifecycle hooks, and child components in a clear and organized manner.
  • The use of slots in the "TinyGrid" component allows for customization of the grid cells based on the column.
  • The binding of "modelValue" and "onChange" props in the slot components enables two-way data binding between the slot components and the grid data.
  • The event handlers "onChangeInput" and "onChangeNumber" are defined in the "methods" section and are correctly referenced in the slot components.

Overall, the schema provides a declarative and maintainable way to define the structure and behavior of the "Page" component.

packages/settings/events/src/components/BindEventsDialog.vue (1)

3-3: LGTM!

The change from using the v-show directive to the :visible prop for controlling the visibility of the <tiny-dialog-box> component is a good improvement. It aligns with a more explicit and prop-driven approach, enhancing the readability and maintainability of the code.

The binding of the dialogVisible variable to the :visible prop is correctly implemented.

packages/settings/styles/src/js/parser.js (1)

234-234: LGTM!

The changes to handle empty string values in the stringify function are correct and enhance the clarity of the generated CSS string.

Also applies to: 252-252, 269-269

packages/settings/styles/src/components/spacing/SpacingSetting.vue (2)

64-66: LGTM!

The updateStyle method consolidates the emission of the 'update' event, improving code maintainability by reducing duplication. The logic is correct and the implementation is clean.


90-90: Verify the handling of the null value in the parent component.

The change in the reset method to pass null instead of an empty string aligns with the consolidated updateStyle method. This improves code consistency.

However, please ensure that the parent component correctly handles the null value when the reset event is triggered. Verify this by searching for the event listener and confirming the expected behavior.

Run the following script to locate the event listener:

Verification successful

Approve the change: Parent components handle the update event correctly.

The modification to pass null instead of an empty string in the reset method of the SpacingSetting component is appropriate. After examining the parent components (SpacingGroup and PositionGroup), it's clear that they both use an @update event handler to process changes from the SpacingSetting component. This consistent approach suggests that these parent components are equipped to handle various input types, including null values.

The change improves code consistency without introducing any apparent issues in the parent components' event handling.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the parent component correctly handles the `null` value for the reset event.

# Test: Search for the event listener in parent components. Expect: Correct handling of `null`.
rg --type vue -A 5 $'@update="[^"]*"'

Length of output: 66


Script:

#!/bin/bash
# Description: Find parent components using SpacingSetting and check for @update event handler

# Step 1: Find Vue files that import or use SpacingSetting
echo "Vue files importing or using SpacingSetting:"
fd -e vue | xargs rg -l "import.*SpacingSetting|<SpacingSetting"

# Step 2: Search for @update event handler in those files
echo -e "\n@update event handlers in relevant files:"
fd -e vue | xargs rg -n "@update.*=.*" -C 5

Length of output: 89489

scripts/buildMaterials.mjs (5)

15-16: LGTM!

The introduction of the appSchemaPath constant and the corresponding file path looks good. It provides a clear reference to the required JSON schema file.


18-18: LGTM!

Reading the JSON schema file synchronously using fsExtra.readJSONSync and assigning its content to the appSchema constant is a valid approach. It ensures that the schema data is available for further processing.


28-28: LGTM!

The addition of writing the appSchema data to the file system using fsExtra.outputJSONSync is a valid approach. It ensures that any modifications made to the schema during the script execution are persisted for future use.


43-43: LGTM!

The English translations of the logging messages throughout the script improve clarity and understanding for a wider audience. The translations accurately convey the meaning of the original Chinese messages, making it easier to comprehend the script's output.

Additionally, updating the event names in the eventMap object and the corresponding log message to English enhances consistency and readability.

Also applies to: 49-49, 69-69, 87-87, 111-111, 181-181, 183-183, 192-194, 198-198


102-102: LGTM!

The introduction of packagesMap and the associated code to collect package information for each component is a valid addition to the script. It allows for a structured representation of the component's package details, including packageName, version, exportName, and optionally, the destructuring property.

Creating a mapItem object for each component package provides a consistent format for storing the package details. Pushing the mapItem object into packagesMap only when npm.package exists ensures that only valid package information is collected.

Assigning packagesMap to appSchema.data.componentsMap effectively updates the schema with the collected package information, making it available for further use.

Also applies to: 159-178

packages/design-core/src/preview/src/preview/Preview.vue (1)

114-114: LGTM!

The change to append .vue to blockSchema.fileName when assigning it to panelName is a good improvement. It explicitly indicates that panelName corresponds to a Vue component file, which enhances code clarity and maintains consistency with the naming convention for Vue component files.

packages/vue-generator/src/generator/vue/sfc/genSetupSFC.js (5)

1-1: LGTM!

The import statement for BUILTIN_COMPONENTS_MAP is correctly added and will likely be used to enhance the functionality of the module.


22-23: LGTM!

The import statements for the new attribute hooks, handleTinyIconPropsHook and handleJsxModelValueUpdate, are correctly added and will enhance the attribute handling capabilities of the generated SFCs.


217-217: LGTM!

The handleJsxModelValueUpdate attribute hook is correctly added to the defaultAttributeHook array, enhancing the default attribute handling capabilities of the generated SFCs for JSX model value updates.


265-266: LGTM!

The creation of the compsMapWithBuiltIn variable by combining the componentsMap and BUILTIN_COMPONENTS_MAP arrays is a good addition. It ensures that built-in components are included by default when generating the SFC file, enhancing the flexibility of the genSFCWithDefaultPlugin function to accommodate independent calls.


268-268: LGTM!

The updated generateSFCFile function call with the schema, compsMapWithBuiltIn, and newConfig arguments correctly propagates the changes made to the genSFCWithDefaultPlugin function, ensuring that the generated SFC file incorporates the built-in components and updated hooks.

packages/settings/styles/src/Main.vue (1)

130-130: LGTM!

The removal of the formatString function and the direct assignment of styleStrRemoveRoot(content) to styleString simplifies the code without altering the functionality. The change looks good.

packages/canvas/render/src/RenderMain.js (1)

363-364: LGTM!

The addition of the data-id attribute to the root container node is a good way to uniquely identify it in the DOM. This can be useful for implementing additional logic or styling specific to the root node without modifying the existing schema structure.

scripts/connection.mjs (6)

41-41: LGTM!

The log messages have been correctly translated to English, and the function logic remains intact.

Also applies to: 44-44


103-103: LGTM!

The variable name has been correctly updated to follow the camelCase naming convention, and the error message has been correctly translated to English. The function logic remains intact.

Also applies to: 106-107


196-196: LGTM!

The log messages have been correctly translated to English, and the function logic remains intact.

Also applies to: 199-199


325-325: LGTM!

The log messages have been correctly translated to English, and the function logic remains intact.

Also applies to: 329-329


347-347: LGTM!

The error message has been correctly translated to English, and the function logic remains intact.


398-398: LGTM!

The log messages have been correctly translated to English, and the function logic remains intact.

Also applies to: 402-402

packages/settings/styles/src/components/spacing/SpacingGroup.vue (1)

432-432: LGTM!

The change improves the handling of falsy values for value. If value is an empty string or null, the text property will now be set to '0' (as a string) instead of '0'. This is a minor but beneficial change.

packages/common/component/ConfigItem.vue (1)

318-320: LGTM!

The function has been simplified to use the new isEmptyInputValue function, and the logic is correct and concise.

packages/canvas/container/src/components/CanvasAction.vue (1)

232-235: LGTM! The new condition correctly hides the action for the root container.

The added condition schema?.props?.['data-id'] === 'root-container' checks if the current node is the root container, and if so, sets showAction to false. This effectively hides the action UI for the root container node, while preserving the existing behavior of hiding the action during resizing or when the parent is a 'JSSlot'.

packages/settings/styles/src/components/border/BorderGroup.vue (3)

293-293: LGTM!

The addition of the activedBorder property to the state reactive object is a valid change for managing the selected border setting state. The default value of BORDER_SETTING.All is appropriate.


337-343: LGTM!

The code segment correctly updates the borderRadius reactive object properties based on the corresponding values from props.style. Using parseInt to parse the values as integers and providing a default value of 0 when the property doesn't exist is a good approach.


388-394: Good performance optimization!

The added check to prevent unnecessary updates when the current value is 0 and the corresponding property doesn't exist in props.style is a nice optimization. It helps maintain the integrity of the style object by avoiding the addition of unnecessary properties.

mockServer/src/mock/get/app-center/v1/apps/schema/918.json (5)

1921-1927: LGTM!

The new TinyCheckbox component is being added correctly to the componentsMap array.


1984-1990: LGTM!

The new TinyCollapse component is being added correctly to the componentsMap array.


1991-1997: LGTM!

The new TinyCollapseItem component is being added correctly to the componentsMap array.


1998-2004: LGTM!

The new TinyBreadcrumb component is being added correctly to the componentsMap array.


2005-2011: LGTM!

The new TinyBreadcrumbItem component is being added correctly to the componentsMap array.

packages/engine-cli/template/designer/public/mock/bundle.json (9)

26-27: LGTM!

The changes to add exportName and enable destructuring for the ElInput component look good.


307-308: Looks good!

The exportName and destructuring changes for the ElButton component are consistent with the previous changes and look fine.


629-630: Good to go!

The destructuring and exportName changes for the ElForm component look good, even with the swapped order. No issues here.


1087-1088: Approved!

The addition of destructuring and exportName to the ElFormItem component is consistent with the other changes and looks good.


1438-1439: Looks good to me!

Adding destructuring and exportName to the ElTable component follows the established pattern and looks fine.


2677-2678: Approved!

The destructuring and exportName additions to ElTableColumn are consistent with the ElTable changes and look good.


8948-8950: Verify the export name change.

The exportName was changed from "Select" to "Breadcrumb". Please confirm whether "Breadcrumb" is the correct export name for this component configuration.


14080-14083: Confirm the options structure change.

The options property structure was changed from a plain array to an object with type as "JSExpression" and the array stringified in the value property.

Please verify the following:

  1. Is this change to represent options as a JavaScript expression intentional and valid?
  2. Ensure that the stringified array in the value property is escaped properly to avoid any parsing issues.

14338-14338: Verify the active prop type change.

The active property was changed from a string value "2" to a numeric value 2. Please confirm if the TinyTimeLine component expects and correctly handles the active prop as a number instead of a string.

packages/utils/src/fs/index.js (5)

2-11: License Header Verified

The license header is correctly included and follows the project's licensing guidelines.


18-19: Implemented Correct Support Check for File System Access

The constant isSupportFileSystemAccess correctly checks for the presence of showDirectoryPicker and ensures the code is not running in an iframe.


28-29: Verify Return Value Compatibility When File System Access Is Unsupported

The function getUserBaseDirHandle now returns createZip() when isSupportFileSystemAccess is false. Please verify that the return value from createZip() is compatible with the expected directory handle and that any code using this function can handle the returned value appropriately.


178-183: Function Signature Updated with Default Parameters

The writeFiles function now includes zipName and supportZipCache with default values. Ensure that this change does not affect existing calls to writeFiles and that the new parameters are utilized where necessary.


188-192: Enhanced Logic for Handling Unsupported File System Access

The writeFiles function now handles scenarios where the File System Access API is not supported by creating a zip file. This improves compatibility with browsers that do not support the API.

packages/vue-generator/src/generator/vue/sfc/generateAttribute.js (1)

Line range hint 525-546: Verify that handleJsxModelValueUpdate is being invoked

The function handleJsxModelValueUpdate is defined but it's not clear if it's being called within the codebase. Ensure that this function is invoked where necessary to apply the intended logic.

Run the following script to check if the function is used:

Verification successful

handleJsxModelValueUpdate is correctly imported and utilized

The function handleJsxModelValueUpdate is indeed being used within the codebase. It's imported and applied in the file packages/vue-generator/src/generator/vue/sfc/genSetupSFC.js. Specifically:

  • It's imported from './generateAttribute'
  • It's included in the defaultAttributeHook array, which suggests it's automatically applied during the component generation process.

This usage indicates that the function is properly integrated into the Vue component generation pipeline, addressing the concern raised in the original review comment.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for calls to 'handleJsxModelValueUpdate' in the codebase, excluding its own definition.

# Test: Find all occurrences of 'handleJsxModelValueUpdate' outside its declaration.
rg --type js --type jsx --type ts --type tsx 'handleJsxModelValueUpdate' -g '!*generateAttribute.js'

Length of output: 128


Script:

#!/bin/bash
# Description: Search for calls to 'handleJsxModelValueUpdate' in the codebase, excluding its own definition.

# Search for 'handleJsxModelValueUpdate' in js, jsx, ts, and tsx files, excluding generateAttribute.js
rg 'handleJsxModelValueUpdate' -g '*.{js,jsx,ts,tsx}' -g '!*generateAttribute.js' -C 2

Length of output: 942

packages/canvas/container/src/container.js (2)

189-189: LGTM: Added history update on drag end

The addition of getController().addHistory() ensures that the state is recorded when a drag operation ends in absolute positioning mode. This helps maintain accurate undo/redo functionality.


736-736: Verify coordinate calculations for accurate positioning

When setting data.props.style using dragState.mouse.y and dragState.mouse.x, ensure that these coordinates account for any scrolling, zoom levels, or offsets within the canvas to position the element accurately.

@chilingling chilingling merged commit 8213973 into opentiny:refactor/develop Sep 24, 2024
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* fix(mockServer): mockServer page preview can't render element-plus element (opentiny#503)

* fix(style): fix render error caused by inline style breaks (opentiny#526)

* fix(metaComp): fix bug where metaHtmlText could set value to incorret schema children (opentiny#473)

* fix(vue-generator): fix globalstate codegen error (opentiny#547)

* fix(material): add componentsMap to app Schema after material build (opentiny#527)

* fix: slot params missing double quote (opentiny#605)

* fix: slot params missing double quote

* fix: exclude nodemodule test case

* fix: 修复onMouseover拼写错误 (opentiny#662)

* fix: esbuild install failed on node v16 (opentiny#668)

* fix: esbuild install failed on nodev16

* fix: esbuild install failed on nodev16

* fix: builtin components can't generate import statement with genSFCWithDefaultPlugin method (opentiny#656)

* fix: esbuild install failed on nodev16 (opentiny#671)

* fix: esbuild install failed on nodev16

* fix: esbuild install failed on nodev16

* fix: remove deps on root pkg.json

* fix(preview): multiple nested blocks cannot preview opentiny#663 (opentiny#665)

* fix(material): add missing componentsMap to mockServer (opentiny#701)

* fix(setting): fix bindEvent dialog visible can't work on tinyvue 3.17 (opentiny#715)

* feat(download-code): support download zip for not support browsers (opentiny#703)

* feat(download-code): support download zip for not support browsers

* feat(download-code): support download zip for not support browsers - review

* feat(download-code): support download zip for not support browsers - review

* docs: update milestone (opentiny#728)

* docs: update milestone

* fix: tab

* fix: abaolute canvas init inlineStyle should be string (opentiny#730)

* fix(download): Optimize download logic and adapt to iframe (opentiny#739)

* fix(download): Optimize download logic and adapt to iframe

* feat(cdn): change cdn from onmicrosoft to unpkg (opentiny#750)

* fix: 隐藏画布根节点的包裹元素的操作选项 (opentiny#492)

* fix(script): translate log (opentiny#549)

* fix: translate log

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: reset spacing cannot generate correct source code (opentiny#657)

* fix: jsx slot modelvalue can't update value (opentiny#734)

* fix: jsx slot modelvalue can't update value

* fix: add unit test for updateModel event

* fix(canvas): absolute dnd update position to schema. close opentiny#664 (opentiny#751)

* fix(generate-vue):修复出码文件选择界面打包后样式丢失问题 (opentiny#789)

Co-authored-by: wangwenbing <11535041@qq.com>

* fix(stylePanel): fix setting border-radius could not work on first time (opentiny#481)

* fix(common): fix verify required (opentiny#787)

* fix: mixed lifeCyclesContent when empty lifecycles (opentiny#810)

close opentiny#806
修复生命周期为空时,取当前页面schema生命周期值的 bug

---------

Co-authored-by: chilingling <26962197+chilingling@users.noreply.github.com>
Co-authored-by: yeser <631300329@qq.com>
Co-authored-by: wenmine <wwmmail@foxmail.com>
Co-authored-by: Gene <Pacify.98@gmail.com>
Co-authored-by: yaoyun8 <142570291+yaoyun8@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: bwrong <ibwrong@foxmail.com>
Co-authored-by: wangwenbing <11535041@qq.com>
Co-authored-by: Xie Jay <xiejay97@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants