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.
Files changed (53) hide show
  1. package/.github/workflows/bun-build.reusable.yml +32 -0
  2. package/.github/workflows/bun-lint.reusable.yml +32 -0
  3. package/.github/workflows/bun-npm-publish.reusable.yml +47 -0
  4. package/.github/workflows/bun-test.reusable.yml +43 -0
  5. package/.github/workflows/ci.yml +27 -0
  6. package/.github/workflows/release.yml +13 -0
  7. package/LICENSE +21 -0
  8. package/README.md +23 -25
  9. package/bun.lock +227 -314
  10. package/package.json +24 -23
  11. package/src/composables/ns.ts +2 -2
  12. package/src/iife.ts +7 -0
  13. package/tsconfig.json +5 -2
  14. package/{src/types → types}/global.d.ts +1 -1
  15. package/{src/interfaces/INSElement.ts → types/interfaces/INSElement.d.ts} +1 -1
  16. package/{src/interfaces/INanosplash.ts → types/interfaces/INanosplash.d.ts} +2 -2
  17. package/vitest.config.ts +14 -14
  18. package/.github/workflows/ci.all.yml +0 -32
  19. package/.github/workflows/ci.prod.pull_request.yml +0 -54
  20. package/.github/workflows/ci.prod.push.yml +0 -61
  21. package/.github/workflows/ci.test.yml +0 -56
  22. package/.github/workflows/reusable.build.yml +0 -42
  23. package/.github/workflows/reusable.format.yml +0 -55
  24. package/.github/workflows/reusable.lint.yml +0 -30
  25. package/.github/workflows/reusable.npm-publish.yml +0 -61
  26. package/.github/workflows/reusable.test.yml +0 -50
  27. package/coverage/lcov-report/base.css +0 -224
  28. package/coverage/lcov-report/block-navigation.js +0 -87
  29. package/coverage/lcov-report/favicon.png +0 -0
  30. package/coverage/lcov-report/index.html +0 -176
  31. package/coverage/lcov-report/prettify.css +0 -1
  32. package/coverage/lcov-report/prettify.js +0 -2
  33. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  34. package/coverage/lcov-report/sorter.js +0 -196
  35. package/coverage/lcov-report/src/composables/index.html +0 -116
  36. package/coverage/lcov-report/src/composables/ns.ts.html +0 -547
  37. package/coverage/lcov-report/src/constants/index.html +0 -116
  38. package/coverage/lcov-report/src/constants/ns.ts.html +0 -124
  39. package/coverage/lcov-report/src/iife.ts.html +0 -100
  40. package/coverage/lcov-report/src/index.html +0 -116
  41. package/coverage/lcov-report/src/interfaces/INSElement.ts.html +0 -100
  42. package/coverage/lcov-report/src/interfaces/INanosplash.ts.html +0 -304
  43. package/coverage/lcov-report/src/interfaces/index.html +0 -131
  44. package/coverage/lcov-report/src/utils/dom-utils.ts.html +0 -289
  45. package/coverage/lcov-report/src/utils/index.html +0 -116
  46. package/coverage/lcov.info +0 -271
  47. package/dist/cjs/ns.cjs.js +0 -1
  48. package/dist/es/ns.es.js +0 -63
  49. package/dist/iife/ns.iife.js +0 -1
  50. /package/{src/types → types}/dom.d.ts +0 -0
  51. /package/{src/types → types}/generic/function.d.ts +0 -0
  52. /package/{src/types → types}/semantic/number.d.ts +0 -0
  53. /package/{src/types → types}/semantic/string.d.ts +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nanosplash",
3
3
  "private": false,
4
- "version": "4.0.8",
4
+ "version": "4.0.16",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Isak K. Hauge",
@@ -39,39 +39,40 @@
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
- "types": "./src/types/global.d.ts",
45
+ "types": "./types/global.d.ts",
46
46
  "main": "./dist/es/ns.es.js",
47
47
  "exports": {
48
48
  ".": {
49
- "types": "./src/types/global.d.ts",
49
+ "types": "./types/global.d.ts",
50
50
  "import": "./dist/es/ns.es.js",
51
51
  "require": "./dist/cjs/ns.cjs.js",
52
52
  "default": "./dist/es/ns.es.js"
53
53
  }
54
54
  },
55
- "source": "./dist/es/ns.es.js",
55
+ "source": "./src/composables/ns.ts",
56
56
  "unpkg": "./dist/iife/ns.iife.js",
