-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
fix(runtime-dom): export nodeOps and patchProp for easier custom render creation #13753
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds named re-exports for nodeOps and patchProp from runtime-dom’s index.ts, expanding the module’s public API. No runtime behavior or control flow changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration 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: 0
🧹 Nitpick comments (1)
packages/runtime-dom/src/index.ts (1)
20-20
: Document and track the new public exportsThis expands the public API. Please:
- Add an API/docs note that nodeOps and patchProp are available from @vue/runtime-dom for custom renderers.
- Add a changelog entry (semver: minor).
- Double-check d.ts output to ensure consumers without "dom" lib in tsconfig don’t hit surprising type errors. Given this is runtime-dom, it should be fine.
I can draft the changelog and a short docs blurb if helpful.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/runtime-dom/src/index.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (1)
packages/runtime-dom/src/index.ts (1)
20-20
: Public API addition for custom renderers — LGTMRe-exporting nodeOps and patchProp from the runtime-dom entry is a clean way to enable custom renderer composition without deep imports. No runtime behavior changes; size impact is negligible since both are already imported for rendererOptions.
@coderabbitai where can I add documentation? |
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed:
Length of output: 4773 🏁 Script executed:
Length of output: 13434 🏁 Script executed:
Length of output: 4871 🏁 Script executed:
Length of output: 49742 @stefanonepanedap Based on my analysis of the Vue.js core repository, here are the recommended places where you can add documentation for the newly exported 1. JSDoc Comments in index.ts (Recommended)Add JSDoc comments directly above the export statement in /**
* Platform-agnostic node operations for DOM manipulation.
* Used internally by Vue's DOM renderer and can be used for creating custom renderers.
*
* @example
* ```js
* import { nodeOps, patchProp, createRenderer } from '@vue/runtime-dom'
*
* const customRenderer = createRenderer({
* ...nodeOps,
* patchProp
* })
* ```
*/
export { nodeOps } from './nodeOps'
/**
* Platform-specific property patching function for DOM elements.
* Handles class, style, events, and other DOM properties/attributes.
* Used internally by Vue's DOM renderer and can be used for creating custom renderers.
*
* @param el - The target DOM element
* @param key - The property/attribute key
* @param prevValue - Previous value
* @param nextValue - New value
* @param namespace - Element namespace (svg, mathml, etc.)
* @param parentComponent - Parent component instance (for context)
*/
export { patchProp } from './patchProp' 2. Update the runtime-dom README.mdEnhance # @vue/runtime-dom
```js
import { h, createApp } from '@vue/runtime-dom'
const RootComponent = {
render() {
return h('div', 'hello world')
},
}
createApp(RootComponent).mount('#app') Custom Renderer CreationThe import { createRenderer, nodeOps, patchProp } from '@vue/runtime-dom'
// Create a custom renderer using DOM operations
const customRenderer = createRenderer({
...nodeOps,
patchProp,
// Add custom logic here
})
|
This PR exposes nodeOps and patchProps in order to facilitate the extension of web base custom renderers.
eg. Implementing scopedRegistry for custom component support.
Summary by CodeRabbit