nanosplash 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- name: Main Github Actions Workflow
1
+ name: Build and Test
2
2
 
3
3
  on:
4
4
  push:
@@ -41,11 +41,10 @@ jobs:
41
41
  uses: actions/setup-node@v3
42
42
  with:
43
43
  node-version: 20
44
- cache: yarn
45
44
  - name: Setup Pages
46
45
  uses: actions/configure-pages@v3
47
46
  - name: Install dependencies
48
- run: bun install
47
+ run: yarn install
49
48
  - name: Build with VitePress
50
49
  run: |
51
50
  bun run docs:build
package/README.md CHANGED
@@ -1,28 +1,23 @@
1
+ <script setup>
2
+ import { version } from '../../../../package.json'
3
+ </script>
4
+
1
5
  # Nanosplash
2
6
 
3
7
  ### The tiny loading screen for web artisans
4
8
 
5
9
  <br>
6
10
 
7
- [![Build](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml/badge.svg?branch=production)](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/nanosplash) [![Coverage](https://img.shields.io/badge/Coverage-99%25-brightgreen)](./coverage/index.html) [![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://github.com/ellerbrock/typescript-badges/) [![Last Commit](https://img.shields.io/github/last-commit/isakhauge/nanosplash)](https://github.com/isakhauge/nanosplash/commits/production)
8
-
9
- <br>
10
-
11
- > 📣 **New in 3.0.3**
12
- >
13
- > - CSS is included inside the ES and CJS bundles 🎉
14
- > - The `ns.hide` method will now delete splash screens in a FIFO sequence.
11
+ [![Build](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml/badge.svg?branch=production)](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/nanosplash) [![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)
15
12
 
16
13
  ## Usage
17
14
 
18
15
  ```js
19
16
  // Fullscreen splash screen
20
17
  ns.show('Loading')
21
- ns.hide()
22
18
 
23
19
  // Splash screen inside a DOM element
24
20
  ns.showInside('#my-div', 'Loading')
25
- ns.hide()
26
21
  ```
27
22
 
28
23
  ## Documentation
@@ -553,7 +553,7 @@ export function getRecycledSplash(targetElement: Element): Splash | null {
553
553
  <div class='footer quiet pad2 space-top1 center small'>
554
554
  Code coverage generated by
555
555
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
556
- at 2023-10-20T11:24:59.864Z
556
+ at 2023-10-20T11:31:43.251Z
557
557
  </div>
558
558
  <script src="prettify.js"></script>
559
559
  <script>
@@ -703,7 +703,7 @@ export default { Service }
703
703
  <div class='footer quiet pad2 space-top1 center small'>
704
704
  Code coverage generated by
705
705
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
706
- at 2023-10-20T11:24:59.864Z
706
+ at 2023-10-20T11:31:43.251Z
707
707
  </div>
708
708
  <script src="prettify.js"></script>
709
709
  <script>
@@ -433,7 +433,7 @@ export class Splash implements SplashInterface {
433
433
  <div class='footer quiet pad2 space-top1 center small'>
434
434
  Code coverage generated by
435
435
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
436
- at 2023-10-20T11:24:59.864Z
436
+ at 2023-10-20T11:31:43.251Z
437
437
  </div>
438
438
  <script src="prettify.js"></script>
439
439
  <script>
@@ -217,7 +217,7 @@ export class SplashQueue {
217
217
  <div class='footer quiet pad2 space-top1 center small'>
218
218
  Code coverage generated by
219
219
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
220
- at 2023-10-20T11:24:59.864Z
220
+ at 2023-10-20T11:31:43.251Z
221
221
  </div>
222
222
  <script src="prettify.js"></script>
223
223
  <script>
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1697801099879" clover="3.2.0">
3
- <project timestamp="1697801099879" name="All files">
2
+ <coverage generated="1697801503272" clover="3.2.0">
3
+ <project timestamp="1697801503273" name="All files">
4
4
  <metrics statements="542" coveredstatements="529" conditionals="80" coveredconditionals="63" methods="43" coveredmethods="43" elements="665" coveredelements="635" complexity="0" loc="542" ncloc="542" packages="1" files="4" classes="4"/>
5
5
  <file name="DomUtilities.ts" path="/home/runner/work/nanosplash/nanosplash/src/ts/core/DomUtilities.ts">
6
6
  <metrics statements="161" coveredstatements="156" conditionals="23" coveredconditionals="18" methods="10" coveredmethods="10"/>
@@ -146,7 +146,7 @@
146
146
  <div class='footer quiet pad2 space-top1 center small'>
147
147
  Code coverage generated by
148
148
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
149
- at 2023-10-20T11:24:59.864Z
149
+ at 2023-10-20T11:31:43.251Z
150
150
  </div>
151
151
  <script src="prettify.js"></script>
152
152
  <script>
package/dist/cjs/ns.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var v=(s,e,t)=>e in s?m(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>(v(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y="3.0.2",a=class a{constructor(){r(this,"id");r(this,"element");this.element=w(),this.element.id=this.id=a.generateGUID()}static generateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}getId(){return this.id}getElement(){return this.element}getTextElement(){var e,t;return((t=(e=this.getElement())==null?void 0:e.firstElementChild)==null?void 0:t.firstElementChild)??null}setText(e){return this.getTextElement().innerText=e,e.length>0?this.showText():this.hideText(),this}showText(){return S(this.getTextElement()),this}hideText(){return I(this.getTextElement()),this}delete(){return this.id=null,this.element!==null&&(this.element.innerHTML="",this.element.remove(),this.element=null),this.element===null}};r(a,"NSClass","ns"),r(a,"NSHostClass","nsh");let o=a;function x(s){return(e=>(()=>e.firstChild)(e.innerHTML=s))(document.createElement("div"))}function w(){return x('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>')}function b(s,e){e.children.length>0?e.insertBefore(s,e.children.item(0)):e.append(s)}function p(s){s==null||s.classList.add(o.NSHostClass)}function g(s){s==null||s.classList.remove(o.NSHostClass)}function S(s){s.style.display="flex"}function I(s){s.style.display="none"}function h(s){switch(typeof s){case"object":const e=s===document.body,t=s instanceof Element;if(e||t)return s;throw new Error("Reference is an object but not an Element instance.");case"string":return document.querySelector(s);default:throw new Error("Reference is not an object or a string.")}}function k(s,e){g(s.parentElement),p(e),b(s,e)}function f(s){const e=Array.from(s.children||[]),t=c.getInstance();let n=null;const d=e.length;for(let l=0;l<d;l++){const u=e[l];if(u.classList.contains(o.NSClass)){n=t.nsQueue.get(u.id)??null;break}}return n}const T=`.ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
1
+ "use strict";var m=Object.defineProperty;var v=(s,e,t)=>e in s?m(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>(v(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y="3.0.4",a=class a{constructor(){r(this,"id");r(this,"element");this.element=w(),this.element.id=this.id=a.generateGUID()}static generateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}getId(){return this.id}getElement(){return this.element}getTextElement(){var e,t;return((t=(e=this.getElement())==null?void 0:e.firstElementChild)==null?void 0:t.firstElementChild)??null}setText(e){return this.getTextElement().innerText=e,e.length>0?this.showText():this.hideText(),this}showText(){return S(this.getTextElement()),this}hideText(){return I(this.getTextElement()),this}delete(){return this.id=null,this.element!==null&&(this.element.innerHTML="",this.element.remove(),this.element=null),this.element===null}};r(a,"NSClass","ns"),r(a,"NSHostClass","nsh");let o=a;function x(s){return(e=>(()=>e.firstChild)(e.innerHTML=s))(document.createElement("div"))}function w(){return x('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>')}function b(s,e){e.children.length>0?e.insertBefore(s,e.children.item(0)):e.append(s)}function p(s){s==null||s.classList.add(o.NSHostClass)}function g(s){s==null||s.classList.remove(o.NSHostClass)}function S(s){s.style.display="flex"}function I(s){s.style.display="none"}function h(s){switch(typeof s){case"object":const e=s===document.body,t=s instanceof Element;if(e||t)return s;throw new Error("Reference is an object but not an Element instance.");case"string":return document.querySelector(s);default:throw new Error("Reference is not an object or a string.")}}function k(s,e){g(s.parentElement),p(e),b(s,e)}function f(s){const e=Array.from(s.children||[]),t=c.getInstance();let n=null;const d=e.length;for(let l=0;l<d;l++){const u=e[l];if(u.classList.contains(o.NSClass)){n=t.nsQueue.get(u.id)??null;break}}return n}const T=`.ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
2
2
  `;class E{constructor(){r(this,"queue");this.queue=[]}enqueue(e){return this.queue.push(e),this}dequeue(){return this.queue.shift()}get(e){return this.queue.find(t=>t.getId()===e)}delete(e){const t=this.queue.findIndex(n=>n.getId()===e);if(t!==-1)return this.queue.splice(t,1)[0]}}const i=class i{constructor(){r(this,"version");r(this,"nsQueue");this.version=y,this.nsQueue=new E,i.addStyle()}static addStyle(){const e=x(`<style>${T}</style>`);document.body.append(e)}static getInstance(){return i.instance||(i.instance=new i),i.instance}static assignToWindow(){Object.defineProperty(window,i.WindowAccessorKey,{value:i.getInstance(),writable:!1})}static start(){window[i.WindowAccessorKey]||i.assignToWindow()}createNS(e){const t=new o().setText(e||"");return this.nsQueue.enqueue(t),t}cleanAndRemoveFromDOM(e){var t;return e?(g(((t=e.getElement())==null?void 0:t.parentElement)??null),e.delete()):!1}deleteNS(e){return this.cleanAndRemoveFromDOM(this.nsQueue.delete(e)??null)}show(e){return this.showInside(document.body,e)}showInside(e,t){try{const n=h(e),d=f(n)??this.createNS();k(d.getElement(),n);const l=t?String(t):"";return d.setText(l).getId()}catch(n){return console.error(n),null}}hide(){const e=this.nsQueue.dequeue();return e?(this.cleanAndRemoveFromDOM(e),e.getId()):null}hideAll(){let e=this.nsQueue.dequeue();for(;e;)this.cleanAndRemoveFromDOM(e),e=this.nsQueue.dequeue()}hideId(e){return this.deleteNS(e)?e:null}hideInside(e){try{const t=f(h(e)),n=(t==null?void 0:t.getId())??"";return this.deleteNS(n??"")?n:null}catch(t){return console.error(t),null}}};r(i,"WindowAccessorKey","ns"),r(i,"instance");let c=i;const z={Service:c};exports.Service=c;exports.default=z;
package/dist/es/ns.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var m = Object.defineProperty;
2
2
  var v = (s, e, t) => e in s ? m(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var r = (s, e, t) => (v(s, typeof e != "symbol" ? e + "" : e, t), t);
4
- const y = "3.0.2", a = class a {
4
+ const y = "3.0.4", a = class a {
5
5
  /**
6
6
  * # Constructor
7
7
  * Creates a new Nanosplash instance.
@@ -1,2 +1,2 @@
1
- var E=Object.defineProperty;var T=(l,s,a)=>s in l?E(l,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[s]=a;var o=(l,s,a)=>(T(l,typeof s!="symbol"?s+"":s,a),a);(function(){"use strict";const l="3.0.2",c=class c{constructor(){o(this,"id");o(this,"element");this.element=v(),this.element.id=this.id=c.generateGUID()}static generateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)})}getId(){return this.id}getElement(){return this.element}getTextElement(){var e,n;return((n=(e=this.getElement())==null?void 0:e.firstElementChild)==null?void 0:n.firstElementChild)??null}setText(e){return this.getTextElement().innerText=e,e.length>0?this.showText():this.hideText(),this}showText(){return b(this.getTextElement()),this}hideText(){return p(this.getTextElement()),this}delete(){return this.id=null,this.element!==null&&(this.element.innerHTML="",this.element.remove(),this.element=null),this.element===null}};o(c,"NSClass","ns"),o(c,"NSHostClass","nsh");let s=c;function a(t){return(e=>(()=>e.firstChild)(e.innerHTML=t))(document.createElement("div"))}function v(){return a('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>')}function y(t,e){e.children.length>0?e.insertBefore(t,e.children.item(0)):e.append(t)}function w(t){t==null||t.classList.add(s.NSHostClass)}function f(t){t==null||t.classList.remove(s.NSHostClass)}function b(t){t.style.display="flex"}function p(t){t.style.display="none"}function x(t){switch(typeof t){case"object":const e=t===document.body,n=t instanceof Element;if(e||n)return t;throw new Error("Reference is an object but not an Element instance.");case"string":return document.querySelector(t);default:throw new Error("Reference is not an object or a string.")}}function I(t,e){f(t.parentElement),w(e),y(t,e)}function g(t){const e=Array.from(t.children||[]),n=u.getInstance();let r=null;const h=e.length;for(let d=0;d<h;d++){const m=e[d];if(m.classList.contains(s.NSClass)){r=n.nsQueue.get(m.id)??null;break}}return r}const k=`.ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
1
+ var E=Object.defineProperty;var T=(l,s,a)=>s in l?E(l,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[s]=a;var o=(l,s,a)=>(T(l,typeof s!="symbol"?s+"":s,a),a);(function(){"use strict";const l="3.0.4",c=class c{constructor(){o(this,"id");o(this,"element");this.element=v(),this.element.id=this.id=c.generateGUID()}static generateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)})}getId(){return this.id}getElement(){return this.element}getTextElement(){var e,n;return((n=(e=this.getElement())==null?void 0:e.firstElementChild)==null?void 0:n.firstElementChild)??null}setText(e){return this.getTextElement().innerText=e,e.length>0?this.showText():this.hideText(),this}showText(){return b(this.getTextElement()),this}hideText(){return p(this.getTextElement()),this}delete(){return this.id=null,this.element!==null&&(this.element.innerHTML="",this.element.remove(),this.element=null),this.element===null}};o(c,"NSClass","ns"),o(c,"NSHostClass","nsh");let s=c;function a(t){return(e=>(()=>e.firstChild)(e.innerHTML=t))(document.createElement("div"))}function v(){return a('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>')}function y(t,e){e.children.length>0?e.insertBefore(t,e.children.item(0)):e.append(t)}function w(t){t==null||t.classList.add(s.NSHostClass)}function f(t){t==null||t.classList.remove(s.NSHostClass)}function b(t){t.style.display="flex"}function p(t){t.style.display="none"}function x(t){switch(typeof t){case"object":const e=t===document.body,n=t instanceof Element;if(e||n)return t;throw new Error("Reference is an object but not an Element instance.");case"string":return document.querySelector(t);default:throw new Error("Reference is not an object or a string.")}}function I(t,e){f(t.parentElement),w(e),y(t,e)}function g(t){const e=Array.from(t.children||[]),n=u.getInstance();let r=null;const h=e.length;for(let d=0;d<h;d++){const m=e[d];if(m.classList.contains(s.NSClass)){r=n.nsQueue.get(m.id)??null;break}}return r}const k=`.ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
2
2
  `;class S{constructor(){o(this,"queue");this.queue=[]}enqueue(e){return this.queue.push(e),this}dequeue(){return this.queue.shift()}get(e){return this.queue.find(n=>n.getId()===e)}delete(e){const n=this.queue.findIndex(r=>r.getId()===e);if(n!==-1)return this.queue.splice(n,1)[0]}}const i=class i{constructor(){o(this,"version");o(this,"nsQueue");this.version=l,this.nsQueue=new S,i.addStyle()}static addStyle(){const e=a(`<style>${k}</style>`);document.body.append(e)}static getInstance(){return i.instance||(i.instance=new i),i.instance}static assignToWindow(){Object.defineProperty(window,i.WindowAccessorKey,{value:i.getInstance(),writable:!1})}static start(){window[i.WindowAccessorKey]||i.assignToWindow()}createNS(e){const n=new s().setText(e||"");return this.nsQueue.enqueue(n),n}cleanAndRemoveFromDOM(e){var n;return e?(f(((n=e.getElement())==null?void 0:n.parentElement)??null),e.delete()):!1}deleteNS(e){return this.cleanAndRemoveFromDOM(this.nsQueue.delete(e)??null)}show(e){return this.showInside(document.body,e)}showInside(e,n){try{const r=x(e),h=g(r)??this.createNS();I(h.getElement(),r);const d=n?String(n):"";return h.setText(d).getId()}catch(r){return console.error(r),null}}hide(){const e=this.nsQueue.dequeue();return e?(this.cleanAndRemoveFromDOM(e),e.getId()):null}hideAll(){let e=this.nsQueue.dequeue();for(;e;)this.cleanAndRemoveFromDOM(e),e=this.nsQueue.dequeue()}hideId(e){return this.deleteNS(e)?e:null}hideInside(e){try{const n=g(x(e)),r=(n==null?void 0:n.getId())??"";return this.deleteNS(r??"")?r:null}catch(n){return console.error(n),null}}};o(i,"WindowAccessorKey","ns"),o(i,"instance");let u=i;try{u.start()}catch(t){console.warn(t)}})();
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import { version } from '../../../package.json'
2
3
  import Card from '../../.vitepress/theme/vue/Card.vue'
3
4
  </script>
4
5
 
@@ -8,14 +9,14 @@ Nanosplash can be installed either via CDN or NPM. Installing via CDN is easier
8
9
 
9
10
  ## CSS
10
11
 
11
- Since version 3.0.3, CSS is included inside the JS bundle. 🎉
12
+ Since version {{ version }}, CSS is included inside the JS bundle. 🎉
12
13
 
13
14
  ## Install via CDN
14
15
 
15
16
  Add the following script tag to the `<head>` of your HTML document:
16
17
 
17
18
  ```html
18
- <script src="https://unpkg.com/nanosplash@3.0.3/dist/iife/ns.iife.js"></script>
19
+ <script src="https://unpkg.com/nanosplash/dist/iife/ns.iife.js"></script>
19
20
  ```
20
21
 
21
22
  ```html{5}
@@ -23,7 +24,7 @@ Add the following script tag to the `<head>` of your HTML document:
23
24
  <head>
24
25
  <meta charset="UTF-8" />
25
26
  <title>My awesome application 🚀</title>
26
- <script src="https://unpkg.com/nanosplash@3.0.3/dist/iife/ns.iife.js"></script>
27
+ <script src="https://unpkg.com/nanosplash/dist/iife/ns.iife.js"></script>
27
28
  </head>
28
29
  ...
29
30
  </html>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "nanosplash",
3
3
  "description": "The tiny loading screen for web artisans",
4
4
  "private": false,
5
- "version": "3.0.3",
5
+ "version": "3.0.5",
6
6
  "type": "module",
7
7
  "author": {
8
8
  "name": "Isak K. Hauge",