UNPKG

@sutton-signwriting/sgnw-components

Version:

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

82 lines (74 loc) 2.85 kB
/*! * The Sutton SignWriting Web Components */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const _commonjsHelpers = require('./_commonjsHelpers-9aed4453.js'); const swu = require('./swu-58a6fbe8.js'); const style = require('./style-49616a98.js'); const swu$1 = require('./swu-8ca7dadc.js'); const global = require('./global-8a256890.js'); const sgnwSignCss = ":host{direction:ltr}"; const SgnwSign = class { constructor(hostRef) { _commonjsHelpers.registerInstance(this, hostRef); this.sgnw = window.sgnw; } connectedCallback() { if (!this.sign) { let sign = swu.swu.parse.sign(this.el.innerHTML); if (sign.style) { this.styling = style.style.compose(style.style.merge(style.style.parse(sign.style), style.style.parse(this.styling))); } sign.style = ""; this.sign = swu.swu.compose.sign(sign); } if (!this.sgnw) { let self = this; function handleSgnw() { self.sgnw = window.sgnw; window.removeEventListener("sgnw", handleSgnw, false); } window.addEventListener('sgnw', handleSgnw, false); } } render() { const styleStr = style.style.compose(style.style.merge(global.cssValues(this.el), style.style.parse(this.styling))); return (_commonjsHelpers.h(_commonjsHelpers.Host, { sign: this.sign, styling: this.styling, innerHTML: this.sgnw ? swu$1.swu.signSvg(this.sign + (styleStr)) : '' }, _commonjsHelpers.h("slot", null))); } get el() { return _commonjsHelpers.getElement(this); } }; SgnwSign.style = sgnwSignCss; const sgnwSymbolCss = ""; const SgnwSymbol = class { constructor(hostRef) { _commonjsHelpers.registerInstance(this, hostRef); this.sgnw = window.sgnw; } connectedCallback() { if (!this.symbol) { let symbol = swu.swu.parse.symbol(this.el.innerHTML); if (symbol.style) { this.styling = style.style.compose(style.style.merge(style.style.parse(symbol.style), style.style.parse(this.styling))); } symbol.style = ""; this.symbol = swu.swu.compose.symbol(symbol); } if (!this.sgnw) { let self = this; function handleSgnw() { self.sgnw = window.sgnw; window.removeEventListener("sgnw", handleSgnw, false); } window.addEventListener('sgnw', handleSgnw, false); } } render() { const styleStr = style.style.compose(style.style.merge(global.cssValues(this.el), style.style.parse(this.styling))); return (_commonjsHelpers.h(_commonjsHelpers.Host, { symbol: this.symbol, styling: this.styling, innerHTML: this.sgnw ? swu$1.swu.symbolSvg(this.symbol + (styleStr)) : '' }, _commonjsHelpers.h("slot", null))); } get el() { return _commonjsHelpers.getElement(this); } }; SgnwSymbol.style = sgnwSymbolCss; exports.sgnw_sign = SgnwSign; exports.sgnw_symbol = SgnwSymbol;