@reimujs/aos 0.0.2 → 0.1.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 +67 -3
- package/dist/index.d.ts +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ Just same as aos@next. For more information, please visit [aos-how-to-use-it](ht
|
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
import AOS from "@reimujs/aos";
|
|
31
|
+
import "@reimujs/aos/dist/aos.css";
|
|
31
32
|
|
|
32
33
|
AOS.init({
|
|
33
34
|
// Global settings:
|
|
@@ -54,11 +55,74 @@ AOS.init({
|
|
|
54
55
|
});
|
|
55
56
|
```
|
|
56
57
|
|
|
58
|
+
### Next.js
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
"use client";
|
|
62
|
+
import { useEffect } from "react";
|
|
63
|
+
import "@reimujs/aos/dist/aos.css";
|
|
64
|
+
|
|
65
|
+
export default function Page() {
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
import("@reimujs/aos").then(({ default: AOS }) => {
|
|
68
|
+
AOS.init();
|
|
69
|
+
});
|
|
70
|
+
}, []);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Nuxt
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<script lang="ts" setup>
|
|
78
|
+
import { onMounted } from "vue";
|
|
79
|
+
import "@reimujs/aos/dist/aos.css";
|
|
80
|
+
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
import("@reimujs/aos").then(({ default: AOS }) => {
|
|
83
|
+
AOS.init();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Augular
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { Component, Inject, PLATFORM_ID } from '@angular/core';
|
|
93
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
94
|
+
import '@reimujs/aos/dist/aos.css';
|
|
95
|
+
|
|
96
|
+
@Component({})
|
|
97
|
+
export class AppComponent {
|
|
98
|
+
constructor(
|
|
99
|
+
@Inject(PLATFORM_ID) private platformId: Object
|
|
100
|
+
) {
|
|
101
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
102
|
+
import("@reimujs/aos").then(({ default: AOS }) => {
|
|
103
|
+
AOS.init();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Astro
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
---
|
|
114
|
+
import "@reimujs/aos/dist/aos.css";
|
|
115
|
+
---
|
|
116
|
+
<script>
|
|
117
|
+
import AOS from "@reimujs/aos";
|
|
118
|
+
AOS.init();
|
|
119
|
+
</script>
|
|
120
|
+
```
|
|
121
|
+
|
|
57
122
|
## Difference
|
|
58
123
|
|
|
59
124
|
So what's the difference between aos and @reimujs/aos?
|
|
60
125
|
|
|
61
|
-
|
|
62
126
|
- Typescript friendly
|
|
63
127
|
- Smaller package size (from 14.7KB + 26.1KB to 6.9KB + 25.2KB)
|
|
64
128
|
- Only support modern browsers
|
|
@@ -85,6 +149,6 @@ function destroy(): void;
|
|
|
85
149
|
|
|
86
150
|
Remove all event listeners and disconnect MutationObserver.
|
|
87
151
|
|
|
88
|
-
|
|
89
152
|
## License
|
|
90
|
-
|
|
153
|
+
|
|
154
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
type AosEventType = "aos:in" | "aos:out";
|
|
2
|
+
interface AosEvent extends Event {
|
|
3
|
+
detail: Element;
|
|
4
|
+
}
|
|
5
|
+
declare global {
|
|
6
|
+
interface Document {
|
|
7
|
+
addEventListener(type: AosEventType, listener: (event: AosEvent) => void, options?: boolean | AddEventListenerOptions): void;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
type easingOptions = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "ease-in-back" | "ease-out-back" | "ease-in-out-back" | "ease-in-sine" | "ease-out-sine" | "ease-in-out-sine" | "ease-in-quad" | "ease-out-quad" | "ease-in-out-quad" | "ease-in-cubic" | "ease-out-cubic" | "ease-in-out-cubic" | "ease-in-quart" | "ease-out-quart" | "ease-in-out-quart";
|
|
11
|
+
type anchorPlacementOptions = "top-bottom" | "top-center" | "top-top" | "center-bottom" | "center-center" | "center-top" | "bottom-bottom" | "bottom-center" | "bottom-top";
|
|
1
12
|
export interface Options {
|
|
2
13
|
offset: number;
|
|
3
14
|
delay: number;
|
|
4
|
-
easing:
|
|
15
|
+
easing: easingOptions;
|
|
5
16
|
duration: number;
|
|
6
17
|
disable: boolean | "mobile" | "phone" | "tablet" | (() => boolean);
|
|
7
18
|
once: boolean;
|
|
8
19
|
mirror: boolean;
|
|
9
|
-
anchorPlacement:
|
|
20
|
+
anchorPlacement: anchorPlacementOptions;
|
|
10
21
|
startEvent: string;
|
|
11
22
|
animatedClassName: string;
|
|
12
23
|
initClassName: string;
|