nanosplash 4.0.8 → 4.0.17
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/LICENSE +21 -0
- package/README.md +23 -25
- package/dist/cjs/ns.cjs.js +1 -1
- package/dist/es/ns.es.js +24 -27
- package/dist/iife/ns.iife.js +1 -1
- package/package.json +30 -23
- package/{src/types → types}/global.d.ts +1 -1
- package/{src/interfaces/INSElement.ts → types/interfaces/INSElement.d.ts} +1 -1
- package/{src/interfaces/INanosplash.ts → types/interfaces/INanosplash.d.ts} +2 -2
- package/.github/workflows/ci.all.yml +0 -32
- package/.github/workflows/ci.prod.pull_request.yml +0 -54
- package/.github/workflows/ci.prod.push.yml +0 -61
- package/.github/workflows/ci.test.yml +0 -56
- package/.github/workflows/reusable.build.yml +0 -42
- package/.github/workflows/reusable.format.yml +0 -55
- package/.github/workflows/reusable.lint.yml +0 -30
- package/.github/workflows/reusable.npm-publish.yml +0 -61
- package/.github/workflows/reusable.test.yml +0 -50
- package/.prettierrc +0 -11
- package/bun.lock +0 -765
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -176
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/composables/index.html +0 -116
- package/coverage/lcov-report/src/composables/ns.ts.html +0 -547
- package/coverage/lcov-report/src/constants/index.html +0 -116
- package/coverage/lcov-report/src/constants/ns.ts.html +0 -124
- package/coverage/lcov-report/src/iife.ts.html +0 -100
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/interfaces/INSElement.ts.html +0 -100
- package/coverage/lcov-report/src/interfaces/INanosplash.ts.html +0 -304
- package/coverage/lcov-report/src/interfaces/index.html +0 -131
- package/coverage/lcov-report/src/utils/dom-utils.ts.html +0 -289
- package/coverage/lcov-report/src/utils/index.html +0 -116
- package/coverage/lcov.info +0 -271
- package/eslint.config.js +0 -14
- package/src/composables/ns.ts +0 -154
- package/src/constants/ns.ts +0 -13
- package/src/iife.ts +0 -5
- package/src/style/ns.css +0 -134
- package/src/utils/dom-utils.ts +0 -68
- package/src/vite-env.d.ts +0 -1
- package/tests/ns.spec.ts +0 -123
- package/tsconfig.json +0 -31
- package/vite.config.ts +0 -36
- package/vitest.config.ts +0 -20
- /package/{src/types → types}/dom.d.ts +0 -0
- /package/{src/types → types}/generic/function.d.ts +0 -0
- /package/{src/types → types}/semantic/number.d.ts +0 -0
- /package/{src/types → types}/semantic/string.d.ts +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Nanosplash, Copyright (c) 2025 Isak Hauge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,12 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
**The tiny loading screen for web artisans**
|
|
4
4
|
|
|
5
|
-
[](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml)
|
|
6
|
+
[](https://coveralls.io/github/isakhauge/nanosplash?branch=main)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
### Nanosplash is
|
|
10
|
+
### Nanosplash is a 3KB zero-dependency library for effortless loading screens. Its 2-function API lets you add fullscreen or container-based spinners in seconds, fully customizable with CSS. Fast, beautiful, and simple.
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
// Display spinner fullscreen
|
|
14
|
+
show('Loading')
|
|
15
|
+
|
|
16
|
+
// Display spinner in target
|
|
17
|
+
show('Loading', '#my-div')
|
|
18
|
+
|
|
19
|
+
// Hide spinner
|
|
20
|
+
hide()
|
|
21
|
+
```
|
|
11
22
|
|
|
12
23
|
## Features
|
|
13
24
|
|
|
@@ -41,38 +52,31 @@ The show function displays a Nanosplash loading indicator on your page.
|
|
|
41
52
|
You can pass in optional text to display with the spinner, and an optional target element (or CSS selector) to control where it appears.
|
|
42
53
|
If no target is provided, Nanosplash will create a fullscreen splash covering the entire viewport.
|
|
43
54
|
|
|
44
|
-
```
|
|
55
|
+
```ts
|
|
45
56
|
show(text?: string, target?: string | Element): number
|
|
46
57
|
```
|
|
47
58
|
|
|
48
|
-
#### Parameters
|
|
49
|
-
|
|
50
|
-
| Parameter | Type | Description |
|
|
51
|
-
|-----------|----------------------------------|-------------------------------------------------------------|
|
|
52
|
-
| `text` | `string \| undefined` | Optional. Text to display alongside the spinner. |
|
|
53
|
-
| `target` | `string \| Element \| undefined` | Optional. CSS selector or an element to contain the splash. |
|
|
54
|
-
|
|
55
59
|
#### Examples:
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
**Fullscreen spinner only:**
|
|
58
62
|
|
|
59
63
|
```js
|
|
60
64
|
ns.show()
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
**Fullscreen text and spinner:**
|
|
64
68
|
|
|
65
69
|
```js
|
|
66
70
|
ns.show('Loading...')
|
|
67
71
|
```
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
**Spinner only within a specific element:**
|
|
70
74
|
|
|
71
75
|
```js
|
|
72
76
|
ns.show(null, '#my-div')
|
|
73
77
|
```
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
**Text and spinner within a specific element:**
|
|
76
80
|
|
|
77
81
|
```js
|
|
78
82
|
ns.show('Please wait', '#my-div')
|
|
@@ -84,31 +88,25 @@ The hide function removes one or more Nanosplash loading indicators from your pa
|
|
|
84
88
|
By default, it removes the oldest fullscreen splash (FIFO). If you want to remove a specific splash, you can pass its ID (returned by show).
|
|
85
89
|
You can also remove all splashes at once by passing the wildcard '*'.
|
|
86
90
|
|
|
87
|
-
```
|
|
91
|
+
```ts
|
|
88
92
|
hide(id?: number | '*'): void
|
|
89
93
|
```
|
|
90
|
-
#### Arguments
|
|
91
|
-
|
|
92
|
-
| Parameter | Type | Description |
|
|
93
|
-
|-----------|-----------------------|------------------------------------------------------------|
|
|
94
|
-
| `id` | `number \| undefined` | Optional. The ID of the Nanosplash to remove. |
|
|
95
|
-
|
|
96
94
|
#### Examples:
|
|
97
95
|
|
|
98
|
-
|
|
96
|
+
**Remove the oldest (FIFO) fullscreen Nanosplash:**
|
|
99
97
|
|
|
100
98
|
```js
|
|
101
99
|
ns.hide()
|
|
102
100
|
```
|
|
103
101
|
|
|
104
|
-
|
|
102
|
+
**Remove a specific Nanosplash by ID:**
|
|
105
103
|
|
|
106
104
|
```js
|
|
107
105
|
const id = ns.show() // 1700000000000
|
|
108
106
|
ns.hide(id)
|
|
109
107
|
```
|
|
110
108
|
|
|
111
|
-
|
|
109
|
+
**Remove all Nanosplashes:**
|
|
112
110
|
|
|
113
111
|
```js
|
|
114
112
|
ns.hide('*')
|
package/dist/cjs/ns.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I='@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{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 nsFade{0%{opacity:0}to{opacity:1}}@keyframes nsAscend{0%{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}:root{--ns-top: 0}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Inter", "Helvetica", "Arial";--weight: 400;--bg: rgba(255, 255, 255, .9);--zIdx: 9999999999;--blur: blur(5px);position:relative;z-index:var(--zIdx)}.nsh:before{width:100%;height:100%;bottom:0;right:0;position:absolute;content:"";background-color:var(--bg);backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:var(--size)}body.nsh,body.nsh:before{width:100%;height:100%;position:fixed;top:var(--ns-top);left:0}.ns{width:100%;height:100%;bottom:0;right:0;display:flex;justify-content:center;align-items:center;position:absolute;z-index:calc(var(--zIdx) + 2);animation:nsFade 2s;gap:var(--relSize)}.nst{color:var(--color);font-size:var(--size);font-family:var(--font),sans-serif;font-weight:var(--weight);max-width:80dvw;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-shadow:0 0 .06rem rgba(0,0,0,.25);filter:drop-shadow(0 0 .07rem rgba(0,0,0,.25));animation:nsAscend .5s}.nss{display:block;width:var(--relSize);height:var(--relSize);animation:nsAscend .5s}.nss>svg{animation:nsRotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:nsDash 1.5s ease-in-out infinite}',d=()=>globalThis.document,l=()=>globalThis.document.body,y=s=>Array.from(s),u=(s,o)=>y(s.querySelectorAll(o)),h=(s,o)=>u(s,o)[0]??null,N=s=>s instanceof Element?s:h(d(),s),c=(s,...o)=>{const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I='@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{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 nsFade{0%{opacity:0}to{opacity:1}}@keyframes nsAscend{0%{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}:root{--ns-top: 0}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Inter", "Helvetica", "Arial";--weight: 400;--bg: rgba(255, 255, 255, .9);--zIdx: 9999999999;--blur: blur(5px);position:relative;z-index:var(--zIdx)}.nsh:before{width:100%;height:100%;bottom:0;right:0;position:absolute;content:"";background-color:var(--bg);backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:var(--size)}body.nsh,body.nsh:before{width:100%;height:100%;position:fixed;top:var(--ns-top);left:0}.ns{width:100%;height:100%;bottom:0;right:0;display:flex;justify-content:center;align-items:center;position:absolute;z-index:calc(var(--zIdx) + 2);animation:nsFade 2s;gap:var(--relSize)}.nst{color:var(--color);font-size:var(--size);font-family:var(--font),sans-serif;font-weight:var(--weight);max-width:80dvw;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-shadow:0 0 .06rem rgba(0,0,0,.25);filter:drop-shadow(0 0 .07rem rgba(0,0,0,.25));animation:nsAscend .5s}.nss{display:block;width:var(--relSize);height:var(--relSize);animation:nsAscend .5s}.nss>svg{animation:nsRotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:nsDash 1.5s ease-in-out infinite}',d=()=>globalThis.document,l=()=>globalThis.document.body,y=s=>Array.from(s),u=(s,o)=>y(s.querySelectorAll(o)),h=(s,o)=>u(s,o)[0]??null,N=s=>s instanceof Element?s:h(d(),s),c=(s,...o)=>{const i=d().createElement("div");return s&&i.classList.add(s),i.append(...o),i},v=s=>{const o=c();return o.innerHTML=s,o.firstChild},r={ns:"ns",nsHost:"nsh",nsText:"nst",nsSpinner:"nss"},m={ns:"."+r.ns,nsText:"."+r.nsText},A="4.0.17",E=()=>{const s=()=>u(d(),m.ns),o=()=>{const t=v('<svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none /></svg>'),n=c(r.ns,c(r.nsText),c(r.nsSpinner,t));return n.nsId=Date.now(),n},i=()=>s().sort((e,t)=>e.nsId-t.nsId),b=()=>i()[0]??null,g=(e,t)=>{if(h(e,m.nsText)?.remove(),!t)return;const n=c(r.nsText,t);e.insertBefore(n,e.firstChild)},x=(e,t)=>{const n=t.firstElementChild;n&&t.insertBefore(e,n),t.append(e),t.classList.add(r.nsHost)},w=e=>y(e.children).find(n=>n.classList.contains(r.ns)),k=(e,t)=>{const n=t?N(t)??l():l();let a;const p=w(n);if(p?a=p:(a=o(),x(a,n)),g(a,e??""),n===l()){const T=scrollY+"px";l().style.setProperty("--ns-top",T)}return a.nsId},f=e=>{e?.parentElement?.classList.remove(r.nsHost),e?.remove()},z=e=>s().find(t=>t.nsId===e)??null,S=e=>{e==="*"?s().forEach(f):f(typeof e=="number"?z(e):b())};return(()=>{h(d(),"#ns")?.remove();const e=v(`<style id="ns">${I}</style>`);l().append(e)})(),{show:k,hide:S,version:A}};exports.useNs=E;
|
package/dist/es/ns.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const T = '@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{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 nsFade{0%{opacity:0}to{opacity:1}}@keyframes nsAscend{0%{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}:root{--ns-top: 0}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Inter", "Helvetica", "Arial";--weight: 400;--bg: rgba(255, 255, 255, .9);--zIdx: 9999999999;--blur: blur(5px);position:relative;z-index:var(--zIdx)}.nsh:before{width:100%;height:100%;bottom:0;right:0;position:absolute;content:"";background-color:var(--bg);backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:var(--size)}body.nsh,body.nsh:before{width:100%;height:100%;position:fixed;top:var(--ns-top);left:0}.ns{width:100%;height:100%;bottom:0;right:0;display:flex;justify-content:center;align-items:center;position:absolute;z-index:calc(var(--zIdx) + 2);animation:nsFade 2s;gap:var(--relSize)}.nst{color:var(--color);font-size:var(--size);font-family:var(--font),sans-serif;font-weight:var(--weight);max-width:80dvw;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-shadow:0 0 .06rem rgba(0,0,0,.25);filter:drop-shadow(0 0 .07rem rgba(0,0,0,.25));animation:nsAscend .5s}.nss{display:block;width:var(--relSize);height:var(--relSize);animation:nsAscend .5s}.nss>svg{animation:nsRotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:nsDash 1.5s ease-in-out infinite}', d = () => globalThis.document, l = () => globalThis.document.body, y = (
|
|
2
|
-
const
|
|
3
|
-
return
|
|
4
|
-
}, v = (
|
|
1
|
+
const T = '@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{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 nsFade{0%{opacity:0}to{opacity:1}}@keyframes nsAscend{0%{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}:root{--ns-top: 0}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Inter", "Helvetica", "Arial";--weight: 400;--bg: rgba(255, 255, 255, .9);--zIdx: 9999999999;--blur: blur(5px);position:relative;z-index:var(--zIdx)}.nsh:before{width:100%;height:100%;bottom:0;right:0;position:absolute;content:"";background-color:var(--bg);backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:var(--size)}body.nsh,body.nsh:before{width:100%;height:100%;position:fixed;top:var(--ns-top);left:0}.ns{width:100%;height:100%;bottom:0;right:0;display:flex;justify-content:center;align-items:center;position:absolute;z-index:calc(var(--zIdx) + 2);animation:nsFade 2s;gap:var(--relSize)}.nst{color:var(--color);font-size:var(--size);font-family:var(--font),sans-serif;font-weight:var(--weight);max-width:80dvw;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-shadow:0 0 .06rem rgba(0,0,0,.25);filter:drop-shadow(0 0 .07rem rgba(0,0,0,.25));animation:nsAscend .5s}.nss{display:block;width:var(--relSize);height:var(--relSize);animation:nsAscend .5s}.nss>svg{animation:nsRotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:nsDash 1.5s ease-in-out infinite}', d = () => globalThis.document, l = () => globalThis.document.body, y = (e) => Array.from(e), u = (e, o) => y(e.querySelectorAll(o)), h = (e, o) => u(e, o)[0] ?? null, A = (e) => e instanceof Element ? e : h(d(), e), c = (e, ...o) => {
|
|
2
|
+
const i = d().createElement("div");
|
|
3
|
+
return e && i.classList.add(e), i.append(...o), i;
|
|
4
|
+
}, v = (e) => {
|
|
5
5
|
const o = c();
|
|
6
|
-
return o.innerHTML =
|
|
6
|
+
return o.innerHTML = e, o.firstChild;
|
|
7
7
|
}, r = {
|
|
8
8
|
ns: "ns",
|
|
9
9
|
nsHost: "nsh",
|
|
@@ -12,46 +12,43 @@ const T = '@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{0%
|
|
|
12
12
|
}, m = {
|
|
13
13
|
ns: "." + r.ns,
|
|
14
14
|
nsText: "." + r.nsText
|
|
15
|
-
}, N = "4.0.
|
|
16
|
-
const
|
|
15
|
+
}, N = "4.0.17", H = () => {
|
|
16
|
+
const e = () => u(d(), m.ns), o = () => {
|
|
17
17
|
const t = v('<svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none /></svg>'), n = c(
|
|
18
18
|
r.ns,
|
|
19
19
|
c(r.nsText),
|
|
20
20
|
c(r.nsSpinner, t)
|
|
21
21
|
);
|
|
22
22
|
return n.nsId = Date.now(), n;
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
if ((i = h(e, m.nsText)) == null || i.remove(), !t) return;
|
|
23
|
+
}, i = () => e().sort((s, t) => s.nsId - t.nsId), b = () => i()[0] ?? null, g = (s, t) => {
|
|
24
|
+
if (h(s, m.nsText)?.remove(), !t) return;
|
|
26
25
|
const n = c(r.nsText, t);
|
|
27
|
-
|
|
28
|
-
}, x = (
|
|
26
|
+
s.insertBefore(n, s.firstChild);
|
|
27
|
+
}, x = (s, t) => {
|
|
29
28
|
const n = t.firstElementChild;
|
|
30
|
-
n && t.insertBefore(
|
|
31
|
-
}, w = (
|
|
29
|
+
n && t.insertBefore(s, n), t.append(s), t.classList.add(r.nsHost);
|
|
30
|
+
}, w = (s) => y(s.children).find(
|
|
32
31
|
(n) => n.classList.contains(r.ns)
|
|
33
|
-
), k = (
|
|
32
|
+
), k = (s, t) => {
|
|
34
33
|
const n = t ? A(t) ?? l() : l();
|
|
35
|
-
let
|
|
34
|
+
let a;
|
|
36
35
|
const p = w(n);
|
|
37
|
-
if (p ?
|
|
36
|
+
if (p ? a = p : (a = o(), x(a, n)), g(a, s ?? ""), n === l()) {
|
|
38
37
|
const S = scrollY + "px";
|
|
39
38
|
l().style.setProperty("--ns-top", S);
|
|
40
39
|
}
|
|
41
|
-
return
|
|
42
|
-
}, f = (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
e === "*" ? s().forEach(f) : f(typeof e == "number" ? z(e) : b());
|
|
40
|
+
return a.nsId;
|
|
41
|
+
}, f = (s) => {
|
|
42
|
+
s?.parentElement?.classList.remove(r.nsHost), s?.remove();
|
|
43
|
+
}, z = (s) => e().find((t) => t.nsId === s) ?? null, I = (s) => {
|
|
44
|
+
s === "*" ? e().forEach(f) : f(typeof s == "number" ? z(s) : b());
|
|
47
45
|
};
|
|
48
46
|
return (() => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const e = v(
|
|
47
|
+
h(d(), "#ns")?.remove();
|
|
48
|
+
const s = v(
|
|
52
49
|
`<style id="ns">${T}</style>`
|
|
53
50
|
);
|
|
54
|
-
l().append(
|
|
51
|
+
l().append(s);
|
|
55
52
|
})(), {
|
|
56
53
|
show: k,
|
|
57
54
|
hide: I,
|
package/dist/iife/ns.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const b='@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{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 nsFade{0%{opacity:0}to{opacity:1}}@keyframes nsAscend{0%{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}:root{--ns-top: 0}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Inter", "Helvetica", "Arial";--weight: 400;--bg: rgba(255, 255, 255, .9);--zIdx: 9999999999;--blur: blur(5px);position:relative;z-index:var(--zIdx)}.nsh:before{width:100%;height:100%;bottom:0;right:0;position:absolute;content:"";background-color:var(--bg);backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:var(--size)}body.nsh,body.nsh:before{width:100%;height:100%;position:fixed;top:var(--ns-top);left:0}.ns{width:100%;height:100%;bottom:0;right:0;display:flex;justify-content:center;align-items:center;position:absolute;z-index:calc(var(--zIdx) + 2);animation:nsFade 2s;gap:var(--relSize)}.nst{color:var(--color);font-size:var(--size);font-family:var(--font),sans-serif;font-weight:var(--weight);max-width:80dvw;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-shadow:0 0 .06rem rgba(0,0,0,.25);filter:drop-shadow(0 0 .07rem rgba(0,0,0,.25));animation:nsAscend .5s}.nss{display:block;width:var(--relSize);height:var(--relSize);animation:nsAscend .5s}.nss>svg{animation:nsRotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:nsDash 1.5s ease-in-out infinite}',d=()=>globalThis.document,
|
|
1
|
+
(function(){"use strict";const b='@keyframes nsRotate{to{transform:rotate(360deg)}}@keyframes nsDash{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 nsFade{0%{opacity:0}to{opacity:1}}@keyframes nsAscend{0%{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}:root{--ns-top: 0}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Inter", "Helvetica", "Arial";--weight: 400;--bg: rgba(255, 255, 255, .9);--zIdx: 9999999999;--blur: blur(5px);position:relative;z-index:var(--zIdx)}.nsh:before{width:100%;height:100%;bottom:0;right:0;position:absolute;content:"";background-color:var(--bg);backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:var(--size)}body.nsh,body.nsh:before{width:100%;height:100%;position:fixed;top:var(--ns-top);left:0}.ns{width:100%;height:100%;bottom:0;right:0;display:flex;justify-content:center;align-items:center;position:absolute;z-index:calc(var(--zIdx) + 2);animation:nsFade 2s;gap:var(--relSize)}.nst{color:var(--color);font-size:var(--size);font-family:var(--font),sans-serif;font-weight:var(--weight);max-width:80dvw;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-shadow:0 0 .06rem rgba(0,0,0,.25);filter:drop-shadow(0 0 .07rem rgba(0,0,0,.25));animation:nsAscend .5s}.nss{display:block;width:var(--relSize);height:var(--relSize);animation:nsAscend .5s}.nss>svg{animation:nsRotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:nsDash 1.5s ease-in-out infinite}',d=()=>globalThis.document,i=()=>globalThis.document.body,f=e=>Array.from(e),p=(e,o)=>f(e.querySelectorAll(o)),h=(e,o)=>p(e,o)[0]??null,g=e=>e instanceof Element?e:h(d(),e),a=(e,...o)=>{const c=d().createElement("div");return e&&c.classList.add(e),c.append(...o),c},v=e=>{const o=a();return o.innerHTML=e,o.firstChild},r={ns:"ns",nsHost:"nsh",nsText:"nst",nsSpinner:"nss"},m={ns:"."+r.ns,nsText:"."+r.nsText},x="4.0.17",w=()=>{const e=()=>p(d(),m.ns),o=()=>{const t=v('<svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none /></svg>'),n=a(r.ns,a(r.nsText),a(r.nsSpinner,t));return n.nsId=Date.now(),n},c=()=>e().sort((s,t)=>s.nsId-t.nsId),k=()=>c()[0]??null,z=(s,t)=>{if(h(s,m.nsText)?.remove(),!t)return;const n=a(r.nsText,t);s.insertBefore(n,s.firstChild)},I=(s,t)=>{const n=t.firstElementChild;n&&t.insertBefore(s,n),t.append(s),t.classList.add(r.nsHost)},S=s=>f(s.children).find(n=>n.classList.contains(r.ns)),T=(s,t)=>{const n=t?g(t)??i():i();let l;const y=S(n);if(y?l=y:(l=o(),I(l,n)),z(l,s??""),n===i()){const E=scrollY+"px";i().style.setProperty("--ns-top",E)}return l.nsId},u=s=>{s?.parentElement?.classList.remove(r.nsHost),s?.remove()},A=s=>e().find(t=>t.nsId===s)??null,N=s=>{s==="*"?e().forEach(u):u(typeof s=="number"?A(s):k())};return(()=>{h(d(),"#ns")?.remove();const s=v(`<style id="ns">${b}</style>`);i().append(s)})(),{show:T,hide:N,version:x}};window.addEventListener("load",function(){this.ns=w()})})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nanosplash",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.17",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Isak K. Hauge",
|
|
@@ -39,39 +39,46 @@
|
|
|
39
39
|
"build:iife": "tsc && cross-env entry=./src/iife.ts format=iife vite build -m production --outDir ./dist/iife",
|
|
40
40
|
"preview": "vite preview",
|
|
41
41
|
"lint": "eslint . --fix",
|
|
42
|
-
"format": "prettier --write ./src/**/*.ts ./vite.config.ts",
|
|
42
|
+
"format": "prettier --write ./src/**/*.ts ./vite.config.ts ./vitest.config.ts",
|
|
43
43
|
"test": "bunx vitest --coverage"
|
|
44
44
|
},
|
|
45
|
-
"
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"types",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE"
|
|
50
|
+
],
|
|
51
|
+
"types": "./types/global.d.ts",
|
|
46
52
|
"main": "./dist/es/ns.es.js",
|
|
47
53
|
"exports": {
|
|
48
54
|
".": {
|
|
49
|
-
"types": "./
|
|
55
|
+
"types": "./types/global.d.ts",
|
|
50
56
|
"import": "./dist/es/ns.es.js",
|
|
51
57
|
"require": "./dist/cjs/ns.cjs.js",
|
|
52
58
|
"default": "./dist/es/ns.es.js"
|
|
53
59
|
}
|
|
54
60
|
},
|
|
55
|
-
"source": "./
|
|
61
|
+
"source": "./src/composables/ns.ts",
|
|
56
62
|
"unpkg": "./dist/iife/ns.iife.js",
|
|
63
|
+
"jsdelivr": "./dist/iife/ns.iife.js",
|
|
57
64
|
"devDependencies": {
|
|
58
|
-
"@eslint/js": "^
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
61
|
-
"@typescript-eslint/parser": "^8.
|
|
62
|
-
"@vitest/coverage-v8": "
|
|
63
|
-
"cross-env": "^
|
|
64
|
-
"cssnano": "^7.
|
|
65
|
-
"dotenv": "^
|
|
66
|
-
"eslint": "^
|
|
67
|
-
"eslint-config-prettier": "^10.1.
|
|
68
|
-
"globals": "^
|
|
69
|
-
"jsdom": "^
|
|
70
|
-
"postcss": "^8.5.
|
|
71
|
-
"prettier": "3.
|
|
72
|
-
"typescript": "^5.
|
|
73
|
-
"typescript-eslint": "^8.
|
|
74
|
-
"vite": "^
|
|
75
|
-
"vitest": "^
|
|
65
|
+
"@eslint/js": "^10.0.1",
|
|
66
|
+
"@types/node": "^25.3.0",
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
68
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
69
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
70
|
+
"cross-env": "^10.1.0",
|
|
71
|
+
"cssnano": "^7.1.2",
|
|
72
|
+
"dotenv": "^17.3.1",
|
|
73
|
+
"eslint": "^10.0.1",
|
|
74
|
+
"eslint-config-prettier": "^10.1.8",
|
|
75
|
+
"globals": "^17.3.0",
|
|
76
|
+
"jsdom": "^28.1.0",
|
|
77
|
+
"postcss": "^8.5.6",
|
|
78
|
+
"prettier": "3.8.1",
|
|
79
|
+
"typescript": "^5.9.3",
|
|
80
|
+
"typescript-eslint": "^8.56.0",
|
|
81
|
+
"vite": "^7.3.1",
|
|
82
|
+
"vitest": "^4.0.18"
|
|
76
83
|
}
|
|
77
84
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: CI General (non-persistent)
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches-ignore:
|
|
6
|
-
- production
|
|
7
|
-
- test
|
|
8
|
-
pull_request:
|
|
9
|
-
branches-ignore:
|
|
10
|
-
- production
|
|
11
|
-
- test
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
call-test-non-persistent:
|
|
15
|
-
name: Running Test (non-persistent)
|
|
16
|
-
uses: './.github/workflows/reusable.test.yml'
|
|
17
|
-
with:
|
|
18
|
-
persistent: false
|
|
19
|
-
|
|
20
|
-
call-lint-non-persistent:
|
|
21
|
-
needs: call-test-non-persistent
|
|
22
|
-
name: Running Linting (non-persistent)
|
|
23
|
-
uses: './.github/workflows/reusable.lint.yml'
|
|
24
|
-
with:
|
|
25
|
-
run-linting: true
|
|
26
|
-
|
|
27
|
-
call-build-non-persistent:
|
|
28
|
-
needs: call-lint-non-persistent
|
|
29
|
-
name: Running build (non-persistent)
|
|
30
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
31
|
-
with:
|
|
32
|
-
persistent: false
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
name: CI Prepare for Production
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [ production ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
call-lint-non-persistent:
|
|
9
|
-
name: Lint (non-persistent)
|
|
10
|
-
uses: './.github/workflows/reusable.lint.yml'
|
|
11
|
-
with:
|
|
12
|
-
run-linting: true
|
|
13
|
-
|
|
14
|
-
call-format-non-persistent:
|
|
15
|
-
needs: call-lint-non-persistent
|
|
16
|
-
name: Format (non-persistent)
|
|
17
|
-
uses: './.github/workflows/reusable.format.yml'
|
|
18
|
-
with:
|
|
19
|
-
persistent: false
|
|
20
|
-
|
|
21
|
-
call-test-non-persistent:
|
|
22
|
-
needs: call-format-non-persistent
|
|
23
|
-
name: Test (non-persistent)
|
|
24
|
-
uses: './.github/workflows/reusable.test.yml'
|
|
25
|
-
with:
|
|
26
|
-
persistent: false
|
|
27
|
-
|
|
28
|
-
call-build-non-persistent:
|
|
29
|
-
needs: call-test-non-persistent
|
|
30
|
-
name: Build (non-persistent)
|
|
31
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
32
|
-
with:
|
|
33
|
-
persistent: false
|
|
34
|
-
|
|
35
|
-
call-npm-publish-non-persistent:
|
|
36
|
-
needs: call-build-non-persistent
|
|
37
|
-
name: NPM Publish Dry-Run (non-persistent)
|
|
38
|
-
uses: './.github/workflows/reusable.npm-publish.yml'
|
|
39
|
-
with:
|
|
40
|
-
persistent: false
|
|
41
|
-
|
|
42
|
-
call-format:
|
|
43
|
-
needs: call-npm-publish-non-persistent
|
|
44
|
-
name: Format
|
|
45
|
-
uses: './.github/workflows/reusable.format.yml'
|
|
46
|
-
with:
|
|
47
|
-
persistent: true
|
|
48
|
-
|
|
49
|
-
call-build:
|
|
50
|
-
needs: call-format
|
|
51
|
-
name: Build
|
|
52
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
53
|
-
with:
|
|
54
|
-
persistent: true
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
name: CI Production & Publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ production ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
call-lint-non-persistent:
|
|
9
|
-
name: Lint (non-persistent)
|
|
10
|
-
uses: './.github/workflows/reusable.lint.yml'
|
|
11
|
-
with:
|
|
12
|
-
run-linting: true
|
|
13
|
-
|
|
14
|
-
call-format-non-persistent:
|
|
15
|
-
needs: call-lint-non-persistent
|
|
16
|
-
name: Format (non-persistent)
|
|
17
|
-
uses: './.github/workflows/reusable.format.yml'
|
|
18
|
-
with:
|
|
19
|
-
persistent: false
|
|
20
|
-
|
|
21
|
-
call-test-non-persistent:
|
|
22
|
-
needs: call-format-non-persistent
|
|
23
|
-
name: Test (non-persistent)
|
|
24
|
-
uses: './.github/workflows/reusable.test.yml'
|
|
25
|
-
with:
|
|
26
|
-
persistent: false
|
|
27
|
-
|
|
28
|
-
call-build-non-persistent:
|
|
29
|
-
needs: call-test-non-persistent
|
|
30
|
-
name: Build (non-persistent)
|
|
31
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
32
|
-
with:
|
|
33
|
-
persistent: false
|
|
34
|
-
|
|
35
|
-
call-npm-publish-dryrun:
|
|
36
|
-
needs: call-build-non-persistent
|
|
37
|
-
name: NPM Publish Dry-Run (non-persistent)
|
|
38
|
-
uses: './.github/workflows/reusable.npm-publish.yml'
|
|
39
|
-
with:
|
|
40
|
-
persistent: false
|
|
41
|
-
|
|
42
|
-
call-format:
|
|
43
|
-
needs: call-npm-publish-dryrun
|
|
44
|
-
name: Format
|
|
45
|
-
uses: './.github/workflows/reusable.format.yml'
|
|
46
|
-
with:
|
|
47
|
-
persistent: true
|
|
48
|
-
|
|
49
|
-
call-test-and-coverage:
|
|
50
|
-
needs: call-format
|
|
51
|
-
name: Test & Coverage
|
|
52
|
-
uses: './.github/workflows/reusable.test.yml'
|
|
53
|
-
with:
|
|
54
|
-
persistent: true
|
|
55
|
-
|
|
56
|
-
call-build:
|
|
57
|
-
needs: call-test-and-coverage
|
|
58
|
-
name: Build
|
|
59
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
60
|
-
with:
|
|
61
|
-
persistent: true
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
name: CI Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ test ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ test ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
call-lint-non-persistent:
|
|
11
|
-
name: Lint (non-persistent)
|
|
12
|
-
uses: './.github/workflows/reusable.lint.yml'
|
|
13
|
-
with:
|
|
14
|
-
run-linting: true
|
|
15
|
-
|
|
16
|
-
call-format-non-persistent:
|
|
17
|
-
needs: call-lint-non-persistent
|
|
18
|
-
name: Format (non-persistent)
|
|
19
|
-
uses: './.github/workflows/reusable.format.yml'
|
|
20
|
-
with:
|
|
21
|
-
persistent: false
|
|
22
|
-
|
|
23
|
-
call-test-non-persistent:
|
|
24
|
-
needs: call-format-non-persistent
|
|
25
|
-
name: Test (non-persistent)
|
|
26
|
-
uses: './.github/workflows/reusable.test.yml'
|
|
27
|
-
with:
|
|
28
|
-
persistent: false
|
|
29
|
-
|
|
30
|
-
call-build-non-persistent:
|
|
31
|
-
needs: call-test-non-persistent
|
|
32
|
-
name: Build (non-persistent)
|
|
33
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
34
|
-
with:
|
|
35
|
-
persistent: false
|
|
36
|
-
|
|
37
|
-
call-npm-publish-non-persistent:
|
|
38
|
-
needs: call-build-non-persistent
|
|
39
|
-
name: NPM Publish Dry-Run (non-persistent)
|
|
40
|
-
uses: './.github/workflows/reusable.npm-publish.yml'
|
|
41
|
-
with:
|
|
42
|
-
persistent: false
|
|
43
|
-
|
|
44
|
-
call-format:
|
|
45
|
-
needs: call-npm-publish-non-persistent
|
|
46
|
-
name: Format
|
|
47
|
-
uses: './.github/workflows/reusable.format.yml'
|
|
48
|
-
with:
|
|
49
|
-
persistent: true
|
|
50
|
-
|
|
51
|
-
call-build:
|
|
52
|
-
needs: call-format
|
|
53
|
-
name: Build
|
|
54
|
-
uses: './.github/workflows/reusable.build.yml'
|
|
55
|
-
with:
|
|
56
|
-
persistent: true
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
name: Reusable - Build
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_call:
|
|
5
|
-
inputs:
|
|
6
|
-
persistent:
|
|
7
|
-
required: true
|
|
8
|
-
type: boolean
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
run-vite-build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
# Checking out the repository with the latest version
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
|
|
18
|
-
# Setting up the latest Bun.js version
|
|
19
|
-
- name: Set up Bun.js
|
|
20
|
-
uses: oven-sh/setup-bun@v2
|
|
21
|
-
with:
|
|
22
|
-
bun-version: 'latest'
|
|
23
|
-
|
|
24
|
-
# Installing dependencies using Bun
|
|
25
|
-
- name: Install Dependencies
|
|
26
|
-
run: bun install
|
|
27
|
-
|
|
28
|
-
# Running Vite Build
|
|
29
|
-
- name: Run Vite Build
|
|
30
|
-
run: bun run build
|
|
31
|
-
|
|
32
|
-
# Committing built files to the current branch
|
|
33
|
-
- name: Commit Built Files
|
|
34
|
-
if: ${{ inputs.persist }}
|
|
35
|
-
run: |
|
|
36
|
-
git config --global user.name "GitHub Actions"
|
|
37
|
-
git config --global user.email "actions@github.com"
|
|
38
|
-
git add .
|
|
39
|
-
git commit -m "GitHub Actions: Build" --allow-empty
|
|
40
|
-
git push
|
|
41
|
-
env:
|
|
42
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|