UNPKG

@sandlada/mdc

Version:

@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.

7 lines 912 B
import{noChange as e,nothing as t}from"../lit-html.js";import{Directive as n,PartType as r,directive as i}from"../directive.js";import{isSingleExpression as a,setCommittedValue as o}from"../directive-helpers.js"; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const s=i(class extends n{constructor(e){if(super(e),e.type!==r.PROPERTY&&e.type!==r.ATTRIBUTE&&e.type!==r.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!a(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(n,[i]){if(i===e||i===t)return i;let a=n.element,s=n.name;if(n.type===r.PROPERTY){if(i===a[s])return e}else if(n.type===r.BOOLEAN_ATTRIBUTE){if(!!i===a.hasAttribute(s))return e}else if(n.type===r.ATTRIBUTE&&a.getAttribute(s)===i+``)return e;return o(n),i}});export{s as live}; //# sourceMappingURL=live.js.map