57
+ "jsdelivr": "./dist/iife/ns.iife.js",
57
58
  "devDependencies": {
58
- "@eslint/js": "^9.28.0",
59
- "@types/node": "^22.15.29",
60
- "@typescript-eslint/eslint-plugin": "^8.33.0",
61
- "@typescript-eslint/parser": "^8.33.0",
62
- "@vitest/coverage-v8": "3.1.4",
63
- "cross-env": "^7.0.3",
64
- "cssnano": "^7.0.7",
65
- "dotenv": "^16.5.0",
66
- "eslint": "^9.28.0",
67
- "eslint-config-prettier": "^10.1.5",
68
- "globals": "^16.2.0",
69
- "jsdom": "^26.1.0",
70
- "postcss": "^8.5.4",
71
- "prettier": "3.5.3",
72
- "typescript": "^5.8.3",
73
- "typescript-eslint": "^8.33.0",
74
- "vite": "^6.3.5",
75
- "vitest": "^3.1.4"
59
+ "@eslint/js": "^10.0.1",
60
+ "@types/node": "^25.3.0",
61
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
62
+ "@typescript-eslint/parser": "^8.56.0",
63
+ "@vitest/coverage-v8": "4.0.18",
64
+ "cross-env": "^10.1.0",
65
+ "cssnano": "^7.1.2",
66
+ "dotenv": "^17.3.1",
67
+ "eslint": "^10.0.1",
68
+ "eslint-config-prettier": "^10.1.8",
69
+ "globals": "^17.3.0",
70
+ "jsdom": "^28.1.0",
71
+ "postcss": "^8.5.6",
72
+ "prettier": "3.8.1",
73
+ "typescript": "^5.9.3",
74
+ "typescript-eslint": "^8.56.0",
75
+ "vite": "^7.3.1",
76
+ "vitest": "^4.0.18"
76
77
  }
77
78
  }
@@ -1,7 +1,7 @@
1
1
  import style from '@/style/ns.css?inline'
2
- import type { INanosplash } from '@/interfaces/INanosplash.ts'
2
+ import type { INanosplash } from '@/types/interfaces/INanosplash'
3
3
  import type { Func } from '@/types/generic/function.ts'
