- New API
van.hydrate
that allows us to hydrate a SSR component into a CSR component with added reactivity while preserving all the server-side states. Sample usage:
van.hydrate(document.getElementById("basic-counter")!, dom => Counter({
van,
id: dom.id,
init: Number(dom.getAttribute("data-counter")),
}))
- Change
van-{VERSION}.debug.js
to allow string values inon...
properties of tag functions, if the properties are used to set HTML attributes (viasetAttribute
) of the DOM element. This is crucial for cross-platform UI components to specify event handlers, as for SSR, only string-valuedon...
event handlers can be visible in the rendered HTML strings. You can refer to https://vanjs.org/ssr#on-properties for a detailed explanation. - Fix some type definitions in
van.d.ts
:- For state-valued child nodes, restrict the types of
val
property toPrimitive | null | undefined
(DOM-node-valued states are not allowed anymore). This is because DOM-node-valued states have problematic behavior and should be generally avoided, see https://vanjs.org/advanced#why-not-dom-valued-states for more information. - For state-derived child nodes, the binding function should be of type
(dom: Node | undefined) => ValidChildDomValue
(changed from(dom: Node) => ValidChildDomValue
), as it needs to handle to case where thedom
parameter isundefined
(when the binding function is invoked for the first time). - Simplify the type definition of
Props
with built-in typeRecord
.
- For state-valued child nodes, restrict the types of
See the release announcement: #114