Skip to content

feat(nvue-styler): 调整 uvue 中 flex-flow 拆分、支持 ::v-deep #5495

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 4 commits into from
May 30, 2025

Conversation

Otto-J
Copy link
Member

@Otto-J Otto-J commented May 27, 2025

No description provided.

@Otto-J Otto-J requested a review from Copilot May 27, 2025 12:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures the flex-flow transform is applied in uvue and updates the corresponding tests to reflect splitting flexFlow into flexDirection and flexWrap.

  • Always include transformFlexFlow for uvue (removed conditional guard)
  • Rename test properties from flexFlow to flex-flow and expect separate flexDirection/flexWrap
  • Adjust test case counts and message indices

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/uni-nvue-styler/src/expand/index.ts Removed the options.type !== 'uvue' guard so transformFlexFlow always applies
packages/uni-nvue-styler/tests/uvueNormalize-android.spec.ts Updated CSS property names in tests and expanded flexFlow split; adjusted message indices and added length check
Comments suppressed due to low confidence (2)

packages/uni-nvue-styler/src/expand/index.ts:52

  • Add a comment explaining why transformFlexFlow is now always applied (even for uvue) to clarify the removal of the conditional spread.
flexFlow: transformFlexFlow,

packages/uni-nvue-styler/tests/uvueNormalize-android.spec.ts:505

  • Consider adding an assertion that the normalized output object contains both flexDirection and flexWrap properties after splitting flexFlow to ensure the transform works as intended.
flexDirection: 'row',

Copy link

Size report

Path Size
packages/size-check/dist/size-check.es.js 47.18 KB (0%)
packages/size-check/dist/style.css 2.82 KB (0%)
packages/uni-app/dist/uni-app.es.js 2.48 KB (0%)
packages/uni-h5-vue/dist/vue.runtime.esm.js 76.41 KB (0%)
packages/uni-mp-vue/dist/vue.runtime.esm.js 43.13 KB (0%)
packages/uni-mp-alipay/dist/uni.api.esm.js 14.68 KB (0%)
packages/uni-mp-alipay/dist/uni.mp.esm.js 7.99 KB (0%)
packages/uni-mp-baidu/dist/uni.api.esm.js 11.33 KB (0%)
packages/uni-mp-baidu/dist/uni.mp.esm.js 9.68 KB (0%)
packages/uni-mp-qq/dist/uni.api.esm.js 10.65 KB (0%)
packages/uni-mp-qq/dist/uni.mp.esm.js 7.6 KB (0%)
packages/uni-mp-toutiao/dist/uni.api.esm.js 10.52 KB (0%)
packages/uni-mp-toutiao/dist/uni.mp.esm.js 9.42 KB (0%)
packages/uni-mp-weixin/dist/uni.api.esm.js 11.65 KB (0%)
packages/uni-mp-weixin/dist/uni.mp.esm.js 7.94 KB (0%)
packages/uni-quickapp-webview/dist/uni.api.esm.js 10.6 KB (0%)
packages/uni-quickapp-webview/dist/uni.mp.esm.js 8.16 KB (0%)

@Otto-J Otto-J requested a review from Copilot May 30, 2025 07:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances flex-flow handling in the uni-nvue-styler, especially for uvue contexts, and updates tests accordingly.

  • Adds special selector normalization for ::v-deep and :deep() in uvue.
  • Makes transformFlexFlow unconditional in the declaration transforms.
  • Updates and adds tests for flex-flow splitting into flexDirection and flexWrap.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/uni-nvue-styler/src/normalize/index.ts Add uvue-specific handling for ::v-deep and :deep() selectors
packages/uni-nvue-styler/src/expand/index.ts Remove conditional around flexFlow transform
packages/uni-nvue-styler/tests/uvueNormalize-ios.spec.ts New tests for deep selector normalization
packages/uni-nvue-styler/tests/uvueNormalize-android.spec.ts Adjust flex-flow tests to output flexDirection/flexWrap and shift error assertions
packages/uni-nvue-styler/tests/parse-nvue.spec.ts Add tests for splitting flex-flow into separate properties
Comments suppressed due to low confidence (3)

packages/uni-nvue-styler/src/normalize/index.ts:51

  • Add the global flag to the regex (/\s+/g) so that multiple whitespace sequences throughout the selector are collapsed, not just the first.
.replace(/\s+/, ' ')

packages/uni-nvue-styler/src/expand/index.ts:52

  • This transform is now applied unconditionally. If uvue should still skip flex-flow, consider reintroducing a guard based on options.type.
flexFlow: transformFlexFlow,

packages/uni-nvue-styler/src/normalize/index.ts:36

  • Add a test case where a selector contains multiple ::v-deep or :deep() patterns to verify that all instances are correctly normalized.
const isUvue = opts.type === 'uvue'

@Otto-J Otto-J requested a review from Copilot May 30, 2025 09:13
@Otto-J Otto-J changed the title feat(nvue-styler): 调整 uvue 中 flex-flow 拆分 feat(nvue-styler): 调整 uvue 中 flex-flow 拆分、支持 ::v-deep May 30, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adjusts flex‐flow splitting for uvue styling in the uni-nvue-styler package by refining deep selector handling and unconditionally applying the flexFlow transformation. Key changes include:

  • In the normalize module, deep selector replacements for ::v-deep and :deep() are applied when opts.type is 'uvue'.
  • In the expand module, the conditional check for uvue has been removed so that flexFlow is now always applied.
  • New test cases have been added to verify the updated behavior across iOS, Android, and nvue modes.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/uni-nvue-styler/src/normalize/index.ts Added uvue-specific deep selector handling and whitespace normalization updates.
packages/uni-nvue-styler/src/expand/index.ts Removed conditional spreading of flexFlow transformation, applying it for all types.
packages/uni-nvue-styler/tests/uvueNormalize-ios.spec.ts Added tests to verify deep selector processing and border properties.
packages/uni-nvue-styler/tests/uvueNormalize-android.spec.ts Updated tests to reflect changes in flex-flow property transformation and message indexing.
packages/uni-nvue-styler/tests/parse-nvue.spec.ts Introduced tests for flex-flow behavior and for cases where nvue does not support deep selectors.
Comments suppressed due to low confidence (1)

packages/uni-nvue-styler/src/expand/index.ts:50

  • The removal of the conditional spread means that the flexFlow transformation is now applied unconditionally. Please add an inline comment to explain that this behavior is an intentional change for uvue styling.
flexFlow: transformFlexFlow,

@Otto-J Otto-J merged commit c2e8d94 into next May 30, 2025
4 checks passed
@Otto-J Otto-J deleted the feature/flex-flow branch May 30, 2025 09:16
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.

1 participant