github vanjs-org/van 1.2.0
1.2.0: Hydration support added (with only 12 more bytes)

latest releases: 1.5.5, 1.5.3, 1.5.2...
2 years ago
  • 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 in on... properties of tag functions, if the properties are used to set HTML attributes (via setAttribute) of the DOM element. This is crucial for cross-platform UI components to specify event handlers, as for SSR, only string-valued on... 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 to Primitive | 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 the dom parameter is undefined (when the binding function is invoked for the first time).
    • Simplify the type definition of Props with built-in type Record.

See the release announcement: #114

Don't miss a new van release

NewReleases is sending notifications on new releases.