{ "version": 3, "sources": ["../../../../../../../../source/febe/ui/src/scripts/components/Tooltip.ts"], "sourcesContent": ["import EventEmitter from \"../classes/EventEmitter.js\";\nimport { Hatch, Domifier } from \"../classes/Hatch\";\n\nconst validPositions = [\"relative\", \"absolute\", \"fixed\"];\n\nlet resolveAttributes = (el: Element, ow = []) => {\n let r = {};\n Object.entries(el?.attributes || {}).forEach((attr) => {\n let a = attr[1];\n if (a.name.indexOf(\"data-\") > -1) {\n let n = a.name.replace(\"data-\", \"\");\n if (ow.indexOf(n) > -1) r[n] = a.value;\n }\n });\n return r;\n};\n\nexport default class Tooltip extends EventEmitter {\n props: {\n text: string;\n target: HTMLElement;\n position: string;\n };\n view: HTMLElement;\n // creates the class\n constructor(props = {}) {\n super();\n // extract object configuration and extend with defaults\n let { target } = (this.props = {\n text: \"Tooltip\",\n target: null,\n position: \"bottom\",\n ...props,\n });\n\n // read out data-attributes and extend to existing props\n this.props = {\n ...this.props,\n ...resolveAttributes(target, Object.keys(this.props)),\n };\n\n this.view = null;\n\n if (target !== null) this.createBindings();\n }\n\n // spits out the view html\n render() {\n let { text, position } = this.props;\n return Domifier(\n Hatch`\n