mponents to invoke the box model highlighter * without having to know where the highlighter exists. */ module.exports = { /** * Show the box model highlighter for the currently selected node front. * The selected node is obtained from the Selection instance on the Inspector. * * @param {object} options * Optional configuration options passed to the box model highlighter */ highlightSelectedNode(options = {}) { return async thunkOptions => { const { inspector } = thunkOptions; if (!inspector || inspector._destroyed) { return; } const { nodeFront } = inspector.selection; if (!nodeFront) { return; } await inspector.highlighters.showHighlighterTypeForNode( inspector.highlighters.TYPES.BOXMODEL, nodeFront, options ); }; }, /** * Show the box model highlighter for the given node front. * * @param {NodeFront} nodeFront * Node that should be highlighted. * @param {object} options * Optional configuration options passed to the box model highlighter */ highlightNode(nodeFront, options = {}) { return async thunkOptions => { const { inspector } = thunkOptions; if (!inspector || inspector._destroyed) { return; } await inspector.highlighters.showHighlighterTypeForNode( inspector.highlighters.TYPES.BOXMODEL, nodeFront, options ); }; }, /** * Hide the box model highlighter for any highlighted node. */ unhighlightNode() { return async thunkOptions => { const { inspector } = thunkOptions; if (!inspector || inspector._destroyed) { return; } await inspector.highlighters.hideHighlighterType( inspector.highlighters.TYPES.BOXMODEL ); }; }, }; PK