@linear_non/stellar-kit 1.0.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/README.md +69 -0
- package/classes/Component.js +46 -0
- package/classes/Manager.js +73 -0
- package/classes/Scrollbar.js +124 -0
- package/classes/Smooth.js +146 -0
- package/classes/index.js +6 -0
- package/events/Emitter.js +67 -0
- package/events/Mouse.js +60 -0
- package/events/Raf.js +122 -0
- package/events/Resize.js +70 -0
- package/events/Scroll.js +51 -0
- package/events/VirtualScroll.js +196 -0
- package/events/index.js +8 -0
- package/index.js +16 -0
- package/kitStore.js +35 -0
- package/package.json +41 -0
- package/utils/bounds.js +15 -0
- package/utils/index.js +8 -0
- package/utils/listener.js +12 -0
- package/utils/math.js +17 -0
- package/utils/selector.js +5 -0
- package/utils/sniffer.js +133 -0
- package/utils/splitText.js +45 -0
- package/utils/support.js +23 -0
- package/utils/window.js +33 -0
package/utils/window.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current viewport dimensions (with fallback)
|
|
3
|
+
*/
|
|
4
|
+
export const getViewport = () => {
|
|
5
|
+
let el = window
|
|
6
|
+
let a = "inner"
|
|
7
|
+
if (!("innerWidth" in window)) {
|
|
8
|
+
a = "client"
|
|
9
|
+
el = document.documentElement || document.body
|
|
10
|
+
}
|
|
11
|
+
return { width: el[`${a}Width`], height: el[`${a}Height`] }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get window breakpoints — should match your SCSS media queries
|
|
16
|
+
*/
|
|
17
|
+
export const getWindowSizes = () => {
|
|
18
|
+
return {
|
|
19
|
+
XS: window.innerWidth <= 500,
|
|
20
|
+
S: window.innerWidth <= 749,
|
|
21
|
+
S_UP: window.innerWidth >= 501,
|
|
22
|
+
M: window.innerWidth <= 1024,
|
|
23
|
+
M_UP: window.innerWidth >= 750,
|
|
24
|
+
L: window.innerWidth >= 1025,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Set --vh CSS variable for mobile 100vh workaround
|
|
30
|
+
*/
|
|
31
|
+
export const setViewportHeight = vh => {
|
|
32
|
+
document.documentElement.style.setProperty("--vh", `${vh}px`)
|
|
33
|
+
}
|