nanosplash 2.3.3 → 2.5.1

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.
Files changed (40) hide show
  1. package/.github/workflows/production.yml +5 -2
  2. package/README.md +38 -42
  3. package/dist/iife/nanosplash.iife.js +1 -1
  4. package/dist/module/manifest.json +1 -4
  5. package/dist/module/nanosplash.cjs.js +1 -1
  6. package/dist/module/nanosplash.es.js +132 -74
  7. package/dist/module/style.css +1 -0
  8. package/docs/index.html +73 -19
  9. package/docs/nanosplash.iife.js +6 -1
  10. package/docs/style.css +1 -1
  11. package/docs/typedoc/assets/main.js +2 -2
  12. package/docs/typedoc/assets/search.js +1 -1
  13. package/docs/typedoc/classes/Core_Nanosplash.default.html +133 -0
  14. package/docs/typedoc/index.html +1 -1
  15. package/docs/typedoc/modules/Core_Nanosplash.html +1 -0
  16. package/docs/typedoc/modules/types.html +1 -0
  17. package/index.html +72 -22
  18. package/package.json +16 -15
  19. package/src/Core/Nanosplash.ts +188 -31
  20. package/src/Core/SplashInstance.ts +137 -21
  21. package/src/Exceptions/DestinationException.ts +13 -0
  22. package/src/Exceptions/Exception.ts +9 -0
  23. package/src/Exceptions/IllegalArgumentException.ts +11 -0
  24. package/src/Factory/NanosplashFactory.ts +37 -17
  25. package/src/Interfaces/NanosplashInterface.ts +6 -2
  26. package/src/Repositories/NanosplashRepository.ts +82 -0
  27. package/src/{utilities → Tests}/dom.spec.ts +7 -5
  28. package/src/Utilities/dom.ts +49 -0
  29. package/src/main.ts +5 -2
  30. package/src/style.sass +47 -17
  31. package/src/types.d.ts +23 -14
  32. package/tsconfig.json +1 -0
  33. package/update-all.sh +2 -2
  34. package/vite.config.ts +16 -0
  35. package/vite.mod.config.js +10 -11
  36. package/dist/module/Nanosplash.css +0 -1
  37. package/jest.config.ts +0 -194
  38. package/src/Interfaces/ImageInterface.ts +0 -5
  39. package/src/repositories/NanosplashRepository.ts +0 -39
  40. package/src/utilities/dom.ts +0 -26
@@ -24,10 +24,13 @@ jobs:
24
24
  - uses: actions/checkout@v2
25
25
  with:
26
26
  fetch-depth: 0
27
-
27
+
28
28
  # Checkout branch
29
29
  - name: Checkout
30
- run: git checkout production
30
+ run: |
31
+ git checkout production
32
+ git fetch
33
+ git pull origin
31
34
 
32
35
  - name: Install npm packages
33
36
  run: yarn install
package/README.md CHANGED
@@ -12,33 +12,26 @@
12
12
 
13
13
  <strong>The simple, tiny loading screen</strong>
14
14
 
15
- > <em>No dependencies, pure JS</em>
16
-
17
- # Installation
15
+ # Getting started
18
16
 
19
- ## Yarn
17
+ ## Import via CDN (recommended)
20
18
 
21
- ```bash
22
- yarn add nanosplash
19
+ ```html
20
+ <script src="https://unpkg.com/nanosplash/dist/iife/nanosplash.iife.js"></script>
23
21
  ```
24
-
25
- ## NPM
26
-
27
- ```bash
28
- npm install nanosplash
22
+ ```js
23
+ // Install Nanosplash in the browser
24
+ window.installNanosplash()
25
+ // Display your first Nanosplash
26
+ window.ns.show('Hello world')
29
27
  ```
30
28
 
31
- # Import
32
-
33
- ## Import via CDN (recommended)
34
-
35
- When you import the IIFE script there is no need to invoke the `install` function.
36
-
37
- ```html
38
- <script src="https://unpkg.com/nanosplash/dist/iife/nanosplash.iife.js">
29
+ ## Install (advanced)
30
+ ```bash
31
+ yarn add nanosplash
39
32
  ```
40
33
 
41
- ## Modules
34
+ ### Modules
42
35
 
43
36
  When including either ES or CJS modules, you need the CSS in the dist folder, whereas in the IIFE variant, everything is included. If you are using a modern bundler e.g Vite, NextJS, NuxtJS, you can import the CSS directly into your code.
44
37
 
@@ -51,29 +44,34 @@ import 'nanosplash/dist/module/style.css'
51
44
  > Full: `node_modules/nanosplash/dist/module/style.css`<br>
52
45
  > Relative: `nanosplash/dist/module/style.css`
53
46
 
54
- ### ESM (ES modules)
47
+ #### ESM (ES modules)
55
48
 
56
49
  ```js
57
50
  import { Nanosplash } from 'nanosplash'
58
51
  ```
59
52
 
60
- ### CJS (CommonJS)
53
+ #### CJS (CommonJS)
61
54
 
62
55
  ```js
63
56
  const Nanosplash = require('nanosplash')
64
57
  ```
65
58
 
66
- # Getting started
67
-
68
- ## Inject Nanosplash into global scope
69
-
70
- > When imported through the CDN, the instance is already injected into the `Window` object and accessible through the global variable `loading`.
71
-
72
- If you are importing Nanosplash through modules, invoking the `install` function is essential in order to make it react to changes in the browser.
73
-
59
+ ### Inject Nanosplash into global scope
60
+ #### Using CDN
61
+ ```js
62
+ const nsOptions = {
63
+ spinner: true,
64
+ fontSize: '18px',
65
+ }
66
+ window.installNanosplash(nsOptions)
67
+ ```
68
+ #### Using modules
74
69
  ```js
75
- const ns = new Nanosplash()
76
- window.ns = ns
70
+ const nsOptions = {
71
+ spinner: true,
72
+ fontSize: '18px',
73
+ }
74
+ window.ns = new Nanosplash(nsOptions)
77
75
  ```
78
76
 
79
77
  ## Basic usage
@@ -81,7 +79,7 @@ window.ns = ns
81
79
  ### Display the loading screen
82
80
 
83
81
  ```js
