// fixtures/inspector-block.mjs — the inspector's Block section: the // selected block's props (each field marked data-types with the types // that have it), its placement (a region on a flow slide, a box and a // layer on a canvas one), and its phone layer (§2.5). fillBlock puts // the block's values in the controls and shows the right ones; // blockChange turns a changed control into its op. // // The controls are typed by attribute rather than by name, so a new // prop is a new field in editor.html and nothing here: // // data-prop="level" data-kind="int" a prop → set_block props // data-text="label" a shape's label → set_text // data-place="region" the region → set_block region // data-box="x" a box field → set_block box, or // set_phone box in the phone view // data-phone="hidden|order|size" the phone layer → set_phone // // size is view-dependent (switcher.mjs): the desktop Size field goes // to the phone map in the phone view, which is what the switcher // promises. The phone fieldset's own Size always goes to the map. import { propOp, propValue, regionOp, labelOp, boxFieldOp } from './inspector-ops.mjs' import { routeEdit, hasOverride } from './switcher.mjs' import { defaultRegion } from './layout.mjs' /** Sets a control's value without disturbing the one the person is typing in. */ export function setValue (el, value) { if (!el) return if (el.type === 'checkbox') { el.checked = !!value return } // Never write into the control somebody is using: a value replaced // under a caret loses what was half-typed, and a