material 0.9.18 → 0.9.20
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/package.json +1 -1
- package/src/class/view.js +3 -6
- package/src/loader.js +66 -42
package/package.json
CHANGED
package/src/class/view.js
CHANGED
|
@@ -14,18 +14,15 @@ class View extends Component {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
on (event, listener) {
|
|
17
|
-
|
|
18
|
-
this.events[event] = []
|
|
19
|
-
}
|
|
17
|
+
this.events[event] ??= []
|
|
20
18
|
this.events[event].push(listener)
|
|
21
19
|
|
|
22
20
|
return this
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
emit (event, ...args) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
24
|
+
this.events?.[event]?.forEach(listener => listener.apply(this, args))
|
|
25
|
+
|
|
29
26
|
return this
|
|
30
27
|
}
|
|
31
28
|
}
|
package/src/loader.js
CHANGED
|
@@ -3,7 +3,7 @@ import emitter from './module/emitter'
|
|
|
3
3
|
class Loader {
|
|
4
4
|
static defaults = {
|
|
5
5
|
class: 'loader',
|
|
6
|
-
timeout:
|
|
6
|
+
timeout: 17000
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
constructor (options) {
|
|
@@ -25,51 +25,69 @@ class Loader {
|
|
|
25
25
|
this.element.appendChild(this.container)
|
|
26
26
|
|
|
27
27
|
const svg = `
|
|
28
|
-
<svg
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50">
|
|
29
|
+
<circle
|
|
30
|
+
class="base"
|
|
31
|
+
cx="25"
|
|
32
|
+
cy="25"
|
|
33
|
+
r="20"
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke="#e5e7eb"
|
|
36
|
+
stroke-width="3"
|
|
37
|
+
/>
|
|
38
|
+
<circle
|
|
39
|
+
class="base"
|
|
40
|
+
cx="25"
|
|
41
|
+
cy="25"
|
|
42
|
+
r="16"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="#e5e7eb"
|
|
45
|
+
stroke-width="2"
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<circle
|
|
49
|
+
class="outer"
|
|
50
|
+
cx="25"
|
|
51
|
+
cy="25"
|
|
52
|
+
r="20"
|
|
53
|
+
fill="none"
|
|
54
|
+
stroke-width="3"
|
|
55
|
+
stroke-linecap="round"
|
|
56
|
+
stroke-dasharray="62.8 62.8"
|
|
57
|
+
stroke-dashoffset="62.8">
|
|
58
|
+
<animateTransform
|
|
59
|
+
attributeName="transform"
|
|
60
|
+
type="rotate"
|
|
61
|
+
from="0 25 25"
|
|
62
|
+
to="360 25 25"
|
|
63
|
+
calcMode="spline"
|
|
64
|
+
keySplines="0.4, 0, 0.2, 1"
|
|
65
|
+
keyTimes="0;1"
|
|
66
|
+
dur="2s"
|
|
67
|
+
repeatCount="indefinite"
|
|
68
|
+
/>
|
|
69
|
+
</circle>
|
|
47
70
|
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
to="360 20 20"
|
|
55
|
-
calcMode="spline"
|
|
56
|
-
keySplines="0.4, 0, 0.2, 1"
|
|
57
|
-
keyTimes="0;1"
|
|
58
|
-
dur="2s"
|
|
59
|
-
repeatCount="indefinite" />
|
|
60
|
-
</path>
|
|
71
|
+
<circle
|
|
72
|
+
class="inner"
|
|
73
|
+
cx="25"
|
|
74
|
+
cy="25"
|
|
75
|
+
r="16"
|
|
76
|
+
fill="none"
|
|
61
77
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
stroke-width="2"
|
|
79
|
+
stroke-linecap="round"
|
|
80
|
+
stroke-dasharray="50.24 50.24"
|
|
81
|
+
stroke-dashoffset="50.24">
|
|
82
|
+
<animateTransform
|
|
66
83
|
attributeName="transform"
|
|
67
84
|
type="rotate"
|
|
68
|
-
from="0
|
|
69
|
-
to="360
|
|
70
|
-
dur="1.8s"
|
|
71
|
-
repeatCount="indefinite"
|
|
72
|
-
|
|
85
|
+
from="0 25 25"
|
|
86
|
+
to="360 25 25"
|
|
87
|
+
dur="1.8s"
|
|
88
|
+
repeatCount="indefinite"
|
|
89
|
+
/>
|
|
90
|
+
</circle>
|
|
73
91
|
</svg>`
|
|
74
92
|
|
|
75
93
|
this.container.innerHTML = svg
|
|
@@ -79,6 +97,12 @@ class Loader {
|
|
|
79
97
|
this.container.appendChild(this.text)
|
|
80
98
|
}
|
|
81
99
|
|
|
100
|
+
setText (text) {
|
|
101
|
+
if (text) {
|
|
102
|
+
this.text.innerHTML = text
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
82
106
|
show () {
|
|
83
107
|
this.element.classList.add('show')
|
|
84
108
|
|