pagewave 1.0.2 → 1.0.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/README.md +331 -0
- package/package.json +6 -1
- package/sw.js +6 -3
- package/transition.js +34 -15
package/README.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
|
|
2
|
+
# PageWave
|
|
3
|
+
|
|
4
|
+
An NPM Package for implementing page transitions in both SSR and CSR apps
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Downloading the project files from Github (Recommended to allow for service worker to cache pages effectively)
|
|
12
|
+
|
|
13
|
+
Install my-project with npm
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install pagewave
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If gotten from NPM, service worker doesn't get added, so the optional parameter useServiceWorker needs to be false and pages should be cached for optimal transitions.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Built-in animations
|
|
24
|
+
- Hooks
|
|
25
|
+
- Doesn't touch history or use push state, allowing for you to use it with routers like sveltekit
|
|
26
|
+
- Manual page transition animations can be run to avoid conflicts with any frameworks
|
|
27
|
+
- Customizable ids for divs to avoid conflict with elements in your body
|
|
28
|
+
- Allows for custom overlay animations, keyframe animations, or transition animations
|
|
29
|
+
- Separate listener animations for different types of animations
|
|
30
|
+
- Separate types of links for overlay or other animations
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## High Level Explanation
|
|
34
|
+
|
|
35
|
+
This package involves two types of animations: Overlay and Keyframe.
|
|
36
|
+
- Overlay involve colored divs that move on the screen i.e. screen wipe
|
|
37
|
+
- Keyframe involve animations of existing animations i.e. fading away
|
|
38
|
+
|
|
39
|
+
These two animations can be created through certain classes
|
|
40
|
+
```javascript
|
|
41
|
+
Style Transition
|
|
42
|
+
//Utilizes CSS transition to affect a certain value
|
|
43
|
+
StyleTransition("opacity", 500, "1", "0")
|
|
44
|
+
|
|
45
|
+
KeyFramePreset
|
|
46
|
+
//Utilizes one of the packages presets to animate
|
|
47
|
+
KeyFramePreset(keyframeType.fade, 250, "ease-in-out");
|
|
48
|
+
|
|
49
|
+
KeyFrameCustom
|
|
50
|
+
//Utilizes a custom animation
|
|
51
|
+
KeyFrameCustom("move", 250, "ease-in-out");
|
|
52
|
+
|
|
53
|
+
OverlayPreset
|
|
54
|
+
//Utilizes one of the packages presets to animate Div overlay
|
|
55
|
+
OverlayPreset(overlayType.bubble, 500, "#293241");
|
|
56
|
+
|
|
57
|
+
OverlayCustom
|
|
58
|
+
//Creates a custom animation of div(s)
|
|
59
|
+
OverlayCustom(
|
|
60
|
+
{
|
|
61
|
+
"first": "rise",
|
|
62
|
+
"second": "fall",
|
|
63
|
+
"third": "slide",
|
|
64
|
+
"fourth": "inverseSlide",
|
|
65
|
+
}, 3000, "#293241", "ease-in-out"
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
MultiElementAnimation
|
|
69
|
+
//Animates many elements independently in the transition
|
|
70
|
+
MultiElementAnimation(
|
|
71
|
+
{
|
|
72
|
+
"h1": "move",
|
|
73
|
+
"p": "move",
|
|
74
|
+
".other-header": "inverseMove",
|
|
75
|
+
}, 1000, "linear", "fadeAll"
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
These styles of transition can be used in link clicks, page loads, and manually very easily through functions calls.
|
|
80
|
+
|
|
81
|
+
## TGetting started
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
//Optional parameter can be ignored if not downloaded from npm
|
|
85
|
+
SetUp({useServiceWorker: false});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Setting up an animation
|
|
89
|
+
|
|
90
|
+
Tag the element that encapsulates the content with an id of 'main-content'
|
|
91
|
+
|
|
92
|
+
If you can't do that, change the parameter name.
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
//Optional parameter can be ignored if not downloaded from npm
|
|
96
|
+
SetUp({useServiceWorker: false});
|
|
97
|
+
|
|
98
|
+
//Creates a style with preset bubble transition
|
|
99
|
+
//Length of 500ms and color of "#293241"
|
|
100
|
+
let aSty = new OverlayPreset(
|
|
101
|
+
overlayType.bubble, 500, "#293241"
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
//Makes links use transition and plays transition on page enter
|
|
105
|
+
ListenForChange(aSty);
|
|
106
|
+
|
|
107
|
+
//Alternatively, split it up if you want different animations for each
|
|
108
|
+
|
|
109
|
+
//Makes links use the transitions when going to page
|
|
110
|
+
SendPoint(aSty);
|
|
111
|
+
|
|
112
|
+
//Makes transition appear when arriving to this page
|
|
113
|
+
EndPoint(aSty);
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Working with SSR
|
|
120
|
+
|
|
121
|
+
Many of these features work flawlessly with CSR.
|
|
122
|
+
|
|
123
|
+
However, small changes need to be made depending on what SSR you are using.
|
|
124
|
+
|
|
125
|
+
I tested this with Svelte as that is what I am familiar with.
|
|
126
|
+
|
|
127
|
+
#### Changes
|
|
128
|
+
|
|
129
|
+
- runAnimationOnPageReload needs to be set to true, because hydrating the page only counts as a reload, not a page change
|
|
130
|
+
- loadEvent needs to be run independently. I would change it to "load" and call the event separately using dispatch event
|
|
131
|
+
- SetUp may not automatically import the preset CSS files, so it may need to be done manually
|
|
132
|
+
|
|
133
|
+
## Other Cool Features
|
|
134
|
+
|
|
135
|
+
### Custom Keyframe Transitions
|
|
136
|
+
|
|
137
|
+
This will create an animation style, that when called:
|
|
138
|
+
|
|
139
|
+
Moves h1 and p elements to the left
|
|
140
|
+
|
|
141
|
+
Moves h2 and elements with 'moving' class to the right
|
|
142
|
+
|
|
143
|
+
This is over 1000ms, at a 'linear' pace, and fades everything
|
|
144
|
+
|
|
145
|
+
Essentially you can specify specific transitions for certain classes and a global transition for everything
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
SetUp();
|
|
150
|
+
|
|
151
|
+
let anim = new MultiElementAnimation(
|
|
152
|
+
{
|
|
153
|
+
"h1": "move",
|
|
154
|
+
"p": "move",
|
|
155
|
+
"h2": "inverseMove",
|
|
156
|
+
".moving": "inverseMove",
|
|
157
|
+
}, 1000, "linear", "fadeAll"
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
ListenForChange(anim);
|
|
161
|
+
|
|
162
|
+
...
|
|
163
|
+
|
|
164
|
+
<style>
|
|
165
|
+
|
|
166
|
+
@keyframes move {
|
|
167
|
+
from{
|
|
168
|
+
transform: translate(0px, 0px);
|
|
169
|
+
color: black;
|
|
170
|
+
opacity: 1;
|
|
171
|
+
}
|
|
172
|
+
to{
|
|
173
|
+
transform: translate(-200px, 0px);
|
|
174
|
+
opacity: 0;
|
|
175
|
+
color: white;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
}
|
|
179
|
+
@keyframes inverseMove {
|
|
180
|
+
from{
|
|
181
|
+
transform: translate(0, 0px);
|
|
182
|
+
opacity: 1;
|
|
183
|
+
}
|
|
184
|
+
to{
|
|
185
|
+
transform: translate(200px, 0px);
|
|
186
|
+
opacity: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
@keyframes fadeAll {
|
|
191
|
+
from{
|
|
192
|
+
opacity: 1;
|
|
193
|
+
}
|
|
194
|
+
to{
|
|
195
|
+
opacity: 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Custom Overlay Transitions
|
|
203
|
+
|
|
204
|
+
The same thing can be done with overlays
|
|
205
|
+
|
|
206
|
+
This will run these transitions and the overlays will have the class names of 'first', 'second', etc.
|
|
207
|
+
|
|
208
|
+
Run for 3000ms, with a color of #293241 and pace of 'ease-in-out'
|
|
209
|
+
|
|
210
|
+
```javascript
|
|
211
|
+
let aStyle = new OverlayCustom(
|
|
212
|
+
{
|
|
213
|
+
"first": "rise",
|
|
214
|
+
"second": "fall",
|
|
215
|
+
"third": "slide",
|
|
216
|
+
"fourth": "inverseSlide",
|
|
217
|
+
}, 3000, "#293241", "ease-in-out"
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
//Names are presets transitions, so check OverlayPreset.css to see the CSS
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Manual Transitions
|
|
225
|
+
|
|
226
|
+
You can do transitions manually through the ```AnimatePageTransition(style)``` function which takes an animation style as a parameter
|
|
227
|
+
|
|
228
|
+
### Different Transitions
|
|
229
|
+
|
|
230
|
+
You can have three different animations you can call in the ```SendPoint(), EndPoint(), or ListenForChange()``` function.
|
|
231
|
+
|
|
232
|
+
For example:
|
|
233
|
+
```
|
|
234
|
+
let defaultAnimation = ...
|
|
235
|
+
let overlayAnimation = ...
|
|
236
|
+
let keyframeAnimation = ...
|
|
237
|
+
SendPoint(defaultAnimation, overlayAnimation, keyframeAnimation);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
You can specify which animation is called by adding classes to link.
|
|
241
|
+
- a-overlay for overlayAnimation
|
|
242
|
+
- a-animation for keyframeAnimation
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
### Custom Link function
|
|
246
|
+
|
|
247
|
+
By default, this package uses a default function of ```window.location = link;``` for changing links. However, this can be customized in either ```SendPoint() or ListenForChange()```
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
let defaultAnimation = ...
|
|
251
|
+
let overlayAnimation = ...
|
|
252
|
+
let keyframeAnimation = ...
|
|
253
|
+
let linkFunction = (link) => {
|
|
254
|
+
console.log(link);
|
|
255
|
+
window.location = link;
|
|
256
|
+
}
|
|
257
|
+
SendPoint(defaultAnimation, overlayAnimation, keyframeAnimation, linkFunction);
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
This is useful in SSR when the link change function is different from the default one.
|
|
261
|
+
|
|
262
|
+
### Events
|
|
263
|
+
|
|
264
|
+
There are many events that can be listened to to call certain code.
|
|
265
|
+
|
|
266
|
+
- animateSF - animation start, forward direction
|
|
267
|
+
- animateSR - animation start, reverse direction
|
|
268
|
+
- animateEF - animation end, forward direction
|
|
269
|
+
- animateER - animation end, reverse direction
|
|
270
|
+
- animateSSP - start of Send Point listening (when a link is clicked)
|
|
271
|
+
- animateESP - end of Send Point listen (when the animation is handled)
|
|
272
|
+
- animateSEP - start of end point listen (when the load event is dispatched)
|
|
273
|
+
- animateEPNSW - end point no service worker exists (when there is no service worker and service workers are being used)
|
|
274
|
+
- animateEEP - end of end point (when the page is revealed after an animation)
|
|
275
|
+
- animateEPNA - end point no animation played (when the page is revealed but no animation was played)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
### This program has optional parameters:
|
|
280
|
+
|
|
281
|
+
#### Optional Parameter Name : Default Value
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
//This is the class for the content that the transition will affect/cover
|
|
285
|
+
mainContentIdName: "main-content"
|
|
286
|
+
|
|
287
|
+
//This is the class name that a button needs to cause the overlay transitions
|
|
288
|
+
overlayClass: "a-overlay",
|
|
289
|
+
|
|
290
|
+
//This is the class name that a button needs to cause the key frame transition
|
|
291
|
+
animationClass: "a-animation",
|
|
292
|
+
|
|
293
|
+
//This is the delay between the page loading and the page beginning the animation
|
|
294
|
+
pageAnimationDelay: 200,
|
|
295
|
+
|
|
296
|
+
//This is the whether to use a service worker. If using npm, service worker doesn't work, so this needs to be disabled!
|
|
297
|
+
useServiceWorker: true,
|
|
298
|
+
|
|
299
|
+
//Whether the transition should run when the page is reloaded
|
|
300
|
+
//Sometimes needs to be enabled in SSR because of how they treat going from one page to another as reloading
|
|
301
|
+
runAnimationOnPageReload: false,
|
|
302
|
+
|
|
303
|
+
//Whether the transition should run when a link goes to a different page
|
|
304
|
+
runAnimationOnCrossSite: false,
|
|
305
|
+
|
|
306
|
+
//The delay between the animation playing and the page revealing
|
|
307
|
+
pageRevealDelay: 0,
|
|
308
|
+
|
|
309
|
+
//Whether the page should be left after animation
|
|
310
|
+
leavePageOnLink: true,
|
|
311
|
+
|
|
312
|
+
//What the ID of the element that blocks the page is
|
|
313
|
+
pageBlockerId: "pageBlocker",
|
|
314
|
+
|
|
315
|
+
//What class should be added to links to not transition
|
|
316
|
+
classToIgnoreLink: "ignore-click",
|
|
317
|
+
|
|
318
|
+
//Whether ignored links should animate
|
|
319
|
+
animateIgnoredLinks: false,
|
|
320
|
+
|
|
321
|
+
//Whether links to the same page should animate
|
|
322
|
+
animateSelfLink: true,
|
|
323
|
+
|
|
324
|
+
//The event that is checked to see that the page is loaded
|
|
325
|
+
//Important to change on SSR because this event isn't automatically triggered
|
|
326
|
+
loadEvent: "DOMContentLoaded",
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Supporting
|
|
330
|
+
|
|
331
|
+
If you find this project helpful, considering starring it. I would greatly appreciate it! :)
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pagewave",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "NPM Package for implementing page transitions in both SSR and CSR apps. Utilize both custom and preset animations. Choose between transitions, keyframe animations, and overlays.",
|
|
5
5
|
"main": "transition.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"style": ["KeyFramePreset.css", "OverlayPreset.css"],
|
|
6
8
|
"scripts": {
|
|
7
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
10
|
},
|
|
@@ -13,6 +15,9 @@
|
|
|
13
15
|
"ssr",
|
|
14
16
|
"csr"
|
|
15
17
|
],
|
|
18
|
+
"files": [
|
|
19
|
+
"sw.js", "transition.js", "OverlayPreset.css", "KeyFramePreset.css"
|
|
20
|
+
],
|
|
16
21
|
"author": "Daniel Pagano",
|
|
17
22
|
"license": "ISC",
|
|
18
23
|
"repository": {
|
package/sw.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const CACHE_NAME = "Page Transition SW";
|
|
2
2
|
let pageCache = [
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"transition.js",
|
|
4
|
+
"OverlayPreset.css",
|
|
5
|
+
"KeyFramePreset.css",
|
|
6
6
|
];
|
|
7
7
|
self.addEventListener("fetch", (e) => {
|
|
8
8
|
e.respondWith(
|
|
@@ -23,6 +23,9 @@ self.addEventListener("install", (e) => {
|
|
|
23
23
|
)
|
|
24
24
|
);
|
|
25
25
|
});
|
|
26
|
+
self.addEventListener('activate', function(event) {
|
|
27
|
+
event.waitUntil(self.clients.claim()); // Become available to all pages
|
|
28
|
+
});
|
|
26
29
|
self.addEventListener("message", (event) => {
|
|
27
30
|
fetch(event.data).then((response) => {
|
|
28
31
|
if (!response.ok) {
|
package/transition.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
//Imports CSS Files from node_modules
|
|
2
|
+
import * as kfp from "/node_modules/pagewave/KeyFramePreset.css";
|
|
3
|
+
import * as op from "/node_modules/pagewave/OverlayPreset.css";
|
|
4
|
+
|
|
1
5
|
//Default Options
|
|
2
6
|
let defaultOptions = {
|
|
3
7
|
mainContentIdName: "main-content",
|
|
@@ -53,7 +57,8 @@ function SetUp(options = {}) {
|
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
|
-
|
|
60
|
+
const _SetUp = SetUp;
|
|
61
|
+
export { _SetUp as SetUp };
|
|
57
62
|
//Overlay Preset Types to Choose From
|
|
58
63
|
const overlayType = Object.freeze({
|
|
59
64
|
slide: Symbol("slide"),
|
|
@@ -63,13 +68,15 @@ const overlayType = Object.freeze({
|
|
|
63
68
|
fall: Symbol("fall"),
|
|
64
69
|
bubble: Symbol("bubble"),
|
|
65
70
|
});
|
|
66
|
-
|
|
71
|
+
const _overlayType = overlayType;
|
|
72
|
+
export { _overlayType as overlayType };
|
|
67
73
|
//Keyframe Preset Types to Choose From
|
|
68
74
|
const keyframeType = Object.freeze({
|
|
69
75
|
fade: Symbol("fade"),
|
|
70
76
|
fadeaway: Symbol("fadeaway"),
|
|
71
77
|
});
|
|
72
|
-
|
|
78
|
+
const _keyframeType = keyframeType;
|
|
79
|
+
export { _keyframeType as keyframeType };
|
|
73
80
|
|
|
74
81
|
//Function to apply animation to element and keep its properties and remove the animation
|
|
75
82
|
function ApplyAnimation(element, animationName, duration, timing, direction) {
|
|
@@ -123,7 +130,8 @@ class KeyFramePreset {
|
|
|
123
130
|
}
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
|
-
|
|
133
|
+
const _KeyFramePreset = KeyFramePreset;
|
|
134
|
+
export { _KeyFramePreset as KeyFramePreset };
|
|
127
135
|
class KeyFrameCustom {
|
|
128
136
|
constructor(animationName, duration, timing = "linear") {
|
|
129
137
|
this.animationName = animationName;
|
|
@@ -136,7 +144,8 @@ class KeyFrameCustom {
|
|
|
136
144
|
ApplyAnimation(mainElement, this.animationName, this.duration, this.timing, direction)
|
|
137
145
|
}
|
|
138
146
|
}
|
|
139
|
-
|
|
147
|
+
const _KeyFrameCustom = KeyFrameCustom;
|
|
148
|
+
export { _KeyFrameCustom as KeyFrameCustom };
|
|
140
149
|
class StyleTransition {
|
|
141
150
|
constructor(styleString, duration, startValue, endValue, timing = "linear") {
|
|
142
151
|
this.styleString = styleString;
|
|
@@ -164,7 +173,8 @@ class StyleTransition {
|
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
|
-
|
|
176
|
+
const _StyleTransition = StyleTransition;
|
|
177
|
+
export { _StyleTransition as StyleTransition };
|
|
168
178
|
class MultiElementAnimation {
|
|
169
179
|
constructor(animateableObjects, duration, timing = "linear", mainElementAnimation = "") {
|
|
170
180
|
this.animateableObjects = animateableObjects;
|
|
@@ -185,7 +195,8 @@ class MultiElementAnimation {
|
|
|
185
195
|
}
|
|
186
196
|
}
|
|
187
197
|
}
|
|
188
|
-
|
|
198
|
+
const _MultiElementAnimation = MultiElementAnimation;
|
|
199
|
+
export { _MultiElementAnimation as MultiElementAnimation };
|
|
189
200
|
class OverlayPreset {
|
|
190
201
|
constructor(oType, duration, color, timing = "linear") {
|
|
191
202
|
this.duration = duration;
|
|
@@ -208,7 +219,8 @@ class OverlayPreset {
|
|
|
208
219
|
}
|
|
209
220
|
}
|
|
210
221
|
}
|
|
211
|
-
|
|
222
|
+
const _OverlayPreset = OverlayPreset;
|
|
223
|
+
export { _OverlayPreset as OverlayPreset };
|
|
212
224
|
class OverlayCustom {
|
|
213
225
|
constructor(divAnimationObject, duration, color, timing = "linear", mainElementAnimation = "") {
|
|
214
226
|
this.divAnimationObject = divAnimationObject;
|
|
@@ -246,7 +258,8 @@ class OverlayCustom {
|
|
|
246
258
|
}
|
|
247
259
|
}
|
|
248
260
|
}
|
|
249
|
-
|
|
261
|
+
const _OverlayCustom = OverlayCustom;
|
|
262
|
+
export { _OverlayCustom as OverlayCustom };
|
|
250
263
|
/*
|
|
251
264
|
function AddFileToCache(file) {
|
|
252
265
|
if ("serviceWorker" in navigator) {
|
|
@@ -292,7 +305,8 @@ function IsOverlay(transitionStyle) {
|
|
|
292
305
|
return false;
|
|
293
306
|
}
|
|
294
307
|
}
|
|
295
|
-
|
|
308
|
+
const _IsOverlay = IsOverlay;
|
|
309
|
+
export { _IsOverlay as IsOverlay };
|
|
296
310
|
//Checks if element exists. If it does, it runs functionToExecute. Otherwise, waits until element exists to run the function
|
|
297
311
|
function WaitForElementLoad(selector, functionToExecute) {
|
|
298
312
|
if(document.querySelector(selector) != null){
|
|
@@ -312,13 +326,15 @@ function WaitForElementLoad(selector, functionToExecute) {
|
|
|
312
326
|
// Start observing the document body for child additions
|
|
313
327
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
314
328
|
}
|
|
315
|
-
|
|
329
|
+
const _WaitForElementLoad = WaitForElementLoad;
|
|
330
|
+
export { _WaitForElementLoad as WaitForElementLoad };
|
|
316
331
|
//Shorthand for SendPoint and EndPoint
|
|
317
332
|
function ListenForChange(aStyle, aOverlay = aStyle, aAnimation = aStyle, leaveFunction = (link) => {window.location = link;}) {
|
|
318
333
|
EndPoint(aStyle, aOverlay, aAnimation, leaveFunction);
|
|
319
334
|
SendPoint(aStyle, aOverlay, aAnimation);
|
|
320
335
|
}
|
|
321
|
-
|
|
336
|
+
const _ListenForChange = ListenForChange;
|
|
337
|
+
export { _ListenForChange as ListenForChange };
|
|
322
338
|
//Listens for clicks and plays animation and then redirects
|
|
323
339
|
function SendPoint(aStyle, aOverlay = aStyle, aAnimation = aStyle, leaveFunction = (link) => {window.location = link;}) {
|
|
324
340
|
//True if service worker is active or ignored with useServiceWorker=false, false otherwise
|
|
@@ -373,7 +389,8 @@ function SendPoint(aStyle, aOverlay = aStyle, aAnimation = aStyle, leaveFunction
|
|
|
373
389
|
}, { once: true });
|
|
374
390
|
}
|
|
375
391
|
}
|
|
376
|
-
|
|
392
|
+
const _SendPoint = SendPoint;
|
|
393
|
+
export { _SendPoint as SendPoint };
|
|
377
394
|
//Waits for the document to load and plays the reverse animation
|
|
378
395
|
function EndPoint(aStyle, aOverlay = aStyle, aAnimation = aStyle) {
|
|
379
396
|
//Checks to see what kind of receiving animation to play
|
|
@@ -466,7 +483,8 @@ function EndPoint(aStyle, aOverlay = aStyle, aAnimation = aStyle) {
|
|
|
466
483
|
}, { once: true });
|
|
467
484
|
}
|
|
468
485
|
}
|
|
469
|
-
|
|
486
|
+
const _EndPoint = EndPoint;
|
|
487
|
+
export { _EndPoint as EndPoint };
|
|
470
488
|
//Animates the page transition
|
|
471
489
|
function AnimatePageTransition(aStyle, direction = "normal") {
|
|
472
490
|
let mainElement = document.getElementById(finalOptions.mainContentIdName);
|
|
@@ -496,4 +514,5 @@ function AnimatePageTransition(aStyle, direction = "normal") {
|
|
|
496
514
|
}
|
|
497
515
|
|
|
498
516
|
}
|
|
499
|
-
|
|
517
|
+
const _AnimatePageTransition = AnimatePageTransition;
|
|
518
|
+
export { _AnimatePageTransition as AnimatePageTransition };
|