2023-03-30 09:08:29 +00:00
|
|
|
import './instrument/happydom.js';
|
2022-05-28 15:29:36 +00:00
|
|
|
import * as plugins from './smartntml.plugins.js';
|
|
|
|
|
2023-03-30 09:08:29 +00:00
|
|
|
const deesElement = plugins.deesElement;
|
|
|
|
export {
|
|
|
|
deesElement
|
|
|
|
}
|
2022-05-28 18:03:13 +00:00
|
|
|
|
2023-03-30 09:08:29 +00:00
|
|
|
export class Smartntml {
|
2022-05-28 15:29:36 +00:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
|
2023-03-30 09:08:29 +00:00
|
|
|
public async renderTemplateResult(templateResult: plugins.deesElement.TemplateResult, stripCommentsArg = true) {
|
2022-05-28 15:29:36 +00:00
|
|
|
const element = document.createElement('div');
|
2023-03-30 09:08:29 +00:00
|
|
|
plugins.deesElement.render(templateResult, element);
|
2022-05-29 13:02:48 +00:00
|
|
|
let stringResult = element.innerHTML;
|
|
|
|
if (stripCommentsArg) {
|
|
|
|
stringResult = stringResult.replace(/<!--(.*?)-->/g, '');
|
|
|
|
}
|
|
|
|
return stringResult;
|
2022-05-28 15:29:36 +00:00
|
|
|
}
|
|
|
|
}
|