nanosplash 2.2.2 → 2.3.0

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 (51) hide show
  1. package/.github/workflows/production.yml +57 -0
  2. package/.github/workflows/release.yml +61 -0
  3. package/README.md +33 -9
  4. package/dist/iife/nanosplash.iife.js +1 -1
  5. package/dist/module/Nanosplash.css +1 -0
  6. package/dist/module/manifest.json +6 -3
  7. package/dist/module/nanosplash.cjs.js +1 -1
  8. package/dist/module/nanosplash.es.js +249 -285
  9. package/docs/index.html +54 -415
  10. package/docs/nanosplash.iife.js +1 -1
  11. package/docs/style.css +1 -1
  12. package/docs/typedoc/assets/highlight.css +1 -50
  13. package/docs/typedoc/assets/main.js +2 -2
  14. package/docs/typedoc/assets/search.js +1 -1
  15. package/docs/typedoc/assets/style.css +32 -2
  16. package/docs/typedoc/classes/Core_Nanosplash.Nanosplash.html +1 -0
  17. package/docs/typedoc/index.html +1 -1
  18. package/docs/typedoc/modules/types.html +1 -1
  19. package/index.html +51 -397
  20. package/jest.config.ts +194 -0
  21. package/package.json +71 -66
  22. package/src/Core/Nanosplash.ts +74 -0
  23. package/src/Core/SplashInstance.ts +154 -0
  24. package/src/Factory/NanosplashFactory.ts +73 -0
  25. package/src/Interfaces/ContextualAPIInterface.ts +8 -0
  26. package/src/Interfaces/IdentityInterface.ts +3 -0
  27. package/src/Interfaces/ImageInterface.ts +5 -0
  28. package/src/Interfaces/InsideInterface.ts +5 -0
  29. package/src/Interfaces/NanosplashInterface.ts +4 -0
  30. package/src/Interfaces/ProgressInterface.ts +5 -0
  31. package/src/Interfaces/ShowInterface.ts +5 -0
  32. package/src/Interfaces/WhileInterface.ts +5 -0
  33. package/src/main.ts +2 -6
  34. package/src/repositories/NanosplashRepository.ts +34 -57
  35. package/src/style.sass +36 -61
  36. package/src/types.d.ts +45 -197
  37. package/src/utilities/dom.spec.ts +70 -0
  38. package/src/utilities/dom.ts +17 -246
  39. package/update-all.sh +3 -0
  40. package/vite.iife.config.js +46 -18
  41. package/vite.mod.config.js +48 -12
  42. package/vite.site.config.js +0 -3
  43. package/dist/module/style.css +0 -1
  44. package/docs/typedoc/classes/Nanosplash.Nanosplash-1.html +0 -56
  45. package/docs/typedoc/classes/types.Nanosplash.html +0 -56
  46. package/docs/typedoc/modules/Nanosplash.html +0 -1
  47. package/src/Nanosplash.ts +0 -421
  48. package/src/exceptions/Exception.ts +0 -11
  49. package/src/exceptions/IllegalArgumentException.ts +0 -9
  50. package/src/exceptions/InvalidDestinationException.ts +0 -9
  51. package/update-latest.sh +0 -21
package/docs/index.html CHANGED
@@ -3,436 +3,75 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDEwIiBoZWlnaHQ9IjQwNCIgdmlld0JveD0iMCAwIDQxMCA0MDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zOTkuNjQxIDU5LjUyNDZMMjE1LjY0MyAzODguNTQ1QzIxMS44NDQgMzk1LjMzOCAyMDIuMDg0IDM5NS4zNzggMTk4LjIyOCAzODguNjE4TDEwLjU4MTcgNTkuNTU2M0M2LjM4MDg3IDUyLjE4OTYgMTIuNjgwMiA0My4yNjY1IDIxLjAyODEgNDQuNzU4NkwyMDUuMjIzIDc3LjY4MjRDMjA2LjM5OCA3Ny44OTI0IDIwNy42MDEgNzcuODkwNCAyMDguNzc2IDc3LjY3NjNMMzg5LjExOSA0NC44MDU4QzM5Ny40MzkgNDMuMjg5NCA0MDMuNzY4IDUyLjE0MzQgMzk5LjY0MSA1OS41MjQ2WiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyKSIvPgo8cGF0aCBkPSJNMjkyLjk2NSAxLjU3NDRMMTU2LjgwMSAyOC4yNTUyQzE1NC41NjMgMjguNjkzNyAxNTIuOTA2IDMwLjU5MDMgMTUyLjc3MSAzMi44NjY0TDE0NC4zOTUgMTc0LjMzQzE0NC4xOTggMTc3LjY2MiAxNDcuMjU4IDE4MC4yNDggMTUwLjUxIDE3OS40OThMMTg4LjQyIDE3MC43NDlDMTkxLjk2NyAxNjkuOTMxIDE5NS4xNzIgMTczLjA1NSAxOTQuNDQzIDE3Ni42MjJMMTgzLjE4IDIzMS43NzVDMTgyLjQyMiAyMzUuNDg3IDE4NS45MDcgMjM4LjY2MSAxODkuNTMyIDIzNy41NkwyMTIuOTQ3IDIzMC40NDZDMjE2LjU3NyAyMjkuMzQ0IDIyMC4wNjUgMjMyLjUyNyAyMTkuMjk3IDIzNi4yNDJMMjAxLjM5OCAzMjIuODc1QzIwMC4yNzggMzI4LjI5NCAyMDcuNDg2IDMzMS4yNDkgMjEwLjQ5MiAzMjYuNjAzTDIxMi41IDMyMy41TDMyMy40NTQgMTAyLjA3MkMzMjUuMzEyIDk4LjM2NDUgMzIyLjEwOCA5NC4xMzcgMzE4LjAzNiA5NC45MjI4TDI3OS4wMTQgMTAyLjQ1NEMyNzUuMzQ3IDEwMy4xNjEgMjcyLjIyNyA5OS43NDYgMjczLjI2MiA5Ni4xNTgzTDI5OC43MzEgNy44NjY4OUMyOTkuNzY3IDQuMjczMTQgMjk2LjYzNiAwLjg1NTE4MSAyOTIuOTY1IDEuNTc0NFoiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcikiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhciIgeDE9IjYuMDAwMTciIHkxPSIzMi45OTk5IiB4Mj0iMjM1IiB5Mj0iMzQ0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiM0MUQxRkYiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjQkQzNEZFIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhciIgeDE9IjE5NC42NTEiIHkxPSI4LjgxODE4IiB4Mj0iMjM2LjA3NiIgeTI9IjI5Mi45ODkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRUE4MyIvPgo8c3RvcCBvZmZzZXQ9IjAuMDgzMzMzMyIgc3RvcC1jb2xvcj0iI0ZGREQzNSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRkE4MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K" />
6
- <link
7
- href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
8
- rel="stylesheet"
9
- />
6
+ <script src="https://cdn.tailwindcss.com"></script>
10
7
  <link href="https://cdn.lineicons.com/3.0/lineicons.css" rel="stylesheet" />
