UNPKG

@haxtheweb/haxcms-nodejs

Version:

HAXcms single and multisite nodejs server, api, and administration

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