nanosplash 3.0.7 → 3.0.9

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 (40) hide show
  1. package/.prettierrc +1 -1
  2. package/README.md +6 -6
  3. package/bun.lockb +0 -0
  4. package/dist/cjs/ns.cjs +1 -2
  5. package/dist/es/ns.js +61 -340
  6. package/dist/iife/ns.iife.js +1 -2
  7. package/docs/.vitepress/{config.ts → config.mts} +42 -43
  8. package/docs/.vitepress/theme/css/style.css +107 -6
  9. package/docs/.vitepress/theme/vue/CardGrid.vue +1 -1
  10. package/docs/.vitepress/theme/vue/Exe.vue +58 -28
  11. package/docs/.vitepress/theme/vue/PlayGround.vue +5 -21
  12. package/docs/api/doc/hide.md +10 -31
  13. package/docs/api/doc/show.md +12 -13
  14. package/docs/api/start/features.md +1 -1
  15. package/docs/api/start/install.md +6 -4
  16. package/docs/api/start/playground.md +1 -1
  17. package/docs/api/start/usage.md +2 -5
  18. package/docs/index.md +25 -25
  19. package/docs/public/macos.jpg +0 -0
  20. package/eslint.config.js +9 -0
  21. package/package.json +54 -48
  22. package/src/style/ns.sass +100 -70
  23. package/src/ts/Nanosplash.ts +219 -0
  24. package/src/ts/main.ts +2 -8
  25. package/src/ts/types/NanosplashInterface.ts +7 -0
  26. package/src/ts/types/Types.ts +28 -3
  27. package/src/ts/types/global.d.ts +9 -9
  28. package/tests/Nanosplash.spec.ts +35 -0
  29. package/.prettierignore +0 -1
  30. package/src/ts/core/DomUtilities.ts +0 -161
  31. package/src/ts/core/Service.ts +0 -211
  32. package/src/ts/core/ServiceInterface.ts +0 -58
  33. package/src/ts/core/Splash.ts +0 -121
  34. package/src/ts/core/SplashInterface.ts +0 -46
  35. package/src/ts/core/SplashQueue.ts +0 -49
  36. package/tests/DomUtilities.spec.ts +0 -117
  37. package/tests/Guid.spec.ts +0 -21
  38. package/tests/Service.spec.ts +0 -198
  39. package/tests/Splash.spec.ts +0 -64
  40. package/tests/TestUtilities.ts +0 -48
@@ -142,16 +142,117 @@
142
142
  }
143
143
 
144
144
  .vp-doc [class*='language-'] .has-highlighted-lines .line {
145
- transition: filter 0.35s, opacity 0.35s;
145
+ transition:
146
+ filter 0.35s,
147
+ opacity 0.35s;
146
148
  }
