v0.6.0
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 akey, atitle, and optionally agroupheading, adescription, abadgecount, and atypeof "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 withde-wp-plugin-utils-settings-railandde-wp-plugin-utils-settings-rail-pagemixins insettings/styles/_settings-rail.scss. The existing stackedAdminSettingsPageis unchanged and still exported. - ENH: Settings -
createUseSettingsnow keeps the values it loaded, so it can report what has been edited since. It returnsisDirty,dirtyCount,dirtyFields,dirtySectionsanddiscardChanges, and rebases that baseline after a successful save. Field definitions accept asectionnaming 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.
saveSettingsawaitedapiFetchwithout 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