diff --git a/dist/components.min.js b/dist/components.min.js index 6fb2d7d..65f34b9 100644 --- a/dist/components.min.js +++ b/dist/components.min.js @@ -33,7 +33,23 @@ class HtmxComponent { refresh() { this.unmount(), this.mount(); } + css(urls) { + return Promise.all(urls.map(this._loadCSS)); + } + _loadCSS(href) { + return new Promise((resolve) => { + if (HtmxComponent.sheets.includes(href)) + return resolve(); + HtmxComponent.sheets.push(href); + let link = document.createElement("link"); + link.type = "text/css", link.rel = "stylesheet", link.onload = resolve, link.setAttribute("href", href), document.head.appendChild(link); + }); + } } +Object.defineProperty(HtmxComponent, "sheets", { + value: [], + writable: !0 +}); (function() { let config = { origin: location.origin,