84
- ns.show('Loading the good stuff ...')
82
+ ns.show('Loading the good stuff')
85
83
  ```
86
84
 
87
85
  ### Hide the loading screen
@@ -100,26 +98,24 @@ ns.hideAll()
100
98
 
101
99
  ```js
102
100
  // Use CSS selector string
103
- ns.show('Loading component ...').inside('#my-element')
101
+ ns.show('Loading component').inside('#my-element')
104
102
 
105
103
  // Use HTMLElement objects directly
106
- ns
107
- .show('Loading component ...')
108
- .inside(document.getElementById('my-element'))
104
+ ns.show('Loading component').inside(document.getElementById('my-element'))
109
105
  ```
110
106
 
111
107
  ### Combine Nanosplash with async tasks
112
108
 
113
109
  ```js
114
- const task1 = new Promise(r => setTimeout(() => r(), 3000))
110
+ const task1 = new Promise(r => setTimeout(r, 3000))
115
111
  const task2 = async () => await getDataFromApi()
116
112
 
117
- ns.while(task1).show('Loading resources ...')
118
- ns.while(task2).show('Fetching table data ...').inside('#my-table')
113
+ ns.while(task1).show('Loading resources')
114
+ ns.while(task2).show('Fetching table data').inside('#my-table')
119
115
 
120
116
  ns.progress(
121
- [task1, 'Loading data from API ...'],
122
- [task2, 'Processing data ...']
117
+ [task1, 'Loading data from API'],
118
+ [task2, 'Processing data']
123
119
  ).inside('#my-table')