11
8
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
12
9
  <title>Nanosplash</title>
13
10
  <meta name="description" content="The tiny loading screen" />
14
11
  <meta name="keywords" content="splash, screen, loading" />
15
12
  <meta name="author" content="Isak Hauge" />
16
- <script type="module">
17
- //nanosplash.iife.js
18
- (()=>{(function(){"use strict";const w=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))l(e);new MutationObserver(e=>{for(const i of e)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&l(o)}).observe(document,{childList:!0,subtree:!0});function n(e){const i={};return e.integrity&&(i.integrity=e.integrity),e.referrerpolicy&&(i.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?i.credentials="include":e.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function l(e){if(e.ep)return;e.ep=!0;const i=n(e);fetch(e.href,i)}};class D extends Error{constructor(t){super(t)}getName(){return this.constructor.name}}class y extends D{constructor(t){super(t)}}const O=s=>document.querySelector(s),p=(s,t)=>{var l;const n=document.createElement(s);return t&&(n.id||(n.id=t.id+""),n.className||(n.className=t.className+""),(l=t.attributes)==null||l.filter(e=>e.value).forEach(({key:e,value:i})=>d(n,e,i)),t.content&&(typeof t.content=="string"?n.innerText=t.content:n.append(t.content))),n},h=(s,t)=>{s.hidden=!t,t?b(s,"hidden"):d(s,"hidden","true")},u=s=>({to:(t,n)=>{const l=Array.from(t.childNodes);if(l.length<1||!n){t.appendChild(s);return}const i=l[0];t.insertBefore(s,i)}}),E=s=>{const t=s.parentNode;t&&(n=>{t.style.position="relative";const l="px",e=t===document.body;let i,o,c,m;e?i=scrollX+l:i=0+l,e?o=scrollY+l:o=0+l,e?c="100%":c=n.width+l,e?m="100vh":m=n.height+l,r(t,"position","relative"),r(s,"left",i),r(s,"top",o),r(s,"width",c),r(s,"height",m)})(t.getBoundingClientRect())},N=(s,t,n)=>(([l,e])=>{n.forEach(i=>{l?l(`on${i}`,t):e(i,t,!0)})})([s.attachEvent,s.addEventListener]),F=s=>s instanceof Element||s instanceof Node,U=s=>s&&{}.toString.call(s)==="[object Function]",r=(s,t,n)=>{s.style[t]=n},d=(s,t,n)=>{s.setAttribute(t,n)},b=(s,t)=>{s.removeAttribute(t)};class a{static makeMainElement(){const t=p("div",{className:"nanosplash-container",attributes:[{key:"data-splash-animation",value:this.DEFAULT.SPLASH_ANIMATION}]});return t.style.backgroundColor=this.DEFAULT.BACKGROUND_COLOR,t}static makeSplashElement(){const t=p("img",{className:"nanosplash-img",attributes:[{key:"src",value:this.DEFAULT.SPLASH_SOURCE},{key:"alt",value:"Nanosplash indicator"}]});return h(t,!1),t}static makeTextElement(){return p("div",{className:"nanosplash-text",content:this.DEFAULT.TEXT})}}a.DEFAULT={DESTINATION_NODE:document.body,TEXT:"Loading ...",TEXT_FONT:'"Arial", sans-serif',TEXT_WEIGHT:"medium",TEXT_COLOR:"#555",TEXT_SIZE:"26px",SPLASH_SOURCE:"favicon.svg",SPLASH_WIDTH:"100px",SPLASH_HEIGHT:"auto",SPLASH_ANIMATION:"pulse",BACKGROUND_COLOR:"rgba(255, 255, 255, 0.90)",BACKGROUND_BLUR:"light"};var C="";class T{constructor(t){this.cache={parentPosition:""},this.defaultText=a.DEFAULT.TEXT,this.defaultDestination=a.DEFAULT.DESTINATION_NODE,this.mainElement=a.makeMainElement(),this.splashElement=a.makeSplashElement(),this.textElement=a.makeTextElement(),u(this.splashElement).to(this.mainElement),u(this.textElement).to(this.mainElement),u(this.mainElement).to(this.defaultDestination,!0),h(this.mainElement,!1),E(this.mainElement),this.setDefaultStyles(),t&&this.configure(t)}install(){Object.defineProperty(window,"loading",{value:this,writable:!1}),N(window,()=>E(this.mainElement),["resize","scroll"])}configure(t){var n,l,e,i,o,c,m,f,S,A,x,L;return((n=t==null?void 0:t.default)==null?void 0:n.destination)&&(this.defaultDestination=T.getDestinationElement(t.default.destination)),this.defaultText||(this.defaultText=(l=t.default)==null?void 0:l.text),((e=t.text)==null?void 0:e.family)&&this.setTextFontFamily(t.text.family),((i=t.text)==null?void 0:i.weight)&&this.setTextWeight(t.text.weight),((o=t.text)==null?void 0:o.color)&&this.setTextColor(t.text.color),((c=t.text)==null?void 0:c.size)&&this.setTextSize(t.text.size),((m=t.background)==null?void 0:m.color)&&this.setBackgroundColor(t.background.color),((f=t.background)==null?void 0:f.blur)&&this.setBackgroundBlur(t.background.blur),t.splash?(((S=t.splash)==null?void 0:S.src)&&this.setSplashSource(t.splash.src),((A=t.splash)==null?void 0:A.width)&&this.setSplashWidth(t.splash.width),((x=t.splash)==null?void 0:x.height)&&this.setSplashHeight(t.splash.height),((L=t.splash)==null?void 0:L.animation)&&this.setSplashAnimation(t.splash.animation)):h(this.splashElement,!1),this}show(t){this.setText(t!=null?t:a.DEFAULT.TEXT),h(this.mainElement,!0);const n=this.mainElement.parentNode;n&&n!==document.body&&E(this.mainElement);const l=async e=>{await e,this.hide()};return{inside:e=>{const i=T.getDestinationElement(e);return u(this.mainElement).to(i,!0),this.cache.parentPosition=i.style.position,E(this.mainElement),{during:l}},during:l}}hide(){const t=this.mainElement.parentElement;r(t,"position",this.cache.parentPosition),h(this.mainElement,!1),this.setText(this.defaultText),u(this.mainElement).to(this.defaultDestination,!0),E(this.mainElement)}setDefaultStyles(){this.setTextFontFamily(a.DEFAULT.TEXT_FONT),this.setTextWeight(a.DEFAULT.TEXT_WEIGHT),this.setTextColor(a.DEFAULT.TEXT_COLOR),this.setTextSize(a.DEFAULT.TEXT_SIZE),this.setSplashSource(a.DEFAULT.SPLASH_SOURCE),this.setSplashWidth(a.DEFAULT.SPLASH_WIDTH),this.setSplashHeight(a.DEFAULT.SPLASH_HEIGHT),this.setSplashAnimation(a.DEFAULT.SPLASH_ANIMATION),this.setBackgroundColor(a.DEFAULT.BACKGROUND_COLOR),this.setBackgroundBlur(a.DEFAULT.BACKGROUND_BLUR)}setText(t){this.textElement.innerText=t}setTextFontFamily(t){r(this.textElement,"fontFamily",t)}setTextWeight(t){r(this.textElement,"fontWeight",t)}setTextColor(t){r(this.textElement,"color",t)}setTextSize(t){r(this.textElement,"fontSize",t)}setSplashSource(t){this.splashElement.src=t,h(this.splashElement,!0)}setSplashWidth(t){r(this.splashElement,"width",t)}setSplashHeight(t){r(this.splashElement,"height",t)}setSplashAnimation(t){d(this.mainElement,"data-splash-animation",t)}setBackgroundColor(t){r(this.mainElement,"backgroundColor",t)}setBackgroundBlur(t){d(this.mainElement,"data-blur",t)}static getDestinationElement(t){const n=typeof t=="string",l=U(t),e=F(t);let i;if(n)i=O(t);else if(l)i=t();else if(e)i=t;else throw new y;return i}}window&&window instanceof Window&&new T().install()})();})();
19
-
20
- </script>
21
- <!-- style.css --><style type="text/css">
22
- @-webkit-keyframes pulse{0%{transform:scale(1)}to{transform:scale(1.1)}}@keyframes pulse{0%{transform:scale(1)}to{transform:scale(1.1)}}@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.nanosplash-container{align-items:center;border-radius:inherit;flex-direction:column;justify-content:center;overflow:inherit;position:absolute;z-index:1}.nanosplash-container[hidden=true]{display:none}.nanosplash-container:not([hidden=true]){display:flex}.nanosplash-container[data-blur=none]:not([hidden=true])~*{filter:blur(0)}.nanosplash-container[data-blur=light]:not([hidden=true])~*{filter:blur(2px)}.nanosplash-container[data-blur=medium]:not([hidden=true])~*{filter:blur(4px)}.nanosplash-container[data-blur=heavy]:not([hidden=true])~*{filter:blur(10px)}.nanosplash-container .nanosplash-text{text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-smoothing:antialiased;-webkit-font-smoothing:antialiased;text-shadow:0 0 2px rgba(0,0,0,.2)}.nanosplash-container img.nanosplash-img{margin-bottom:40px}.nanosplash-container[data-splash-animation=pulse]>img{-webkit-animation-direction:alternate;animation-direction:alternate;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:pulse;animation-name:pulse}.nanosplash-container[data-splash-animation=spin]>img{-webkit-animation-duration:.7s;animation-duration:.7s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:spin;animation-name:spin;-webkit-animation-timing-function:linear;animation-timing-function:linear}body>.nanosplash-container:not([hidden=true]){height:100vh;width:100%}
23
-
24
- </style>
13
+ <script type="module" crossorigin src="/nanosplash.iife.js"></script>
14
+ <link rel="stylesheet" href="/style.css">
25
15
  </head>
