v0.19.0
Puck 0.19 introduces the Slots API for nesting components using fields, along with major performance optimizations, a new metadata API, and various quality-of-life improvements.
Read the Puck 0.19 release post for a list of all the new features, and the Puck 0.19 upgrade guide for upgrading from Puck 0.18.3.
Summary
- Slots API:
slot
is a new field type you can use to nest components. Since slots are fields, you can fully leverage APIs likedefaultProps
andresolveData
to programmatically control nested content. walkTree
: a utility function for recursively traversing and updating the entire data payload, or just a singleComponentData
node. It can be used to inspect, update, or validate nested components.- Metadata API: inject data into all components in your config without using React context. The injected data is available in both
render
andresolveData
. - Selectors for
usePuck
: subscribe to the parts of the internal Puck API you need in order to avoid unnecessary re-renders using thecreateUsePuck
factory. useGetPuck
: access the latest Puck API within callbacks without triggering re-renders.
Full changelog
Features
- add convenience metadata API to fields (5fe936e)
- add getItem helpers to usePuck (ad947d8)
- add labelIcon param to all fields for custom label icons (24030a9)
- add mapSlots helper function for manipulating slot data (a27944f)
- add metadata API for passing data to every component (b9add22)
- add placeholder param for text, textarea and number fields (32a6f78)
- add react-router v7 recipe (706ea0c)
- add replaceRoot action to dispatcher (586eccd)
- add selector to usePuck for improved performance (8976e5f)
- add slots API (40bc2ee)
- add step parameter to number fields (0ea6ce4)
- add useGetPuck hook for getting latest internal PuckApi (1d9a47d)
- add visible param to show/hide fields (e5911f3)
- deprecate DropZone component (d54145d)
- export package.json for module federation (b918900)
- expose CustomFieldRender type for custom field render functions (8d459e4)
- expose RootConfig type (638e066)
- expose WithSlotProps type (6dc5101)
- provide
trigger
event to resolveData parameters (55b42ae) - rename mapSlots to walkTree (427e686)
- support slots in transformProps via optional config arg (7d59b94)
Performance Improvements
Bug Fixes
- account for transforms in overlays (22f5e3a)
- add missing
id
to changed type for resolvers (eb4f9d8) - avoid query selector collision with multiple iframes (2c1db86)
- bind array item to correct field when using multiple arrays (7e231b7)
- deeply check items before populating resolveData changed (db75e42)
- don't artificially constrain array items to container (36b5713)
- don't collide with parent if component contains drop zone (e7d2371)
- don't render array item until dropped (1dfc1b3)
- don't reset old values when modifying fields in other array items (ad78e98)
- don't track dragged headings in heading-outline-analyzer (2e1a24e)
- ensure array items can be opened on mobile (a60c81e)
- ensure file inputs work inside array fields (83f8f2d)
- ensure nested array fields are draggable (af4f756)
- export migrate util in RSC bundle (2568ac3)
- expose transformProps in server bundle (020071e)
- fix undo/redo hotkeys for Windows (a994207)
- prevent ActionBar clipping if it exceeds top bounds (56f23e8)
- prevent horizontal scroll on touch devices (cb4b6ee)
- prevent input-type fields from exceeding container boundaries (b22833e)
- prevent item from sometimes sticking to window during drag (e62832e)
- reflect resolveData value changes in fields (69dd799)
- remove erroneous React 17 from supported peer dependencies (46212f0)
- remove unexpected license from recipes (7010bdc)
- reorder array items more predictably (64c65c3)
- reset stacking context in Puck entry (6bf9c99)
- restore ability to drop between sibling zones (2807cba)
- restore field values during undo/redo (6917928)
- retain minimum height when ActionBar is empty (a52ccb9)
- set ready status more reliably when using strict mode (5a526d0)
- show correct styles when insert permission is disabled (f19cdca)
- show top border on array button when array empty (add5a17)
- still select item from outline if element not in document (8e1d722)
- support strings in readOnly type for arrays and object (9358a3b)