@linear_non/stellar-libs 1.1.2 → 1.1.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/package.json +1 -1
- package/src/Smooth/index.js +10 -1
- package/src/SplitOnScroll/index.js +7 -1
package/package.json
CHANGED
package/src/Smooth/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Scrollbar from "../ScrollBar"
|
|
2
2
|
import { kitStore } from "@linear_non/stellar-kit"
|
|
3
3
|
import { emitter, EVENTS } from "@linear_non/stellar-kit/events"
|
|
4
|
-
import { qs, qsa, bounds } from "@linear_non/stellar-kit/utils"
|
|
4
|
+
import { qs, qsa, bounds, Debug } from "@linear_non/stellar-kit/utils"
|
|
5
5
|
|
|
6
6
|
export default class Smooth {
|
|
7
7
|
constructor(obj) {
|
|
@@ -12,6 +12,7 @@ export default class Smooth {
|
|
|
12
12
|
this.sections = null
|
|
13
13
|
this.scrollbar = null
|
|
14
14
|
this.dpr = Math.max(1, Math.round(window.devicePixelRatio || 1))
|
|
15
|
+
|
|
15
16
|
this.init()
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -53,6 +54,8 @@ export default class Smooth {
|
|
|
53
54
|
tick = ({ current }) => {
|
|
54
55
|
const { isSmooth, isResizing } = kitStore.flags
|
|
55
56
|
if (!isSmooth || isResizing) return
|
|
57
|
+
console.log("Smooth Tick: ", current)
|
|
58
|
+
|
|
56
59
|
this.current = current
|
|
57
60
|
this.transformSections()
|
|
58
61
|
}
|
|
@@ -132,6 +135,8 @@ export default class Smooth {
|
|
|
132
135
|
this.getSections()
|
|
133
136
|
this.transformSections()
|
|
134
137
|
kitStore.flags.isResizing = false
|
|
138
|
+
|
|
139
|
+
console.log("Smooth Update", this.elems)
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
clean() {
|
|
@@ -140,6 +145,8 @@ export default class Smooth {
|
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
on() {
|
|
148
|
+
console.log("Smooth On")
|
|
149
|
+
|
|
143
150
|
emitter.on(EVENTS.APP_TICK, this.tick)
|
|
144
151
|
emitter.on(EVENTS.APP_RESIZE, this.resize)
|
|
145
152
|
}
|
|
@@ -159,6 +166,8 @@ export default class Smooth {
|
|
|
159
166
|
const root = kitStore.currentPage || document
|
|
160
167
|
this.elems = elems || qsa("[data-smooth]", root)
|
|
161
168
|
|
|
169
|
+
console.log("Smooth Init: ", this.elems)
|
|
170
|
+
|
|
162
171
|
this.scrollbar = new Scrollbar({
|
|
163
172
|
container: kitStore.currentPage,
|
|
164
173
|
})
|
|
@@ -13,7 +13,7 @@ function normalizeTargets(splitTargets) {
|
|
|
13
13
|
export default class SplitonScroll {
|
|
14
14
|
constructor({
|
|
15
15
|
el,
|
|
16
|
-
splitTargets,
|
|
16
|
+
splitText: splitTargets,
|
|
17
17
|
isReady,
|
|
18
18
|
reverse,
|
|
19
19
|
resize,
|
|
@@ -42,6 +42,7 @@ export default class SplitonScroll {
|
|
|
42
42
|
|
|
43
43
|
this._readyFired = false
|
|
44
44
|
this._rebuilding = false
|
|
45
|
+
this._entering = false
|
|
45
46
|
|
|
46
47
|
if (!this.element || !this.targets.length) {
|
|
47
48
|
this._notifyReadyOnce([])
|
|
@@ -98,6 +99,10 @@ export default class SplitonScroll {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
async handleEnter() {
|
|
102
|
+
// Prevent double-split if already entering or already split
|
|
103
|
+
if (this._entering || this.splits) return
|
|
104
|
+
this._entering = true
|
|
105
|
+
|
|
101
106
|
const splitEmitter = splitText(this.targets)
|
|
102
107
|
|
|
103
108
|
const { splits, groups } = await new Promise(resolve => {
|
|
@@ -119,6 +124,7 @@ export default class SplitonScroll {
|
|
|
119
124
|
|
|
120
125
|
this.splits = splits
|
|
121
126
|
this.groups = groups
|
|
127
|
+
this._entering = false
|
|
122
128
|
|
|
123
129
|
this._notifyReadyOnce(splits, groups)
|
|
124
130
|
}
|