UNPKG

@sutton-signwriting/sgnw-components

Version:

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

4 lines 1.97 kB
/*! * The Sutton SignWriting Web Components */ import{r as s,f as t,d as i,H as n,e as o}from"./p-BAJUTSOF.js";import{s as c}from"./p-CKUP3WBD.js";import{C as h,s as e}from"./p-BgrNWcmU.js";import{s as r}from"./p-B5gdK0rg.js";const a=class{constructor(t){s(this,t),this.sgnw=window.sgnw}connectedCallback(){if(this.colorWatch=new h(this.el,this),!this.sign){let s=c.parse.sign(this.el.innerHTML);s.style&&(this.styling=e.compose(e.merge(e.parse(s.style),e.parse(this.styling)))),s.style="",this.sign=c.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=e.compose(e.merge(t(this.el),e.parse(this.styling)));return i(n,{key:"cc1ffd2004b25f139c6c0a6fc13884f9a40ef33d",sign:this.sign,styling:this.styling,innerHTML:this.sgnw?r.signSvg(this.sign+s):""},i("slot",{key:"a02cce53502a3b97fbb13ce40d88aebdb34e2fc1"}))}get el(){return o(this)}};a.style=":host{direction:ltr}:host{transition:color 1ms, background-color 1ms}";const d=class{constructor(t){s(this,t),this.sgnw=window.sgnw}connectedCallback(){if(this.colorWatch=new h(this.el,this),!this.symbol){let s=c.parse.symbol(this.el.innerHTML);s.style&&(this.styling=e.compose(e.merge(e.parse(s.style),e.parse(this.styling)))),s.style="",this.symbol=c.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=e.compose(e.merge(t(this.el),e.parse(this.styling)));return i(n,{key:"bd85ac33f6f31f16132489252f04c981433edc78",symbol:this.symbol,styling:this.styling,innerHTML:this.sgnw?r.symbolSvg(this.symbol+s):""},i("slot",{key:"082c6e15c0f121f3ba97d91b70f73979414c8b7a"}))}get el(){return o(this)}};d.style=":host{transition:color 1ms, background-color 1ms}";export{a as sgnw_sign,d as sgnw_symbol}