function htmlb(el, ...args) {
el = html`${el.join('')}`;
let text = args[0];
let elWidth;
mutable debug.args = args;
mutable debug.elWidth = elWidth;
for (const arg of args) {
if (typeof arg === "number") {
elWidth = arg;
} else {
text = arg;
}
}
function update() {
if (!elWidth) {
const temp = el.append(text);
elWidth = el.clientWidth;
mutable debug.el = el;
while (el.lastChild) {
el.removeChild(el.lastChild);
}
}
const fragment = calculate(elWidth, text, { el }).reduce(
(df, curr, idx, src) => {
df.append(curr);
if (idx + 1 < src.length) df.append(html`<br/>`);
return df;
},
new DocumentFragment()
);
el.append(fragment);
}
mutable debug.el = elWidth;
if (elWidth) {
const fragment = calculate(elWidth, text).reduce((df, curr, idx, src) => {
df.append(curr);
if (idx + 1 < src.length) df.append(html`<br/>`);
return df;
}, new DocumentFragment());
el.append(fragment);
return el;
} else return Object.assign(el, { update });
}