UNPKG

2.53 kBJavaScriptView Raw
1/*!
2 * The Sutton SignWriting Web Components
3 */
4import { r as registerInstance, h, H as Host, g as getElement } from './_commonjsHelpers-383fba37.js';
5import { s as swu } from './swu-f4cee096.js';
6import { s as style } from './style-fd531f8d.js';
7import { s as swu$1 } from './swu-a03963b7.js';
8import { c as cssValues } from './global-4493408c.js';
9
10const sgnwSignCss = ":host{direction:ltr}";
11
12const SgnwSign = class {
13 constructor(hostRef) {
14 registerInstance(this, hostRef);
15 this.sgnw = window.sgnw;
16 }
17 connectedCallback() {
18 if (!this.sign) {
19 let sign = swu.parse.sign(this.el.innerHTML);
20 if (sign.style) {
21 this.styling = style.compose(style.merge(style.parse(sign.style), style.parse(this.styling)));
22 }
23 sign.style = "";
24 this.sign = swu.compose.sign(sign);
25 }
26 if (!this.sgnw) {
27 let self = this;
28 function handleSgnw() {
29 self.sgnw = window.sgnw;
30 window.removeEventListener("sgnw", handleSgnw, false);
31 }
32 window.addEventListener('sgnw', handleSgnw, false);
33 }
34 }
35 render() {
36 const styleStr = style.compose(style.merge(cssValues(this.el), style.parse(this.styling)));
37 return (h(Host, { sign: this.sign, styling: this.styling, innerHTML: this.sgnw ? swu$1.signSvg(this.sign + (styleStr)) : '' }, h("slot", null)));
38 }
39 get el() { return getElement(this); }
40};
41SgnwSign.style = sgnwSignCss;
42
43const sgnwSymbolCss = "";
44
45const SgnwSymbol = class {
46 constructor(hostRef) {
47 registerInstance(this, hostRef);
48 this.sgnw = window.sgnw;
49 }
50 connectedCallback() {
51 if (!this.symbol) {
52 let symbol = swu.parse.symbol(this.el.innerHTML);
53 if (symbol.style) {
54 this.styling = style.compose(style.merge(style.parse(symbol.style), style.parse(this.styling)));
55 }
56 symbol.style = "";
57 this.symbol = swu.compose.symbol(symbol);
58 }
59 if (!this.sgnw) {
60 let self = this;
61 function handleSgnw() {
62 self.sgnw = window.sgnw;
63 window.removeEventListener("sgnw", handleSgnw, false);
64 }
65 window.addEventListener('sgnw', handleSgnw, false);
66 }
67 }
68 render() {
69 const styleStr = style.compose(style.merge(cssValues(this.el), style.parse(this.styling)));
70 return (h(Host, { symbol: this.symbol, styling: this.styling, innerHTML: this.sgnw ? swu$1.symbolSvg(this.symbol + (styleStr)) : '' }, h("slot", null)));
71 }
72 get el() { return getElement(this); }
73};
74SgnwSymbol.style = sgnwSymbolCss;
75
76export { SgnwSign as sgnw_sign, SgnwSymbol as sgnw_symbol };