nanosplash 2.2.2 → 2.3.0
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/production.yml +57 -0
- package/.github/workflows/release.yml +61 -0
- package/README.md +33 -9
- package/dist/iife/nanosplash.iife.js +1 -1
- package/dist/module/Nanosplash.css +1 -0
- package/dist/module/manifest.json +6 -3
- package/dist/module/nanosplash.cjs.js +1 -1
- package/dist/module/nanosplash.es.js +249 -285
- package/docs/index.html +54 -415
- package/docs/nanosplash.iife.js +1 -1
- package/docs/style.css +1 -1
- package/docs/typedoc/assets/highlight.css +1 -50
- package/docs/typedoc/assets/main.js +2 -2
- package/docs/typedoc/assets/search.js +1 -1
- package/docs/typedoc/assets/style.css +32 -2
- package/docs/typedoc/classes/Core_Nanosplash.Nanosplash.html +1 -0
- package/docs/typedoc/index.html +1 -1
- package/docs/typedoc/modules/types.html +1 -1
- package/index.html +51 -397
- package/jest.config.ts +194 -0
- package/package.json +71 -66
- package/src/Core/Nanosplash.ts +74 -0
- package/src/Core/SplashInstance.ts +154 -0
- package/src/Factory/NanosplashFactory.ts +73 -0
- package/src/Interfaces/ContextualAPIInterface.ts +8 -0
- package/src/Interfaces/IdentityInterface.ts +3 -0
- package/src/Interfaces/ImageInterface.ts +5 -0
- package/src/Interfaces/InsideInterface.ts +5 -0
- package/src/Interfaces/NanosplashInterface.ts +4 -0
- package/src/Interfaces/ProgressInterface.ts +5 -0
- package/src/Interfaces/ShowInterface.ts +5 -0
- package/src/Interfaces/WhileInterface.ts +5 -0
- package/src/main.ts +2 -6
- package/src/repositories/NanosplashRepository.ts +34 -57
- package/src/style.sass +36 -61
- package/src/types.d.ts +45 -197
- package/src/utilities/dom.spec.ts +70 -0
- package/src/utilities/dom.ts +17 -246
- package/update-all.sh +3 -0
- package/vite.iife.config.js +46 -18
- package/vite.mod.config.js +48 -12
- package/vite.site.config.js +0 -3
- package/dist/module/style.css +0 -1
- package/docs/typedoc/classes/Nanosplash.Nanosplash-1.html +0 -56
- package/docs/typedoc/classes/types.Nanosplash.html +0 -56
- package/docs/typedoc/modules/Nanosplash.html +0 -1
- package/src/Nanosplash.ts +0 -421
- package/src/exceptions/Exception.ts +0 -11
- package/src/exceptions/IllegalArgumentException.ts +0 -9
- package/src/exceptions/InvalidDestinationException.ts +0 -9
- package/update-latest.sh +0 -21
package/index.html
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
|
|
6
|
-
<
|
|
7
|
-
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
|
|
8
|
-
rel="stylesheet"
|
|
9
|
-
/>
|
|
6
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
10
7
|
<link href="https://cdn.lineicons.com/3.0/lineicons.css" rel="stylesheet" />
|
|
11
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
12
9
|
<title>Nanosplash</title>
|
|
@@ -15,406 +12,63 @@
|
|
|
15
12
|
<meta name="author" content="Isak Hauge" />
|
|
16
13
|
</head>
|
|
17
14
|
<body class="flex flex-col justify-between">
|
|
18
|
-
<
|
|
19
|
-
<div
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
rounded
|
|
33
|
-
"
|
|
34
|
-
>
|
|
35
|
-
Title section
|
|
36
|
-
</div>
|
|
37
|
-
<div class="px-10 flex flex-col justify-center items-center">
|
|
38
|
-
<span class="animate-spin mb-3 md:mb-6 text-6xl md:text-7xl"
|
|
39
|
-
>🍩</span
|
|
40
|
-
>
|
|
41
|
-
<h1 class="text-3xl md:text-4xl">Nanosplash</h1>
|
|
42
|
-
<h2 class="text-lg md:text-xl md:mt-1 font-thin">
|
|
43
|
-
The tiny loading screen
|
|
44
|
-
</h2>
|
|
45
|
-
</div>
|
|
46
|
-
</section>
|
|
47
|
-
<section class="py-3 bg-gray-800">
|
|
48
|
-
<div class="flex flex-col space-y-2">
|
|
49
|
-
<div class="flex space-x-2 justify-center">
|
|
50
|
-
<img src="https://badgen.net/npm/v/nanosplash" />
|
|
51
|
-
<img src="https://badgen.net/npm/types/nanosplash" />
|
|
52
|
-
<img src="https://badgen.net/npm/dw/nanosplash" />
|
|
53
|
-
</div>
|
|
54
|
-
<div class="flex space-x-2 justify-center">
|
|
55
|
-
<img src="https://badgen.net/bundlephobia/min/nanosplash" />
|
|
56
|
-
<img
|
|
57
|
-
src="https://badgen.net/bundlephobia/tree-shaking/nanosplash"
|
|
58
|
-
/>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</section>
|
|
62
|
-
</div>
|
|
63
|
-
<section class="flex flex-col items-center py-10 md:pt-16 md:pb-10">
|
|
64
|
-
<div
|
|
65
|
-
class="
|
|
66
|
-
text-center text-xl
|
|
67
|
-
md:text-2xl
|
|
68
|
-
font-light
|
|
69
|
-
text-gray-600
|
|
70
|
-
flex
|
|
71
|
-
justify-center
|
|
72
|
-
mb-2
|
|
73
|
-
md:mb-3
|
|
74
|
-
"
|
|
75
|
-
>
|
|
76
|
-
API reference documentation
|
|
15
|
+
<div class="w-100 min-h-screen flex flex-col justify-center items-center">
|
|
16
|
+
<div class="text-3xl">Nanosplash</div>
|
|
17
|
+
<div class="mt-3">Small. Simple. Reliable.</div>
|
|
18
|
+
<div class="flex flex-col space-y-2 my-10">
|
|
19
|
+
<div class="flex space-x-2 justify-center">
|
|
20
|
+
<img src="https://badgen.net/npm/v/nanosplash" />
|
|
21
|
+
<img src="https://badgen.net/npm/types/nanosplash" />
|
|
22
|
+
<img src="https://badgen.net/npm/dw/nanosplash" />
|
|
23
|
+
</div>
|
|
24
|
+
<div class="flex space-x-2 justify-center">
|
|
25
|
+
<img src="https://badgen.net/bundlephobia/min/nanosplash" />
|
|
26
|
+
<img
|
|
27
|
+
src="https://badgen.net/bundlephobia/tree-shaking/nanosplash"
|
|
28
|
+
/>
|
|
77
29
|
</div>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="text-white bg-slate-700 p-3 rounded shadow-xl font-mono text-sm">ns.show('text').inside('#myDiv')</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="grid grid-cols-2 gap-1">
|
|
34
|
+
<div id="a" class="p-20 bg-slate-100 flex flex-col items-center">
|
|
35
|
+
<div class="text-xl mb-10">Give user progress feedback</div>
|
|
36
|
+
<div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
|
|
37
|
+
ns.img(src).progress(<br>
|
|
38
|
+
[promise1, 'Loading A'],<br>
|
|
39
|
+
[promise2, 'Loading B'],<br>
|
|
40
|
+
[promise3, 'Loading C'],<br>
|
|
41
|
+
).inside('#myDiv')
|
|
86
42
|
</div>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
font-light
|
|
93
|
-
text-gray-600
|
|
94
|
-
flex
|
|
95
|
-
justify-center
|
|
96
|
-
mb-2
|
|
97
|
-
md:mb-3
|
|
98
|
-
"
|
|
99
|
-
>
|
|
100
|
-
Demo
|
|
101
|
-
</div>
|
|
102
|
-
<div class="text-center text-gray-500 flex font-light justify-center">
|
|
103
|
-
Play around with Nanosplash using the controls below.<br />
|
|
104
|
-
The demo serves as showcase of some of the<br />
|
|
105
|
-
features it has to offer.
|
|
106
|
-
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div id="b" class="p-20 bg-slate-100 flex flex-col items-center">
|
|
45
|
+
<div class="text-xl mb-10">Handle async functions</div>
|
|
46
|
+
<div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
|
|
47
|
+
ns.while(promise).show('Loading ...').inside('#myDiv')
|
|
107
48
|
</div>
|
|
108
|
-
</
|
|
109
|
-
<
|
|
110
|
-
<div class="
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<input
|
|
116
|
-
type="text"
|
|
117
|
-
name="splash-src"
|
|
118
|
-
id="splash-src"
|
|
119
|
-
value="doughnut.png"
|
|
120
|
-
class="
|
|
121
|
-
py-3
|
|
122
|
-
px-4
|
|
123
|
-
text-gray-400
|
|
124
|
-
bg-white
|
|
125
|
-
appearance-none
|
|
126
|
-
rounded-lg
|
|
127
|
-
"
|
|
128
|
-
/>
|
|
129
|
-
</div>
|
|
130
|
-
<div class="grid sm:grid-cols-1 md:grid-cols-2 gap-5">
|
|
131
|
-
<div class="flex flex-col">
|
|
132
|
-
<label class="text-gray-600 mb-2" for="anim">Animation</label>
|
|
133
|
-
<select
|
|
134
|
-
class="
|
|
135
|
-
py-3
|
|
136
|
-
px-4
|
|
137
|
-
text-gray-400
|
|
138
|
-
bg-white
|
|
139
|
-
cursor-pointer
|
|
140
|
-
appearance-none
|
|
141
|
-
rounded-lg
|
|
142
|
-
"
|
|
143
|
-
name="anim"
|
|
144
|
-
id="anim"
|
|
145
|
-
>
|
|
146
|
-
<option value="none" selected disabled>Choose animation</option>
|
|
147
|
-
<option value="none">None</option>
|
|
148
|
-
<option value="pulse">Pulse</option>
|
|
149
|
-
<option value="spin">Spin</option>
|
|
150
|
-
</select>
|
|
151
|
-
</div>
|
|
152
|
-
<div class="flex flex-col">
|
|
153
|
-
<label class="text-gray-600 mb-2" for="elem"
|
|
154
|
-
>Show inside element</label
|
|
155
|
-
>
|
|
156
|
-
<select
|
|
157
|
-
class="
|
|
158
|
-
py-3
|
|
159
|
-
px-4
|
|
160
|
-
text-gray-400
|
|
161
|
-
bg-white
|
|
162
|
-
cursor-pointer
|
|
163
|
-
appearance-none
|
|
164
|
-
rounded-lg
|
|
165
|
-
"
|
|
166
|
-
name="elem"
|
|
167
|
-
id="elem"
|
|
168
|
-
>
|
|
169
|
-
<option value="none" selected disabled>Choose location</option>
|
|
170
|
-
<option value="body">Fullscreen (3s)</option>
|
|
171
|
-
<option value="#title">Title section</option>
|
|
172
|
-
<option value="#col1">Column 1</option>
|
|
173
|
-
<option value="#col2">Column 2</option>
|
|
174
|
-
<option value="#col3">Column 3</option>
|
|
175
|
-
</select>
|
|
176
|
-
</div>
|
|
177
|
-
<div class="flex flex-col">
|
|
178
|
-
<label class="text-gray-600 mb-2" for="text">Loading text</label>
|
|
179
|
-
<input
|
|
180
|
-
class="
|
|
181
|
-
py-3
|
|
182
|
-
px-4
|
|
183
|
-
appearance-none
|
|
184
|
-
rounded-lg
|
|
185
|
-
bg-white
|
|
186
|
-
text-gray-400
|
|
187
|
-
"
|
|
188
|
-
type="text"
|
|
189
|
-
name="text"
|
|
190
|
-
id="text"
|
|
191
|
-
value="Loading assets ..."
|
|
192
|
-
/>
|
|
193
|
-
</div>
|
|
194
|
-
<div class="flex flex-col">
|
|
195
|
-
<label class="text-gray-600 mb-2" for="show"
|
|
196
|
-
>Display loading screen</label
|
|
197
|
-
>
|
|
198
|
-
<div
|
|
199
|
-
id="show"
|
|
200
|
-
class="
|
|
201
|
-
bg-purple-900
|
|
202
|
-
text-gray-300
|
|
203
|
-
cursor-pointer
|
|
204
|
-
py-3
|
|
205
|
-
px-4
|
|
206
|
-
rounded-lg
|
|
207
|
-
"
|
|
208
|
-
>
|
|
209
|
-
Show loading screen
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div id="c" class="p-20 bg-slate-100 flex flex-col items-center">
|
|
51
|
+
<div class="text-xl mb-10">Display fullscreen</div>
|
|
52
|
+
<div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
|
|
53
|
+
const splash = ns.show('Fullscreen text')<br>
|
|
54
|
+
splash.moveTo('#myDiv')<br>
|
|
55
|
+
splash.remove()
|
|
213
56
|
</div>
|
|
214
|
-
</
|
|
215
|
-
<
|
|
216
|
-
<div class="
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
left-2
|
|
225
|
-
uppercase
|
|
226
|
-
bg-gray-500
|
|
227
|
-
text-white
|
|
228
|
-
pill
|
|
229
|
-
font-mono
|
|
230
|
-
tracking-wider
|
|
231
|
-
rounded
|
|
232
|
-
"
|
|
233
|
-
>
|
|
234
|
-
Column 1
|
|
235
|
-
</div>
|
|
236
|
-
<div class="text-4xl text-center">
|
|
237
|
-
<i class="lni lni-bolt-alt"></i>
|
|
238
|
-
</div>
|
|
239
|
-
<div class="text-xl font-medium my-6 text-center">
|
|
240
|
-
Tiny and lightning fast
|
|
241
|
-
</div>
|
|
242
|
-
<div>It is only 6kB in size, and it's lightning fast.</div>
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
<div id="col2" class="bg-white rounded-2xl shadow-lg">
|
|
246
|
-
<div class="relative p-8 rounded-2xl">
|
|
247
|
-
<div
|
|
248
|
-
class="
|
|
249
|
-
absolute
|
|
250
|
-
top-2
|
|
251
|
-
left-2
|
|
252
|
-
uppercase
|
|
253
|
-
bg-gray-500
|
|
254
|
-
text-white
|
|
255
|
-
pill
|
|
256
|
-
font-mono
|
|
257
|
-
tracking-wider
|
|
258
|
-
rounded
|
|
259
|
-
"
|
|
260
|
-
>
|
|
261
|
-
Column 2
|
|
262
|
-
</div>
|
|
263
|
-
<div class="text-4xl text-center">
|
|
264
|
-
<i class="lni lni-code"></i>
|
|
265
|
-
</div>
|
|
266
|
-
<div class="text-xl font-medium my-6 text-center">
|
|
267
|
-
Vanilla JS
|
|
268
|
-
</div>
|
|
269
|
-
<div>
|
|
270
|
-
Written from the ground up in vanilla JavaScript and comes
|
|
271
|
-
without any libraries.
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
<div id="col3" class="bg-white rounded-2xl shadow-lg">
|
|
276
|
-
<div class="relative p-8 rounded-2xl">
|
|
277
|
-
<div
|
|
278
|
-
class="
|
|
279
|
-
absolute
|
|
280
|
-
top-2
|
|
281
|
-
left-2
|
|
282
|
-
uppercase
|
|
283
|
-
bg-gray-500
|
|
284
|
-
text-white
|
|
285
|
-
pill
|
|
286
|
-
font-mono
|
|
287
|
-
tracking-wider
|
|
288
|
-
rounded
|
|
289
|
-
"
|
|
290
|
-
>
|
|
291
|
-
Column 3
|
|
292
|
-
</div>
|
|
293
|
-
<div class="text-4xl text-center">
|
|
294
|
-
<i class="lni lni-grid-alt"></i>
|
|
295
|
-
</div>
|
|
296
|
-
<div class="text-xl font-medium my-6 text-center">
|
|
297
|
-
ESM + CJS
|
|
298
|
-
</div>
|
|
299
|
-
<div>
|
|
300
|
-
Nanosplash comes in both ES and CJS modules, making it easy
|
|
301
|
-
for you to import it into your code.
|
|
302
|
-
</div>
|
|
303
|
-
</div>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div id="d" class="p-20 bg-slate-100 flex flex-col items-center">
|
|
59
|
+
<div class="text-xl mb-10">Display multiple, independent instances</div>
|
|
60
|
+
<div class="text-white bg-slate-800 p-5 rounded-lg shadow-2xl font-mono text-sm">
|
|
61
|
+
ns.img(src).show('Loading component A').inside('#a')<br>
|
|
62
|
+
ns.show('Loading component A').inside('#b')<br>
|
|
63
|
+
ns.show('Loading component A').inside('#c')<br>
|
|
64
|
+
<br><br>
|
|
65
|
+
ns.hide() // Removes instances in a FIFO manner.<br>
|
|
66
|
+
ns.hideAll() // Removes all instances.
|
|
306
67
|
</div>
|
|
307
|
-
</
|
|
308
|
-
</
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
309
70
|
<footer>
|
|
310
|
-
<section class="py-6 flex justify-center flex-grow-0">
|
|
311
|
-
<div class="container mx-5">
|
|
312
|
-
<div class="flex space-x-3 justify-center items-center text-gray-600">
|
|
313
|
-
<div class="text-2xl">
|
|
314
|
-
<i class="lni lni-github-original"></i>
|
|
315
|
-
</div>
|
|
316
|
-
<div>
|
|
317
|
-
Developed by
|
|
318
|
-
<a
|
|
319
|
-
class="text-purple-400 hover:text-purple-500"
|
|
320
|
-
href="https://github.com/isakhauge"
|
|
321
|
-
target="_blank"
|
|
322
|
-
>Isak Hauge</a
|
|
323
|
-
>
|
|
324
|
-
</div>
|
|
325
|
-
</div>
|
|
326
|
-
</div>
|
|
327
|
-
</section>
|
|
328
71
|
<script type="module" src="/src/main.ts"></script>
|
|
329
|
-
|
|
330
|
-
<!-- Demo -->
|
|
331
|
-
<script>
|
|
332
|
-
const ref = function (v) {
|
|
333
|
-
return document.querySelector(v)
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// Elements
|
|
337
|
-
const textSplashElem = ref('#splash-src')
|
|
338
|
-
const selectAnimElem = ref('#anim')
|
|
339
|
-
const selectDestinationElem = ref('#elem')
|
|
340
|
-
const textElem = ref('#text')
|
|
341
|
-
const showBtn = ref('#show')
|
|
342
|
-
|
|
343
|
-
const cache = {
|
|
344
|
-
animation: 'none',
|
|
345
|
-
domSelector: 'body',
|
|
346
|
-
text: textElem.value,
|
|
347
|
-
showNextTime: true,
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const text = (function (postfix) {
|
|
351
|
-
return {
|
|
352
|
-
show: 'Show ' + postfix,
|
|
353
|
-
hide: 'Hide ' + postfix,
|
|
354
|
-
}
|
|
355
|
-
})('loading screen')
|
|
356
|
-
|
|
357
|
-
const display = function () {
|
|
358
|
-
const doughnutSrc =
|
|
359
|
-
'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/285/doughnut_1f369.png'
|
|
360
|
-
showBtn.innerText = 'Hide loading screen'
|
|
361
|
-
cache.showNextTime = false
|
|
362
|
-
const isDoughnut = textSplashElem.value === 'doughnut.png'
|
|
363
|
-
const splashSrc = isDoughnut ? doughnutSrc : textSplashElem.value
|
|
364
|
-
const text = textElem.value
|
|
365
|
-
const anim = selectAnimElem.value
|
|
366
|
-
const elem = selectDestinationElem.value
|
|
367
|
-
loading
|
|
368
|
-
.configure({
|
|
369
|
-
splash: { animation: cache.animation, src: splashSrc },
|
|
370
|
-
})
|
|
371
|
-
.show(cache.text)
|
|
372
|
-
.inside(cache.domSelector)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
const hide = function () {
|
|
376
|
-
showBtn.innerText = 'Show loading screen'
|
|
377
|
-
cache.showNextTime = true
|
|
378
|
-
loading.hide()
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
const onSelectAnim = function ({ target }) {
|
|
382
|
-
cache.animation = target.value
|
|
383
|
-
}
|
|
384
|
-
const onSelectDestination = function ({ target }) {
|
|
385
|
-
cache.domSelector = target.value
|
|
386
|
-
}
|
|
387
|
-
const onInputText = function ({ target }) {
|
|
388
|
-
cache.text = target.value
|
|
389
|
-
}
|
|
390
|
-
const onClickBtn = function () {
|
|
391
|
-
if (cache.showNextTime) {
|
|
392
|
-
display()
|
|
393
|
-
const isBody = cache.domSelector === 'body'
|
|
394
|
-
if (isBody) {
|
|
395
|
-
setTimeout(hide, 3000)
|
|
396
|
-
}
|
|
397
|
-
} else {
|
|
398
|
-
hide()
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
selectAnimElem.addEventListener('input', onSelectAnim)
|
|
403
|
-
selectDestinationElem.addEventListener('input', onSelectDestination)
|
|
404
|
-
textElem.addEventListener('input', onInputText)
|
|
405
|
-
showBtn.addEventListener('click', onClickBtn)
|
|
406
|
-
</script>
|
|
407
|
-
|
|
408
|
-
<!-- Nanosplash -->
|
|
409
|
-
<script>
|
|
410
|
-
window.addEventListener('load', () => {
|
|
411
|
-
window.loading.configure({
|
|
412
|
-
splash: {
|
|
413
|
-
src: 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/285/doughnut_1f369.png',
|
|
414
|
-
},
|
|
415
|
-
})
|
|
416
|
-
})
|
|
417
|
-
</script>
|
|
418
72
|
</footer>
|
|
419
73
|
<style>
|
|
420
74
|
body {
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// All imported modules in your tests should be mocked automatically
|
|
8
|
+
// automock: false,
|
|
9
|
+
|
|
10
|
+
// Stop running tests after `n` failures
|
|
11
|
+
// bail: 0,
|
|
12
|
+
|
|
13
|
+
// The directory where Jest should store its cached dependency information
|
|
14
|
+
// cacheDirectory: "/private/var/folders/zc/vybtlxpn4dn4wr85nb3sh7lh0000gn/T/jest_dx",
|
|
15
|
+
|
|
16
|
+
// Automatically clear mock calls and instances between every test
|
|
17
|
+
clearMocks: true,
|
|
18
|
+
|
|
19
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
+
collectCoverage: true,
|
|
21
|
+
|
|
22
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
+
// collectCoverageFrom: undefined,
|
|
24
|
+
|
|
25
|
+
// The directory where Jest should output its coverage files
|
|
26
|
+
coverageDirectory: 'coverage',
|
|
27
|
+
|
|
28
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
+
// coveragePathIgnorePatterns: [
|
|
30
|
+
// "/node_modules/"
|
|
31
|
+
// ],
|
|
32
|
+
|
|
33
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
+
coverageProvider: 'v8',
|
|
35
|
+
|
|
36
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
+
// coverageReporters: [
|
|
38
|
+
// "json",
|
|
39
|
+
// "text",
|
|
40
|
+
// "lcov",
|
|
41
|
+
// "clover"
|
|
42
|
+
// ],
|
|
43
|
+
|
|
44
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
+
// coverageThreshold: undefined,
|
|
46
|
+
|
|
47
|
+
// A path to a custom dependency extractor
|
|
48
|
+
// dependencyExtractor: undefined,
|
|
49
|
+
|
|
50
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
+
// errorOnDeprecated: false,
|
|
52
|
+
|
|
53
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
54
|
+
// forceCoverageMatch: [],
|
|
55
|
+
|
|
56
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
57
|
+
// globalSetup: undefined,
|
|
58
|
+
|
|
59
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
60
|
+
// globalTeardown: undefined,
|
|
61
|
+
|
|
62
|
+
// A set of global variables that need to be available in all test environments
|
|
63
|
+
// globals: {},
|
|
64
|
+
|
|
65
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
66
|
+
// maxWorkers: "50%",
|
|
67
|
+
|
|
68
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
69
|
+
// moduleDirectories: [
|
|
70
|
+
// "node_modules"
|
|
71
|
+
// ],
|
|
72
|
+
|
|
73
|
+
// An array of file extensions your modules use
|
|
74
|
+
// moduleFileExtensions: [
|
|
75
|
+
// "js",
|
|
76
|
+
// "jsx",
|
|
77
|
+
// "ts",
|
|
78
|
+
// "tsx",
|
|
79
|
+
// "json",
|
|
80
|
+
// "node"
|
|
81
|
+
// ],
|
|
82
|
+
|
|
83
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
84
|
+
// moduleNameMapper: {},
|
|
85
|
+
|
|
86
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
87
|
+
// modulePathIgnorePatterns: [],
|
|
88
|
+
|
|
89
|
+
// Activates notifications for test results
|
|
90
|
+
// notify: false,
|
|
91
|
+
|
|
92
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
93
|
+
// notifyMode: "failure-change",
|
|
94
|
+
|
|
95
|
+
// A preset that is used as a base for Jest's configuration
|
|
96
|
+
preset: 'ts-jest',
|
|
97
|
+
|
|
98
|
+
// Run tests from one or more projects
|
|
99
|
+
// projects: undefined,
|
|
100
|
+
|
|
101
|
+
// Use this configuration option to add custom reporters to Jest
|
|
102
|
+
// reporters: undefined,
|
|
103
|
+
|
|
104
|
+
// Automatically reset mock state between every test
|
|
105
|
+
// resetMocks: false,
|
|
106
|
+
|
|
107
|
+
// Reset the module registry before running each individual test
|
|
108
|
+
// resetModules: false,
|
|
109
|
+
|
|
110
|
+
// A path to a custom resolver
|
|
111
|
+
// resolver: undefined,
|
|
112
|
+
|
|
113
|
+
// Automatically restore mock state between every test
|
|
114
|
+
// restoreMocks: false,
|
|
115
|
+
|
|
116
|
+
// The root directory that Jest should scan for tests and modules within
|
|
117
|
+
// rootDir: undefined,
|
|
118
|
+
|
|
119
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
120
|
+
// roots: [
|
|
121
|
+
// "<rootDir>"
|
|
122
|
+
// ],
|
|
123
|
+
|
|
124
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
125
|
+
// runner: "jest-runner",
|
|
126
|
+
|
|
127
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
128
|
+
// setupFiles: [],
|
|
129
|
+
|
|
130
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
131
|
+
// setupFilesAfterEnv: [],
|
|
132
|
+
|
|
133
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
134
|
+
// slowTestThreshold: 5,
|
|
135
|
+
|
|
136
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
137
|
+
// snapshotSerializers: [],
|
|
138
|
+
|
|
139
|
+
// The test environment that will be used for testing
|
|
140
|
+
testEnvironment: 'jsdom',
|
|
141
|
+
|
|
142
|
+
// Options that will be passed to the testEnvironment
|
|
143
|
+
// testEnvironmentOptions: {},
|
|
144
|
+
|
|
145
|
+
// Adds a location field to test results
|
|
146
|
+
// testLocationInResults: false,
|
|
147
|
+
|
|
148
|
+
// The glob patterns Jest uses to detect test files
|
|
149
|
+
// testMatch: [
|
|
150
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
151
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
152
|
+
// ],
|
|
153
|
+
|
|
154
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
155
|
+
// testPathIgnorePatterns: [
|
|
156
|
+
// "/node_modules/"
|
|
157
|
+
// ],
|
|
158
|
+
|
|
159
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
160
|
+
// testRegex: [],
|
|
161
|
+
|
|
162
|
+
// This option allows the use of a custom results processor
|
|
163
|
+
// testResultsProcessor: undefined,
|
|
164
|
+
|
|
165
|
+
// This option allows use of a custom test runner
|
|
166
|
+
// testRunner: "jest-circus/runner",
|
|
167
|
+
|
|
168
|
+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
|
|
169
|
+
// testURL: "http://localhost",
|
|
170
|
+
|
|
171
|
+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
|
|
172
|
+
// timers: "real",
|
|
173
|
+
|
|
174
|
+
// A map from regular expressions to paths to transformers
|
|
175
|
+
// transform: undefined,
|
|
176
|
+
|
|
177
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
178
|
+
// transformIgnorePatterns: [
|
|
179
|
+
// "/node_modules/",
|
|
180
|
+
// "\\.pnp\\.[^\\/]+$"
|
|
181
|
+
// ],
|
|
182
|
+
|
|
183
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
184
|
+
// unmockedModulePathPatterns: undefined,
|
|
185
|
+
|
|
186
|
+
// Indicates whether each individual test should be reported during the run
|
|
187
|
+
// verbose: undefined,
|
|
188
|
+
|
|
189
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
190
|
+
// watchPathIgnorePatterns: [],
|
|
191
|
+
|
|
192
|
+
// Whether to use watchman for file crawling
|
|
193
|
+
// watchman: true,
|
|
194
|
+
}
|