26
16
  <body class="flex flex-col justify-between">
27
- <main class="bg-gray-100 flex-grow">
28
- <div id="title">
29
- <section class="bg-gray-800 pt-6 pb-2 md:py-12 text-white">
30
- <div
31
- class="
32
- absolute
33
- top-2
34
- left-2
35
- uppercase
36
- bg-gray-600
37
- text-white
38
- pill
39
- font-mono
40
- tracking-wider
41
- rounded
42
- "
43
- >
44
- Title section
45
- </div>
46
- <div class="px-10 flex flex-col justify-center items-center">
47
- <span class="animate-spin mb-3 md:mb-6 text-6xl md:text-7xl"
48
- >🍩</span
49
- >
50
- <h1 class="text-3xl md:text-4xl">Nanosplash</h1>
51
- <h2 class="text-lg md:text-xl md:mt-1 font-thin">
52
- The tiny loading screen
53
- </h2>
54
- </div>
55
- </section>
56
- <section class="py-3 bg-gray-800">
57
- <div class="flex flex-col space-y-2">
58
- <div class="flex space-x-2 justify-center">
59
- <img src="https://badgen.net/npm/v/nanosplash" />
60
- <img src="https://badgen.net/npm/types/nanosplash" />
61
- <img src="https://badgen.net/npm/dw/nanosplash" />
62
- </div>
63
- <div class="flex space-x-2 justify-center">
64
- <img src="https://badgen.net/bundlephobia/min/nanosplash" />
65
- <img
66
- src="https://badgen.net/bundlephobia/tree-shaking/nanosplash"
67
- />
68
- </div>
69
- </div>
70
- </section>
71
- </div>
72
- <section class="flex flex-col items-center py-10 md:pt-16 md:pb-10">
73
- <div
74
- class="
75
- text-center text-xl
76
- md:text-2xl
77
- font-light
78
- text-gray-600
79
- flex
80
- justify-center
81
- mb-2
82
- md:mb-3
83
- "
84
- >
85
- API reference documentation
17
+ <div class="w-100 min-h-screen flex flex-col justify-center items-center">
18
+ <div class="text-3xl">Nanosplash</div>
19
+ <div class="mt-3">Small. Simple. Reliable.</div>
20
+ <div class="flex flex-col space-y-2 my-10">
21
+ <div class="flex space-x-2 justify-center">
22
+ <img src="https://badgen.net/npm/v/nanosplash" />
23
+ <img src="https://badgen.net/npm/types/nanosplash" />
24
+ <img src="https://badgen.net/npm/dw/nanosplash" />
25
+ </div>
26
+ <div class="flex space-x-2 justify-center">
27
+ <img src="https://badgen.net/bundlephobia/min/nanosplash" />
28
+ <img
29
+ src="https://badgen.net/bundlephobia/tree-shaking/nanosplash"
30
+ />
86
31
  </div>
