import { directive } from '@lion/core'; /** * In order to speed up the first meaningful paint, use this directive * on content that is: * - (visually) hidden * - out of the page flow (having position: 'absolute|fixed') * * A good practice would be to use it in overlays, * For hidden tab panels, collapsible content etc. it's also useful * @example * * ${lazyRender( * largeListOfData.map(entry => html` ${entry} `), * )} * */ export const lazyRender = directive(tplResult => part => { setTimeout(() => { part.setValue(tplResult); part.commit(); }); });