nanosplash 3.0.0 → 3.0.2

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 (77) hide show
  1. package/.github/workflows/ci.yml +50 -44
  2. package/.github/workflows/vitepress.yml +69 -0
  3. package/.prettierignore +1 -0
  4. package/.prettierrc +10 -10
  5. package/LICENSE +21 -0
  6. package/README.md +14 -41
  7. package/bun.lockb +0 -0
  8. package/coverage/DomUtilities.ts.html +568 -0
  9. package/coverage/Service.ts.html +718 -0
  10. package/coverage/Splash.ts.html +448 -0
  11. package/coverage/SplashQueue.ts.html +232 -0
  12. package/coverage/base.css +224 -0
  13. package/coverage/block-navigation.js +87 -0
  14. package/coverage/clover.xml +560 -0
  15. package/coverage/coverage-final.json +5 -0
  16. package/coverage/favicon.png +0 -0
  17. package/coverage/index.html +161 -0
  18. package/coverage/prettify.css +1 -0
  19. package/coverage/prettify.js +2 -0
  20. package/coverage/sort-arrow-sprite.png +0 -0
  21. package/coverage/sorter.js +196 -0
  22. package/dist/cjs/ns.cjs +2 -0
  23. package/dist/es/ns.js +342 -0
  24. package/dist/iife/ns.iife.js +2 -0
  25. package/docs/.vitepress/config.ts +75 -0
  26. package/docs/.vitepress/theme/css/style.css +157 -0
  27. package/docs/.vitepress/theme/index.ts +16 -0
  28. package/docs/.vitepress/theme/vue/Card.vue +31 -0
  29. package/docs/.vitepress/theme/vue/CardGrid.vue +17 -0
  30. package/docs/.vitepress/theme/vue/Exe.vue +86 -0
  31. package/docs/.vitepress/theme/vue/PlayGround.vue +50 -0
  32. package/docs/api/doc/hide.md +69 -0
  33. package/docs/api/doc/show.md +47 -0
  34. package/docs/api/start/features.md +17 -0
  35. package/docs/api/start/install.md +53 -0
  36. package/docs/api/start/playground.md +11 -0
  37. package/docs/api/start/usage.md +25 -0
  38. package/docs/index.md +30 -0
  39. package/package.json +86 -66
  40. package/src/style/ns.sass +95 -0
  41. package/src/ts/core/DomUtilities.ts +161 -0
  42. package/src/ts/core/Service.ts +211 -0
  43. package/src/ts/core/{Nanosplash/interfaces/NanosplashAPI.ts → ServiceInterface.ts} +18 -10
  44. package/src/ts/core/Splash.ts +121 -0
  45. package/src/ts/core/SplashInterface.ts +46 -0
  46. package/src/ts/core/SplashQueue.ts +49 -0
  47. package/src/ts/main.ts +9 -0
  48. package/src/ts/types/Types.ts +3 -0
  49. package/src/ts/types/global.d.ts +14 -0
  50. package/src/vite-env.d.ts +0 -8
  51. package/tests/DomUtilities.spec.ts +117 -0
  52. package/tests/Guid.spec.ts +5 -5
  53. package/tests/Service.spec.ts +198 -0
  54. package/tests/Splash.spec.ts +64 -0
  55. package/tests/TestUtilities.ts +48 -0
  56. package/tsconfig.json +21 -20
  57. package/vite.config.ts +14 -22
  58. package/dist/main.css +0 -1
  59. package/dist/ns.cjs.js +0 -1
  60. package/dist/ns.es.js +0 -330
  61. package/dist/ns.iife.js +0 -2
  62. package/index.html +0 -52
  63. package/src/main.ts +0 -8
  64. package/src/sass/ns.sass +0 -86
  65. package/src/ts/core/Nanosplash/Nanosplash.ts +0 -97
  66. package/src/ts/core/Nanosplash/interfaces/NanosplashInterface.ts +0 -42
  67. package/src/ts/core/Nanosplash/repositories/NanosplashRepository.ts +0 -178
  68. package/src/ts/core/Nanosplash/services/NanosplashService.ts +0 -222
  69. package/src/ts/types/Alias.d.ts +0 -1
  70. package/src/ts/types/Nanosplash.d.ts +0 -18
  71. package/src/ts/types/NanosplashService.d.ts +0 -1
  72. package/src/ts/util/Guid.ts +0 -13
  73. package/src/ts/util/Stack.ts +0 -73
  74. package/tests/Nanosplash.spec.ts +0 -64
  75. package/tests/NanosplashRepository.spec.ts +0 -91
  76. package/tests/NanosplashService.spec.ts +0 -119
  77. package/tests/Stack.spec.ts +0 -56