87
- <div
88
- class="text-center text-gray-500 flex font-light justify-center mb-6"
89
- >
90
- Please visit the&nbsp;<a
91
- href="/nanosplash/typedoc/index.html"
92
- class="text-blue-400"
93
- >documentation</a
94
- >
32
+ </div>
33
+ <div class="text-white bg-slate-700 p-3 rounded shadow-xl font-mono text-sm">ns.show('text').inside('#myDiv')</div>
34
+ </div>
35
+ <div class="grid grid-cols-2 gap-1">
36
+ <div id="a" class="p-20 bg-slate-100 flex flex-col items-center">
37
+ <div class="text-xl mb-10">Give user progress feedback</div>
38
+ <div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
39
+ ns.img(src).progress(<br>
40
+ &nbsp;&nbsp;[promise1, 'Loading A'],<br>
41
+ &nbsp;&nbsp;[promise2, 'Loading B'],<br>
42
+ &nbsp;&nbsp;[promise3, 'Loading C'],<br>
43
+ ).inside('#myDiv')
95
44
  </div>
96
- <div class="container px-10">
97
- <div
98
- class="
99
- text-center text-xl
100
- md:text-2xl
101
- font-light
102
- text-gray-600
103
- flex
104
- justify-center
105
- mb-2
106
- md:mb-3
107
- "
108
- >
109
- Demo
110
- </div>
111
- <div class="text-center text-gray-500 flex font-light justify-center">
112
- Play around with Nanosplash using the controls below.<br />
113
- The demo serves as showcase of some of the<br />
114
- features it has to offer.
115
- </div>
45
+ </div>
46
+ <div id="b" class="p-20 bg-slate-100 flex flex-col items-center">
47
+ <div class="text-xl mb-10">Handle async functions</div>
48
+ <div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
49
+ ns.while(promise).show('Loading ...').inside('#myDiv')
116
50
  </div>
117
- </section>
118
- <section class="flex flex-col items-center pt-0 pb-10 md:pt-0 md:pb-20">
119
- <div class="container px-10 md:max-w-3xl">
120
- <div class="flex flex-col mb-5">
121
- <label for="splash-src" class="text-gray-600 mb-2"
122
- >Splash image URL</label
123
- >
124
- <input
125
- type="text"
126
- name="splash-src"
127
- id="splash-src"
128
- value="doughnut.png"
129
- class="
130
- py-3
131
- px-4
132
- text-gray-400
133
- bg-white
134
- appearance-none
135
- rounded-lg
136
- "
137
- />
138
- </div>
139
- <div class="grid sm:grid-cols-1 md:grid-cols-2 gap-5">
140
- <div class="flex flex-col">
141
- <label class="text-gray-600 mb-2" for="anim">Animation</label>
142
- <select
143
- class="
144
- py-3
145
- px-4
146
- text-gray-400
147
- bg-white
148
- cursor-pointer
149
- appearance-none
150
- rounded-lg
151
- "
152
- name="anim"
153
- id="anim"
154
- >
155
- <option value="none" selected disabled>Choose animation</option>
156
- <option value="none">None</option>
157
- <option value="pulse">Pulse</option>
158
- <option value="spin">Spin</option>
159
- </select>
160
- </div>
161
- <div class="flex flex-col">
162
- <label class="text-gray-600 mb-2" for="elem"
163
- >Show inside element</label
164
- >
165
- <select
166
- class="
167
- py-3
168
- px-4
169
- text-gray-400
170
- bg-white
171
- cursor-pointer
172
- appearance-none
173
- rounded-lg
174
- "
175
- name="elem"
176
- id="elem"
177
- >
178
- <option value="none" selected disabled>Choose location</option>
179
- <option value="body">Fullscreen (3s)</option>
180
- <option value="#title">Title section</option>
181
- <option value="#col1">Column 1</option>
182
- <option value="#col2">Column 2</option>
183
- <option value="#col3">Column 3</option>
184
- </select>
185
- </div>
186
- <div class="flex flex-col">
187
- <label class="text-gray-600 mb-2" for="text">Loading text</label>
188
- <input
189
- class="
190
- py-3
191
- px-4
192
- appearance-none
193
- rounded-lg
194
- bg-white
195
- text-gray-400
196
- "
197
- type="text"
198
- name="text"
199
- id="text"
200
- value="Loading assets ..."
201
- />
202
- </div>
203
- <div class="flex flex-col">
204
- <label class="text-gray-600 mb-2" for="show"
205
- >Display loading screen</label
206
- >
207
- <div
208
- id="show"
209
- class="
210
- bg-purple-900
211
- text-gray-300
212
- cursor-pointer
213
- py-3
214
- px-4
215
- rounded-lg
216
- "
217
- >
218
- Show loading screen
219
- </div>
220
- </div>
221
- </div>
51
+ </div>
52
+ <div id="c" class="p-20 bg-slate-100 flex flex-col items-center">
53
+ <div class="text-xl mb-10">Display fullscreen</div>
54
+ <div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
55
+ const splash = ns.show('Fullscreen text')<br>
56
+ splash.moveTo('#myDiv')<br>
57
+ splash.remove()
222
58
  </div>
