Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors JSX usage across the codebase to be compatible with the vue-jsx-vapor (vue-jsx-compiler) library, replacing the previous JSX compilation approach. The main changes follow two patterns: (1) replacing bare {slots} and {this.$slots} inside plain HTML elements with {slots.default?.()} / {this.$slots.default?.()}, and (2) replacing <Comp>{slots}</Comp> with <Comp v-slots={slots} /> for component children passing.
Changes:
- Add
vue-jsx-vaporas a dev dependency and configure it as a Vite plugin invite.config.mts - Replace all slot rendering patterns in ~50 component files to be compatible with the new compiler
- Update test snapshots and test assertions to reflect the new compiler's rendering output (e.g.,
class=""on empty class bindings,aria-hidden=""for bare boolean attributes, extra comment/text nodes)
Reviewed changes
Copilot reviewed 85 out of 85 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
vite.config.mts |
Adds vueJsxVapor plugin with interop: true option |
package.json |
Adds vue-jsx-vapor@^3.2.2 as a dev dependency |
src/message/src/Message.tsx |
Refactors iconNode assignment and removes no-cond-assign eslint suppression |
src/popconfirm/src/Popconfirm.tsx |
Migrates slot passing to v-slots and combines spread props |
src/popconfirm/tests/Popconfirm.spec.ts |
Updates test names (removes backticks around prop names) |
themes/tusimple/src/TsConfigProvider.tsx |
Migrates slot passing to v-slots syntax |
src/drawer/src/DrawerContent.tsx |
Updates slot rendering with inconsistency (this.$slots vs $slots) |
src/float-button/tests/__snapshots__/FloatButton.spec.tsx.snap |
Reflects aria-hidden="" instead of aria-hidden="true" |
src/flex/tests/Flex.spec.tsx |
Updates child node count expectations for new compiler output |
src/space/tests/__snapshots__/Space.spec.tsx.snap |
Reflects new compiler adding empty class="" attribute to bindings |
Multiple component .tsx files |
Replace {slots} / {this.$slots} with .default?.() calls or v-slots={} |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -74,7 +74,7 @@ describe('n-popconfirm', () => { | |||
| wrapper.unmount() | |||
| }) | |||
|
|
|||
| it('should work with `on-negative-click` prop', async () => { | |||
| it('should work with on-negative-click prop', async () => { | |||
There was a problem hiding this comment.
The test case names in Popconfirm.spec.ts previously wrapped prop/slot names in backticks (e.g., `show-icon`), which is the consistent convention used throughout the codebase (as seen in dozens of test files). These changes remove the backticks, making the test names inconsistent with the rest of the codebase's naming convention. The test at line 38 was changed from should work with \show-icon` proptoshould work with show-icon prop, and line 77 was changed from should work with `on-negative-click` proptoshould work with on-negative-click prop`.
| exports[`n-float-button > render empty children 1`] = ` | ||
| "<div class="n-float-button n-float-button--circle-shape n-float-button--default-type" style="--n-bezier: cubic-bezier(.4, 0, .2, 1); --n-box-shadow: 0 2px 8px 0px rgba(0, 0, 0, .16); --n-box-shadow-hover: 0 2px 12px 0px rgba(0, 0, 0, .24); --n-box-shadow-pressed: 0 2px 12px 0px rgba(0, 0, 0, .24); --n-color: #fff; --n-text-color: rgb(51, 54, 57); --n-color-hover: rgba(46, 51, 56, .09); --n-color-pressed: rgba(46, 51, 56, .13); --n-border-radius-square: 3px; position: fixed; width: 40px; min-height: 40px;" role="button"> | ||
| <div class="n-float-button__fill" aria-hidden="true"></div> | ||
| <div class="n-float-button__fill" aria-hidden=""></div> |
There was a problem hiding this comment.
The snapshot shows that aria-hidden="true" has changed to aria-hidden="". This is a behavioral change caused by vue-jsx-vapor compiling bare boolean JSX attributes (like aria-hidden without a value in the source) as empty strings instead of the string "true".
According to the WAI-ARIA specification, aria-hidden only accepts "true" or "false" as valid values. An empty string "" is not a valid value and its behavior may vary across assistive technologies. All source files using bare aria-hidden as a JSX attribute (e.g., src/float-button/src/FloatButton.tsx:253, src/progress/src/Circle.tsx:154, src/progress/src/Line.tsx:104, src/progress/src/MultipleCircle.tsx:103) should be updated to explicitly use aria-hidden={true} to ensure correct and consistent behavior with the new compiler.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
<div>{this.$slots.default()}</div>instead<div>{this.$slots}</div>.<Comp v-slots={slots} />instead of<Comp>{slots}</Comp>.