UNPKG

@senx/discovery-plugin-marauder

Version:

Discovery plugin - Marauder's map

115 lines (111 loc) 4.63 kB
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client'; import { P as Param, G as GTSLib, l as lodash, L as Logger, U as Utils } from './utils.js'; const discoveryHiddenCss = "/*!\n * Copyright 2022 SenX S.A.S.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */:host{display:none}"; const DiscoveryHiddenStyle0 = discoveryHiddenCss; const DiscoveryHidden = /*@__PURE__*/ proxyCustomElement(class DiscoveryHidden extends HTMLElement { constructor() { super(); this.__registerHost(); this.__attachShadow(); this.draw = createEvent(this, "draw", 7); this.divider = 1000; this.result = undefined; this.type = undefined; this.options = new Param(); this.width = undefined; this.height = undefined; this.debug = false; this.unit = ''; this.parsing = false; this.rendering = false; this.message = undefined; this.innerStyle = undefined; this.innerOptions = undefined; this.initial = false; } updateRes() { this.result = GTSLib.getData(this.result); } optionsUpdate(newValue, oldValue) { var _a, _b; (_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['optionsUpdate'], newValue, oldValue); let opts = newValue; if (!!newValue && typeof newValue === 'string') { opts = JSON.parse(newValue); } if (!lodash.exports.isEqual(opts, this.innerOptions)) { this.innerOptions = Object.assign({}, opts); (_b = this.LOG) === null || _b === void 0 ? void 0 : _b.debug(['optionsUpdate 2'], { options: this.innerOptions, newValue, oldValue }); } } componentWillLoad() { var _a; this.parsing = true; this.LOG = new Logger(DiscoveryHidden, this.debug); if (typeof this.options === 'string') { this.innerOptions = JSON.parse(this.options); } else { this.innerOptions = this.options; } this.result = GTSLib.getData(this.result); this.divider = GTSLib.getDivider(this.innerOptions.timeUnit || 'us'); (_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['componentWillLoad'], { type: this.type, options: this.innerOptions, }); } componentDidLoad() { setTimeout(() => { this.height = Utils.getContentBounds(this.el.parentElement).h; this.initial = true; this.parsing = false; setTimeout(() => this.draw.emit(), 100); }); } async resize() { // empty } render() { return h("div", { key: 'fce23f9e87e85e697c65207072ed55016fb09c29', style: { display: 'hidden' } }, h("div", { key: '551c501c8733a05dcba5aac30419ee5eaa04a075', ref: (el) => this.wrapper = el })); } get el() { return this; } static get watchers() { return { "result": ["updateRes"], "options": ["optionsUpdate"] }; } static get style() { return DiscoveryHiddenStyle0; } }, [1, "discovery-hidden", { "result": [1025], "type": [1], "options": [1], "width": [32], "height": [32], "debug": [4], "unit": [1], "parsing": [32], "rendering": [32], "message": [32], "innerStyle": [32], "innerOptions": [32], "initial": [32], "resize": [64] }, undefined, { "result": ["updateRes"], "options": ["optionsUpdate"] }]); function defineCustomElement() { if (typeof customElements === "undefined") { return; } const components = ["discovery-hidden"]; components.forEach(tagName => { switch (tagName) { case "discovery-hidden": if (!customElements.get(tagName)) { customElements.define(tagName, DiscoveryHidden); } break; } }); } export { DiscoveryHidden as D, defineCustomElement as d }; //# sourceMappingURL=discovery-hidden2.js.map