nanosplash 3.0.9 → 3.1.1
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/ci.yml +51 -49
- package/.github/workflows/vitepress.yml +52 -52
- package/README.md +74 -6
- package/dist/cjs/ns.cjs +1 -1
- package/dist/es/ns.js +41 -60
- package/dist/iife/ns.iife.js +1 -1
- package/docs/.vitepress/{config.mts → config.ts} +5 -1
- package/docs/.vitepress/theme/vue/Exe.vue +65 -61
- package/docs/api/doc/hide.md +2 -2
- package/docs/api/doc/show.md +2 -2
- package/docs/api/start/customize.md +30 -0
- package/docs/api/start/features.md +2 -2
- package/docs/api/start/install.md +6 -4
- package/docs/api/start/usage.md +2 -2
- package/docs/index.md +4 -4
- package/package.json +90 -91
- package/src/style/ns.sass +11 -16
- package/src/ts/Nanosplash.ts +69 -79
- package/src/ts/types/NanosplashInterface.ts +21 -2
- package/src/ts/types/Types.ts +2 -1
- package/tests/Nanosplash.spec.ts +11 -11
- package/bun.lockb +0 -0
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { DOMSelector, UTCInteger } from './Types'
|
|
2
2
|
|
|
3
3
|
export interface NanosplashInterface {
|
|
4
|
+
/**
|
|
5
|
+
* # Show
|
|
6
|
+
* Display Nanosplash inside the window.
|
|
7
|
+
* @param {string | undefined} text Optional text
|
|
8
|
+
* @param {string | Element | undefined} inside Optional element reference
|
|
9
|
+
* @returns {number | null} The internal ID of the created Nanosplash.
|
|
10
|
+
*/
|
|
4
11
|
show(text?: string, inside?: DOMSelector | HTMLElement): UTCInteger | null
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
/**
|
|
13
|
+
* # Hide
|
|
14
|
+
* Remove Nanosplash in multiple ways depending on the passed argument.
|
|
15
|
+
* - Pass ID: Remove specific.
|
|
16
|
+
* - Pass '*': Remove all in window.
|
|
17
|
+
* - Pass nothing: Remove in FIFO order.
|
|
18
|
+
* @param id The internal ID, an asterisk, or nothing.
|
|
19
|
+
*/
|
|
20
|
+
hide(id?: UTCInteger | '*'): void
|
|
21
|
+
/**
|
|
22
|
+
* # Version
|
|
23
|
+
* The current version of Nanosplash.
|
|
24
|
+
*/
|
|
25
|
+
version: string
|
|
7
26
|
}
|
package/src/ts/types/Types.ts
CHANGED
package/tests/Nanosplash.spec.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { describe, it, test, expect, beforeEach } from 'vitest'
|
|
2
|
-
import { useNs } from '../src/ts/Nanosplash'
|
|
3
2
|
import { JSDOM } from 'jsdom'
|
|
3
|
+
import { NanosplashInterface } from '../src/ts/types/NanosplashInterface'
|
|
4
4
|
|
|
5
|
-
let
|
|
5
|
+
let dom = new JSDOM()
|
|
6
|
+
let document: Document | null = null
|
|
7
|
+
let ns: NanosplashInterface | null = null
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
async function updateGlobals() {
|
|
10
|
+
dom = new JSDOM()
|
|
9
11
|
// @ts-ignore
|
|
10
12
|
globalThis.window = dom.window
|
|
11
|
-
globalThis.document = window.document
|
|
12
|
-
globalThis.window.ns =
|
|
13
|
-
}
|
|
13
|
+
document = globalThis.document = dom.window.document
|
|
14
|
+
ns = globalThis.window.ns = (await import('../src/ts/Nanosplash')).useNs()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
beforeEach(updateGlobals)
|
|
14
18
|
|
|
15
19
|
describe('Nanosplash API', () => {
|
|
16
20
|
it('should be defined', () => {
|
|
@@ -25,10 +29,6 @@ describe('Nanosplash API', () => {
|
|
|
25
29
|
expect(window.ns.hide).toBeDefined()
|
|
26
30
|
})
|
|
27
31
|
|
|
28
|
-
it('should have the "hideAll" method', () => {
|
|
29
|
-
expect(window.ns.hideAll).toBeDefined()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
32
|
it('should have the global instance', () => {
|
|
33
33
|
expect(window.ns).toBe(ns)
|
|
34
34
|
})
|
package/bun.lockb
DELETED
|
Binary file
|