UNPKG

@sutton-signwriting/sgnw-components

Version:

a javascript package of web components for use with the SignWriting script.

4 lines 1.45 kB
/*! * The Sutton SignWriting Web Components */ import{proxyCustomElement as s,HTMLElement as t,h as i,Host as o,transformTag as e}from"@stencil/core/internal/client";import{f as n}from"./fsw2.js";import{C as c,s as r}from"./color-watch.js";import{f as l}from"./fsw.js";import{c as a}from"./global.js";const h=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.symbol){let s=n.parse.symbol(this.el.innerHTML);s.style&&(this.styling=r.compose(r.merge(r.parse(s.style),r.parse(this.styling)))),this.symbol=s.symbol}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(a(this.el),r.parse(this.styling)));return i(o,{key:"86f20d62b1a9c98b90474a9ec054a76ee3a2d1b9",symbol:this.symbol,styling:this.styling,innerHTML:this.sgnw?l.symbolSvg(this.symbol+s):""},i("slot",{key:"526c8016004ba63407640a123475c6a9e3b48041"}))}get el(){return this}static get style(){return":host{transition:color 1ms, background-color 1ms}"}},[257,"fsw-symbol",{symbol:[1537],styling:[1537],sgnw:[32]}]);function m(){"undefined"!=typeof customElements&&["fsw-symbol"].forEach((s=>{"fsw-symbol"===s&&(customElements.get(e(s))||customElements.define(e(s),h))}))}export{h as F,m as d}