@linear_non/stellar-kit 2.1.4 → 2.1.6
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/plugins/Observer.js +2 -0
- package/plugins/SplitText.js +15 -21
package/package.json
CHANGED
package/plugins/Observer.js
CHANGED
|
@@ -7,6 +7,7 @@ const DEFAULTS = {
|
|
|
7
7
|
start: "top bottom",
|
|
8
8
|
end: "bottom top",
|
|
9
9
|
scrub: false,
|
|
10
|
+
once: true,
|
|
10
11
|
markers: false,
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -21,6 +22,7 @@ export default class Observer extends Emitter {
|
|
|
21
22
|
start: this.opts.start,
|
|
22
23
|
end: this.opts.end,
|
|
23
24
|
scrub: this.opts.scrub,
|
|
25
|
+
once: this.opts.once,
|
|
24
26
|
markers: this.opts.markers,
|
|
25
27
|
onEnter: self => this.emit("enter", self, this),
|
|
26
28
|
onLeave: self => this.emit("leave", self, this),
|
package/plugins/SplitText.js
CHANGED
|
@@ -5,36 +5,32 @@ import { SplitText } from "../libraries/gsap"
|
|
|
5
5
|
export const splitText = data => {
|
|
6
6
|
const emitter = new Emitter()
|
|
7
7
|
const splits = []
|
|
8
|
-
let
|
|
9
|
-
const totalSplits = data.length
|
|
8
|
+
let remaining = data.length
|
|
10
9
|
|
|
11
10
|
data.forEach(el => {
|
|
12
|
-
const dataset = el.dataset.split
|
|
13
|
-
const
|
|
14
|
-
const split = {}
|
|
11
|
+
const dataset = el.dataset.split || ""
|
|
12
|
+
const parts = dataset.split(",")
|
|
15
13
|
const classes = {}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (filter == "lines") classes.linesClass = `line-${i}`
|
|
23
|
-
if (filter == "words") classes.wordsClass = `word-${i}`
|
|
24
|
-
if (filter == "chars") classes.charsClass = `char-${i} chr-++`
|
|
15
|
+
parts.forEach((type, i) => {
|
|
16
|
+
const t = type.trim()
|
|
17
|
+
if (t === "lines") classes.linesClass = `line-${i}`
|
|
18
|
+
if (t === "words") classes.wordsClass = `word-${i}`
|
|
19
|
+
if (t === "chars") classes.charsClass = `char-${i} chr-++`
|
|
25
20
|
})
|
|
26
21
|
|
|
27
|
-
const
|
|
28
|
-
type: dataset
|
|
22
|
+
const splitInstance = new SplitText(el, {
|
|
23
|
+
type: dataset,
|
|
29
24
|
...classes,
|
|
30
25
|
})
|
|
31
26
|
|
|
32
|
-
splits.push(
|
|
27
|
+
splits.push(splitInstance)
|
|
28
|
+
remaining -= 1
|
|
33
29
|
|
|
34
|
-
if (
|
|
30
|
+
if (remaining === 0) {
|
|
35
31
|
setTimeout(() => {
|
|
36
32
|
emitter.emit(EVENTS.APP_SPLITTEXT_READY, splits)
|
|
37
|
-
}, 0)
|
|
33
|
+
}, 0)
|
|
38
34
|
}
|
|
39
35
|
})
|
|
40
36
|
|
|
@@ -42,7 +38,5 @@ export const splitText = data => {
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
export const reverseSplit = data => {
|
|
45
|
-
data.forEach(split =>
|
|
46
|
-
split.revert()
|
|
47
|
-
})
|
|
41
|
+
data.forEach(split => split.revert())
|
|
48
42
|
}
|