Skip to content

v4.2.0

Choose a tag to compare

@github-actions github-actions released this 30 Sep 07:10
· 210 commits to main since this release
65a45d8

Version 4.2.0 brings a suite of API refinements, enhanced document handling, keyboard navigation, batch editing, and numerous bug fixes to improve stability and developer experience.

API and feature updates

  • Rename the two structural editing hooks to useDndItems and useDndChildren, keeping deprecated aliases for backward compatibility (9838e72).
  • Allow Live.Dnd to work with any container ID via the containerId prop (default app-container), report missing containers through onEditError or a toast, and provide a new DndEditError shape for container‑not‑found errors; add createDocument({ containerId? }) and extend many utility functions to accept an optional { containerId } argument (2f56573).
  • Export getFieldKind, isStructuralFieldKind, and their types from @jbpark/live-editor/dnd so custom panels can determine the built‑in control for a binding and identify structural kinds (3ed041f).
  • Export resolvePanelBindings and withPanelCommit from @jbpark/live-editor/dnd, along with PanelBindingSource and PanelBindingData, to support building panel bindings for elements not directly handled by the panel (258f5b0).
  • Enable keyboard navigation between canvas sections: Arrow Up/Down, Home/End, and Delete/Backspace operate on the focused section, keeping focus and scrolling into view (804f9b7).
  • Make the palette and canvas fully keyboard‑accessible, allow host confirmation on delete via onBeforeDelete, and provide keyboard‑based drag‑and‑drop with Enter, Space, and Escape (a997ae6).
  • Commit multiple panel edits as a single change using useDndPanel().onNodesChange and updateAll in the utils, with atomic success/failure handling and new types UpdateEntry, UpdateAllResult, and PanelNodesChange; deprecate bulkUpdate (2247ec3).
  • Default section names to English “Section 1”, “Section 2”, etc., and expose sectionNameFallback on Live.Dnd and extractSections for custom naming (9d82d41).
  • Keep the canvas and panel populated with the last successfully parsed document when the source contains a syntax error, marking them read‑only and reporting parse errors via onEditError (77a0d27).
  • Allow optional attributes to be toggled by committing undefined, removing them from the DOM, and handling missing attributes gracefully; introduce required-property failure for required bindings (69fd2b1).

Patch fixes

  • Layout the preview iframe as a block element to eliminate baseline gaps and prevent unnecessary scrollbars (725b8b5).
  • Prevent the built‑in panel’s validation error from shifting fields by setting margin-bottom: 0 (b911ecf).
  • Correct full‑height section overflow by subtracting canvas margins and padding from vh calculations (01e2e00).
  • Fix useDndItems and Live.Dnd to correctly handle multiple edits or commits in the same tick, building on the previous state instead of overwriting (1d34220, 341cd84).
  • Ensure preview scripts from frame.scripts load reliably by retaining blob URLs until injection completes (73cb3a9).
  • Allow a <section> to carry its own data-binding, showing it in the panel, while protecting editor attributes from being bound (14963e1).

What's Changed

  • fix(editor): give the demo editor a viewport-sized shell and the preflight it was missing by @pjb0811 in #410
  • fix(dnd): keep the panel's validation error from shifting the fields below it by @pjb0811 in #411
  • docs: space the samples' title and button with flex gap instead of space-y by @pjb0811 in #413
  • fix(demos): pin the demos to a light color scheme with an opaque background by @pjb0811 in #414
  • docs(binding): explain that widget is a name your own panel defines, not a built-in option by @pjb0811 in #415
  • docs(binding): describe widget's step and unit as your own settings, not built-in ones by @pjb0811 in #416
  • fix(demos): fit the custom panel demo's stacked layout and toolbar to a phone by @pjb0811 in #417
  • refactor(dnd): rename the structural editing hooks to useDndItems and useDndChildren by @pjb0811 in #418
  • fix(demos): edit children bindings in the custom panel demo's headless mode by @pjb0811 in #419
  • feat(dnd): export resolvePanelBindings and withPanelCommit by @pjb0811 in #420
  • ci: drop gitmoji from bot-generated commits and PR titles by @pjb0811 in #421
  • chore(website): build the library and demos before starting the docs dev server by @pjb0811 in #422
  • fix(demos): keep nested structural bindings headless in the custom panel demo by @pjb0811 in #423
  • feat(dnd): export getFieldKind so custom panels share Field's control rule by @pjb0811 in #424
  • fix(dnd): build each panel commit on the one before it in the same tick by @pjb0811 in #452
  • fix(dnd): build each useDndItems edit on the one before it in the same tick by @pjb0811 in #453
  • fix(frame): lay out the preview iframe as a block by @pjb0811 in #454
  • fix(frame): subtract margins and container padding from the probe height by @pjb0811 in #455
  • fix(scripts): keep a script's blob URL alive until the frame injects it by @pjb0811 in #456
  • refactor(ast): resolve JSX tag names through one shared function by @pjb0811 in #457
  • feat(dnd): name unnamed sections in English and add sectionNameFallback by @pjb0811 in #458
  • chore(changeset): drop the major bump drafted for the tag-name refactor by @pjb0811 in #459
  • ci: cap the changeset draft bot at a minor bump by @pjb0811 in #461
  • feat(dnd): make the document container id configurable and report a missing one by @pjb0811 in #462
  • fix(dnd): keep the last parsed sections, read-only, while the document doesn't parse by @pjb0811 in #463
  • feat(dnd): let a section carry its own data-binding by @pjb0811 in #464
  • feat(dnd): commit several panel edits as one with onNodesChange by @pjb0811 in #465
  • feat(dnd): select, add and reorder sections from the keyboard, and confirm deletes by @pjb0811 in #466
  • feat(dnd): move between sections with the arrow keys and delete the focused one by @pjb0811 in #467
  • feat(dnd): remove an attribute with undefined and add a missing one with a value by @pjb0811 in #468
  • chore: version packages by @github-actions[bot] in #412

Full Changelog: v4.1.1...v4.2.0