nanosplash 4.0.16 → 4.0.18

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.
@@ -0,0 +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:inherit}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},m=s=>{const o=c();return o.innerHTML=s,o.firstChild},r={ns:"ns",nsHost:"nsh",nsText:"nst",nsSpinner:"nss"},v={ns:"."+r.ns,nsText:"."+r.nsText},A="4.0.18",E=()=>{const s=()=>u(d(),v.ns),o=()=>{const t=m('<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,v.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=m(`<style id="ns">${I}</style>`);l().append(e)})(),{show:k,hide:S,version:A}};exports.useNs=E;
@@ -0,0 +1,60 @@
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:inherit}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
+ }, m = (e) => {
5
+ const o = c();
6
+ return o.innerHTML = e, o.firstChild;
7
+ }, r = {
8
+ ns: "ns",
9
+ nsHost: "nsh",
10
+ nsText: "nst",
11
+ nsSpinner: "nss"
12
+ }, v = {
13
+ ns: "." + r.ns,
14
+ nsText: "." + r.nsText
15
+ }, N = "4.0.18", H = () => {
16
+ const e = () => u(d(), v.ns), o = () => {
17
+ const t = m('<svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none /></svg>'), n = c(
18
+ r.ns,
19
+ c(r.nsText),
20
+ c(r.nsSpinner, t)
21
+ );
22
+ return n.nsId = Date.now(), n;
23
+ }, i = () => e().sort((s, t) => s.nsId - t.nsId), b = () => i()[0] ?? null, g = (s, t) => {
24
+ if (h(s, v.nsText)?.remove(), !t) return;
25
+ const n = c(r.nsText, t);
26
+ s.insertBefore(n, s.firstChild);
27
+ }, x = (s, t) => {
28
+ const n = t.firstElementChild;
29
+ n && t.insertBefore(s, n), t.append(s), t.classList.add(r.nsHost);
30
+ }, w = (s) => y(s.children).find(
31
+ (n) => n.classList.contains(r.ns)
32
+ ), k = (s, t) => {
33
+ const n = t ? A(t) ?? l() : l();
34
+ let a;
35
+ const p = w(n);
36
+ if (p ? a = p : (a = o(), x(a, n)), g(a, s ?? ""), n === l()) {
37
+ const S = scrollY + "px";
38
+ l().style.setProperty("--ns-top", S);
39
+ }
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());
45
+ };
46
+ return (() => {
47
+ h(d(), "#ns")?.remove();
48
+ const s = m(
49
+ `<style id="ns">${T}</style>`
50
+ );
51
+ l().append(s);
52
+ })(), {
53
+ show: k,
54
+ hide: I,
55
+ version: N
56
+ };
57
+ };
58
+ export {
59
+ H as useNs
60
+ };
@@ -0,0 +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:inherit}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=t=>Array.from(t),p=(t,o)=>f(t.querySelectorAll(o)),h=(t,o)=>p(t,o)[0]??null,g=t=>t instanceof Element?t:h(d(),t),a=(t,...o)=>{const c=d().createElement("div");return t&&c.classList.add(t),c.append(...o),c},v=t=>{const o=a();return o.innerHTML=t,o.firstChild},r={ns:"ns",nsHost:"nsh",nsText:"nst",nsSpinner:"nss"},m={ns:"."+r.ns,nsText:"."+r.nsText},x="4.0.18",w=()=>{const t=()=>p(d(),m.ns),o=()=>{const e=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,e));return n.nsId=Date.now(),n},c=()=>t().sort((s,e)=>s.nsId-e.nsId),k=()=>c()[0]??null,z=(s,e)=>{if(h(s,m.nsText)?.remove(),!e)return;const n=a(r.nsText,e);s.insertBefore(n,s.firstChild)},I=(s,e)=>{const n=e.firstElementChild;n&&e.insertBefore(s,n),e.append(s),e.classList.add(r.nsHost)},S=s=>f(s.children).find(n=>n.classList.contains(r.ns)),T=(s,e)=>{const n=e?g(e)??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=>t().find(e=>e.nsId===s)??null,N=s=>{s==="*"?t().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.16",
4
+ "version": "4.0.18",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Isak K. Hauge",
@@ -42,6 +42,12 @@
42
42
  "format": "prettier --write ./src/**/*.ts ./vite.config.ts ./vitest.config.ts",
43
43
  "test": "bunx vitest --coverage"
44
44
  },
45
+ "files": [
46
+ "dist",
47
+ "types",
48
+ "README.md",
49
+ "LICENSE"
50
+ ],
45
51
  "types": "./types/global.d.ts",
46
52
  "main": "./dist/es/ns.es.js",
47
53
  "exports": {
@@ -1,32 +0,0 @@
1
- # .github/workflows/reusables/bun-build.yml
2
- name: Reusable - Bun Build
3
-
4
- on:
5
- workflow_call:
6
- inputs:
7
- working-directory:
8
- description: "Directory of the project (if not repo root)"
9
- required: false
10
- type: string
11
- default: "."
12
-
13
- jobs:
14
- build:
15
- runs-on: ubuntu-latest
16
-
17
- defaults:
18
- run:
19
- working-directory: ${{ inputs.working-directory }}
20
-
21
- steps:
22
- - name: Checkout
23
- uses: actions/checkout@v4
24
-
25
- - name: Setup Bun
26
- uses: oven-sh/setup-bun@v2
27
-
28
- - name: Install dependencies
29
- run: bun install --frozen-lockfile
30
-
31
- - name: Build
32
- run: bun run build
@@ -1,32 +0,0 @@
1
- # .github/workflows/reusables/bun-lint.yml
2
- name: Reusable - Bun Lint
3
-
4
- on:
5
- workflow_call:
6
- inputs:
7
- working-directory:
8
- description: "Directory of the project (if not repo root)"
9
- required: false
10
- type: string
11
- default: "."
12
-
13
- jobs:
14
- lint:
15
- runs-on: ubuntu-latest
16
-
17
- defaults:
18
- run:
19
- working-directory: ${{ inputs.working-directory }}
20
-
21
- steps:
22
- - name: Checkout
23
- uses: actions/checkout@v4
24
-
25
- - name: Setup Bun
26
- uses: oven-sh/setup-bun@v2
27
-
28
- - name: Install dependencies
29
- run: bun install --frozen-lockfile
30
-
31
- - name: Lint
32
- run: bun run lint
@@ -1,47 +0,0 @@
1
- name: Reusable - Bun NPM Publish (Trusted Publisher)
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- working-directory:
7
- description: "Directory of the package"
8
- required: false
9
- type: string
10
- default: "."
11
-
12
- jobs:
13
- publish:
14
- runs-on: ubuntu-latest
15
-
16
- # Required for npm Trusted Publishing (OIDC)
17
- permissions:
18
- id-token: write
19
- contents: read
20
-
21
- defaults:
22
- run:
23
- working-directory: ${{ inputs.working-directory }}
24
-
25
- steps:
26
- - name: Checkout
27
- uses: actions/checkout@v4
28
-
29
- # 1) Use Bun for install & build
30
- - name: Setup Bun
31
- uses: oven-sh/setup-bun@v2
32
- with:
33
- bun-version: latest
34
-
35
- - name: Install dependencies
36
- run: bun install --frozen-lockfile
37
-
38
- - name: Build package
39
- run: bun run build
40
-
41
- # 2) Use Node 24 + newest npm *just* for publication
42
- - name: Setup Node for publish
43
- uses: actions/setup-node@v4
44
- with:
45
- node-version: "24.x"
46
- registry-url: "https://registry.npmjs.org"
47
- - run: npm publish
@@ -1,43 +0,0 @@
1
- name: Reusable - Bun Test + Coverage (Coveralls)
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- working-directory:
7
- description: "Directory of the project (if not repo root)"
8
- required: false
9
- type: string
10
- default: "."
11
- upload-to-coveralls:
12
- description: "Whether to upload coverage to Coveralls"
13
- required: false
14
- type: boolean
15
- default: true
16
-
17
- jobs:
18
- test-coverage:
19
- runs-on: ubuntu-latest
20
-
21
- defaults:
22
- run:
23
- working-directory: ${{ inputs.working-directory }}
24
-
25
- steps:
26
- - name: Checkout
27
- uses: actions/checkout@v4
28
-
29
- - name: Setup Bun
30
- uses: oven-sh/setup-bun@v2
31
-
32
- - name: Install dependencies
33
- run: bun install --frozen-lockfile
34
-
35
- - name: Run tests with coverage
36
- run: bun run test
37
-
38
- # - name: Upload coverage to Coveralls
39
- # if: ${{ inputs.upload-to-coveralls }}
40
- # uses: coverallsapp/github-action@v2
41
- # with:
42
- # github-token: ${{ secrets.GITHUB_TOKEN }}
43
- # path-to-lcov: ${{ inputs.working-directory }}/coverage/lcov.info
@@ -1,27 +0,0 @@
1
- # .github/workflows/ci.yml
2
- name: Nanosplash CI
3
-
4
- on:
5
- push:
6
- branches: [ main, develop ]
7
- pull_request:
8
- branches: [ main, develop ]
9
-
10
- jobs:
11
- build:
12
- uses: ./.github/workflows/bun-build.reusable.yml
13
- with:
14
- working-directory: .
15
-
16
- test:
17
- needs: build
18
- uses: ./.github/workflows/bun-test.reusable.yml
19
- with:
20
- working-directory: .
21
- upload-to-coveralls: true
22
-
23
- lint:
24
- needs: build
25
- uses: ./.github/workflows/bun-lint.reusable.yml
26
- with:
27
- working-directory: .
@@ -1,13 +0,0 @@
1
- # .github/workflows/release.yml
2
- name: Release Nanosplash
3
-
4
- on:
5
- push:
6
- tags:
7
- - "v*.*.*" # e.g. v1.2.3
8
-
9
- jobs:
10
- publish:
11
- uses: ./.github/workflows/bun-npm-publish.reusable.yml
12
- with:
13
- working-directory: .
package/.prettierrc DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "singleQuote": true,
4
- "bracketSpacing": true,
5
- "jsxSingleQuote": true,
6
- "endOfLine": "lf",
7
- "trailingComma": "es5",
8
- "arrowParens": "avoid",
9
- "semi": false,
10
- "printWidth": 80
11
- }