github diegomura/react-pdf @react-pdf/layout@5.0.0

latest releases: @react-pdf/paginate@1.0.0, @react-pdf/types@2.12.0, @react-pdf/font@4.0.11...
4 hours ago

Major Changes

  • #3500 572cedc23493e4a3085e259bf129ceec458418bd Thanks @diegomura! - Move render-prop element conversion from layout to the renderer

    Render props are now wrapped at the reconciler boundary: by the time layout
    calls them they return internal instances, not React elements. Layout's
    createInstances is deleted and resolvePagination consumes instances
    directly.

    Breaking (layout): anyone calling @react-pdf/layout directly with
    trees whose render props return React elements must convert the result
    before handing it to layout — the contract is now instance arrays. Users of
    @react-pdf/renderer are unaffected: the renderer performs the conversion.

Minor Changes

  • #3505 ae9a9983e8bd8b63c3873000531a8307e22c7bae Thanks @diegomura! - Experimental pagination engine, opt-in per page

    A new pagination engine ships alongside the current one: content is
    measured once and packed into pages instead of relayouting on every split,
    making long documents paginate orders of magnitude faster (a 300-page
    document drops from ~40s to ~200ms).

    Opt in with <Page experimentalPagination> — any page opting in switches
    the whole document. The default behavior is unchanged.

    Under the new engine:

    • <Page layout={Layout}> renders per-page chrome (headers, footers,
      sidebars) around the content. The layout component receives
      { pageNumber, totalPages, subPageNumber, subPageTotalPages } and the
      page content as children, and runs once per output page. Using layout
      implies experimentalPagination.
    • One fixed semantic: in-flow fixed elements repeat at the top of every
      page they span; footers are the layout's job.
    • minPresenceAhead is supported, with one refinement: a trailing element
      with nothing after it stays in place instead of moving to its own page.

    The current engine remains the default until the next major, when the new
    engine takes over.

Patch Changes

Don't miss a new react-pdf release

NewReleases is sending notifications on new releases.