147
- .vp-doc [class*='language-'] .has-highlighted-lines .line:not(.highlighted) {
149
+ .vp-doc code:has(.highlighted) .line:not(.highlighted) {
148
150
  filter: blur(1px);
149
151
  opacity: 0.5;
152
+ transition: all 0.3s ease;
150
153
  }
151
- .vp-doc
152
- [class*='language-']
153
- .has-highlighted-lines:hover
154
- .line:not(.highlighted) {
154
+ .vp-doc code:has(.highlighted):hover .line:not(.highlighted) {
155
155
  filter: blur(0);
156
156
  opacity: 1;
157
+ transition: all 0.3s ease;
158
+ }
159
+
160
+ :root {
161
+ --ns-doc-glass-border: 1px solid rgba(130, 130, 130, 0.2);
162
+ }
163
+
164
+ header {
165
+ backdrop-filter: blur(10px) !important;
166
+ -webkit-backdrop-filter: blur(10px) !important;
167
+ border-top: var(--ns-doc-glass-border);
168
+ border-bottom: var(--ns-doc-glass-border);
169
+ }
170
+
171
+ .mac.dark header {
172
+ background-color: rgba(0, 0, 0, 0.1);
173
+ }
174
+
175
+ .mac:not(.dark) header {
176
+ background-color: rgba(255, 255, 255, 0.5);
177
+ }
178
+
179
+ .VPNavBar {
180
+ background-color: transparent !important;
181
+ border-bottom: 0 !important;
182
+ }
183
+
184
+ .VPNavBar .content-body {
185
+ background-color: transparent !important;
186
+ border-bottom: 0 !important;
187
+ }
188
+
189
+ /* Remove header divider */
190
+ .VPNavBar > .divider {
191
+ opacity: 0;
192
+ }
193
+
194
+ .VPNavBarTitle {
195
+ background: var(--vp-home-hero-name-background);
196
+ -webkit-background-clip: text;
197
+ background-clip: text;
198
+ -webkit-text-fill-color: var(--vp-home-hero-name-color);
199
+ }
200
+
201
+ .VPNavBarTitle .title {
202
+ border: 0 !important;
203
+ }
204
+
205
+ .DocSearch-Button {
206
+ background-color: rgba(255, 255, 255, 0.05);
207
+ border: var(--ns-doc-glass-border);
208
+ }
209
+
210
+ .VPButton {
211
+ border-radius: 8px !important;
212
+ }
213
+
214
+ .VPFeature {
215
+ background-color: transparent !important;
216
+ box-shadow:
217
+ 0 -8px 32px rgba(0, 81, 255, 0.1),
218
+ 0 8px 32px rgba(251, 0, 255, 0.1);
219
+ }
220
+
221
+ /* Remove footer border */
222
+ .VPFooter {
223
+ border-top: 0 !important;
224
+ }
225
+
226
+ /* Center footer credits */
227
+ .VPFooter .container {
228
+ justify-content: center;
229
+ }
230
+
231
+ .VPLocalSearchBox .backdrop {
232
+ background-color: transparent !important;
233
+ backdrop-filter: blur(10px) !important;
234
+ -webkit-backdrop-filter: blur(10px) !important;
235
+ }
236
+
237
+ .VPButton {
238
+ border: var(--ns-doc-glass-border) !important;
239
+ background-color: transparent !important;
240
+ /* box-shadow:
241
+ 0 2px 4px rgba(0, 0, 0, 0.025),
242
+ 0 4px 8px rgba(0, 0, 0, 0.025),
243
+ 0 8px 16px rgba(0, 0, 0, 0.025); */
244
+ }
245
+
246
+ .VPButton.brand {
247
+ background-color: #222 !important;
248
+ }
249
+
250
+ .VPLocalSearchBox .shell {
251
+ box-shadow:
252
+ 0 0 2px 1px #0000000d,
253
+ 0 4px 8px rgba(0, 0, 0, 0.05),
254
+ 0 8px 16px rgba(0, 0, 0, 0.05),
255
+ 0 16px 32px rgba(0, 0, 0, 0.05),
256
+ 0 32px 64px rgba(0, 0, 0, 0.05),
257
+ 0 64px 128px rgba(0, 0, 0, 0.05);
157
258
  }
@@ -9,7 +9,7 @@
9
9
  display: grid
10
10
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))
11
11
  grid-gap: 25px