4
- import type { INSElement } from '@/interfaces/INSElement.ts'
4
+ import type { INSElement } from '@/types/interfaces/INSElement'
5
5
  import {
6
6
  all,
7
7
  bod,
package/src/iife.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  import { useNs } from '@/composables/ns.ts'
2
+ import type { INanosplash } from "@/types/interfaces/INanosplash"
3
+
4
+ declare global {
5
+ interface Window {
6
+ ns: INanosplash
7
+ }
8
+ }
2
9
 
3
10
  window.addEventListener('load', function () {
4
11
  this.ns = useNs()
package/tsconfig.json CHANGED
@@ -23,8 +23,11 @@
23
23
  "baseUrl": ".",
24
24
  "paths": {
25
25
  "@/*": [
26
- "./src/*"
27
- ]
26
+ "./src/*",
27
+ ],
28
+ "@/types/*": [
29
+ "./types/*"
30
+ ],
28
31
  }
29
32
  },
30
33
  "include": ["src"]
@@ -1,4 +1,4 @@
1
- import type { INanosplash } from '../interfaces/INanosplash.ts'
1
+ import type { INanosplash } from './interfaces/INanosplash.ts'
2
2
 
3
3
  declare global {
4
4
  interface Window {
@@ -1,4 +1,4 @@
1
- import type { int } from '@/types/semantic/number.ts'
1
+ import type { int } from "../semantic/number";
2
2
 
3
3
  export interface INSElement extends HTMLDivElement {
4
4
  nsId: int
@@ -1,5 +1,5 @@
1
- import type { ElementRef } from '@/types/dom.ts'
2
- import type { int } from '@/types/semantic/number.ts'
1
+ import type { ElementRef } from '../dom'
2
+ import type { int } from '../semantic/number'
3
3
 
4
4
  /**
5
5
  * # Nanosplash
package/vitest.config.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  // vitest.config.ts
2
2
  import { defineConfig } from 'vitest/config'
3
- import path from "node:path";
3
+ import path from 'node:path'
4
4
 
5
5
  export default defineConfig({
6
- test: {
7
- environment: 'jsdom',
8
- coverage: {
9
- enabled: true, // Enable coverage collection
10
- provider: 'v8', // Use 'v8' (default) or 'istanbul' provider
11
- reporter: ['lcov'], // Output coverage in LCOV format
12
- reportsDirectory: './coverage', // Directory for coverage reports
13
- },
6
+ test: {
7
+ environment: 'jsdom',
8
+ coverage: {
9
+ enabled: true, // Enable coverage collection
10
+ provider: 'v8', // Use 'v8' (default) or 'istanbul' provider
11
+ reporter: ['lcov'], // Output coverage in LCOV format
12
+ reportsDirectory: './coverage', // Directory for coverage reports
14
13
  },
15
- resolve: {
16
- alias: {
17
- '@': path.resolve(__dirname, './src'),
18
- },
14
+ },
15
+ resolve: {
16
+ alias: {
17
+ '@': path.resolve(__dirname, './src'),
19
18
  },
20
- })
19
+ },
20
+ })
@@ -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 }}
@@ -1,55 +0,0 @@
1
- name: Reusable - Prettier Formatting
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- persistent:
7
- required: true
8
- type: boolean
9
-
10
- jobs:
11
- run-prettier:
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 Prettier using Bun
29
- - name: Run Prettier Format
30
- run: bun run format
31
-
32
- # Committing formatted files to the current branch
33
- - name: Commit Formatted Files
34
- if: ${{ inputs.persistent }}
35
- run: |
36
- git config --global user.name "GitHub Actions"
37
- git config --global user.email "actions@github.com"
38
-
39
- # Stage all changes
40
- git add .
41
-
42
- # Check if there are any staged changes
43
- if ! git diff --cached --quiet; then
44
- echo "There are changes to commit and push."
45
-
46
- # Commit the changes
47
- git commit -m "GitHub Actions: Format using Prettier"
48
-
49
- # Push to the current branch
50
- git push
51
- else
52
- echo "No changes to commit."
53
- fi
54
- env:
55
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,30 +0,0 @@
1
- name: Reusable - ESLint (non-persistent)
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- run-linting:
7
- required: true
8
- type: boolean
9
-
10
- jobs:
11
- run-eslint:
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 Vitest with coverage using Bun
29
- - name: Run ESLint
30
- run: bun run lint
@@ -1,61 +0,0 @@
1
- name: Reusable - NPM Publish
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- persistent:
7
- required: true
8
- type: boolean
9
-
10
- jobs:
11
- npm-publish:
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 Node.js version
19
- - name: Set up Node.js
20
- uses: actions/setup-node@v4
21
- with:
22
- node-version: 'latest'
23
- registry-url: 'https://registry.npmjs.org' # Specify NPM registry
24
-
25
- # Installing dependencies
26
- - name: Install Dependencies
27
- run: npm install --no-package-lock
28
-
29
- # Get the version inside package.json
30
- - name: Get version from package.json
31
- id: get-version
32
- run: |
33
- VERSION=$(node -p "require('./package.json').version")
34
- echo "VERSION=$VERSION" >> $GITHUB_ENV
35
-
36
- # Publishing to NPM (dry-run for testing purposes)
37
- - name: Publish to NPM (dry-run)
38
- run: npm publish --dry-run
39
- env:
40
- NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
41
-
42
- # Commit the version tag made by NPM
43
- - name: Commit version tag
44
- if: ${{ inputs.persist }}
45
- run: |
46
- git config --global user.name "GitHub Actions"
47
- git config --global user.email "actions@github.com"
48
- git add .
49
- git commit -m "GitHub Actions: NPM build ${{ env.VERSION }}" --allow-empty
50
- git push origin
51
- env:
52
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
-
54
- - name: Configure npm for authentication
55
- run: echo "https://registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ~/.npmrc
56
-
57
- - name: Publish to NPM
58
- if: ${{ inputs.persistent }}
59
- run: npm publish
60
- env:
61
- NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
@@ -1,50 +0,0 @@
1
- name: Reusable - Run Tests
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- persistent:
7
- required: true
8
- type: boolean
9
-
10
- jobs:
11
- run-vitest:
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 Vitest with coverage using Bun
29
- - name: Run Vitest
30
- run: bunx vitest
31
-
32
- # Committing coverage artifacts to the current branch
33
- - name: Commit Build
34
- if: ${{ inputs.persistent }}
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: Create Test Coverage" --allow-empty
40
- git push
41
- env:
42
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43
-
44
- # Uploading coverage to Coveralls
45
- - name: Upload Coverage to Coveralls
46
- if: ${{ inputs.persistent }}
47
- uses: coverallsapp/github-action@v2
48
- with:
49
- github-token: ${{ secrets.GITHUB_TOKEN }}
50
- path-to-lcov: ./coverage/lcov.info