@@ -1,48 +1,54 @@
1
- name: Build and Test
1
+ name: Main Github Actions Workflow
2
2
 
3
3
  on:
4
- push:
5
- branches:
6
- - production
7
- pull_request:
8
- branches:
9
- - production
4
+ push:
5
+ branches:
6
+ - production
7
+ pull_request:
8
+ branches:
9
+ - production
10
10
 
11
11
  jobs:
12
- build-and-test:
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - name: Checkout code
17
- uses: actions/checkout@v2
18
-
19
- - name: Setup Node.js
20
- uses: actions/setup-node@v2
21
- with:
22
- node-version: '20'
23
-
24
- - name: Set up Git and update production branch
25
- run: |
26
- git config --global user.name "GitHub Actions"
27
- git config --global user.email "actions@github.com"
28
- git checkout production
29
- git fetch
30
- git pull --no-rebase
31
-
32
- - name: Install dependencies
33
- run: yarn install --frozen-lockfile
34
-
35
- - name: Build (Vite)
36
- run: yarn build
37
-
38
- - name: Test (Vitest)
39
- run: yarn test
40
-
41
- - name: Generate Code Coverage (Vitest)
42
- run: yarn coverage
43
-
44
- - name: Commit and push changes
45
- run: |
46
- git add .
47
- git commit --allow-empty -m "Build, test, and coverage report"
48
- git push
12
+ build-and-test:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v3
18
+
19
+ - name: Install Bun
20
+ uses: oven-sh/setup-bun@v1
21
+
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v3
24
+ with:
25
+ node-version: 20
26
+
27
+ - name: Set up Git and update production branch
28
+ run: |
29
+ git config --global user.name "GitHub Actions"
30
+ git config --global user.email "actions@github.com"
31
+ git checkout production
32
+ git fetch
33
+ git pull --no-rebase
34
+
35
+ - name: Setup Pages
36
+ uses: actions/configure-pages@v3
37
+
38
+ - name: Install dependencies
39
+ run: bun install
40
+
41
+ - name: Build (Vite)
42
+ run: bun run build
43
+
44
+ - name: Test (Vitest)
45
+ run: bun run test
46
+
47
+ - name: Generate Code Coverage (Vitest)
48
+ run: bun run coverage
49
+
50
+ - name: Commit and push changes
51
+ run: |
52
+ git add .
53
+ git commit --allow-empty -m "Build, test, and coverage report"
54
+ git push
@@ -0,0 +1,69 @@
1
+ # Sample workflow for building and deploying a VitePress site to GitHub Pages
2
+ #
3
+ name: Deploy VitePress site to Pages
4
+
5
+ on:
6
+ # Runs on pushes targeting the `main` branch. Change this to `master` if you're
7
+ # using the `master` branch as the default branch.
8
+ push:
9
+ branches: [production]
10
+ pull_request:
11
+ branches: [production]
12
+
13
+ # Allows you to run this workflow manually from the Actions tab
14
+ workflow_dispatch:
15
+
16
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
17
+ permissions:
18
+ contents: read
19
+ pages: write
20
+ id-token: write
21
+
22
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
23
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
24
+ concurrency:
25
+ group: pages
26
+ cancel-in-progress: false
27
+
28
+ jobs:
29
+ # Build job
30
+ build:
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Checkout
34
+ uses: actions/checkout@v3
35
+ with:
36
+ fetch-depth: 0 # Not needed if lastUpdated is not enabled
37
+ # - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
38
+ - name: Install Bun
39
+ uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
40
+ - name: Setup Node
41
+ uses: actions/setup-node@v3
42
+ with:
43
+ node-version: 20
44
+ cache: yarn
45
+ - name: Setup Pages
46
+ uses: actions/configure-pages@v3
47
+ - name: Install dependencies
48
+ run: yarn install
49
+ - name: Build with VitePress
50
+ run: |
51
+ bun run docs:build
52
+ touch docs/.vitepress/dist/.nojekyll
53
+ - name: Upload artifact
54
+ uses: actions/upload-pages-artifact@v2
55
+ with:
56
+ path: docs/.vitepress/dist
57
+
58
+ # Deployment job
59
+ deploy:
60
+ environment:
61
+ name: github-pages
62
+ url: ${{ steps.deployment.outputs.page_url }}
63
+ needs: build
64
+ runs-on: ubuntu-latest
65
+ name: Deploy
66
+ steps:
67
+ - name: Deploy to GitHub Pages
68
+ id: deployment
69
+ uses: actions/deploy-pages@v2
@@ -0,0 +1 @@
1
+ *.sass
package/.prettierrc CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
- "tabWidth": 2,
3
- "useTabs": true,
4
- "singleQuote": true,
5
- "bracketSpacing": true,
6
- "jsxSingleQuote": true,
7
- "endOfLine": "lf",
8
- "trailingComma": "es5",
9
- "arrowParens": "avoid",
10
- "semi": false,
11
- "printWidth": 80
2
+ "tabWidth": 4,
3
+ "useTabs": true,
4
+ "singleQuote": true,
5
+ "bracketSpacing": true,
6
+ "jsxSingleQuote": true,
7
+ "endOfLine": "lf",
8
+ "trailingComma": "es5",
9
+ "arrowParens": "avoid",
10
+ "semi": false,
11
+ "printWidth": 80
12
12
  }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 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
