UNPKG

@popeindustries/lit-html

Version:

Seamlessly and efficiently use @popeindustries/lit-html-server rendered HTML to hydrate lit-html templates in the browser

6 lines (5 loc) 874 B
/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */import{nothing as i,noChange as s}from"../lit-html.js";import{directive as n,Directive as o,PartType as c}from"../directive.js";const u=1;class r extends o{constructor(t){if(super(t),this._value=i,t.type!==c.CHILD)throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`)}render(t){if(t===i||t==null)return this._templateResult=void 0,this._value=t;if(t===s)return t;if(typeof t!="string")throw new Error(`${this.constructor.directiveName}() called with a non-string value`);if(t===this._value)return this._templateResult;this._value=t;const e=[t];return e.raw=e,this._templateResult={_$litType$:this.constructor.resultType,strings:e,values:[]}}}r.directiveName="unsafeHTML",r.resultType=u;const p=n(r);export{r as UnsafeHTMLDirective,p as unsafeHTML};