nanosplash 4.0.8 → 4.0.16
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/bun-build.reusable.yml +32 -0
- package/.github/workflows/bun-lint.reusable.yml +32 -0
- package/.github/workflows/bun-npm-publish.reusable.yml +47 -0
- package/.github/workflows/bun-test.reusable.yml +43 -0
- package/.github/workflows/ci.yml +27 -0
- package/.github/workflows/release.yml +13 -0
- package/LICENSE +21 -0
- package/README.md +23 -25
- package/bun.lock +227 -314
- package/package.json +24 -23
- package/src/composables/ns.ts +2 -2
- package/src/iife.ts +7 -0
- package/tsconfig.json +5 -2
- 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/vitest.config.ts +14 -14
- 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/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/dist/cjs/ns.cjs.js +0 -1
- package/dist/es/ns.es.js +0 -63
- package/dist/iife/ns.iife.js +0 -1
- /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
|
@@ -0,0 +1,32 @@
|
|
|
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
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
|
@@ -0,0 +1,27 @@
|
|
|
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: .
|
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('*')
|