@sutton-signwriting/sgnw-components
Version:
a javascript package of web components for use with the SignWriting script.
4 lines • 1.47 kB
JavaScript
/*!
* The Sutton SignWriting Web Components
*/
import{proxyCustomElement as s,HTMLElement as t,h as i,Host as n,transformTag as e}from"@stencil/core/internal/client";import{s as o}from"./swu2.js";import{C as c,s as r}from"./color-watch.js";import{s as h}from"./swu.js";import{c as l}from"./global.js";const a=s(class extends t{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.sgnw=window.sgnw}connectedCallback(){if(this.colorWatch=new c(this.el,this),!this.sign){let s=o.parse.sign(this.el.innerHTML);s.style&&(this.styling=r.compose(r.merge(r.parse(s.style),r.parse(this.styling)))),s.style="",this.sign=o.compose.sign(s)}if(!this.sgnw){let t=this;function i(){t.sgnw=window.sgnw,window.removeEventListener("sgnw",i,!1)}window.addEventListener("sgnw",i,!1)}}disconnectedCallback(){this.colorWatch.dispose()}render(){const s=r.compose(r.merge(l(this.el),r.parse(this.styling)));return i(n,{key:"cc1ffd2004b25f139c6c0a6fc13884f9a40ef33d",sign:this.sign,styling:this.styling,innerHTML:this.sgnw?h.signSvg(this.sign+s):""},i("slot",{key:"a02cce53502a3b97fbb13ce40d88aebdb34e2fc1"}))}get el(){return this}static get style(){return":host{direction:ltr}:host{transition:color 1ms, background-color 1ms}"}},[257,"sgnw-sign",{sign:[1537],styling:[1537],sgnw:[32]}]);function f(){"undefined"!=typeof customElements&&["sgnw-sign"].forEach((s=>{"sgnw-sign"===s&&(customElements.get(e(s))||customElements.define(e(s),a))}))}export{a as S,f as d}