nanosplash 4.0.2 â 4.0.4
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.prod.yml +68 -0
- package/.prettierrc +9 -10
- package/README.md +118 -51
- package/bun.lock +635 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +176 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/composables/index.html +116 -0
- package/coverage/lcov-report/src/composables/ns.ts.html +547 -0
- package/coverage/lcov-report/src/constants/index.html +116 -0
- package/coverage/lcov-report/src/constants/ns.ts.html +124 -0
- package/coverage/lcov-report/src/iife.ts.html +100 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/interfaces/INSElement.ts.html +100 -0
- package/coverage/lcov-report/src/interfaces/INanosplash.ts.html +304 -0
- package/coverage/lcov-report/src/interfaces/index.html +131 -0
- package/coverage/lcov-report/src/utils/dom-utils.ts.html +289 -0
- package/coverage/lcov-report/src/utils/index.html +116 -0
- package/coverage/lcov.info +271 -0
- package/eslint.config.js +7 -2
- package/package.json +74 -88
- package/src/composables/ns.ts +154 -0
- package/src/constants/ns.ts +13 -0
- package/src/iife.ts +5 -0
- package/src/interfaces/INSElement.ts +5 -0
- package/src/interfaces/INanosplash.ts +73 -0
- package/src/style/ns.css +134 -0
- package/src/types/dom.d.ts +3 -0
- package/src/types/generic/function.d.ts +1 -0
- package/src/types/global.d.ts +26 -0
- package/src/types/semantic/number.d.ts +1 -0
- package/src/types/semantic/string.d.ts +2 -0
- package/src/utils/dom-utils.ts +68 -0
- package/tests/ns.spec.ts +124 -0
- package/tsconfig.json +29 -21
- package/vite.config.ts +18 -10
- package/vitest.config.ts +20 -0
- package/.github/workflows/ci.yml +0 -62
- package/.github/workflows/vitepress.yml +0 -68
- package/LICENSE +0 -21
- package/docs/.vitepress/config.ts +0 -78
- package/docs/.vitepress/theme/css/style.css +0 -258
- package/docs/.vitepress/theme/index.ts +0 -16
- package/docs/.vitepress/theme/vue/Card.vue +0 -31
- package/docs/.vitepress/theme/vue/CardGrid.vue +0 -17
- package/docs/.vitepress/theme/vue/PlayGround.vue +0 -36
- package/docs/api/doc/hide.md +0 -48
- package/docs/api/doc/show.md +0 -46
- package/docs/api/start/customize.md +0 -30
- package/docs/api/start/features.md +0 -17
- package/docs/api/start/install.md +0 -61
- package/docs/api/start/playground.md +0 -16
- package/docs/api/start/usage.md +0 -22
- package/docs/index.md +0 -33
- package/docs/public/macos.jpg +0 -0
- package/src/style/ns.sass +0 -120
- package/src/ts/Nanosplash.ts +0 -177
- package/src/ts/main.ts +0 -5
- package/src/ts/types/NanosplashInterface.ts +0 -26
- package/src/ts/types/Types.ts +0 -16
- package/src/ts/types/global.d.ts +0 -14
- package/tests/Nanosplash.spec.ts +0 -25
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Customize default theme styling by overriding CSS variables:
|
|
3
|
-
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Colors
|
|
8
|
-
*
|
|
9
|
-
* Each colors have exact same color scale system with 3 levels of solid
|
|
10
|
-
* colors with different brightness, and 1 soft color.
|
|
11
|
-
*
|
|
12
|
-
* - `XXX-1`: The most solid color used mainly for colored text. It must
|
|
13
|
-
* satisfy the contrast ratio against when used on top of `XXX-soft`.
|
|
14
|
-
*
|
|
15
|
-
* - `XXX-2`: The color used mainly for hover state of the button.
|
|
16
|
-
*
|
|
17
|
-
* - `XXX-3`: The color for solid background, such as bg color of the button.
|
|
18
|
-
* It must satisfy the contrast ratio with pure white (#ffffff) text on
|
|
19
|
-
* top of it.
|
|
20
|
-
*
|
|
21
|
-
* - `XXX-soft`: The color used for subtle background such as custom container
|
|
22
|
-
* or badges. It must satisfy the contrast ratio when putting `XXX-1` colors
|
|
23
|
-
* on top of it.
|
|
24
|
-
*
|
|
25
|
-
* The soft color must be semi transparent alpha channel. This is crucial
|
|
26
|
-
* because it allows adding multiple "soft" colors on top of each other
|
|
27
|
-
* to create a accent, such as when having inline code block inside
|
|
28
|
-
* custom containers.
|
|
29
|
-
*
|
|
30
|
-
* - `default`: The color used purely for subtle indication without any
|
|
31
|
-
* special meanings attched to it such as bg color for menu hover state.
|
|
32
|
-
*
|
|
33
|
-
* - `brand`: Used for primary brand colors, such as link text, button with
|
|
34
|
-
* brand theme, etc.
|
|
35
|
-
*
|
|
36
|
-
* - `tip`: Used to indicate useful information. The default theme uses the
|
|
37
|
-
* brand color for this by default.
|
|
38
|
-
*
|
|
39
|
-
* - `warning`: Used to indicate warning to the users. Used in custom
|
|
40
|
-
* container, badges, etc.
|
|
41
|
-
*
|
|
42
|
-
* - `danger`: Used to show error, or dangerous message to the users. Used
|
|
43
|
-
* in custom container, badges, etc.
|
|
44
|
-
* -------------------------------------------------------------------------- */
|
|
45
|
-
|
|
46
|
-
:root {
|
|
47
|
-
--vp-c-default-1: var(--vp-c-gray-1);
|
|
48
|
-
--vp-c-default-2: var(--vp-c-gray-2);
|
|
49
|
-
--vp-c-default-3: var(--vp-c-gray-3);
|
|
50
|
-
--vp-c-default-soft: var(--vp-c-gray-soft);
|
|
51
|
-
|
|
52
|
-
--vp-c-brand-1: var(--vp-c-indigo-1);
|
|
53
|
-
--vp-c-brand-2: var(--vp-c-indigo-2);
|
|
54
|
-
--vp-c-brand-3: var(--vp-c-indigo-3);
|
|
55
|
-
--vp-c-brand-soft: var(--vp-c-indigo-soft);
|
|
56
|
-
|
|
57
|
-
--vp-c-tip-1: var(--vp-c-brand-1);
|
|
58
|
-
--vp-c-tip-2: var(--vp-c-brand-2);
|
|
59
|
-
--vp-c-tip-3: var(--vp-c-brand-3);
|
|
60
|
-
--vp-c-tip-soft: var(--vp-c-brand-soft);
|
|
61
|
-
|
|
62
|
-
--vp-c-warning-1: var(--vp-c-yellow-1);
|
|
63
|
-
--vp-c-warning-2: var(--vp-c-yellow-2);
|
|
64
|
-
--vp-c-warning-3: var(--vp-c-yellow-3);
|
|
65
|
-
--vp-c-warning-soft: var(--vp-c-yellow-soft);
|
|
66
|
-
|
|
67
|
-
--vp-c-danger-1: var(--vp-c-red-1);
|
|
68
|
-
--vp-c-danger-2: var(--vp-c-red-2);
|
|
69
|
-
--vp-c-danger-3: var(--vp-c-red-3);
|
|
70
|
-
--vp-c-danger-soft: var(--vp-c-red-soft);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Component: Button
|
|
75
|
-
* -------------------------------------------------------------------------- */
|
|
76
|
-
|
|
77
|
-
:root {
|
|
78
|
-
--vp-button-brand-border: transparent;
|
|
79
|
-
--vp-button-brand-text: var(--vp-c-white);
|
|
80
|
-
--vp-button-brand-bg: var(--vp-c-brand-3);
|
|
81
|
-
--vp-button-brand-hover-border: transparent;
|
|
82
|
-
--vp-button-brand-hover-text: var(--vp-c-white);
|
|
83
|
-
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
|
|
84
|
-
--vp-button-brand-active-border: transparent;
|
|
85
|
-
--vp-button-brand-active-text: var(--vp-c-white);
|
|
86
|
-
--vp-button-brand-active-bg: var(--vp-c-brand-1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Component: Home
|
|
91
|
-
* -------------------------------------------------------------------------- */
|
|
92
|
-
|
|
93
|
-
:root {
|
|
94
|
-
--vp-home-hero-name-color: transparent;
|
|
95
|
-
--vp-home-hero-name-background: -webkit-linear-gradient(
|
|
96
|
-
120deg,
|
|
97
|
-
#bd34fe 30%,
|
|
98
|
-
#41d1ff
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
--vp-home-hero-image-background-image: linear-gradient(
|
|
102
|
-
-45deg,
|
|
103
|
-
#bd34fe 50%,
|
|
104
|
-
#47caff 50%
|
|
105
|
-
);
|
|
106
|
-
--vp-home-hero-image-filter: blur(40px);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@media (min-width: 640px) {
|
|
110
|
-
:root {
|
|
111
|
-
--vp-home-hero-image-filter: blur(56px);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@media (min-width: 960px) {
|
|
116
|
-
:root {
|
|
117
|
-
--vp-home-hero-image-filter: blur(72px);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Component: Custom Block
|
|
123
|
-
* -------------------------------------------------------------------------- */
|
|
124
|
-
|
|
125
|
-
:root {
|
|
126
|
-
--vp-custom-block-tip-border: transparent;
|
|
127
|
-
--vp-custom-block-tip-text: var(--vp-c-text-1);
|
|
128
|
-
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
|
|
129
|
-
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Component: Algolia
|
|
134
|
-
* -------------------------------------------------------------------------- */
|
|
135
|
-
|
|
136
|
-
.DocSearch {
|
|
137
|
-
--docsearch-primary-color: var(--vp-c-brand-1) !important;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.vp-doc [class*='language-'] code .highlighted {
|
|
141
|
-
background-color: transparent;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.vp-doc [class*='language-'] .has-highlighted-lines .line {
|
|
145
|
-
transition:
|
|
146
|
-
filter 0.35s,
|
|
147
|
-
opacity 0.35s;
|
|
148
|
-
}
|
|
149
|
-
.vp-doc code:has(.highlighted) .line:not(.highlighted) {
|
|
150
|
-
filter: blur(1px);
|
|
151
|
-
opacity: 0.5;
|
|
152
|
-
transition: all 0.3s ease;
|
|
153
|
-
}
|
|
154
|
-
.vp-doc code:has(.highlighted):hover .line:not(.highlighted) {
|
|
155
|
-
filter: blur(0);
|
|
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);
|
|
258
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// https://vitepress.dev/guide/custom-theme
|
|
2
|
-
import { h } from 'vue'
|
|
3
|
-
import Theme from 'vitepress/theme'
|
|
4
|
-
import './css/style.css'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
extends: Theme,
|
|
8
|
-
Layout: () => {
|
|
9
|
-
return h(Theme.Layout, null, {
|
|
10
|
-
// https://vitepress.dev/guide/extending-default-theme#layout-slots
|
|
11
|
-
})
|
|
12
|
-
},
|
|
13
|
-
enhanceApp({ app, router, siteData }) {
|
|
14
|
-
// ...
|
|
15
|
-
},
|
|
16
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useAttrs } from 'vue'
|
|
3
|
-
const attrs = useAttrs()
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<template>
|
|
7
|
-
<div class="card">
|
|
8
|
-
<div v-if="attrs.id" class="id">#{{ attrs.id }}</div>
|
|
9
|
-
<slot></slot>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<style lang="sass" scoped>
|
|
14
|
-
.card
|
|
15
|
-
color: White
|
|
16
|
-
line-height: 1
|
|
17
|
-
position: relative
|
|
18
|
-
padding: 30px
|
|
19
|
-
border-radius: 5px
|
|
20
|
-
background-color: rgba(White, 0.2)
|
|
21
|
-
backdrop-filter: blur(5px)
|
|
22
|
-
-webkit-backdrop-filter: blur(5px)
|
|
23
|
-
border: 1px solid rgba(White, 0.2)
|
|
24
|
-
.id
|
|
25
|
-
position: absolute
|
|
26
|
-
top: 5px
|
|
27
|
-
left: 5px
|
|
28
|
-
font-size: 10px
|
|
29
|
-
color: rgba(White, 0.7)
|
|
30
|
-
letter-spacing: 0.1em
|
|
31
|
-
</style>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="card-grid">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<style lang="sass" scoped>
|
|
8
|
-
.card-grid
|
|
9
|
-
display: grid
|
|
10
|
-
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))
|
|
11
|
-
grid-gap: 25px
|
|
12
|
-
background-image: url('/macos.jpg')
|
|
13
|
-
background-size: cover
|
|
14
|
-
background-position-y: bottom
|
|
15
|
-
padding: 25px
|
|
16
|
-
border-radius: 5px
|
|
17
|
-
</style>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import CardGrid from './CardGrid.vue'
|
|
3
|
-
import Card from './Card.vue'
|
|
4
|
-
import { useNs } from '../../../../dist/es/ns'
|
|
5
|
-
if (window) {
|
|
6
|
-
window.ns = useNs(window)
|
|
7
|
-
}
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div class="playground">
|
|
12
|
-
<CardGrid id="wrapper">
|
|
13
|
-
<Card id="a">
|
|
14
|
-
Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
|
|
15
|
-
</Card>
|
|
16
|
-
<Card id="b">
|
|
17
|
-
Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
|
|
18
|
-
</Card>
|
|
19
|
-
<Card id="c">
|
|
20
|
-
Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
|
|
21
|
-
</Card>
|
|
22
|
-
<Card id="d">
|
|
23
|
-
Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam
|
|
24
|
-
</Card>
|
|
25
|
-
</CardGrid>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<style lang="sass" scoped>
|
|
30
|
-
.playground
|
|
31
|
-
display: flex
|
|
32
|
-
flex-direction: column
|
|
33
|
-
row-gap: 20px
|
|
34
|
-
& > *
|
|
35
|
-
box-shadow: 0 2px 10px rgba(Black, 0.1)
|
|
36
|
-
</style>
|
package/docs/api/doc/hide.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Hide Nanosplash
|
|
2
|
-
|
|
3
|
-
## Hide
|
|
4
|
-
|
|
5
|
-
Hides the oldest Nanosplash (FIFO).
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
ns.hide(): void
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
ns.show('a')
|
|
13
|
-
ns.show('b')
|
|
14
|
-
ns.show('c')
|
|
15
|
-
ns.hide() // Hides 'a'
|
|
16
|
-
ns.hide() // Hides 'b'
|
|
17
|
-
ns.hide() // Hides 'c'
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
::: tip
|
|
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.
|
|
24
|
-
:::
|
|
25
|
-
|
|
26
|
-
## Hide by ID
|
|
27
|
-
|
|
28
|
-
Hides a Nanosplash by its ID.
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
ns.hide(id: number): number | null
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
The show method returns the Nanosplash ID. This identifier can be
|
|
35
|
-
used to hide a specific Nanosplash at a later time.
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
const id = ns.show('Loading')
|
|
39
|
-
ns.hide(id)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Hide all
|
|
43
|
-
|
|
44
|
-
Hides all Nanosplashes in the `window`.
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
ns.hide('*'): void
|
|
48
|
-
```
|
package/docs/api/doc/show.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Show Nanosplash
|
|
2
|
-
|
|
3
|
-
## Show
|
|
4
|
-
|
|
5
|
-
This function display NS in fullscreen and returns the internal ID.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
ns.show(text?: string): number
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
If you enter no text, it will display the spinning wheel only.
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
ns.show(): number
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
If you enter text, it will display the spinning wheel adjacent to the text.
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
ns.show('Loading'): number
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Show inside
|
|
24
|
-
|
|
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.
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
ns.show(text?: string, ref?: Element | string): number | null
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
// DOM selector
|
|
34
|
-
const selector: string = '#my-table'
|
|
35
|
-
ns.show('Loading', selector)
|
|
36
|
-
|
|
37
|
-
// Element
|
|
38
|
-
const element: HTMLElement = document.getElementById('my-table')
|
|
39
|
-
ns.show('Loading', element)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
::: tip
|
|
43
|
-
A host element can only contain one Nanosplash element at a time. If
|
|
44
|
-
you try to show a splash inside an element that already contains a splash,
|
|
45
|
-
the existing splash will be overwritten.
|
|
46
|
-
:::
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Customize
|
|
2
|
-
|
|
3
|
-
Styling Nanosplash to your needs is easy!
|
|
4
|
-
|
|
5
|
-
```css
|
|
6
|
-
/* Backdrop */
|
|
7
|
-
.nsh::before {
|
|
8
|
-
background-color: var(--your-bg);
|
|
9
|
-
backdrop-filter: var(--your-filter);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* Main */
|
|
13
|
-
.ns {
|
|
14
|
-
gap: var(--text-spinner-gap);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* Text */
|
|
18
|
-
.nst {
|
|
19
|
-
color: var(--color);
|
|
20
|
-
font-size: var(--size);
|
|
21
|
-
font-family: var(--font);
|
|
22
|
-
font-weight: var(--weight);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* Spinner */
|
|
26
|
-
.nss {
|
|
27
|
-
width: var(--spinner-width);
|
|
28
|
-
height: var(--spinner-height);
|
|
29
|
-
}
|
|
30
|
-
```
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Features
|
|
2
|
-
|
|
3
|
-
## Small bundle size
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
## Simple, 2 Function API
|
|
8
|
-
|
|
9
|
-
Nanosplash was written from the ground up with simplicity in mind. The API is very simple and easy to use, and you can easily get started in seconds. Just install the package and start using `ns.show` and `ns.hide`. Go to [Getting started](/api/start/install.md) to see how.
|
|
10
|
-
|
|
11
|
-
## Spawning
|
|
12
|
-
|
|
13
|
-
With Nanosplash you can spawn a splash element anywhere in your DOM. You can even spawn multiple splash elements if you want to. Go to the [API Documentation](/api/doc/show#show-inside) to see how.
|
|
14
|
-
|
|
15
|
-
## Node recycling
|
|
16
|
-
|
|
17
|
-
Instead of creating new elements all the time and exhausting DOM manipulations, we recycle and repurpose obsolete splash elements instead. For each time a splash element is created, we check for existing splash elements inside the parent element and use them instead of creating new ones.
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import Card from '../../.vitepress/theme/vue/Card.vue'
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
# Installation
|
|
6
|
-
|
|
7
|
-
Nanosplash can be installed either via CDN or NPM. Installing via CDN is easier and requires less configuration, but installing via NPM is more flexible and allows you to controll the imports and initialization of the Nanosplash service running in your application.
|
|
8
|
-
|
|
9
|
-
## CSS
|
|
10
|
-
|
|
11
|
-
CSS is included inside the JS bundle. ð
|
|
12
|
-
|
|
13
|
-
## Install via CDN
|
|
14
|
-
|
|
15
|
-
Add the following script tag inside of the `<body>` tag:
|
|
16
|
-
|
|
17
|
-
```html
|
|
18
|
-
<script src="https://unpkg.com/nanosplash/dist/iife/ns.iife.js"></script>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Example
|
|
22
|
-
|
|
23
|
-
```html{6}
|
|
24
|
-
<html>
|
|
25
|
-
<head>
|
|
26
|
-
<title>My awesome application ð</title>
|
|
27
|
-
</head>
|
|
28
|
-
<body>
|
|
29
|
-
<script src="https://unpkg.com/nanosplash/dist/iife/ns.iife.js"></script>
|
|
30
|
-
</body>
|
|
31
|
-
</html>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Now you can easily start using Nanosplash by simply calling `ns.show`.
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
ns.show('It works!')
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Install via NPM
|
|
41
|
-
|
|
42
|
-
Install Nanosplash via NPM by running the following command:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
yarn add nanosplash
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
To import and start the Nanosplash service in your application, you need to import the Service class and start it.
|
|
49
|
-
|
|
50
|
-
```js{2,3}
|
|
51
|
-
import { useNs } from 'nanosplash'
|
|
52
|
-
const ns = useNs()
|
|
53
|
-
ns.show('It works!')
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
For ease of use, add it to the window object for global access.
|
|
57
|
-
|
|
58
|
-
```js{2}
|
|
59
|
-
import { useNs } from 'nanosplash'
|
|
60
|
-
window.ns = useNs()
|
|
61
|
-
```
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import PlayGround from '../../.vitepress/theme/vue/PlayGround.vue'
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
# Playground
|
|
6
|
-
|
|
7
|
-
Here you can play around with Nanosplash and see how it works.
|
|
8
|
-
|
|
9
|
-
<PlayGround />
|
|
10
|
-
|
|
11
|
-
Open your browser console (developer tools).
|
|
12
|
-
|
|
13
|
-
- macOS: `â` `âĨ` `i`
|
|
14
|
-
- Windows: `Ctrl` `â§` `i`
|
|
15
|
-
|
|
16
|
-
Try to target different elements in the DOM. Nanosplash is available in the window scope as `ns`. Give it a shot!
|
package/docs/api/start/usage.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Usage
|
|
2
|
-
|
|
3
|
-
```js{2,5,8,11,15,18}
|
|
4
|
-
// Fullscreen spinning wheel
|
|
5
|
-
ns.show()
|
|
6
|
-
|
|
7
|
-
// Fullscreen spinning wheel with text
|
|
8
|
-
ns.show('Loading')
|
|
9
|
-
|
|
10
|
-
// Display inside an element
|
|
11
|
-
ns.show('Fetching data', '#my-table')
|
|
12
|
-
|
|
13
|
-
// Hide the first created loading screen (FIFO)
|
|
14
|
-
ns.hide()
|
|
15
|
-
|
|
16
|
-
// Hide specific loading screen
|
|
17
|
-
const id = ns.show('Loading')
|
|
18
|
-
ns.hide(id)
|
|
19
|
-
|
|
20
|
-
// Hide all loading screens
|
|
21
|
-
ns.hide('*')
|
|
22
|
-
```
|
package/docs/index.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# https://vitepress.dev/reference/default-theme-home-page
|
|
3
|
-
layout: home
|
|
4
|
-
|
|
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
|
|
19
|
-
|
|
20
|
-
features:
|
|
21
|
-
- title: âĻ Tiny
|
|
22
|
-
details: Less than 2KB minified and gzipped.
|
|
23
|
-
link: /api/start/features#small-bundle-size
|
|
24
|
-
- title: âïļ 2 Function 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: ð Node recycling
|
|
31
|
-
details: Nanosplash will recycle existing elements.
|
|
32
|
-
link: /api/start/features#element-recycling
|
|
33
|
-
---
|
package/docs/public/macos.jpg
DELETED
|
Binary file
|