124
120
  ```
125
121
 
@@ -1 +1 @@
1
- var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,h=(e,i,s)=>i in e?t(e,i,{t:!0,i:!0,writable:!0,value:s}):e[i]=s,o=document.createElement("style");o.innerHTML='@charset "UTF-8";.ns-blur,body .ns-fs~*{filter:blur(5px);overflow:hidden}.ns-wrapper{position:relative}.ns-fs{left:0;min-height:100vh;min-width:100%;position:fixed;top:0;z-index:2}.ns-window{align-items:center;background-color:#fffc;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%;z-index:1}.ns-img{margin-bottom:1rem;max-height:9rem;max-width:9rem}.ns-text{color:#333;display:flex;text-align:center}.ns-text:after{-webkit-animation:anim 1s infinite;animation:anim 1s infinite;content:"\\a0\\a0\\a0";margin-left:.25em}@-webkit-keyframes anim{0%{content:"\\a0\\a0\\a0"}30%{content:".\\a0\\a0"}60%{content:"..\\a0"}90%{content:"..."}}@keyframes anim{0%{content:"\\a0\\a0\\a0"}30%{content:".\\a0\\a0"}60%{content:"..\\a0"}90%{content:"..."}}\n',document.head.appendChild(o),function(){const t=t=>document.createElement(t);function o(t,...e){t.classList.add(...e)}function a(t,e,i){t.setAttribute(e,i)}class c{static h(t){if("string"==typeof t){const i=(e=t,document.querySelector(e));if(!i)throw new Error(`No match with ${t}`);return i}if(t instanceof Node)return t;var e;throw new Error("Destination argument must string or Node")}static o(t){const o={getId:()=>t.getId(),remove:()=>t.delete(),moveTo:e=>t.moveTo(e),getText:()=>t.getText(),setText:e=>t.setText(e),getImgSrc:()=>t.getImgSrc(),setImgSrc:e=>t.setImgSrc(e)};return a=((t,e)=>{for(var i in e||(e={}))n.call(e,i)&&h(t,i,e[i]);if(s)for(var i of s(e))r.call(e,i)&&h(t,i,e[i]);return t})({},o),e(a,i({inside:e=>(t.moveTo(e),o)}));var a}}class l{constructor(e,i,s){var n;this.l=t("div"),this.u=t("div"),this.m=t("div"),this.g=t("div"),this.p=t("div"),this.v=t("img"),this.id=Math.random().toString(36).substring(2),this.S=e,this.u.innerText=i,this.I=s,this.v.src=null!=(n=this.I)?n:"",this.v.alt=m.O,this.j(),this.setImgSrc(s)}F(){o(this.p,"ns-container"),o(this.g,"ns-blur"),o(this.v,"ns-img"),o(this.u,"ns-text"),o(this.m,"ns","ns-window"),o(this.l,"ns-wrapper")}N(){this.p.append(this.v,this.u),this.m.append(this.p),this.l.append(this.g,this.m)}j(){this.l.id=this.getId(),a(this.l,"data-ctx","nanosplash"),this.N(),this.F()}getId(){return this.id}getText(){return this.u.innerText}setText(t){return this.u.innerText=t,this}getImgSrc(){return this.I}setImgSrc(t){return this.v.src=null!=t?t:"",this.v.style.display=t?"block":"none",this.N(),this}T(){return this.k}A(){const t=this.l.parentElement;t&&this.D(t)}C(){a(this.l,"style",""),this.l.classList.remove("ns-fs")}W(t){const e=t.parentNode;e&&(this.D(e),e.replaceChild(this.l,t),this.g.appendChild(t))}M(){this.l.classList.add("ns-fs"),((t,e,i=!1)=>{t&&e&&(e.hasChildNodes()&&i?e.insertBefore(t,e.firstChild):e.appendChild(t))})(this.l,document.body,!0)}R(t){this.S.$(t).filter((t=>t.getId()!==this.getId())).forEach((t=>t.delete()))}moveTo(t){this.A(),this.k=c.h(t),this.R(this.k),this.k===document.body?this.M():(this.C(),this.W(this.k)),this.j()}H(t){Array.from(this.g.childNodes).forEach(t)}D(t){this.H((e=>t.insertBefore(e,this.l)))}P(){[this.u,this.v,this.p,this.g,this.m,this.l].forEach((t=>t.remove()))}delete(){this.A(),this.P(),this.S.delete(this)}}class u{static U(t,e,i,s){var n;return t||(t=new l(e,i,s)),t.setText(i).setImgSrc(null!=(n=t.getImgSrc())?n:s)}static q(t,e){return i=>(e=u.U(e,t,"",i),{show:u.B(t,e),progress:u.G(t,e),while:u.J(t,e)})}static B(t,e){return i=>(e=u.U(e,t,i),t.K.set(e.getId(),e),e.moveTo(document.body),c.o(e))}static G(t,e){return(...i)=>((e=u.U(e,t,"")).moveTo(document.body),(async()=>{for(const[t,[s,n]]of i.entries())e.setText(n),await s;e.delete()})(),c.o(e))}static J(t,e){return i=>(e=u.U(e,t,""),{show:s=>(t.K.set(e.getId(),e),e.moveTo(document.body),e.setText(s),i.finally((()=>e.delete())),c.o(e))})}}class m{constructor(){this.K=new Map}img(t){return u.q(this,new l(this,"",t))(t)}show(t){return u.B(this,new l(this,t))(t)}progress(...t){return u.G(this,new l(this,""))(...t)}while(t){return u.J(this,new l(this,""))(t)}L(t){let e=0;const i=this.K.entries();for(const[s,n]of i)if(!t(s,n,e++))break}delete(t){this.K.delete(t.getId())}hideAll(){this.K.forEach((t=>t.delete()))}hide(t){if(t){const e=this.K.get(t);if(!e)throw new Error(`Could not find element with id: ${t}`);e.delete()}else this.L(((t,e,i)=>{const s=0===i;return s&&e.delete(),s}))}$(t){return Array.from(this.K.values()).filter((e=>e.T()===t))}}m.O="Nanosplash",window.addEventListener("load",(()=>window.ns=new m))}();
1
+ var t=document.createElement("style");t.innerHTML=".ns-blur,body .ns-fs~*{filter:blur(5px);overflow:hidden}.ns-wrapper{position:relative}.ns-fs{left:0;min-height:100vh;min-width:100%;position:fixed;top:0;z-index:2}.ns-window{align-items:center;background-color:#fffc;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%;z-index:1}.ns-img{margin-bottom:2em;max-height:9rem;width:9rem}.ns-text-container{align-items:center}.ns-text,.ns-text-container{display:flex;justify-content:center}.ns-text{color:#5a6685}.ns-spinner{display:flex;height:1em;margin-left:1em;width:1em}.ns-spinner>svg{stroke-width:8;-webkit-animation:Rotate 2s linear infinite;animation:Rotate 2s linear infinite;height:inherit;position:relative;width:inherit}.ns-spinner .path{stroke:#5a6685;stroke-linecap:round;-webkit-animation:Dash 1.5s ease-in-out infinite;animation:Dash 1.5s ease-in-out infinite}@-webkit-keyframes Rotate{to{transform:rotate(1turn)}}@keyframes Rotate{to{transform:rotate(1turn)}}@-webkit-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}}@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}}\n",document.head.appendChild(t),function(){function t(t){return document.querySelector(t)}const s=t=>document.createElement(t);function e(t,...s){t.classList.add(...s)}function i(t,s,e){t.setAttribute(s,e)}class n extends Error{constructor(t,s){super(t),this.name=this.constructor.name,this.t=s}}class r extends n{constructor(t,s,e){super(t),this.destination=s,this.t=e}}class h extends n{constructor(t,s){super(t),this.i=s}}class o{static h(s){if("string"==typeof s)try{const e=t(s);if(!e)throw new n(`No DOM match with ${s}`);return e}catch(t){throw new r(`Destination (${s}) is either invalid or non-existing in DOM`,s,t)}else if(s instanceof Node)return s;throw new h(`Destination (${s}) must be either a Node or a CSS selector`,s)}static o(t){const s={getId:()=>t.getId(),remove:()=>t.delete(),moveTo:s=>t.moveTo(s),getText:()=>t.getText(),setText:s=>t.setText(s),getImgSrc:()=>t.getImgSrc(),setImgSrc:s=>t.setImgSrc(s)};return{...s,inside:e=>(t.moveTo(e),s)}}static l(){const t=s("div");return e(t,"ns-spinner"),t.innerHTML='\n <svg viewBox="0 0 50 50">\n <circle class="path" cx="25" cy="25" r="20" fill="none"></circle>\n </svg>\n ',t}}class a{constructor(t,e,i){var n;this.u=s("div"),this.m=s("div"),this.g=s("div"),this.p=o.l(),this.v=s("div"),this.k=s("div"),this.S=s("div"),this.D=s("img"),this.id=Math.random().toString(36).substring(2),this.I=t,this.m.innerText=e,this.N=i,this.D.src=null!=(n=this.N)?n:"",this.D.alt=u.F,this.u.style.fontSize=t.A(),this.p.style.display=t.T()?"flex":"none",this.M(),this.setImgSrc(i)}R(){e(this.S,"ns-container"),e(this.k,"ns-blur"),e(this.D,"ns-img"),e(this.m,"ns-text"),e(this.g,"ns-text-container"),e(this.p,"ns-spinner"),e(this.v,"ns","ns-window"),e(this.u,"ns-wrapper")}C(){this.g.append(this.m,this.p),this.S.append(this.D,this.g),this.v.append(this.S),this.u.append(this.k,this.v)}M(){this.u.id=this.getId(),i(this.u,"data-ctx","nanosplash"),this.C(),this.R()}getId(){return this.id}getText(){return this.m.innerText}setText(t){return this.m.innerText=t,this}getImgSrc(){return this.N}setImgSrc(t){return this.D.src=null!=t?t:"",this.D.style.display=t?"block":"none",this.C(),this}O(){return this.W}j(){const t=this.u.parentElement;t&&this.$(t)}B(){i(this.u,"style",""),this.u.classList.remove("ns-fs")}H(t){const s=t.parentNode;s&&(this.$(s),s.replaceChild(this.u,t),this.k.appendChild(t))}P(){this.u.classList.add("ns-fs"),((t,s,e=!1)=>{t&&s&&(s.hasChildNodes()&&e?s.insertBefore(t,s.firstChild):s.appendChild(t))})(this.u,document.body,!0)}V(t){this.I.q(t).filter((t=>t.getId()!==this.getId())).forEach((t=>t.delete()))}moveTo(t){try{this.j(),this.W=o.h(t),this.V(this.W),this.W===document.body?this.P():(this.B(),this.H(this.W)),this.M()}catch(t){console.warn(t)}}G(t){Array.from(this.k.childNodes).forEach(t)}$(t){this.G((s=>t.insertBefore(s,this.u)))}J(){[this.m,this.p,this.g,this.D,this.S,this.k,this.v,this.u].forEach((t=>t.remove()))}delete(){this.j(),this.J(),this.I.delete(this)}}class c{static K(t,s,e,i){var n;return t||(t=new a(s,e,i)),t.setText(e).setImgSrc(null!=(n=t.getImgSrc())?n:i)}static L(t,s){return e=>(s=c.K(s,t,e),t.U.set(s.getId(),s),s.moveTo(document.body),o.o(s))}static X(t,s){return(...e)=>((s=c.K(s,t,"")).moveTo(document.body),(async()=>{for(const[t,[i,n]]of e.entries())s.setText(n),await i;s.delete()})(),o.o(s))}static Y(t,s){return e=>(s=c.K(s,t,""),{show:i=>(t.U.set(s.getId(),s),s.moveTo(document.body),s.setText(i),e.finally((()=>s.delete())),o.o(s))})}}const l=class{constructor(t){var s;this.N=null==t?void 0:t.N,this.Z=void 0===(null==t?void 0:t.Z)?l._:t.Z,this.fontSize=null!=(s=null==t?void 0:t.fontSize)?s:"18px",this.U=new Map}setImgSrc(t){return this.N=t,this}tt(t){return this.Z=t,this}st(t){return this.fontSize=t,this}getImgSrc(){return this.N}T(){return this.Z}A(){return this.fontSize}show(t){return c.L(this,new a(this,t,this.N))(t)}progress(...t){return c.X(this,new a(this,"",this.N))(...t)}while(t){return c.Y(this,new a(this,"",this.N))(t)}et(t){const s=this.U.size,e=Array.from(this.U.values());for(let i=s-1;i>=0;i--){const s=e[i];if(!t(s.getId(),s,i))break}}delete(t){this.U.delete(t.getId())}hideAll(){this.U.forEach((t=>t.delete()))}hide(s){if(s){const e=s instanceof Node,i=t=>{Array.from(this.U.values()).filter((s=>s.O()===t)).forEach((t=>t.delete()))};if("string"==typeof s){const e=this.U.get(s);if(e)e.delete();else{const e=t(s);e&&i(e)}}else e&&i(s)}else{const t=this.U.size;this.et(((s,e,i)=>{const n=i===t-1;return n&&e.delete(),n}))}}q(t){return Array.from(this.U.values()).filter((s=>s.O()===t))}};let u=l;u.F="Nanosplash",u._=!0,window.addEventListener("load",(()=>{window.Nanosplash=u,window.ns=new u}))}();
@@ -2,9 +2,6 @@
2
2
  "src/Core/Nanosplash.ts": {
3
3
  "file": "nanosplash.cjs.js",
4
4
  "src": "src/Core/Nanosplash.ts",
5
- "isEntry": true,
6
- "css": [
7
- "Nanosplash.css"
8
- ]
5
+ "isEntry": true
9
6
  }
10
7
  }
@@ -1 +1 @@
1
- var t=Object.defineProperty,s=Object.defineProperties,e=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,h=(s,e,i)=>e in s?t(s,e,{t:!0,i:!0,writable:!0,value:i}):s[e]=i;Object.defineProperties(exports,{h:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=t=>document.createElement(t);function a(t,...s){t.classList.add(...s)}function c(t,s,e){t.setAttribute(s,e)}class u{static o(t){if("string"==typeof t){const e=(s=t,document.querySelector(s));if(!e)throw new Error(`No match with ${t}`);return e}if(t instanceof Node)return t;var s;throw new Error("Destination argument must string or Node")}static u(t){const o={getId:()=>t.getId(),remove:()=>t.delete(),moveTo:s=>t.moveTo(s),getText:()=>t.getText(),setText:s=>t.setText(s),getImgSrc:()=>t.getImgSrc(),setImgSrc:s=>t.setImgSrc(s)};return a=((t,s)=>{for(var e in s||(s={}))r.call(s,e)&&h(t,e,s[e]);if(i)for(var e of i(s))n.call(s,e)&&h(t,e,s[e]);return t})({},o),s(a,e({inside:s=>(t.moveTo(s),o)}));var a}}class l{constructor(t,s,e){var i;this.l=o("div"),this.m=o("div"),this.g=o("div"),this.v=o("div"),this.p=o("div"),this.S=o("img"),this.id=Math.random().toString(36).substring(2),this.I=t,this.m.innerText=s,this.O=e,this.S.src=null!=(i=this.O)?i:"",this.S.alt=m.j,this.N(),this.setImgSrc(e)}F(){a(this.p,"ns-container"),a(this.v,"ns-blur"),a(this.S,"ns-img"),a(this.m,"ns-text"),a(this.g,"ns","ns-window"),a(this.l,"ns-wrapper")}T(){this.p.append(this.S,this.m),this.g.append(this.p),this.l.append(this.v,this.g)}N(){this.l.id=this.getId(),c(this.l,"data-ctx","nanosplash"),this.T(),this.F()}getId(){return this.id}getText(){return this.m.innerText}setText(t){return this.m.innerText=t,this}getImgSrc(){return this.O}setImgSrc(t){return this.S.src=null!=t?t:"",this.S.style.display=t?"block":"none",this.T(),this}A(){return this.D}M(){const t=this.l.parentElement;t&&this.C(t)}W(){c(this.l,"style",""),this.l.classList.remove("ns-fs")}k(t){const s=t.parentNode;s&&(this.C(s),s.replaceChild(this.l,t),this.v.appendChild(t))}R(){this.l.classList.add("ns-fs"),((t,s,e=!1)=>{t&&s&&(s.hasChildNodes()&&e?s.insertBefore(t,s.firstChild):s.appendChild(t))})(this.l,document.body,!0)}$(t){this.I._(t).filter((t=>t.getId()!==this.getId())).forEach((t=>t.delete()))}moveTo(t){this.M(),this.D=u.o(t),this.$(this.D),this.D===document.body?this.R():(this.W(),this.k(this.D)),this.N()}H(t){Array.from(this.v.childNodes).forEach(t)}C(t){this.H((s=>t.insertBefore(s,this.l)))}P(){[this.m,this.S,this.p,this.v,this.g,this.l].forEach((t=>t.remove()))}delete(){this.M(),this.P(),this.I.delete(this)}}class d{static q(t,s,e,i){var r;return t||(t=new l(s,e,i)),t.setText(e).setImgSrc(null!=(r=t.getImgSrc())?r:i)}static B(t,s){return e=>(s=d.q(s,t,"",e),{show:d.G(t,s),progress:d.J(t,s),while:d.K(t,s)})}static G(t,s){return e=>(s=d.q(s,t,e),t.L.set(s.getId(),s),s.moveTo(document.body),u.u(s))}static J(t,s){return(...e)=>((s=d.q(s,t,"")).moveTo(document.body),(async()=>{for(const[t,[i,r]]of e.entries())s.setText(r),await i;s.delete()})(),u.u(s))}static K(t,s){return e=>(s=d.q(s,t,""),{show:i=>(t.L.set(s.getId(),s),s.moveTo(document.body),s.setText(i),e.finally((()=>s.delete())),u.u(s))})}}class m{constructor(){this.L=new Map}img(t){return d.B(this,new l(this,"",t))(t)}show(t){return d.G(this,new l(this,t))(t)}progress(...t){return d.J(this,new l(this,""))(...t)}while(t){return d.K(this,new l(this,""))(t)}U(t){let s=0;const e=this.L.entries();for(const[i,r]of e)if(!t(i,r,s++))break}delete(t){this.L.delete(t.getId())}hideAll(){this.L.forEach((t=>t.delete()))}hide(t){if(t){const s=this.L.get(t);if(!s)throw new Error(`Could not find element with id: ${t}`);s.delete()}else this.U(((t,s,e)=>{const i=0===e;return i&&s.delete(),i}))}_(t){return Array.from(this.L.values()).filter((s=>s.A()===t))}}m.j="Nanosplash",exports.Nanosplash=m;
1
+ function t(t){return document.querySelector(t)}const s=t=>document.createElement(t);function i(t,...s){t.classList.add(...s)}function e(t,s,i){t.setAttribute(s,i)}class Exception extends Error{constructor(t,s){super(t),this.name=this.constructor.name,this.t=s}}class DestinationException extends Exception{constructor(t,s,i){super(t),this.destination=s,this.t=i}}class IllegalArgumentException extends Exception{constructor(t,s){super(t),this.i=s}}class NanosplashRepository{static h(s){if("string"==typeof s)try{const i=t(s);if(!i)throw new Exception(`No DOM match with ${s}`);return i}catch(t){throw new DestinationException(`Destination (${s}) is either invalid or non-existing in DOM`,s,t)}else if(s instanceof Node)return s;throw new IllegalArgumentException(`Destination (${s}) must be either a Node or a CSS selector`,s)}static o(t){const s={getId:()=>t.getId(),remove:()=>t.delete(),moveTo:s=>t.moveTo(s),getText:()=>t.getText(),setText:s=>t.setText(s),getImgSrc:()=>t.getImgSrc(),setImgSrc:s=>t.setImgSrc(s)};return{...s,inside:i=>(t.moveTo(i),s)}}static l(){const t=s("div");return i(t,"ns-spinner"),t.innerHTML='\n <svg viewBox="0 0 50 50">\n <circle class="path" cx="25" cy="25" r="20" fill="none"></circle>\n </svg>\n ',t}}class SplashInstance{constructor(t,i,e){var n;this.u=s("div"),this.p=s("div"),this.m=s("div"),this.g=NanosplashRepository.l(),this.S=s("div"),this.v=s("div"),this.N=s("div"),this.I=s("img"),this.id=Math.random().toString(36).substring(2),this.F=t,this.p.innerText=i,this.D=e,this.I.src=null!=(n=this.D)?n:"",this.I.alt=h.A,this.u.style.fontSize=t.getFontSize(),this.g.style.display=t.spinnerIsVisible()?"flex":"none",this.R(),this.setImgSrc(e)}T(){i(this.N,"ns-container"),i(this.v,"ns-blur"),i(this.I,"ns-img"),i(this.p,"ns-text"),i(this.m,"ns-text-container"),i(this.g,"ns-spinner"),i(this.S,"ns","ns-window"),i(this.u,"ns-wrapper")}M(){this.m.append(this.p,this.g),this.N.append(this.I,this.m),this.S.append(this.N),this.u.append(this.v,this.S)}R(){this.u.id=this.getId(),e(this.u,"data-ctx","nanosplash"),this.M(),this.T()}getId(){return this.id}getText(){return this.p.innerText}setText(t){return this.p.innerText=t,this}getImgSrc(){return this.D}setImgSrc(t){return this.I.src=null!=t?t:"",this.I.style.display=t?"block":"none",this.M(),this}getDestination(){return this.C}O(){const t=this.u.parentElement;t&&this.W(t)}$(){e(this.u,"style",""),this.u.classList.remove("ns-fs")}k(t){const s=t.parentNode;s&&(this.W(s),s.replaceChild(this.u,t),this.v.appendChild(t))}j(){this.u.classList.add("ns-fs"),((t,s,i=!1)=>{t&&s&&(s.hasChildNodes()&&i?s.insertBefore(t,s.firstChild):s.appendChild(t))})(this.u,document.body,!0)}B(t){this.F.getFromDestinationNode(t).filter((t=>t.getId()!==this.getId())).forEach((t=>t.delete()))}moveTo(t){try{this.O(),this.C=NanosplashRepository.h(t),this.B(this.C),this.C===document.body?this.j():(this.$(),this.k(this.C)),this.R()}catch(t){console.warn(t)}}H(t){Array.from(this.v.childNodes).forEach(t)}W(t){this.H((s=>t.insertBefore(s,this.u)))}P(){[this.p,this.g,this.m,this.I,this.N,this.v,this.S,this.u].forEach((t=>t.remove()))}delete(){this.O(),this.P(),this.F.delete(this)}}class NanosplashFactory{static V(t,s,i,e){var n;return t||(t=new SplashInstance(s,i,e)),t.setText(i).setImgSrc(null!=(n=t.getImgSrc())?n:e)}static q(t,s){return i=>(s=NanosplashFactory.V(s,t,i),t.G.set(s.getId(),s),s.moveTo(document.body),NanosplashRepository.o(s))}static J(t,s){return(...i)=>((s=NanosplashFactory.V(s,t,"")).moveTo(document.body),(async()=>{for(const[t,[e,n]]of i.entries())s.setText(n),await e;s.delete()})(),NanosplashRepository.o(s))}static K(t,s){return i=>(s=NanosplashFactory.V(s,t,""),{show:e=>(t.G.set(s.getId(),s),s.moveTo(document.body),s.setText(e),i.finally((()=>s.delete())),NanosplashRepository.o(s))})}}const n=class{constructor(t){var s;this.D=null==t?void 0:t.D,this.L=void 0===(null==t?void 0:t.L)?n.U:t.L,this.fontSize=null!=(s=null==t?void 0:t.fontSize)?s:"18px",this.G=new Map}setImgSrc(t){return this.D=t,this}showSpinner(t){return this.L=t,this}setFontSize(t){return this.fontSize=t,this}getImgSrc(){return this.D}spinnerIsVisible(){return this.L}getFontSize(){return this.fontSize}show(t){return NanosplashFactory.q(this,new SplashInstance(this,t,this.D))(t)}progress(...t){return NanosplashFactory.J(this,new SplashInstance(this,"",this.D))(...t)}while(t){return NanosplashFactory.K(this,new SplashInstance(this,"",this.D))(t)}X(t){const s=this.G.size,i=Array.from(this.G.values());for(let e=s-1;e>=0;e--){const s=i[e];if(!t(s.getId(),s,e))break}}delete(t){this.G.delete(t.getId())}hideAll(){this.G.forEach((t=>t.delete()))}hide(s){if(s){const i=s instanceof Node,e=t=>{Array.from(this.G.values()).filter((s=>s.getDestination()===t)).forEach((t=>t.delete()))};if("string"==typeof s){const i=this.G.get(s);if(i)i.delete();else{const i=t(s);i&&e(i)}}else i&&e(s)}else{const t=this.G.size;this.X(((s,i,e)=>{const n=e===t-1;return n&&i.delete(),n}))}}getFromDestinationNode(t){return Array.from(this.G.values()).filter((s=>s.getDestination()===t))}};let h=n;h.A="Nanosplash",h.U=!0,module.exports=h;
@@ -1,23 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var style = "";
1
+ var style = /* @__PURE__ */ (() => ".ns-blur,body .ns-fs~*{filter:blur(5px);overflow:hidden}.ns-wrapper{position:relative}.ns-fs{left:0;min-height:100vh;min-width:100%;position:fixed;top:0;z-index:2}.ns-window{align-items:center;background-color:#fffc;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%;z-index:1}.ns-img{margin-bottom:2em;max-height:9rem;width:9rem}.ns-text-container{align-items:center}.ns-text,.ns-text-container{display:flex;justify-content:center}.ns-text{color:#5a6685}.ns-spinner{display:flex;height:1em;margin-left:1em;width:1em}.ns-spinner>svg{stroke-width:8;-webkit-animation:Rotate 2s linear infinite;animation:Rotate 2s linear infinite;height:inherit;position:relative;width:inherit}.ns-spinner .path{stroke:#5a6685;stroke-linecap:round;-webkit-animation:Dash 1.5s ease-in-out infinite;animation:Dash 1.5s ease-in-out infinite}@-webkit-keyframes Rotate{to{transform:rotate(1turn)}}@keyframes Rotate{to{transform:rotate(1turn)}}@-webkit-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}}@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}}\n")();
21
2
  function get(selector) {
22
3
  return document.querySelector(selector);
23
4
  }
@@ -33,18 +14,42 @@ function addClass(node, ...classes) {
33
14
  function setAttr(node, attribute, value) {
34
15
  node.setAttribute(attribute, value);
35
16
  }
17
+ class Exception extends Error {
18
+ constructor(message, cause) {
19
+ super(message);
20
+ this.name = this.constructor.name;
21
+ this.cause = cause;
22
+ }
23
+ }
24
+ class DestinationException extends Exception {
25
+ constructor(message, destination, cause) {
26
+ super(message);
27
+ this.destination = destination;
28
+ this.cause = cause;
29
+ }
30
+ }
31
+ class IllegalArgumentException extends Exception {
32
+ constructor(message, argument) {
33
+ super(message);
34
+ this.argument = argument;
35
+ }
36
+ }
36
37
  class NanosplashRepository {
37
38
  static destinationToNode(destination) {
38
39
  if (typeof destination === "string") {
39
- const element = get(destination);
40
- if (!element) {
41
- throw new Error(`No match with ${destination}`);
40
+ try {
41
+ const element = get(destination);
42
+ if (!element) {
43
+ throw new Exception(`No DOM match with ${destination}`);
44
+ }
45
+ return element;
46
+ } catch (e) {
47
+ throw new DestinationException(`Destination (${destination}) is either invalid or non-existing in DOM`, destination, e);
42
48
  }
43
- return element;
44
49
  } else if (destination instanceof Node) {
45
50
  return destination;
46
51
  }
47
- throw new Error("Destination argument must string or Node");
52
+ throw new IllegalArgumentException(`Destination (${destination}) must be either a Node or a CSS selector`, destination);
48
53
  }
49
54
  static createContextualApiObject(splash) {
50
55
  const ctx = {
@@ -56,12 +61,23 @@ class NanosplashRepository {
56
61
  getImgSrc: () => splash.getImgSrc(),
57
62
  setImgSrc: (src) => splash.setImgSrc(src)
58
63
  };
59
- return __spreadProps(__spreadValues({}, ctx), {
64
+ return {
65
+ ...ctx,
60
66
  inside: (selector) => {
61
67
  splash.moveTo(selector);
62
68
  return ctx;
63
69
  }
64
- });
70
+ };
71
+ }
72
+ static createNanosplashSpinnerElement() {
73
+ const div = mk("div");
74
+ addClass(div, "ns-spinner");
75
+ div.innerHTML = `
76
+ <svg viewBox="0 0 50 50">
77
+ <circle class="path" cx="25" cy="25" r="20" fill="none"></circle>
78
+ </svg>
79
+ `;
80
+ return div;
65
81
  }
66
82
  }
67
83
  class SplashInstance {
@@ -69,6 +85,8 @@ class SplashInstance {
69
85
  var _a;
70
86
  this.nsRootElement = mk("div");
71
87
  this.nsTextElement = mk("div");
88
+ this.nsTextContainerElement = mk("div");
89
+ this.nsSpinnerElement = NanosplashRepository.createNanosplashSpinnerElement();
72
90
  this.nsWindowElement = mk("div");
73
91
  this.nsWrapperElement = mk("div");
74
92
  this.nsContentElement = mk("div");
@@ -79,6 +97,8 @@ class SplashInstance {
79
97
  this.imgSrc = imgSrc;
80
98
  this.nsImageElement.src = (_a = this.imgSrc) != null ? _a : "";
81
99
  this.nsImageElement.alt = Nanosplash.APP_NAME;
100
+ this.nsRootElement.style.fontSize = ns.getFontSize();
101
+ this.nsSpinnerElement.style.display = ns.spinnerIsVisible() ? "flex" : "none";
82
102
  this.assembleNSComponent();
83
103
  this.setImgSrc(imgSrc);
84
104
  }
@@ -87,11 +107,14 @@ class SplashInstance {
87
107
  addClass(this.nsWrapperElement, "ns-blur");
88
108
  addClass(this.nsImageElement, "ns-img");
89
109
  addClass(this.nsTextElement, "ns-text");
110
+ addClass(this.nsTextContainerElement, "ns-text-container");
111
+ addClass(this.nsSpinnerElement, "ns-spinner");
90
112
  addClass(this.nsWindowElement, "ns", "ns-window");
91
113
  addClass(this.nsRootElement, "ns-wrapper");
92
114
  }
93
115
  assembleElementStructure() {
94
- this.nsContentElement.append(this.nsImageElement, this.nsTextElement);
116
+ this.nsTextContainerElement.append(this.nsTextElement, this.nsSpinnerElement);
117
+ this.nsContentElement.append(this.nsImageElement, this.nsTextContainerElement);
95
118
  this.nsWindowElement.append(this.nsContentElement);
96
119
  this.nsRootElement.append(this.nsWrapperElement, this.nsWindowElement);
97
120
  }
@@ -148,20 +171,24 @@ class SplashInstance {
148
171
  replaceSplashInstancesHavingSameDestination(destinationNode) {
149
172
  const fnNotSameInstance = (v) => v.getId() !== this.getId();
150
173
  const fnDelete = (v) => v.delete();
151
- this.nsInstance.getSplashesWithDestinationNode(destinationNode).filter(fnNotSameInstance).forEach(fnDelete);
174
+ this.nsInstance.getFromDestinationNode(destinationNode).filter(fnNotSameInstance).forEach(fnDelete);
152
175
  }
153
176
  moveTo(destination) {
154
- this.cleanAndRestore();
155
- this.destinationNode = NanosplashRepository.destinationToNode(destination);
156
- this.replaceSplashInstancesHavingSameDestination(this.destinationNode);
157
- const targetIsBody = this.destinationNode === document.body;
158
- if (targetIsBody) {
159
- this.moveWithFullscreenStrategy();
160
- } else {
161
- this.resetFullscreenAttributes();
162
- this.moveWithRegularStrategy(this.destinationNode);
177
+ try {
178
+ this.cleanAndRestore();
179
+ this.destinationNode = NanosplashRepository.destinationToNode(destination);
180
+ this.replaceSplashInstancesHavingSameDestination(this.destinationNode);
181
+ const targetIsBody = this.destinationNode === document.body;
182
+ if (targetIsBody) {
183
+ this.moveWithFullscreenStrategy();
184
+ } else {
185
+ this.resetFullscreenAttributes();
186
+ this.moveWithRegularStrategy(this.destinationNode);
187
+ }
188
+ this.assembleNSComponent();
189
+ } catch (e) {
190
+ console.warn(e);
163
191
  }
164
- this.assembleNSComponent();
165
192
  }
166
193
  forEachWrappedNode(callback) {
167
194
  Array.from(this.nsWrapperElement.childNodes).forEach(callback);
@@ -172,6 +199,8 @@ class SplashInstance {
172
199
  removeElementsFromDOM() {
173
200
  [
174
201
  this.nsTextElement,
202
+ this.nsSpinnerElement,
203
+ this.nsTextContainerElement,
175
204
  this.nsImageElement,
176
205
  this.nsContentElement,
177
206
  this.nsWrapperElement,
@@ -193,16 +222,6 @@ class NanosplashFactory {
193
222
  }
194
223
  return splash.setText(text).setImgSrc((_a = splash.getImgSrc()) != null ? _a : imgSrc);
195
224
  }
196
- static createImgFunction(ns, splash) {
197
- return (src) => {
198
- splash = NanosplashFactory.ensureInstance(splash, ns, "", src);
199
- return {
200
- show: NanosplashFactory.createShowFunction(ns, splash),
201
- progress: NanosplashFactory.createProgressFunction(ns, splash),
202
- while: NanosplashFactory.createWhileFunction(ns, splash)
203
- };
204
- };
205
- }
206
225
  static createShowFunction(ns, splash) {
207
226
  return (text) => {
208
227
  splash = NanosplashFactory.ensureInstance(splash, ns, text);
@@ -240,27 +259,51 @@ class NanosplashFactory {
240
259
  };
241
260
  }
242
261
  }
243
- class Nanosplash {
244
- constructor() {
262
+ const _Nanosplash = class {
263
+ constructor(options) {
264
+ var _a;
265
+ this.imgSrc = options == null ? void 0 : options.imgSrc;
266
+ this.spinner = (options == null ? void 0 : options.spinner) === void 0 ? _Nanosplash.SPINNER_DEFAULT_VISIBILITY : options.spinner;
267
+ this.fontSize = (_a = options == null ? void 0 : options.fontSize) != null ? _a : "18px";
245
268
  this.instances = /* @__PURE__ */ new Map();
246
269
  }
247
- img(src) {
248
- return NanosplashFactory.createImgFunction(this, new SplashInstance(this, "", src))(src);
270
+ setImgSrc(value) {
271
+ this.imgSrc = value;
272
+ return this;
273
+ }
274
+ showSpinner(value) {
275
+ this.spinner = value;
276
+ return this;
277
+ }
278
+ setFontSize(value) {
279
+ this.fontSize = value;
280
+ return this;
281
+ }
282
+ getImgSrc() {
283
+ return this.imgSrc;
284
+ }
285
+ spinnerIsVisible() {
286
+ return this.spinner;
287
+ }
288
+ getFontSize() {
289
+ return this.fontSize;
249
290
  }
250
291
  show(text) {
251
- return NanosplashFactory.createShowFunction(this, new SplashInstance(this, text))(text);
292
+ return NanosplashFactory.createShowFunction(this, new SplashInstance(this, text, this.imgSrc))(text);
252
293
  }
253
294
  progress(...jobs) {
254
- return NanosplashFactory.createProgressFunction(this, new SplashInstance(this, ""))(...jobs);
295
+ return NanosplashFactory.createProgressFunction(this, new SplashInstance(this, "", this.imgSrc))(...jobs);
255
296
  }
256
297
  while(asyncTask) {
257
- return NanosplashFactory.createWhileFunction(this, new SplashInstance(this, ""))(asyncTask);
258
- }
259
- fifoIterate(callback) {
260
- let i = 0;
261
- const instanceEntries = this.instances.entries();
262
- for (const [id, splashInstance] of instanceEntries) {
263
- if (!callback(id, splashInstance, i++)) {
298
+ return NanosplashFactory.createWhileFunction(this, new SplashInstance(this, "", this.imgSrc))(asyncTask);
299
+ }
300
+ lifoIterate(callback) {
301
+ const n = this.instances.size;
302
+ const instances = Array.from(this.instances.values());
303
+ for (let i = n - 1; i >= 0; i--) {
304
+ const instance = instances[i];
305
+ const id = instance.getId();
306
+ if (!callback(id, instance, i)) {
264
307
  break;
265
308
  }
266
309
  }
@@ -271,17 +314,30 @@ class Nanosplash {
271
314
  hideAll() {
272
315
  this.instances.forEach((instance) => instance.delete());
273
316
  }
274
- hide(id) {
275
- if (id) {
276
- const splashInstance = this.instances.get(id);
277
- if (splashInstance) {
278
- splashInstance.delete();
279
- } else {
280
- throw new Error(`Could not find element with id: ${id}`);
317
+ hide(ref) {
318
+ if (ref) {
319
+ const isString = typeof ref === "string";
320
+ const isNode = ref instanceof Node;
321
+ const deleteInstancesWhereDestination = (destination) => {
322
+ Array.from(this.instances.values()).filter((v) => v.getDestination() === destination).forEach((v) => v.delete());
323
+ };
324
+ if (isString) {
325
+ const splashInstance = this.instances.get(ref);
326
+ if (splashInstance) {
327
+ splashInstance.delete();
328
+ } else {
329
+ const element = get(ref);
330
+ if (element) {
331
+ deleteInstancesWhereDestination(element);
332
+ }
333
+ }
334
+ } else if (isNode) {
335
+ deleteInstancesWhereDestination(ref);
281
336
  }
282
337
  } else {
283
- this.fifoIterate((_, splashInstance, i) => {
284
- const remove = i === 0;
338
+ const n = this.instances.size;
339
+ this.lifoIterate((_, splashInstance, i) => {
340
+ const remove = i === n - 1;
285
341
  if (remove) {
286
342
  splashInstance.delete();
287
343
  }
@@ -289,10 +345,12 @@ class Nanosplash {
289
345
  });
290
346
  }
291
347
  }
292
- getSplashesWithDestinationNode(node) {
348
+ getFromDestinationNode(node) {
293
349
  const fnSameDestinationNode = (v) => v.getDestination() === node;
294
350
  return Array.from(this.instances.values()).filter(fnSameDestinationNode);
295
351
  }
296
- }
352
+ };
353
+ let Nanosplash = _Nanosplash;
297
354
  Nanosplash.APP_NAME = "Nanosplash";
298
- export { Nanosplash };
355
+ Nanosplash.SPINNER_DEFAULT_VISIBILITY = true;
356
+ export { Nanosplash as default };
@@ -0,0 +1 @@
1
+ .ns-blur,body .ns-fs~*{filter:blur(5px);overflow:hidden}.ns-wrapper{position:relative}.ns-fs{left:0;min-height:100vh;min-width:100%;position:fixed;top:0;z-index:2}.ns-window{align-items:center;background-color:#fffc;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%;z-index:1}.ns-img{margin-bottom:2em;max-height:9rem;width:9rem}.ns-text-container{align-items:center}.ns-text,.ns-text-container{display:flex;justify-content:center}.ns-text{color:#5a6685}.ns-spinner{display:flex;height:1em;margin-left:1em;width:1em}.ns-spinner>svg{stroke-width:8;-webkit-animation:Rotate 2s linear infinite;animation:Rotate 2s linear infinite;height:inherit;position:relative;width:inherit}.ns-spinner .path{stroke:#5a6685;stroke-linecap:round;-webkit-animation:Dash 1.5s ease-in-out infinite;animation:Dash 1.5s ease-in-out infinite}@-webkit-keyframes Rotate{to{transform:rotate(1turn)}}@keyframes Rotate{to{transform:rotate(1turn)}}@-webkit-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}}@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}}