@sutton-signwriting/sgnw-components
Version:
a javascript package of web components for use with the SignWriting script.
4 lines • 1.46 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{f as o}from"./fsw2.js";import{C as c,s as r}from"./color-watch.js";import{f as h}from"./fsw.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:"569666a6b261005ca3f9219e6320b6729824c420",sign:this.sign,styling:this.styling,innerHTML:this.sgnw?h.signSvg(this.sign+s):""},i("slot",{key:"b53feac3a744d011833be0e65e3927c92ca6f63f"}))}get el(){return this}static get style(){return":host{direction:ltr}:host{transition:color 1ms, background-color 1ms}"}},[257,"fsw-sign",{sign:[1537],styling:[1537],sgnw:[32]}]);function f(){"undefined"!=typeof customElements&&["fsw-sign"].forEach((s=>{"fsw-sign"===s&&(customElements.get(e(s))||customElements.define(e(s),a))}))}export{a as F,f as d}