223
- </section>
224
- <section class="flex flex-col items-center pb-20">
225
- <div class="container px-10">
226
- <div class="grid sm:grid-cols-1 lg:grid-cols-3 gap-10">
227
- <div id="col1" class="bg-white rounded-2xl shadow-lg">
228
- <div class="relative p-8 rounded-2xl">
229
- <div
230
- class="
231
- absolute
232
- top-2
233
- left-2
234
- uppercase
235
- bg-gray-500
236
- text-white
237
- pill
238
- font-mono
239
- tracking-wider
240
- rounded
241
- "
242
- >
243
- Column 1
244
- </div>
245
- <div class="text-4xl text-center">
246
- <i class="lni lni-bolt-alt"></i>
247
- </div>
248
- <div class="text-xl font-medium my-6 text-center">
249
- Tiny and lightning fast
250
- </div>
251
- <div>It is only 6kB in size, and it's lightning fast.</div>
252
- </div>
253
- </div>
254
- <div id="col2" class="bg-white rounded-2xl shadow-lg">
255
- <div class="relative p-8 rounded-2xl">
256
- <div
257
- class="
258
- absolute
259
- top-2
260
- left-2
261
- uppercase
262
- bg-gray-500
263
- text-white
264
- pill
265
- font-mono
266
- tracking-wider
267
- rounded
268
- "
269
- >
270
- Column 2
271
- </div>
272
- <div class="text-4xl text-center">
273
- <i class="lni lni-code"></i>
274
- </div>
275
- <div class="text-xl font-medium my-6 text-center">
276
- Vanilla JS
277
- </div>
278
- <div>
279
- Written from the ground up in vanilla JavaScript and comes
280
- without any libraries.
281
- </div>
282
- </div>
283
- </div>
284
- <div id="col3" class="bg-white rounded-2xl shadow-lg">
285
- <div class="relative p-8 rounded-2xl">
286
- <div
287
- class="
288
- absolute
289
- top-2
290
- left-2
291
- uppercase
292
- bg-gray-500
293
- text-white
294
- pill
295
- font-mono
296
- tracking-wider
297
- rounded
298
- "
299
- >
300
- Column 3
301
- </div>
302
- <div class="text-4xl text-center">
303
- <i class="lni lni-grid-alt"></i>
304
- </div>
305
- <div class="text-xl font-medium my-6 text-center">
306
- ESM + CJS
307
- </div>
308
- <div>
309
- Nanosplash comes in both ES and CJS modules, making it easy
310
- for you to import it into your code.
311
- </div>
312
- </div>
313
- </div>
314
- </div>
59
+ </div>
60
+ <div id="d" class="p-20 bg-slate-100 flex flex-col items-center">
61
+ <div class="text-xl mb-10">Display multiple, independent instances</div>
62
+ <div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
63
+ ns.img(src).show('Loading component A').inside('#a')<br>
64
+ ns.show('Loading component A').inside('#b')<br>
65
+ ns.show('Loading component A').inside('#c')<br>
66
+ <br><br>
67
+ ns.hide() // Removes instances in a FIFO manner.<br>
68
+ ns.hideAll() // Removes all instances.
315
69
  </div>
316
- </section>
317
- </main>
70
+ </div>
71
+ </div>
318
72
  <footer>
319
- <section class="py-6 flex justify-center flex-grow-0">
320
- <div class="container mx-5">
321
- <div class="flex space-x-3 justify-center items-center text-gray-600">
322
- <div class="text-2xl">
323
- <i class="lni lni-github-original"></i>
324
- </div>
325
- <div>
326
- Developed by
327
- <a
328
- class="text-purple-400 hover:text-purple-500"
329
- href="https://github.com/isakhauge"
330
- target="_blank"
331
- >Isak Hauge</a
332
- >
333
- </div>
334
- </div>
335
- </div>
336
- </section>
337
73
 
338
-
339
- <!-- Demo -->
340
- <script>
341
- const ref = function (v) {
342
- return document.querySelector(v)
343
- }
344
-
345
- // Elements
346
- const textSplashElem = ref('#splash-src')
347
- const selectAnimElem = ref('#anim')
348
- const selectDestinationElem = ref('#elem')
349
- const textElem = ref('#text')
350
- const showBtn = ref('#show')
351
-
352
- const cache = {
353
- animation: 'none',
354
- domSelector: 'body',
355
- text: textElem.value,
356
- showNextTime: true,
357
- }
358
-
359
- const text = (function (postfix) {
360
- return {
361
- show: 'Show ' + postfix,
362
- hide: 'Hide ' + postfix,
363
- }
364
- })('loading screen')
365
-
366
- const display = function () {
367
- const doughnutSrc =
368
- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/285/doughnut_1f369.png'
369
- showBtn.innerText = 'Hide loading screen'
370
- cache.showNextTime = false
371
- const isDoughnut = textSplashElem.value === 'doughnut.png'
372
- const splashSrc = isDoughnut ? doughnutSrc : textSplashElem.value
373
- const text = textElem.value
374
- const anim = selectAnimElem.value
375
- const elem = selectDestinationElem.value
376
- loading
377
- .configure({
378
- splash: { animation: cache.animation, src: splashSrc },
379
- })
380
- .show(cache.text)
381
- .inside(cache.domSelector)
382
- }
383
-
384
- const hide = function () {
385
- showBtn.innerText = 'Show loading screen'
386
- cache.showNextTime = true
387
- loading.hide()
388
- }
389
-
390
- const onSelectAnim = function ({ target }) {
391
- cache.animation = target.value
392
- }
393
- const onSelectDestination = function ({ target }) {
394
- cache.domSelector = target.value
395
- }
396
- const onInputText = function ({ target }) {
397
- cache.text = target.value
398
- }
399
- const onClickBtn = function () {
400
- if (cache.showNextTime) {
401
- display()
402
- const isBody = cache.domSelector === 'body'
403
- if (isBody) {
404
- setTimeout(hide, 3000)
405
- }
406
- } else {
407
- hide()
408
- }
409
- }
410
-
411
- selectAnimElem.addEventListener('input', onSelectAnim)
412
- selectDestinationElem.addEventListener('input', onSelectDestination)
413
- textElem.addEventListener('input', onInputText)
414
- showBtn.addEventListener('click', onClickBtn)
415
- </script>
416
-
417
- <!-- Nanosplash -->
418
- <script>
419
- window.addEventListener('load', () => {
420
- window.loading.configure({
421
- splash: {
422
- src: 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/285/doughnut_1f369.png',
423
- },
424
- })
425
- })
426
- </script>
427
74
  </footer>
428
- <style>
429
- body {
430
- min-height: 100vh;
431
- }
432
- .pill {
433
- font-size: 10px;
434
- padding: 0.2em 0.5em;
435
- }
436
- </style>
75
+ <style>body{min-height:100vh}.pill{font-size:10px;padding:.2em .5em}</style>
437
76
  </body>
438
77
  </html>