12
- background-image: url(https://9to5mac.com/wp-content/uploads/sites/6/2022/06/macOS-Ventura-wallpaper-1-1.jpg?quality=82&strip=all)
12
+ background-image: url('/macos.jpg')
13
13
  background-size: cover
14
14
  background-position-y: bottom
15
15
  padding: 25px
@@ -1,35 +1,69 @@
1
1
  <script setup>
2
- import { ref, defineProps } from 'vue'
3
- import { Service } from '../../../../dist/es/ns'
4
- Service.start()
2
+ import { ref } from 'vue'
3
+ import { useNs } from '../../../../dist/es/ns.js'
4
+ const ns = useNs()
5
5
 
6
- const props = defineProps({
7
- commands: Array,
8
- })
6
+ const Commands = {
7
+ ShowInsideA: 'ns.show("Loading A", "#a")',
8
+ ShowInsideB: 'ns.show("Loading B", "#b")',
9
+ ShowInsideC: 'ns.show("Loading C", "#c")',
10
+ ShowInsideD: 'ns.show("Loading D", "#d")',
11
+ ShowInsideWrapper: 'ns.show("Loading Wrapper", "#wrapper")',
12
+ ShowFullScreen: 'ns.show("Loading window")',
13
+ Progress: 'Progressive Demo',
14
+ Hide: 'ns.hide()',
15
+ HideAll: 'ns.hideAll()',
16
+ }
9
17
 
10
18
  const rCommandString = ref('')
11
19
 
12
20
  const wait = ms => new Promise(r => setTimeout(r, ms))
13
21
 
14
- function onClickExe() {
15
- const str = rCommandString.value
16
- let executable = null
17
- if (str.startsWith('ns.show(')) {
18
- const text = /ns\.show\(['"](.+)['"]\)/.exec(str)[1]
19
- executable = async () => {
20
- const id = eval(str)
21
- let ms = 4000
22
- while (ms > 0) {
23
- await wait(1000)
24
- ms -= 1000
25
- ns.show(`${text} (${ms / 1000})`)
22
+ async function onClickExe() {
23
+ const value = rCommandString.value
24
+ const phrases = [
25
+ 'Generating witty dialog',
26
+ 'Swapping time and space',
27
+ 'sudo rm -rf /**/*',
28
+ 'Tokenizing real life',
29
+ 'Pushing pixels',
30
+ "Don't think of purple hippos",
31
+ 'One mississippi, two mississippi...',
32
+ ]
33
+ switch (value) {
34
+ case Commands.ShowInsideA:
35
+ ns.show('Loading A', '#a')
36
+ break
37
+ case Commands.ShowInsideB:
38
+ ns.show('Loading B', '#b')
39
+ break
40
+ case Commands.ShowInsideC:
41
+ ns.show('Loading C', '#c')
42
+ break
43
+ case Commands.ShowInsideD:
44
+ ns.show('Loading D', '#d')
45
+ break
46
+ case Commands.ShowInsideWrapper:
47
+ ns.show('Loading Wrapper', '#wrapper')
48
+ break
49
+ case Commands.ShowFullScreen:
50
+ const id = ns.show('Loading window')
51
+ await wait(4000)
52
+ ns.hide(id)
53
+ break
54
+ case Commands.Hide:
55
+ ns.hide()
56
+ break
57
+ case Commands.HideAll:
58
+ ns.hideAll()
59
+ break
60
+ case Commands.Progress:
61
+ for (const phrase of phrases) {
62
+ ns.show(phrase)
63
+ await wait(1500)
26
64
  }
27
- ns.hideId(id)
28
- }
29
- } else {
30
- executable = new Function(rCommandString.value)
65
+ ns.hideAll()
31
66
  }
32
- executable()
33
67
  }
34
68
  </script>
35
69
 
@@ -37,11 +71,7 @@ function onClickExe() {
37
71
  <div class="container">
38
72
  <select class="select" v-model="rCommandString">
39
73
  <option value="" selected disabled>Click and select</option>
40
- <option
41
- v-for="(command, i) in props.commands"
42
- :key="i"
43
- :value="command"
44
- >
74
+ <option v-for="(command, i) in Commands" :key="i" :value="command">
45
75
  {{ command }}
46
76
  </option>
47
77
  </select>
@@ -2,41 +2,25 @@
2
2
  import CardGrid from './CardGrid.vue'
3
3
  import Card from './Card.vue'
4
4
  import Exe from './Exe.vue'
5
-
6
- const commands = [
7
- 'ns.showInside("#a", "Loading A")',
8
- 'ns.showInside("#b", "Loading B")',
9
- 'ns.showInside("#c", "Loading C")',
10
- 'ns.showInside("#d", "Loading D")',
11
- 'ns.showInside("#wrapper", "Loading Wrapper")',
12
- 'ns.show("Loading window")',
13
- 'ns.hide()',
14
- 'ns.hideInside("#b")',
15
- 'ns.hideAll()',
16
- ]
17
5
  </script>
18
6
 
19
7
  <template>
20
8
  <div class="playground">
21
9
  <CardGrid id="wrapper">
22
10
  <Card id="a">
23
- Lorem ipsum dolor sit amet consectetur adipiscing elit ut
24
- aliquam
11
+ Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
25
12
  </Card>
26
13
  <Card id="b">
27
- Lorem ipsum dolor sit amet consectetur adipiscing elit ut
28
- aliquam
14
+ Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
29
15
  </Card>
30
16
  <Card id="c">
31
- Lorem ipsum dolor sit amet consectetur adipiscing elit ut
32
- aliquam
17
+ Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
33
18
  </Card>
34
19
  <Card id="d">
35
- Lorem ipsum dolor sit amet consectetur adipiscing elit ut
36
- aliquam
20
+ Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
37
21
  </Card>
38
22
  </CardGrid>
39
- <Exe :commands="commands"></Exe>
23
+ <Exe />
40
24
  </div>
41
25
  </template>
42
26
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  ## Hide
4
4
 
5
- Hides the oldest loading screen (FIFO) and returns the GUID of the loading screen that was removed, or `null` if no loading screen was found.
5
+ Hides the oldest Nanosplash (FIFO).
6
6
 
7
7
  ```ts
8
- ns.hide(): GUIDString | null
8
+ ns.hide(): void
9
9
  ```
10
10
 
11
11
  ```js
@@ -18,51 +18,30 @@ ns.hide() // Hides 'c'
18
18
  ```
19
19
 
20
20
  ::: tip
21
- If you have multiple loading screens open at the same time, I would recommend that you hide specific elements based on their GUID or host element. See [`hideId`](#hide-by-id) and [`hideInside`](#hide-inside) for more information.
21
+ If you have multiple Nanosplashes open at the same time, I would recommend
22
+ that you hide specific elements based on their ID.
23
+ See [Hide by ID](#hide-by-id) for more information.
22
24
  :::
23
25
 
24
26
  ## Hide by ID
25
27
 
26
- Hides the Nanosplash loading screen with the given GUID. If a loading screen matching the GUID is found, it will be removed and the same GUID will be returned. If no loading screen is found, `null` will be returned.
28
+ Hides a Nanosplash by its ID.
27
29
 
28
30
  ```ts
29
- ns.hideId(guid: GUIDString): GUIDString | null
31
+ ns.hide(id: number): number | null
30
32
  ```
31
33
 
32
- The show methods always retrun a GUID. This identifier can be used to hide specific loading screens.
34
+ The show method returns the Nanosplash ID. This identifier can be
35
+ used to hide a specific Nanosplash at a later time.
33
36
 
34
37
  ```js
35
38
  const id = ns.show('Loading')
36
39
  ns.hideId(id)
37
40
  ```
38
41
 
39
- ## Hide inside
40
-
41
- Hides the Nanosplash loading screen inside another element — if any — that corresponds with the given element reference. Returns the GUID string of the loading screen that was hidden, or `null` if no loading screen was found inside.
42
-
43
- ```ts
44
- ns.hideInside(ref: Reference): GUIDString | null
45
- ```
46
-
47
- This method works almost the same way as `hideId`, but instead of using the GUID string as the identifier, it uses the host element as the identifier.
48
-
49
- ```js
50
- const selector = '#my-table'
51
- ns.showInside(selector, 'Loading')
52
- ns.hideInside(selector)
53
- ```
54
-
55
- You can also use the `Element` type as the reference.
56
-
57
- ```js
58
- const element = document.getElementById('my-table')
59
- ns.showInside(element, 'Loading')
60
- ns.hideInside(element)
61
- ```
62
-
63
42
  ## Hide all
64
43
 
65
- Hides all Nanosplash loading screens.
44
+ Hides all Nanosplashes in the `window`.
66
45
 
67
46
  ```ts
68
47
  ns.hideAll(): void
@@ -2,42 +2,41 @@
2
2
 
3
3
  ## Show
4
4
 
5
- This method displays a fullscreen loading screen and returns a GUID string.
5
+ This function display NS in fullscreen and returns the internal ID.
6
6
 
7
7
  ```ts
8
- ns.show(text?: string): GUIDString
8
+ ns.show(text?: string): number
9
9
  ```
10
10
 
11
11
  If you enter no text, it will display the spinning wheel only.
12
12
 
13
13
  ```js
14
- ns.show()
14
+ ns.show(): number
15
15
  ```
16
16
 
17
17
  If you enter text, it will display the spinning wheel adjacent to the text.
18
18
 
19
19
  ```js
20
- ns.show('Loading')
20
+ ns.show('Loading'): number
21
21
  ```
22
22
 
23
23
  ## Show inside
24
24
 
25
- This method displays a loading screen inside an element and returns a GUID
26
- string. The `Reference` type is a union type of `string | Element`. A reference
27
- can be both a CSS selector `string` or an `Element`.
25
+ This function display NS inside another element and returns the internal ID,
26
+ or `null` if the reference argument does not match any node inside the DOM.
28
27
 
29
28
  ```ts
30
- ns.showInside(ref: Reference, text?: string): GUIDString | null
29
+ ns.show(text?: string, ref?: Element | string): number | null
31
30
  ```
32
31
 
33
32
  ```js
34
- // CSS selector
35
- const selector = '#my-table'
36
- ns.showInside(selector, 'Loading')
33
+ // DOM selector
34
+ const selector: string = '#my-table'
35
+ ns.showInside('Loading', selector)
37
36
 
38
37
  // Element
39
- const element = document.getElementById('my-table')
40
- ns.showInside(element, 'Loading')
38
+ const element: HTMLElement = document.getElementById('my-table')
39
+ ns.showInside('Loading', element)
41
40
  ```
42
41
 
43
42
  ::: tip
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Small bundle size
4
4
 
5
- The Nanosplash bundle is less than 3KB minified and gzipped and will not add any significant weight to your application what so ever. Go to [Bundlephobia](https://bundlephobia.com/package/nanosplash) to see for yourself.
5
+ The Nanosplash bundle is less than 2KB minified and gzipped and will not add any significant weight to your application what so ever. Go to [Bundlephobia](https://bundlephobia.com/package/nanosplash) to see for yourself.
6
6
 
7
7
  ## Simple API
8
8
 
@@ -45,9 +45,11 @@ yarn add nanosplash
45
45
 
46
46
  To import and start the Nanosplash service in your application, you need to import the Service class and start it.
47
47
 
48
- ```js{2}
49
- import { Service } from 'nanosplash'
50
- Service.start()
48
+ ```js{2,3}
49
+ import { useNs } from 'nanosplash'
50
+ const ns = useNs()
51
+ ns.show('It works!')
51
52
  ```
52
53
 
53
- The service will inject an instance of itself inside the global `window` object. You can now start using Nanosplash by simply calling `ns.show`.
54
+ The hook will inject the Nanosplash API inside the global `window` object.
55
+ You can now start using Nanosplash by simply calling `ns.show`.
@@ -6,6 +6,6 @@ import PlayGround from '../../.vitepress/theme/vue/PlayGround.vue'
6
6
 
7
7
  Here you can play around with Nanosplash and see how it works.
8
8
 
9
- <PlayGround></PlayGround>
9
+ <PlayGround />
10
10
 
11
11
  Select a method from the dropdown menu above and click "Run" to see it in action.
@@ -1,6 +1,6 @@
1
1
  # Usage
2
2
 
3
- ```js{2,5,8,11,14,18,21}
3
+ ```js{2,5,8,11,15,18}
4
4
  // Fullscreen spinning wheel
5
5
  ns.show()
6
6
 
@@ -8,14 +8,11 @@ ns.show()
8
8
  ns.show('Loading')
9
9
 
10
10
  // Display inside an element
11
- ns.showInside('#my-table', 'Fetching data')
11
+ ns.show('Fetching data', '#my-table')
12
12
 
13
13
  // Hide the first created loading screen (FIFO)
14
14
  ns.hide()
15
15
 
16
- // Hide loading screen inside an element
17
- ns.hideInside('#my-table')
18
-
19
16
  // Hide specific loading screen
20
17
  const id = ns.show('Loading')
21
18
  ns.hideId(id)
package/docs/index.md CHANGED
@@ -3,31 +3,31 @@
3
3
  layout: home
4
4
 
5
5
  hero:
6
- name: 'Nanosplash'
7
- text: ''
8
- tagline: The tiny loading screen for web artisans
9
- actions:
10
- - theme: brand
11
- text: Get started
12
- link: /api/start/install.md
13
- - theme: alt
14
- text: Playground
15
- link: /api/start/playground.md
16
- - theme: alt
17
- text: API Documentation
18
- link: /api/doc/show.md
6
+ name: 'Nanosplash'
7
+ text: ''
8
+ tagline: The tiny loading screen for web artisans
9
+ actions:
10
+ - theme: brand
11
+ text: Get started
12
+ link: /api/start/install.md
13
+ - theme: alt
14
+ text: Playground
15
+ link: /api/start/playground.md
16
+ - theme: alt
17
+ text: API Documentation
18
+ link: /api/doc/show.md
19
19
 
20
20
  features:
21
- - title: 📦 Tiny
22
- details: Less than 3KB minified and gzipped.
23
- link: /api/start/features#small-bundle-size
24
- - title: 🍼 Simple API
25
- details: Start using Nanosplash in seconds.
26
- link: /api/start/features#simple-api
27
- - title: 🧚 Spawning
28
- details: Spawn a splash element anywhere in your DOM.
29
- link: /api/start/features#spawning
30
- - title: ♻️ Element recycling
31
- details: Nanosplash will recycle existing elements.
32
- link: /api/start/features#element-recycling
21
+ - title: 📦 Tiny
22
+ details: Less than 2KB minified and gzipped.
23
+ link: /api/start/features#small-bundle-size
24
+ - title: 🍼 Simple API
25
+ details: Start using Nanosplash in seconds.
26
+ link: /api/start/features#simple-api
27
+ - title: 🧚 Spawning
28
+ details: Spawn a splash element anywhere in your DOM.
29
+ link: /api/start/features#spawning
30
+ - title: ♻️ Element recycling
31
+ details: Nanosplash will recycle existing elements.
32
+ link: /api/start/features#element-recycling
33
33
  ---
Binary file
@@ -0,0 +1,9 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+
6
+ export default tseslint.config(
7
+ eslint.configs.recommended,
8
+ ...tseslint.configs.recommended,
9
+ );
package/package.json CHANGED
@@ -1,41 +1,37 @@
1
1
  {
2
2
  "name": "nanosplash",
3
- "description": "The tiny loading screen for web artisans",
4
- "private": false,
5
- "version": "3.0.7",
6
- "type": "module",
3
+ "version": "3.0.9",
7
4
  "author": {
8
5
  "name": "Isak K. Hauge",
9
6
  "email": "isakhauge@icloud.com",
10
7
  "url": "https://no.linkedin.com/in/isakhauge"
11
8
  },
12
- "keywords": [
13
- "loading",
14
- "loader",
15
- "screen",
16
- "splash",
17
- "nano",
18
- "nanosplash",
19
- "small",
20
- "tiny",
21
- "es",
22
- "esm",
23
- "ts",
24
- "typescript",
25
- "iife",
26
- "cdn",
27
- "vite"
28
- ],
29
- "homepage": "https://isakhauge.github.io/nanosplash",
30
9
  "repository": {
31
10
  "type": "git",
32
- "url": "https://github.com/isakhauge/nanosplash.git"
11
+ "url": "git+https://github.com/isakhauge/nanosplash.git"
33
12
  },
34
- "license": "MIT",
35
13
  "main": "./dist/es/ns.js",
36
14
  "module": "./dist/es/ns.js",
37
- "source": "./src/main.ts",
38
- "unpkg": "./dist/iife/ns.iife.js",
15
+ "devDependencies": {
16
+ "@types/jsdom": "^21.1.6",
17
+ "@types/node": "^20.11.25",
18
+ "@types/rollup": "^0.54.0",
19
+ "@vitest/coverage-v8": "^1.3.1",
20
+ "@vitest/ui": "^1.3.1",
21
+ "cross-env": "^7.0.3",
22
+ "eslint": "^8.57.0",
23
+ "eslint-config-prettier": "^9.1.0",
24
+ "eslint-plugin-prettier": "^5.1.3",
25
+ "jsdom": "^24.0.0",
26
+ "sass": "^1.71.1",
27
+ "stylelint-prettier": "^5.0.0",
28
+ "terser": "^5.29.1",
29
+ "typescript": "5.3.3",
30
+ "typescript-eslint": "^7.1.1",
31
+ "vite": "^5.1.5",
32
+ "vitepress": "1.0.0-rc.45",
33
+ "vitest": "^1.3.1"
34
+ },
39
35
  "exports": {
40
36
  ".": {
41
37
  "types": {
@@ -52,35 +48,45 @@
52
48
  }
53
49
  }
54
50
  },
55
- "types": "./src/ts/types/global.d.ts",
51
+ "description": "The tiny loading screen for web artisans",
52
+ "homepage": "https://isakhauge.github.io/nanosplash",
53
+ "keywords": [
54
+ "loading",
55
+ "loader",
56
+ "screen",
57
+ "splash",
58
+ "nano",
59
+ "nanosplash",
60
+ "small",
61
+ "tiny",
62
+ "es",
63
+ "esm",
64
+ "ts",
65
+ "typescript",
66
+ "iife",
67
+ "cdn",
68
+ "vite"
69
+ ],
70
+ "license": "MIT",
71
+ "private": false,
56
72
  "scripts": {
57
73
  "build": "bun build:all && bun build:docs",
58
- "build:es": "tsc && cross-env entry=./src/ts/core/Service.ts format=es bun vite build -m production --c vite.config.ts",
59
- "build:cjs": "tsc && cross-env entry=./src/ts/core/Service.ts format=cjs bun vite build -m production --c vite.config.ts",
60
- "build:iife": "tsc && cross-env entry=./src/ts/main.ts format=iife bun vite build -m production --c vite.config.ts",
74
+ "build:es": "bun x -b tsc && cross-env entry=./src/ts/Nanosplash.ts format=es bun run -b vite build -m production --c vite.config.ts",
75
+ "build:cjs": "bun x -b tsc && cross-env entry=./src/ts/Nanosplash.ts format=cjs bun run -b vite build -m production --c vite.config.ts",
76
+ "build:iife": "bun x -b tsc && cross-env entry=./src/ts/main.ts format=iife bun run -b vite build -m production --c vite.config.ts",
61
77
  "build:all": "bun build:es && bun build:cjs && bun build:iife",
62
78
  "build:docs": "bun docs:build",
63
79
  "preview": "vite preview",
64
80
  "test": "vitest",
65
81
  "test:ui": "vitest --ui",
82
+ "lint": "bunx eslint src/ts/**/*.ts --fix",
66
83
  "coverage": "vitest --coverage",
67
- "docs:dev": "vitepress dev docs",
68
- "docs:build": "vitepress build docs",
69
- "docs:preview": "vitepress preview docs"
84
+ "docs:dev": "bun x vitepress dev docs",
85
+ "docs:build": "bun x vitepress build docs",
86
+ "docs:preview": "bun x vitepress preview docs"
70
87
  },
71
- "devDependencies": {
72
- "@types/jsdom": "^21.1.4",
73
- "@types/node": "^20.8.7",
74
- "@types/rollup": "^0.54.0",
75
- "@vitest/coverage-v8": "^0.34.6",
76
- "@vitest/ui": "^0.34.6",
77
- "cross-env": "^7.0.3",
78
- "jsdom": "^22.1.0",
79
- "sass": "^1.69.4",
80
- "terser": "^5.22.0",
81
- "typescript": "^5.2.2",
82
- "vite": "^4.5.0",
83
- "vitepress": "1.0.0-rc.22",
84
- "vitest": "^0.34.6"
85
- }
88
+ "source": "./src/main.ts",
89
+ "type": "module",
90
+ "types": "./src/ts/types/global.d.ts",
91
+ "unpkg": "./dist/iife/ns.iife.js"
86
92
  }