Skip to content

v0.6.0

Choose a tag to compare

@dream-encode dream-encode released this 01 Sep 19:31
· 26 commits to main since this release

Changelog

  • FEA: Settings - Added RailSettingsPage, a settings page shell built around a vertical section rail. Sections are declared as an array rather than nested as panels, and that one list drives the rail, the open pane, the unsaved markers and the deep link. Each entry takes a key, a title, and optionally a group heading, a description, a badge count, and a type of "actions". One section shows at a time in a pane that runs the full width of the screen, and a sticky header carries the title, the version, Discard and a single Save that names how many fields it will write. The open section is written to the URL hash, so a link can point at one section rather than at the top of the page. An actions section hides Save while it is open, because nothing on such a section is written by Save; edits made elsewhere stay reachable through the unsaved count, which opens the first section holding one. The rail takes an optional status readout for its foot, moves under the arrow keys as a single tab stop, and collapses to a horizontal strip below 1100px. Ships with de-wp-plugin-utils-settings-rail and de-wp-plugin-utils-settings-rail-page mixins in settings/styles/_settings-rail.scss. The existing stacked AdminSettingsPage is unchanged and still exported.
  • ENH: Settings - createUseSettings now keeps the values it loaded, so it can report what has been edited since. It returns isDirty, dirtyCount, dirtyFields, dirtySections and discardChanges, and rebases that baseline after a successful save. Field definitions accept a section naming the settings section the field belongs to, which is what lets a rail mark an edited section that is off screen without listing every field twice. Values are compared with object keys sorted, because a value rebuilt through a spread carries the same keys in a different order and would otherwise read as an edit.
  • BUG: Settings - A save whose request rejected left the page saving forever. saveSettings awaited apiFetch without catching, so a network failure or a REST error skipped the call that clears the saving state, and the Save button stayed busy and disabled with no way back except a reload. The rejection is now caught, the saving state cleared, and the error surfaced as a notice carrying the message, with the edits left in place so the save can be retried.

Full Changelog: v0.4.0...v0.6.0