@wocart/theme / index / PreviewPatch
Type Alias: PreviewPatch
PreviewPatch = {
id:string;index:number;op:"move";parent?:string; } | {id:string;ids:Readonly<Record<string,string>>;op:"duplicate"; } | {id:string;op:"remove"; } | {id:string;index:number;op:"restore";parent?:string; } | {hidden:boolean;id:string;op:"hide"; } | {from:string;id:string;op:"text";to:string; }
A change the editor has already made to its draft, for the page to show at
once, before the render that follows it. A patch is a hint: the page
applies what it can find and leaves the rest to that render, which is the
page's truth — so an editor always sends the render too, and a page that
does not know patches (before @wocart/theme 1.6.0) still shows every
change, a moment later.
move: an instance toindexamong its siblings, counted once it has left its place (moveInstance): the document's sections, or withparentthe blocks of that instance. A move to another parent is left to the render.duplicate: a copy of an instance right after it;idsmaps every instance id inside it, its own included, to its copy's.remove: an instance and everything in it;restoreputs what aremovetook back atindexamong the sections, or amongparent's blocks.hide: an instance switched off (it shows nothing) or back on.text: inside an instance, text that readsfromnow readsto— a field's text as the theme prints it.