nanosplash 2.2.4 → 2.3.2
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.
- package/.github/workflows/production.yml +57 -0
- package/.github/workflows/release.yml +61 -0
- package/README.md +17 -15
- package/dist/iife/nanosplash.iife.js +1 -1
- package/dist/module/Nanosplash.css +1 -0
- package/dist/module/manifest.json +6 -3
- package/dist/module/nanosplash.cjs.js +1 -1
- package/dist/module/nanosplash.es.js +244 -330
- package/docs/index.html +54 -430
- package/docs/nanosplash.iife.js +1 -1
- package/docs/style.css +1 -1
- package/docs/typedoc/assets/highlight.css +1 -50
- package/docs/typedoc/assets/main.js +2 -2
- package/docs/typedoc/assets/search.js +1 -1
- package/docs/typedoc/assets/style.css +32 -2
- package/docs/typedoc/classes/Core_Nanosplash.Nanosplash.html +1 -0
- package/docs/typedoc/index.html +1 -1
- package/docs/typedoc/modules/Core_Nanosplash.html +1 -0
- package/docs/typedoc/modules/types.html +1 -1
- package/index.html +51 -412
- package/jest.config.ts +194 -0
- package/package.json +70 -65
- package/src/Core/Nanosplash.ts +74 -0
- package/src/Core/SplashInstance.ts +154 -0
- package/src/Factory/NanosplashFactory.ts +73 -0
- package/src/Interfaces/ContextualAPIInterface.ts +8 -0
- package/src/Interfaces/IdentityInterface.ts +3 -0
- package/src/Interfaces/ImageInterface.ts +5 -0
- package/src/Interfaces/InsideInterface.ts +5 -0
- package/src/Interfaces/NanosplashInterface.ts +4 -0
- package/src/Interfaces/ProgressInterface.ts +5 -0
- package/src/Interfaces/ShowInterface.ts +5 -0
- package/src/Interfaces/WhileInterface.ts +5 -0
- package/src/main.ts +2 -6
- package/src/repositories/NanosplashRepository.ts +34 -55
- package/src/style.sass +51 -61
- package/src/types.d.ts +45 -200
- package/src/utilities/dom.spec.ts +70 -0
- package/src/utilities/dom.ts +17 -256
- package/update-all.sh +3 -0
- package/vite.iife.config.js +46 -18
- package/vite.mod.config.js +48 -12
- package/vite.site.config.js +0 -3
- package/dist/module/style.css +0 -1
- package/docs/typedoc/classes/Nanosplash.Nanosplash-1.html +0 -56
- package/docs/typedoc/classes/types.Nanosplash.html +0 -56
- package/docs/typedoc/modules/Nanosplash.html +0 -1
- package/src/Exceptions/Exception.ts +0 -12
- package/src/Exceptions/IllegalArgumentException.ts +0 -9
- package/src/Exceptions/InvalidDestinationException.ts +0 -9
- package/src/Exceptions/MissingResourceException.ts +0 -9
- package/src/Nanosplash.ts +0 -484
- package/update-latest.sh +0 -21
package/docs/index.html
CHANGED
|
@@ -3,451 +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
|
-
<
|
|
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
|
-
|
|
18
|
-
(()=>{(function(){"use strict";const I=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const r of n.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&l(r)}).observe(document,{childList:!0,subtree:!0});function e(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerpolicy&&(n.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?n.credentials="include":i.crossorigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function l(i){if(i.ep)return;i.ep=!0;const n=e(i);fetch(i.href,n)}};class T extends Error{constructor(t){super(t);this.name=this.constructor.name}getName(){return this.constructor.name}}class L extends T{constructor(t){super(t)}}class w extends T{constructor(t){super(t)}}class N extends T{constructor(t){super(t)}}const O=s=>document.querySelector(s),S=s=>Array.from(document.querySelectorAll(s)),f=(s,t)=>{var l;const e=document.createElement(s);return t&&(e.id||(e.id=t.id+""),e.className||(e.className=t.className+""),(l=t.attributes)==null||l.filter(i=>i.value).forEach(({key:i,value:n})=>p(e,i,n)),t.content&&(typeof t.content=="string"?e.innerText=t.content:e.append(t.content))),e},E=(s,t)=>{s.hidden=!t,t?k(s,"hidden"):p(s,"hidden","true")},c=s=>({to:(t,e)=>{const l=Array.from(t.childNodes);if(l.length<1||!e){t.appendChild(s);return}const n=l[0];t.insertBefore(s,n)}}),d=s=>{const t=s.parentNode;t&&(e=>{const l="px",i=t===document.body;let n,r,h,u;i?n=scrollX+l:n=0+l,i?r=scrollY+l:r=0+l,i?h="100%":h=e.width+l,i?u="100vh":u=e.height+l,o(s,"left",n),o(s,"top",r),o(s,"width",h),o(s,"height",u)})(t.getBoundingClientRect())},F=(s,t,e)=>(([l,i])=>{e.forEach(n=>{l?l(`on${n}`,t):i(n,t,!0)})})([s.attachEvent,s.addEventListener]),C=s=>s instanceof Element||s instanceof Node,b=s=>s&&{}.toString.call(s)==="[object Function]",o=(s,t,e)=>{s.style[t]=e},p=(s,t,e)=>{s.setAttribute(t,e)},k=(s,t)=>{s.removeAttribute(t)};class a{static makeMainElement(){const t=f("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(){return f("img",{className:"nanosplash-img",attributes:[{key:"src",value:null},{key:"alt",value:"Nanosplash indicator"}]})}static makeTextElement(){return f("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_WIDTH:"100px",SPLASH_HEIGHT:"auto",SPLASH_ANIMATION:"pulse",BACKGROUND_COLOR:"rgba(255, 255, 255, 0.90)",BACKGROUND_BLUR:"light"};var U="";class m{constructor(t){var l,i,n,r,h;this.cache={parentPosition:""},this.defaultText=(i=(l=t==null?void 0:t.default)==null?void 0:l.text)!=null?i:a.DEFAULT.TEXT,this.defaultDestination=m.getDestinationElement((r=(n=t==null?void 0:t.default)==null?void 0:n.destination)!=null?r:a.DEFAULT.DESTINATION_NODE),this.mainElement=a.makeMainElement(),this.splashElement=a.makeSplashElement(),this.textElement=a.makeTextElement(),this.setDefaultStyles();const e=(h=t==null?void 0:t.splash)==null?void 0:h.src;e&&(this.setSplashSource(e),c(this.splashElement).to(this.mainElement)),c(this.textElement).to(this.mainElement),c(this.mainElement).to(this.defaultDestination,!0),E(this.mainElement,!1),d(this.mainElement),t&&this.configure(t)}install(){Object.defineProperty(window,"loading",{value:this,writable:!1}),F(window,()=>d(this.mainElement),["resize","scroll"]),m.checkStyleResources()}configure(t){var e,l,i,n,r,h,u,x,A,y,D,P;return((e=t==null?void 0:t.default)==null?void 0:e.destination)&&(this.defaultDestination=m.getDestinationElement(t.default.destination)),this.defaultText||(this.defaultText=(l=t.default)==null?void 0:l.text),((i=t.text)==null?void 0:i.family)&&this.setTextFontFamily(t.text.family),((n=t.text)==null?void 0:n.weight)&&this.setTextWeight(t.text.weight),((r=t.text)==null?void 0:r.color)&&this.setTextColor(t.text.color),((h=t.text)==null?void 0:h.size)&&this.setTextSize(t.text.size),((u=t.background)==null?void 0:u.color)&&this.setBackgroundColor(t.background.color),((x=t.background)==null?void 0:x.blur)&&this.setBackgroundBlur(t.background.blur),t.splash?(((A=t.splash)==null?void 0:A.src)&&(this.mainElement.contains(this.splashElement)||c(this.splashElement).to(this.mainElement,!0),this.setSplashSource(t.splash.src)),((y=t.splash)==null?void 0:y.width)&&this.setSplashWidth(t.splash.width),((D=t.splash)==null?void 0:D.height)&&this.setSplashHeight(t.splash.height),((P=t.splash)==null?void 0:P.animation)&&this.setSplashAnimation(t.splash.animation)):E(this.splashElement,!1),this}show(t){this.setText(t!=null?t:a.DEFAULT.TEXT),E(this.mainElement,!0);const e=l=>l.finally(()=>this.hide());return{inside:l=>{this.restoreParentPosition();const i=m.getDestinationElement(l);return c(this.mainElement).to(i,!0),d(this.mainElement),this.setParentPositionToRelative(),{during:e}},during:e}}hide(){this.restoreParentPosition(),E(this.mainElement,!1),this.setText(this.defaultText),c(this.mainElement).to(this.defaultDestination,!0),d(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.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)}doIfParentExist(t){(e=>{e&&t(e)})(this.mainElement.parentElement)}setParentPosition(t){this.doIfParentExist(e=>{o(e,"position",t)})}cacheParentPosition(){this.doIfParentExist(t=>{this.cache.parentPosition=t.style.position})}restoreParentPosition(){this.setParentPosition(this.cache.parentPosition)}setParentPositionToRelative(){this.cacheParentPosition(),this.setParentPosition("relative")}setText(t){this.textElement.innerText=t}setTextFontFamily(t){o(this.textElement,"fontFamily",t)}setTextWeight(t){o(this.textElement,"fontWeight",t)}setTextColor(t){o(this.textElement,"color",t)}setTextSize(t){o(this.textElement,"fontSize",t)}setSplashSource(t){this.splashElement.src=t,E(this.splashElement,!0)}setSplashWidth(t){o(this.splashElement,"width",t)}setSplashHeight(t){o(this.splashElement,"height",t)}setSplashAnimation(t){p(this.mainElement,"data-splash-animation",t)}setBackgroundColor(t){o(this.mainElement,"backgroundColor",t)}setBackgroundBlur(t){p(this.mainElement,"data-blur",t)}static checkStyleResources(){window.addEventListener("load",async function(){const t=S('link[href*="nanosplash"]'),e=n=>/\.nanosplash/.test(n.innerText),l=S("style").filter(e);if(!(t.length>0||l.length>0))throw new N("Missing the Nanosplash CSS")})}static getDestinationElement(t){const e=typeof t=="string",l=b(t),i=C(t);let n;if(e)n=O(t);else if(l)n=t();else if(i)n=t;else throw new L;if(!n)throw new w("Destination element is falsy");return n}}window&&window instanceof Window&&new m().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
|
-
<
|
|
28
|
-
<div
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
class="
|
|
56
|
-
mt-3
|
|
57
|
-
md:mt-6
|
|
58
|
-
text-xs
|
|
59
|
-
sm:text-sm
|
|
60
|
-
font-mono
|
|
61
|
-
p-2
|
|
62
|
-
bg-gray-700
|
|
63
|
-
rounded
|
|
64
|
-
"
|
|
65
|
-
>
|
|
66
|
-
loading.show(<span class="text-green-400">text</span
|
|
67
|
-
>).inside(<span class="text-green-400">element</span>)
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</section>
|
|
71
|
-
<section class="py-3 bg-gray-800">
|
|
72
|
-
<div class="flex flex-col space-y-2">
|
|
73
|
-
<div class="flex space-x-2 justify-center">
|
|
74
|
-
<img src="https://badgen.net/npm/v/nanosplash" />
|
|
75
|
-
<img src="https://badgen.net/npm/types/nanosplash" />
|
|
76
|
-
<img src="https://badgen.net/npm/dw/nanosplash" />
|
|
77
|
-
</div>
|
|
78
|
-
<div class="flex space-x-2 justify-center">
|
|
79
|
-
<img src="https://badgen.net/bundlephobia/min/nanosplash" />
|
|
80
|
-
<img
|
|
81
|
-
src="https://badgen.net/bundlephobia/tree-shaking/nanosplash"
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
</section>
|
|
86
|
-
</div>
|
|
87
|
-
<section class="flex flex-col items-center py-10 md:pt-16 md:pb-10">
|
|
88
|
-
<div
|
|
89
|
-
class="
|
|
90
|
-
text-center text-xl
|
|
91
|
-
md:text-2xl
|
|
92
|
-
font-light
|
|
93
|
-
text-gray-600
|
|
94
|
-
flex
|
|
95
|
-
justify-center
|
|
96
|
-
mb-2
|
|
97
|
-
md:mb-3
|
|
98
|
-
"
|
|
99
|
-
>
|
|
100
|
-
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
|
+
/>
|
|
101
31
|
</div>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
>
|
|
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
|
+
[promise1, 'Loading A'],<br>
|
|
41
|
+
[promise2, 'Loading B'],<br>
|
|
42
|
+
[promise3, 'Loading C'],<br>
|
|
43
|
+
).inside('#myDiv')
|
|
110
44
|
</div>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
font-light
|
|
117
|
-
text-gray-600
|
|
118
|
-
flex
|
|
119
|
-
justify-center
|
|
120
|
-
mb-2
|
|
121
|
-
md:mb-3
|
|
122
|
-
"
|
|
123
|
-
>
|
|
124
|
-
Demo
|
|
125
|
-
</div>
|
|
126
|
-
<div class="text-center text-gray-500 flex font-light justify-center">
|
|
127
|
-
Play around with Nanosplash using the<br />
|
|
128
|
-
controls below. The demo serves as a<br />
|
|
129
|
-
showcase of what it has to offer.
|
|
130
|
-
</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')
|
|
131
50
|
</div>
|
|
132
|
-
</
|
|
133
|
-
<
|
|
134
|
-
<div class="
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<input
|
|
140
|
-
type="text"
|
|
141
|
-
name="splash-src"
|
|
142
|
-
id="splash-src"
|
|
143
|
-
value="doughnut.png"
|
|
144
|
-
class="
|
|
145
|
-
py-3
|
|
146
|
-
px-4
|
|
147
|
-
text-gray-400
|
|
148
|
-
bg-white
|
|
149
|
-
appearance-none
|
|
150
|
-
rounded-lg
|
|
151
|
-
"
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
<div class="grid sm:grid-cols-1 md:grid-cols-2 gap-5">
|
|
155
|
-
<div class="flex flex-col">
|
|
156
|
-
<label class="text-gray-600 mb-2" for="anim">Animation</label>
|
|
157
|
-
<select
|
|
158
|
-
class="
|
|
159
|
-
py-3
|
|
160
|
-
px-4
|
|
161
|
-
text-gray-400
|
|
162
|
-
bg-white
|
|
163
|
-
cursor-pointer
|
|
164
|
-
appearance-none
|
|
165
|
-
rounded-lg
|
|
166
|
-
"
|
|
167
|
-
name="anim"
|
|
168
|
-
id="anim"
|
|
169
|
-
>
|
|
170
|
-
<option value="none" selected disabled>Choose animation</option>
|
|
171
|
-
<option value="none">None</option>
|
|
172
|
-
<option value="pulse">Pulse</option>
|
|
173
|
-
<option value="spin">Spin</option>
|
|
174
|
-
</select>
|
|
175
|
-
</div>
|
|
176
|
-
<div class="flex flex-col">
|
|
177
|
-
<label class="text-gray-600 mb-2" for="elem"
|
|
178
|
-
>Show inside element</label
|
|
179
|
-
>
|
|
180
|
-
<select
|
|
181
|
-
class="
|
|
182
|
-
py-3
|
|
183
|
-
px-4
|
|
184
|
-
text-gray-400
|
|
185
|
-
bg-white
|
|
186
|
-
cursor-pointer
|
|
187
|
-
appearance-none
|
|
188
|
-
rounded-lg
|
|
189
|
-
"
|
|
190
|
-
name="elem"
|
|
191
|
-
id="elem"
|
|
192
|
-
>
|
|
193
|
-
<option value="none" selected disabled>Choose location</option>
|
|
194
|
-
<option value="body">Fullscreen (3s)</option>
|
|
195
|
-
<option value="#title">Title section</option>
|
|
196
|
-
<option value="#col1">Column 1</option>
|
|
197
|
-
<option value="#col2">Column 2</option>
|
|
198
|
-
<option value="#col3">Column 3</option>
|
|
199
|
-
</select>
|
|
200
|
-
</div>
|
|
201
|
-
<div class="flex flex-col">
|
|
202
|
-
<label class="text-gray-600 mb-2" for="text">Loading text</label>
|
|
203
|
-
<input
|
|
204
|
-
class="
|
|
205
|
-
py-3
|
|
206
|
-
px-4
|
|
207
|
-
appearance-none
|
|
208
|
-
rounded-lg
|
|
209
|
-
bg-white
|
|
210
|
-
text-gray-400
|
|
211
|
-
"
|
|
212
|
-
type="text"
|
|
213
|
-
name="text"
|
|
214
|
-
id="text"
|
|
215
|
-
value="Loading assets ..."
|
|
216
|
-
/>
|
|
217
|
-
</div>
|
|
218
|
-
<div class="flex flex-col">
|
|
219
|
-
<label class="text-gray-600 mb-2" for="show"
|
|
220
|
-
>Display loading screen</label
|
|
221
|
-
>
|
|
222
|
-
<div
|
|
223
|
-
id="show"
|
|
224
|
-
class="
|
|
225
|
-
bg-purple-900
|
|
226
|
-
text-gray-300
|
|
227
|
-
cursor-pointer
|
|
228
|
-
py-3
|
|
229
|
-
px-4
|
|
230
|
-
rounded-lg
|
|
231
|
-
"
|
|
232
|
-
>
|
|
233
|
-
Show loading screen
|
|
234
|
-
</div>
|
|
235
|
-
</div>
|
|
236
|
-
</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()
|
|
237
58
|
</div>
|
|
238
|
-
</
|
|
239
|
-
<
|
|
240
|
-
<div class="
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
left-2
|
|
249
|
-
uppercase
|
|
250
|
-
bg-gray-500
|
|
251
|
-
text-white
|
|
252
|
-
pill
|
|
253
|
-
font-mono
|
|
254
|
-
tracking-wider
|
|
255
|
-
rounded
|
|
256
|
-
"
|
|
257
|
-
>
|
|
258
|
-
Column 1
|
|
259
|
-
</div>
|
|
260
|
-
<div class="text-4xl text-center">
|
|
261
|
-
<i class="lni lni-bolt-alt"></i>
|
|
262
|
-
</div>
|
|
263
|
-
<div class="text-xl font-medium my-6 text-center">
|
|
264
|
-
Tiny and lightning fast
|
|
265
|
-
</div>
|
|
266
|
-
<div>It is only 6kB in size, and it's lightning fast.</div>
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
<div id="col2" class="bg-white rounded-2xl shadow-lg">
|
|
270
|
-
<div class="relative p-8 rounded-2xl">
|
|
271
|
-
<div
|
|
272
|
-
class="
|
|
273
|
-
absolute
|
|
274
|
-
top-2
|
|
275
|
-
left-2
|
|
276
|
-
uppercase
|
|
277
|
-
bg-gray-500
|
|
278
|
-
text-white
|
|
279
|
-
pill
|
|
280
|
-
font-mono
|
|
281
|
-
tracking-wider
|
|
282
|
-
rounded
|
|
283
|
-
"
|
|
284
|
-
>
|
|
285
|
-
Column 2
|
|
286
|
-
</div>
|
|
287
|
-
<div class="text-4xl text-center">
|
|
288
|
-
<i class="lni lni-code"></i>
|
|
289
|
-
</div>
|
|
290
|
-
<div class="text-xl font-medium my-6 text-center">
|
|
291
|
-
Vanilla JS
|
|
292
|
-
</div>
|
|
293
|
-
<div>
|
|
294
|
-
Written from the ground up in vanilla JavaScript and comes
|
|
295
|
-
without any libraries.
|
|
296
|
-
</div>
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
<div id="col3" class="bg-white rounded-2xl shadow-lg">
|
|
300
|
-
<div class="relative p-8 rounded-2xl">
|
|
301
|
-
<div
|
|
302
|
-
class="
|
|
303
|
-
absolute
|
|
304
|
-
top-2
|
|
305
|
-
left-2
|
|
306
|
-
uppercase
|
|
307
|
-
bg-gray-500
|
|
308
|
-
text-white
|
|
309
|
-
pill
|
|
310
|
-
font-mono
|
|
311
|
-
tracking-wider
|
|
312
|
-
rounded
|
|
313
|
-
"
|
|
314
|
-
>
|
|
315
|
-
Column 3
|
|
316
|
-
</div>
|
|
317
|
-
<div class="text-4xl text-center">
|
|
318
|
-
<i class="lni lni-grid-alt"></i>
|
|
319
|
-
</div>
|
|
320
|
-
<div class="text-xl font-medium my-6 text-center">
|
|
321
|
-
ESM + CJS
|
|
322
|
-
</div>
|
|
323
|
-
<div>
|
|
324
|
-
Nanosplash comes in both ES and CJS modules, making it easy
|
|
325
|
-
for you to import it into your code.
|
|
326
|
-
</div>
|
|
327
|
-
</div>
|
|
328
|
-
</div>
|
|
329
|
-
</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.
|
|
330
69
|
</div>
|
|
331
|
-
</
|
|
332
|
-
</
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
333
72
|
<footer>
|
|
334
|
-
<section class="py-4 flex justify-center flex-grow-0">
|
|
335
|
-
<div class="container mx-5">
|
|
336
|
-
<div class="flex space-x-3 justify-center items-center text-gray-600">
|
|
337
|
-
<div class="text-2xl">
|
|
338
|
-
<i class="lni lni-github-original"></i>
|
|
339
|
-
</div>
|
|
340
|
-
<div>
|
|
341
|
-
Developed by
|
|
342
|
-
<a
|
|
343
|
-
class="text-purple-400 hover:text-purple-500"
|
|
344
|
-
href="https://github.com/isakhauge"
|
|
345
|
-
target="_blank"
|
|
346
|
-
>Isak Hauge</a
|
|
347
|
-
>
|
|
348
|
-
</div>
|
|
349
|
-
</div>
|
|
350
|
-
</div>
|
|
351
|
-
</section>
|
|
352
73
|
|
|
353
|
-
|
|
354
|
-
<!-- Demo -->
|
|
355
|
-
<script>
|
|
356
|
-
const ref = function (v) {
|
|
357
|
-
return document.querySelector(v)
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// Elements
|
|
361
|
-
const textSplashElem = ref('#splash-src')
|
|
362
|
-
const selectAnimElem = ref('#anim')
|
|
363
|
-
const selectDestinationElem = ref('#elem')
|
|
364
|
-
const textElem = ref('#text')
|
|
365
|
-
const showBtn = ref('#show')
|
|
366
|
-
|
|
367
|
-
const cache = {
|
|
368
|
-
animation: 'none',
|
|
369
|
-
domSelector: 'body',
|
|
370
|
-
text: textElem.value,
|
|
371
|
-
showNextTime: true,
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
const text = (function (postfix) {
|
|
375
|
-
return {
|
|
376
|
-
show: 'Show ' + postfix,
|
|
377
|
-
hide: 'Hide ' + postfix,
|
|
378
|
-
}
|
|
379
|
-
})('loading screen')
|
|
380
|
-
|
|
381
|
-
const display = function () {
|
|
382
|
-
const doughnutSrc =
|
|
383
|
-
'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/285/doughnut_1f369.png'
|
|
384
|
-
showBtn.innerText = 'Hide loading screen'
|
|
385
|
-
cache.showNextTime = false
|
|
386
|
-
const isDoughnut = textSplashElem.value === 'doughnut.png'
|
|
387
|
-
const splashSrc = isDoughnut ? doughnutSrc : textSplashElem.value
|
|
388
|
-
const text = textElem.value
|
|
389
|
-
const anim = selectAnimElem.value
|
|
390
|
-
const elem = selectDestinationElem.value
|
|
391
|
-
loading
|
|
392
|
-
.configure({
|
|
393
|
-
splash: { animation: cache.animation, src: splashSrc },
|
|
394
|
-
})
|
|
395
|
-
.show(cache.text)
|
|
396
|
-
.inside(cache.domSelector)
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
const hide = function () {
|
|
400
|
-
showBtn.innerText = 'Show loading screen'
|
|
401
|
-
cache.showNextTime = true
|
|
402
|
-
loading.hide()
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const onSelectAnim = function ({ target }) {
|
|
406
|
-
cache.animation = target.value
|
|
407
|
-
}
|
|
408
|
-
const onSelectDestination = function ({ target }) {
|
|
409
|
-
cache.domSelector = target.value
|
|
410
|
-
}
|
|
411
|
-
const onInputText = function ({ target }) {
|
|
412
|
-
cache.text = target.value
|
|
413
|
-
}
|
|
414
|
-
const onClickBtn = function () {
|
|
415
|
-
if (cache.showNextTime) {
|
|
416
|
-
display()
|
|
417
|
-
const isBody = cache.domSelector === 'body'
|
|
418
|
-
if (isBody) {
|
|
419
|
-
setTimeout(hide, 3000)
|
|
420
|
-
}
|
|
421
|
-
} else {
|
|
422
|
-
hide()
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
selectAnimElem.addEventListener('input', onSelectAnim)
|
|
427
|
-
selectDestinationElem.addEventListener('input', onSelectDestination)
|
|
428
|
-
textElem.addEventListener('input', onInputText)
|
|
429
|
-
showBtn.addEventListener('click', onClickBtn)
|
|
430
|
-
</script>
|
|
431
|
-
|
|
432
|
-
<!-- Nanosplash -->
|
|
433
|
-
<script>
|
|
434
|
-
window.addEventListener('load', () => {
|
|
435
|
-
window.loading.configure({
|
|
436
|
-
splash: {
|
|
437
|
-
src: 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/285/doughnut_1f369.png',
|
|
438
|
-
},
|
|
439
|
-
})
|
|
440
|
-
})
|
|
441
|
-
</script>
|
|
442
74
|
</footer>
|
|
443
|
-
<style>
|
|
444
|
-
body {
|
|
445
|
-
min-height: 100vh;
|
|
446
|
-
}
|
|
447
|
-
.pill {
|
|
448
|
-
font-size: 10px;
|
|
449
|
-
padding: 0.2em 0.5em;
|
|
450
|
-
}
|
|
451
|
-
</style>
|
|
75
|
+
<style>body{min-height:100vh}.pill{font-size:10px;padding:.2em .5em}</style>
|
|
452
76
|
</body>
|
|
453
77
|
</html>
|
package/docs/nanosplash.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{(function(){"use strict";const
|
|
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
|
-
|
|
1
|
+
@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:"..."}}
|
|
@@ -1,71 +1,22 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--light-
|
|
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); }
|