@@ -1,57 +1,30 @@
1
1
  # Nanosplash
2
2
 
3
- ### Tiny loading screen for web artisans
3
+ ### The tiny loading screen for web artisans
4
4
 
5
5
  <br>
6
6
 
7
- [![Build](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml/badge.svg?branch=production)](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml) [![Build Status](https://github.com/isakhauge/nanosplash/workflows/CI/badge.svg?branch=production)](https://github.com/isakhauge/nanosplash/actions?query=workflow%3ACI) [![Coverage](https://img.shields.io/badge/Coverage-98.5%25-brightgreen.svg?style=flat)](https://your-coverage-report-url) [![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://github.com/ellerbrock/typescript-badges/) [![Last Commit](https://img.shields.io/github/last-commit/isakhauge/nanosplash)](https://github.com/isakhauge/nanosplash/commits/production)
7
+ [![Build](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml/badge.svg?branch=production)](https://github.com/isakhauge/nanosplash/actions/workflows/ci.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/nanosplash) [![Coverage](https://img.shields.io/badge/Coverage-99%25-brightgreen)](./coverage/index.html) [![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://github.com/ellerbrock/typescript-badges/) [![Last Commit](https://img.shields.io/github/last-commit/isakhauge/nanosplash)](https://github.com/isakhauge/nanosplash/commits/production)
8
8
 
9
9
  <br>
10
10
 
11
- ## Get started
11
+ > 📣 **New in 3.0.2**
12
+ >
13
+ > - CSS is included inside the ES and CJS bundles 🎉
14
+ > - The `ns.hide` method will now delete splash screens in a FIFO sequence.
12
15
 
13
- Always get the latest version.
14
-
15
- ```html
16
- <script src="https://unpkg.com/nanosplash/dist/ns.iife.js">
17
- ```
18
-
19
- ## Display loading screen
20
-
21
- Display spinning wheel only.
22
-
23
- ```js
24
- ns.show()
25
- ```
26
-
27
- Display with text.
28
-
29
- ```js
30
- ns.show('Loading assets')
31
- ```
32
-
33
- Display inside another element.
34
-
35
- ```js
36
- ns.showInside('Loading table', '#my-table')
37
- ```
38
-
39
- ## Hide loading screen
40
-
41
- Hide the last loading screen (LIFO).
16
+ ## Usage
42
17
 
43
18
  ```js
19
+ // Fullscreen splash screen
20
+ ns.show('Loading')
44
21
  ns.hide()
45
- ```
46
22
 
47
- Hide loading screen inside another element.
48
-
49
- ```js
50
- ns.hideInside('#my-table')
23
+ // Splash screen inside a DOM element
24
+ ns.showInside('#my-div', 'Loading')
25
+ ns.hide()
51
26
  ```
52
27
 
53
- Hide all loading screens.
28
+ ## Documentation
54
29
 
55
- ```js
56
- ns.hideAll()
57
- ```
30
+ [isakhauge.github.io/nanosplash/](https://isakhauge.github.io/nanosplash/)
package/bun.lockb ADDED
Binary file