UNPKG

@sutton-signwriting/sgnw-components

Version:

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

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