Repository navigation
v2.2.0
@jbpark/live-editor v2.2.0 – Enhances panel rendering flexibility, exposes new hooks and types, and improves node‑level commit handling.
-
Export the built‑in single‑binding control as
Live.Dnd.Field.- A custom
renderPanelcan now mix its own controls with the built‑in one per binding instead of choosing all‑or‑nothing between hand‑rolling every field and wrappingDefaultPanel. - Driven entirely by public render data—a
PanelBindingfrombindingsplusonNodeChange—and renders only the control, leaving the label to the caller. - Most useful for
items/children/arraybindings, whose editors reach nested data‑bound elements thatbindingsalone can’t address. - Also exports the
FieldPropsandPanelNodeChangetypes;PanelNodeChangenames the node‑level commit callback’s shape, which was previously spelled out inline everywhere it appeared.
- A custom
-
Forward the node‑level commit callback to
renderPanel.PanelRenderDatanow carriesonNodeChange, so a custom panel that re‑embedsLive.Dnd.DefaultPanelcan spread the render data straight in (<Live.Dnd.DefaultPanel {...data} />) and keep nested array/children edits working.- Previously those edits were silent no‑ops, affecting 5 of the 8 shipped sections (9 of Stats’ 10 editable elements).
onNodeChangeis a required field onPanelRenderData. Reading it off the argument in arenderPanelis unaffected; only code that constructs aPanelRenderDataobject by hand (a test helper or a re‑shaping wrapper) needs to add the field.
-
Export
useItemsEditor, the array‑editing engine behind the built‑in Items panel, so a custom panel can keep its own markup instead of adopting the built‑in control.- It returns
PanelBindings and position‑translated actions, so it composes withLive.Dnd.Field: render your own layout and hand individual bindings to the built‑in control where that’s enough. - It saves re‑implementing the parts that are easy to get wrong—re‑parsing each item’s JSX to find nested data‑bound elements, resolving the binding
rendermap, translating visible item positions to array element positions before every edit, and reconciling the selection after a move or delete. - Also exports the
ItemsEditor,ItemsEditorItem,ItemsEditorNestedGroup,ItemsEditorNestedElement,ItemsEditorActionsandItemsEditorOptionstypes. - Internally
panel/items.tsxis now presentation over that hook (668 → 291 lines). The built‑in panel’s rendered markup is unchanged.
- It returns
What's Changed
- docs: drop gitmoji from PR template checklist by @pjb0811 in #305
- chore: drop emoji labels from PR template type-of-change by @pjb0811 in #306
- refactor: rename PascalCase demo and website files to kebab-case by @pjb0811 in #307
- fix(dnd): forward the node-level commit callback to renderPanel by @pjb0811 in #310
- feat(dnd): export the built-in single-binding control as Field by @pjb0811 in #313
- refactor(dnd): extract the array-editing engine into useItemsEditor by @pjb0811 in #314
- 🔖 chore: version packages by @github-actions[bot] in #311
Full Changelog: v2.1.1...v2.2.0