@@ -1 +1 @@
1
- (()=>{(function(){"use strict";const w=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))l(e);new MutationObserver(e=>{for(const i of e)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&l(o)}).observe(document,{childList:!0,subtree:!0});function n(e){const i={};return e.integrity&&(i.integrity=e.integrity),e.referrerpolicy&&(i.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?i.credentials="include":e.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function l(e){if(e.ep)return;e.ep=!0;const i=n(e);fetch(e.href,i)}};class D extends Error{constructor(t){super(t)}getName(){return this.constructor.name}}class y extends D{constructor(t){super(t)}}const O=s=>document.querySelector(s),p=(s,t)=>{var l;const n=document.createElement(s);return t&&(n.id||(n.id=t.id+""),n.className||(n.className=t.className+""),(l=t.attributes)==null||l.filter(e=>e.value).forEach(({key:e,value:i})=>d(n,e,i)),t.content&&(typeof t.content=="string"?n.innerText=t.content:n.append(t.content))),n},h=(s,t)=>{s.hidden=!t,t?b(s,"hidden"):d(s,"hidden","true")},u=s=>({to:(t,n)=>{const l=Array.from(t.childNodes);if(l.length<1||!n){t.appendChild(s);return}const i=l[0];t.insertBefore(s,i)}}),E=s=>{const t=s.parentNode;t&&(n=>{t.style.position="relative";const l="px",e=t===document.body;let i,o,c,m;e?i=scrollX+l:i=0+l,e?o=scrollY+l:o=0+l,e?c="100%":c=n.width+l,e?m="100vh":m=n.height+l,r(t,"position","relative"),r(s,"left",i),r(s,"top",o),r(s,"width",c),r(s,"height",m)})(t.getBoundingClientRect())},N=(s,t,n)=>(([l,e])=>{n.forEach(i=>{l?l(`on${i}`,t):e(i,t,!0)})})([s.attachEvent,s.addEventListener]),F=s=>s instanceof Element||s instanceof Node,U=s=>s&&{}.toString.call(s)==="[object Function]",r=(s,t,n)=>{s.style[t]=n},d=(s,t,n)=>{s.setAttribute(t,n)},b=(s,t)=>{s.removeAttribute(t)};class a{static makeMainElement(){const t=p("div",{className:"nanosplash-container",attributes:[{key:"data-splash-animation",value:this.DEFAULT.SPLASH_ANIMATION}]});return t.style.backgroundColor=this.DEFAULT.BACKGROUND_COLOR,t}static makeSplashElement(){const t=p("img",{className:"nanosplash-img",attributes:[{key:"src",value:this.DEFAULT.SPLASH_SOURCE},{key:"alt",value:"Nanosplash indicator"}]});return h(t,!1),t}static makeTextElement(){return p("div",{className:"nanosplash-text",content:this.DEFAULT.TEXT})}}a.DEFAULT={DESTINATION_NODE:document.body,TEXT:"Loading ...",TEXT_FONT:'"Arial", sans-serif',TEXT_WEIGHT:"medium",TEXT_COLOR:"#555",TEXT_SIZE:"26px",SPLASH_SOURCE:"favicon.svg",SPLASH_WIDTH:"100px",SPLASH_HEIGHT:"auto",SPLASH_ANIMATION:"pulse",BACKGROUND_COLOR:"rgba(255, 255, 255, 0.90)",BACKGROUND_BLUR:"light"};var C="";class T{constructor(t){this.cache={parentPosition:""},this.defaultText=a.DEFAULT.TEXT,this.defaultDestination=a.DEFAULT.DESTINATION_NODE,this.mainElement=a.makeMainElement(),this.splashElement=a.makeSplashElement(),this.textElement=a.makeTextElement(),u(this.splashElement).to(this.mainElement),u(this.textElement).to(this.mainElement),u(this.mainElement).to(this.defaultDestination,!0),h(this.mainElement,!1),E(this.mainElement),this.setDefaultStyles(),t&&this.configure(t)}install(){Object.defineProperty(window,"loading",{value:this,writable:!1}),N(window,()=>E(this.mainElement),["resize","scroll"])}configure(t){var n,l,e,i,o,c,m,f,S,A,x,L;return((n=t==null?void 0:t.default)==null?void 0:n.destination)&&(this.defaultDestination=T.getDestinationElement(t.default.destination)),this.defaultText||(this.defaultText=(l=t.default)==null?void 0:l.text),((e=t.text)==null?void 0:e.family)&&this.setTextFontFamily(t.text.family),((i=t.text)==null?void 0:i.weight)&&this.setTextWeight(t.text.weight),((o=t.text)==null?void 0:o.color)&&this.setTextColor(t.text.color),((c=t.text)==null?void 0:c.size)&&this.setTextSize(t.text.size),((m=t.background)==null?void 0:m.color)&&this.setBackgroundColor(t.background.color),((f=t.background)==null?void 0:f.blur)&&this.setBackgroundBlur(t.background.blur),t.splash?(((S=t.splash)==null?void 0:S.src)&&this.setSplashSource(t.splash.src),((A=t.splash)==null?void 0:A.width)&&this.setSplashWidth(t.splash.width),((x=t.splash)==null?void 0:x.height)&&this.setSplashHeight(t.splash.height),((L=t.splash)==null?void 0:L.animation)&&this.setSplashAnimation(t.splash.animation)):h(this.splashElement,!1),this}show(t){this.setText(t!=null?t:a.DEFAULT.TEXT),h(this.mainElement,!0);const n=this.mainElement.parentNode;n&&n!==document.body&&E(this.mainElement);const l=async e=>{await e,this.hide()};return{inside:e=>{const i=T.getDestinationElement(e);return u(this.mainElement).to(i,!0),this.cache.parentPosition=i.style.position,E(this.mainElement),{during:l}},during:l}}hide(){const t=this.mainElement.parentElement;r(t,"position",this.cache.parentPosition),h(this.mainElement,!1),this.setText(this.defaultText),u(this.mainElement).to(this.defaultDestination,!0),E(this.mainElement)}setDefaultStyles(){this.setTextFontFamily(a.DEFAULT.TEXT_FONT),this.setTextWeight(a.DEFAULT.TEXT_WEIGHT),this.setTextColor(a.DEFAULT.TEXT_COLOR),this.setTextSize(a.DEFAULT.TEXT_SIZE),this.setSplashSource(a.DEFAULT.SPLASH_SOURCE),this.setSplashWidth(a.DEFAULT.SPLASH_WIDTH),this.setSplashHeight(a.DEFAULT.SPLASH_HEIGHT),this.setSplashAnimation(a.DEFAULT.SPLASH_ANIMATION),this.setBackgroundColor(a.DEFAULT.BACKGROUND_COLOR),this.setBackgroundBlur(a.DEFAULT.BACKGROUND_BLUR)}setText(t){this.textElement.innerText=t}setTextFontFamily(t){r(this.textElement,"fontFamily",t)}setTextWeight(t){r(this.textElement,"fontWeight",t)}setTextColor(t){r(this.textElement,"color",t)}setTextSize(t){r(this.textElement,"fontSize",t)}setSplashSource(t){this.splashElement.src=t,h(this.splashElement,!0)}setSplashWidth(t){r(this.splashElement,"width",t)}setSplashHeight(t){r(this.splashElement,"height",t)}setSplashAnimation(t){d(this.mainElement,"data-splash-animation",t)}setBackgroundColor(t){r(this.mainElement,"backgroundColor",t)}setBackgroundBlur(t){d(this.mainElement,"data-blur",t)}static getDestinationElement(t){const n=typeof t=="string",l=U(t),e=F(t);let i;if(n)i=O(t);else if(l)i=t();else if(e)i=t;else throw new y;return i}}window&&window instanceof Window&&new T().install()})();})();
1
+ var v=Object.defineProperty,b=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var w=(l,o,c)=>o in l?v(l,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[o]=c,S=(l,o)=>{for(var c in o||(o={}))y.call(o,c)&&w(l,c,o[c]);if(I)for(var c of I(o))C.call(o,c)&&w(l,c,o[c]);return l},p=(l,o)=>b(l,x(o));(function(){"use strict";const l=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const h of r.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerpolicy&&(r.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?r.credentials="include":s.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}};var o="";function c(i){return document.querySelector(i)}function T(i,e,t=!1){i&&e&&(e.hasChildNodes()&&t?e.insertBefore(i,e.firstChild):e.appendChild(i))}const u=i=>document.createElement(i);function a(i,...e){i.classList.add(...e)}function E(i,e,t){i.setAttribute(e,t)}class f{static destinationToNode(e){if(typeof e=="string"){const t=c(e);if(!t)throw new Error(`No match with ${e}`);return t}else if(e instanceof Node)return e;throw new Error("Destination argument must string or Node")}static createContextualApiObject(e){const t={getId:()=>e.getId(),remove:()=>e.delete(),moveTo:n=>e.moveTo(n),getText:()=>e.getText(),setText:n=>e.setText(n),getImgSrc:()=>e.getImgSrc(),setImgSrc:n=>e.setImgSrc(n)};return p(S({},t),{inside:n=>(e.moveTo(n),t)})}}class d{constructor(e,t,n){var s;this.nsRootElement=u("div"),this.nsWrapperElement=u("div"),this.nsWindowElement=u("div"),this.nsContentElement=u("div"),this.nsImageElement=u("img"),this.nsTextElement=u("div"),this.id=Math.random().toString(36).substring(2),this.nsInstance=e,this.nsTextElement.innerText=t,this.imgSrc=n,this.nsImageElement.src=(s=this.imgSrc)!=null?s:"",this.nsImageElement.alt=g.APP_NAME,this.assembleNSComponent(),this.setImgSrc(n)}assignCSSClasses(){a(this.nsContentElement,"ns-container"),a(this.nsWrapperElement,"ns-blur"),a(this.nsImageElement,"ns-img"),a(this.nsTextElement,"ns-text"),a(this.nsWindowElement,"ns","ns-window"),a(this.nsRootElement,"ns-wrapper")}assembleElementStructure(){this.nsContentElement.append(this.nsImageElement,this.nsTextElement),this.nsWindowElement.append(this.nsContentElement),this.nsRootElement.append(this.nsWrapperElement,this.nsWindowElement)}assembleNSComponent(){this.nsRootElement.id=this.getId(),E(this.nsRootElement,"data-ctx","nanosplash"),this.assembleElementStructure(),this.assignCSSClasses()}getId(){return this.id}getText(){return this.nsTextElement.innerText}setText(e){return this.nsTextElement.innerText=e,this}getImgSrc(){return this.imgSrc}setImgSrc(e){return this.nsImageElement.src=e!=null?e:"",this.nsImageElement.style.display=e?"block":"none",this.assembleElementStructure(),this}cleanup(){const e=this.nsRootElement.parentElement;e&&this.restoreDOMStructure(e)}resetFullscreenAttributes(){E(this.nsRootElement,"style",""),this.nsRootElement.classList.remove("ns-fs")}moveWithRegularStrategy(e){const t=e.parentNode;t&&(this.restoreDOMStructure(t),t.replaceChild(this.nsRootElement,e),this.nsWrapperElement.appendChild(e))}moveWithFullscreenStrategy(){this.nsRootElement.classList.add("ns-fs"),T(this.nsRootElement,document.body,!0)}moveTo(e){this.cleanup();const t=f.destinationToNode(e);t===document.body?this.moveWithFullscreenStrategy():(this.resetFullscreenAttributes(),this.moveWithRegularStrategy(t)),this.assembleNSComponent()}forEachWrappedNode(e){Array.from(this.nsWrapperElement.childNodes).forEach(e)}restoreDOMStructure(e){this.forEachWrappedNode(t=>e.insertBefore(t,this.nsRootElement))}removeElementsFromDOM(){[this.nsTextElement,this.nsImageElement,this.nsContentElement,this.nsWrapperElement,this.nsWindowElement,this.nsRootElement].forEach(e=>e.remove())}delete(){this.cleanup(),this.removeElementsFromDOM(),this.nsInstance.delete(this)}}class m{static ensureInstance(e,t,n,s){var r;return e||(e=new d(t,n,s)),e.setText(n).setImgSrc((r=e.getImgSrc())!=null?r:s)}static createImgFunction(e,t){return n=>(t=m.ensureInstance(t,e,"",n),{show:m.createShowFunction(e,t),progress:m.createProgressFunction(e,t),while:m.createWhileFunction(e,t)})}static createShowFunction(e,t){return n=>(t=m.ensureInstance(t,e,n),e.instances.set(t.getId(),t),t.moveTo(document.body),f.createContextualApiObject(t))}static createProgressFunction(e,t){return(...n)=>(t=m.ensureInstance(t,e,""),t.moveTo(document.body),(async()=>{for(const[s,[r,h]]of n.entries())t.setText(h),await r;t.delete()})(),f.createContextualApiObject(t))}static createWhileFunction(e,t){return n=>(t=m.ensureInstance(t,e,""),{show(s){return e.instances.set(t.getId(),t),t.moveTo(document.body),t.setText(s),n.finally(()=>t.delete()),f.createContextualApiObject(t)}})}}class g{constructor(){this.instances=new Map}img(e){return m.createImgFunction(this,new d(this,"",e))(e)}show(e){return m.createShowFunction(this,new d(this,e))(e)}progress(...e){return m.createProgressFunction(this,new d(this,""))(...e)}while(e){return m.createWhileFunction(this,new d(this,""))(e)}fifoIterate(e){let t=0;const n=this.instances.entries();for(const[s,r]of n)if(!e(s,r,t++))break}delete(e){this.instances.delete(e.getId())}hideAll(){this.instances.forEach(e=>e.delete())}hide(e){if(e){const t=this.instances.get(e);if(t)t.delete();else throw new Error(`Could not find element with id: ${e}`)}else this.fifoIterate((t,n,s)=>{const r=s===0;return r&&n.delete(),r})}}g.APP_NAME="Nanosplash",window.addEventListener("load",()=>window.ns=new g)})();
package/docs/style.css CHANGED
@@ -1 +1 @@
1
- @-webkit-keyframes pulse{0%{transform:scale(1)}to{transform:scale(1.1)}}@keyframes pulse{0%{transform:scale(1)}to{transform:scale(1.1)}}@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.nanosplash-container{align-items:center;border-radius:inherit;flex-direction:column;justify-content:center;overflow:inherit;position:absolute;z-index:1}.nanosplash-container[hidden=true]{display:none}.nanosplash-container:not([hidden=true]){display:flex}.nanosplash-container[data-blur=none]:not([hidden=true])~*{filter:blur(0)}.nanosplash-container[data-blur=light]:not([hidden=true])~*{filter:blur(2px)}.nanosplash-container[data-blur=medium]:not([hidden=true])~*{filter:blur(4px)}.nanosplash-container[data-blur=heavy]:not([hidden=true])~*{filter:blur(10px)}.nanosplash-container .nanosplash-text{text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-smoothing:antialiased;-webkit-font-smoothing:antialiased;text-shadow:0 0 2px rgba(0,0,0,.2)}.nanosplash-container img.nanosplash-img{margin-bottom:40px}.nanosplash-container[data-splash-animation=pulse]>img{-webkit-animation-direction:alternate;animation-direction:alternate;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:pulse;animation-name:pulse}.nanosplash-container[data-splash-animation=spin]>img{-webkit-animation-duration:.7s;animation-duration:.7s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:spin;animation-name:spin;-webkit-animation-timing-function:linear;animation-timing-function:linear}body>.nanosplash-container:not([hidden=true]){height:100vh;width:100%}
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:1rem;max-height:9rem;max-width:9rem}.ns-text{color:#333;text-align:center}
@@ -1,71 +1,22 @@
1
1
  :root {
2
- --light-hl-0: #008000;
3
- --dark-hl-0: #6A9955;
4
- --light-hl-1: #0000FF;
5
- --dark-hl-1: #569CD6;
6
- --light-hl-2: #000000;
7
- --dark-hl-2: #D4D4D4;
8
- --light-hl-3: #795E26;
9
- --dark-hl-3: #DCDCAA;
10
- --light-hl-4: #001080;
11
- --dark-hl-4: #9CDCFE;
12
- --light-hl-5: #A31515;
13
- --dark-hl-5: #CE9178;
14
- --light-hl-6: #AF00DB;
15
- --dark-hl-6: #C586C0;
16
- --light-code-background: #FFFFFF;
2
+ --light-code-background: #F5F5F5;
17
3
  --dark-code-background: #1E1E1E;
18
4
  }
19
5
 
20
6
  @media (prefers-color-scheme: light) { :root {
21
- --hl-0: var(--light-hl-0);
22
- --hl-1: var(--light-hl-1);
23
- --hl-2: var(--light-hl-2);
24
- --hl-3: var(--light-hl-3);
25
- --hl-4: var(--light-hl-4);
26
- --hl-5: var(--light-hl-5);
27
- --hl-6: var(--light-hl-6);
28
7
  --code-background: var(--light-code-background);
29
8
  } }
30
9
 
31
10
  @media (prefers-color-scheme: dark) { :root {
32
- --hl-0: var(--dark-hl-0);
33
- --hl-1: var(--dark-hl-1);
34
- --hl-2: var(--dark-hl-2);
35
- --hl-3: var(--dark-hl-3);
36
- --hl-4: var(--dark-hl-4);
37
- --hl-5: var(--dark-hl-5);
38
- --hl-6: var(--dark-hl-6);
39
11
  --code-background: var(--dark-code-background);
40
12
  } }
41
13
 
42
14
  body.light {
43
- --hl-0: var(--light-hl-0);
44
- --hl-1: var(--light-hl-1);
45
- --hl-2: var(--light-hl-2);
46
- --hl-3: var(--light-hl-3);
47
- --hl-4: var(--light-hl-4);
48
- --hl-5: var(--light-hl-5);
49
- --hl-6: var(--light-hl-6);
50
15
  --code-background: var(--light-code-background);
51
16
  }
52
17
 
53
18
  body.dark {
54
- --hl-0: var(--dark-hl-0);
55
- --hl-1: var(--dark-hl-1);
56
- --hl-2: var(--dark-hl-2);
57
- --hl-3: var(--dark-hl-3);
58
- --hl-4: var(--dark-hl-4);
59
- --hl-5: var(--dark-hl-5);
60
- --hl-6: var(--dark-hl-6);
61
19
  --code-background: var(--dark-code-background);
62
20
  }
63
21
 
64
- .hl-0 { color: var(--hl-0); }
65
- .hl-1 { color: var(--hl-1); }
66
- .hl-2 { color: var(--hl-2); }
67
- .hl-3 { color: var(--hl-3); }
68
- .hl-4 { color: var(--hl-4); }
69
- .hl-5 { color: var(--hl-5); }
70
- .hl-6 { color: var(--hl-6); }
71
22
  pre, code { background: var(--code-background); }