diff --git a/package.json b/package.json index 7de7f11..7253cb9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sigpro", - "version": "1.2.19", + "version": "1.2.20", "type": "module", "license": "MIT", "main": "./dist/sigpro.esm.min.js", diff --git a/sigpro.js b/sigpro.js index 7b0fe00..c7cc523 100644 --- a/sigpro.js +++ b/sigpro.js @@ -577,14 +577,17 @@ const mount = (comp, target) => { return inst } -const SigPro = Object.freeze({ $, $$, watch, h, when, each, fx, router, req, mount, batch }) +const sigproFn = Object.freeze({ $, $$, watch, h, when, each, fx, router, req, mount, batch }) -if (typeof window !== "undefined") { - Object.assign(window, SigPro) - "a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup svg table tbody td template textarea tfoot th thead time tr u ul video" - .split(" ").forEach(tag => { - window[tag] = (props, children) => h(tag, props, children) - }) +const sigpro = () => { + if (typeof window !== "undefined") { + Object.assign(window, sigproFn) + "a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup svg table tbody td template textarea tfoot th thead time tr u ul video" + .split(" ").forEach(tag => { window[tag] = (props, children) => h(tag, props, children) }) + console.log("SigPro DX installed.") + } } -export { $, $$, watch, h, when, each, fx, router, req, mount, batch } \ No newline at end of file +if (typeof import.meta === 'undefined' && typeof window !== 'undefined') sigpro() + +export { sigpro, $, $$, watch, h, when, each, fx, router, req, mount, batch } \ No newline at end of file