gsap-nuxt-module 1.0.1
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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +27 -0
- package/dist/runtime/composables/useCustomEase.d.ts +1 -0
- package/dist/runtime/composables/useCustomEase.js +8 -0
- package/dist/runtime/composables/useDraggable.d.ts +1 -0
- package/dist/runtime/composables/useDraggable.js +8 -0
- package/dist/runtime/composables/useFlip.d.ts +1 -0
- package/dist/runtime/composables/useFlip.js +8 -0
- package/dist/runtime/composables/useObserver.d.ts +1 -0
- package/dist/runtime/composables/useObserver.js +8 -0
- package/dist/runtime/composables/useScrollToPlugin.d.ts +1 -0
- package/dist/runtime/composables/useScrollToPlugin.js +8 -0
- package/dist/runtime/composables/useScrollTrigger.d.ts +1 -0
- package/dist/runtime/composables/useScrollTrigger.js +8 -0
- package/dist/runtime/plugin.d.ts +5 -0
- package/dist/runtime/plugin.js +15 -0
- package/dist/runtime/utils/available-gsap-plugins.d.ts +183 -0
- package/dist/runtime/utils/available-gsap-plugins.js +15 -0
- package/dist/runtime/utils/gsap-export.d.ts +1 -0
- package/dist/runtime/utils/gsap-export.js +1 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Luca Argentieri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Get your module up and running quickly.
|
|
3
|
+
|
|
4
|
+
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
+
- Name: gsap-nuxt-module
|
|
6
|
+
- Package name: gsap-nuxt-module
|
|
7
|
+
- Description: GSAP integration for Nuxt.
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# gsap-nuxt-module
|
|
11
|
+
|
|
12
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
+
[![License][license-src]][license-href]
|
|
15
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
|
+
|
|
17
|
+
**Enhance your Nuxt application with powerful animations and transitions using GSAP!**
|
|
18
|
+
|
|
19
|
+
- [**GSAP**](https://gsap.com/)
|
|
20
|
+
- [✨ Release Notes](/CHANGELOG.md)
|
|
21
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/gsap-nuxt-module ?file=playground%2Fapp.vue) -->
|
|
22
|
+
<!-- - [📖 Documentation](https://example.com) -->
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Auto-import GSAP**: Easily integrate GSAP without manually importing it in every file.
|
|
27
|
+
- **Dynamic Plugin Registration**: Import and register GSAP plugins only if enabled in `nuxt.config.ts`, optimizing performance.
|
|
28
|
+
- **Composable for Each Plugin**: Use GSAP plugins as composables for a simple and direct experience.
|
|
29
|
+
|
|
30
|
+
## Quick Setup ⚠️ (The installation is not ready yet)
|
|
31
|
+
|
|
32
|
+
1. Install the module to your Nuxt application with one command:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx nuxi module add gsap-nuxt-module
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Add gsap-nuxt-module to the modules section of nuxt.config.ts
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
export default defineNuxtConfig({
|
|
42
|
+
modules: ['gsap-nuxt-module'],
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Example Configuration
|
|
47
|
+
|
|
48
|
+
1. In your nuxt.config.ts, enable the desired GSAP plugins:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
export default defineNuxtConfig({
|
|
52
|
+
modules: ["gsap-nuxt-module"],
|
|
53
|
+
gsap: {
|
|
54
|
+
plugins: ["Draggable"],
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. Here's how to use the Draggable plugin in your component:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
<script setup>
|
|
63
|
+
const Draggable = useDraggable()
|
|
64
|
+
|
|
65
|
+
const elementRef = ref(null)
|
|
66
|
+
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
Draggable.create(elementRef.value)
|
|
69
|
+
})
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<div ref="elementRef">Drag me!</div>
|
|
74
|
+
</template>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
##### You can find more examples in playground
|
|
78
|
+
|
|
79
|
+
That's it! You can now use gsap-nuxt-module in your Nuxt app ✨
|
|
80
|
+
|
|
81
|
+
## Contribution
|
|
82
|
+
|
|
83
|
+
<details>
|
|
84
|
+
<summary>Local development</summary>
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Install dependencies
|
|
88
|
+
npm install
|
|
89
|
+
|
|
90
|
+
# Generate type stubs
|
|
91
|
+
npm run dev:prepare
|
|
92
|
+
|
|
93
|
+
# Develop with the playground
|
|
94
|
+
npm run dev
|
|
95
|
+
|
|
96
|
+
# Build the playground
|
|
97
|
+
npm run dev:build
|
|
98
|
+
|
|
99
|
+
# Run ESLint
|
|
100
|
+
npm run lint
|
|
101
|
+
|
|
102
|
+
# Run Vitest
|
|
103
|
+
npm run test
|
|
104
|
+
npm run test:watch
|
|
105
|
+
|
|
106
|
+
# Release new version
|
|
107
|
+
npm run release
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
<!-- Badges -->
|
|
113
|
+
|
|
114
|
+
[npm-version-src]: https://img.shields.io/npm/v/gsap-nuxt-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
115
|
+
[npm-version-href]: https://npmjs.com/package/gsap-nuxt-module
|
|
116
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/gsap-nuxt-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
117
|
+
[npm-downloads-href]: https://npm.chart.dev/gsap-nuxt-module
|
|
118
|
+
[license-src]: https://img.shields.io/npm/l/gsap-nuxt-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
119
|
+
[license-href]: https://npmjs.com/package/gsap-nuxt-module
|
|
120
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
|
|
121
|
+
[nuxt-href]: https://nuxt.com
|
package/dist/module.cjs
ADDED
package/dist/module.d.ts
ADDED
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { defineNuxtModule, createResolver, addPlugin, addImportsDir } from '@nuxt/kit';
|
|
3
|
+
|
|
4
|
+
const module = defineNuxtModule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "gsap-nuxt-module",
|
|
7
|
+
configKey: "gsap",
|
|
8
|
+
compatibility: {
|
|
9
|
+
nuxt: ">=3.0.0"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaults: {
|
|
13
|
+
plugins: []
|
|
14
|
+
},
|
|
15
|
+
setup(_options, _nuxt) {
|
|
16
|
+
const resolver = createResolver(import.meta.url);
|
|
17
|
+
const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
|
|
18
|
+
_nuxt.options.runtimeConfig.public.gsap = {
|
|
19
|
+
plugins: _options.plugins ?? []
|
|
20
|
+
};
|
|
21
|
+
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
22
|
+
addImportsDir(resolver.resolve(runtimeDir, "composables"));
|
|
23
|
+
addImportsDir(resolver.resolve(runtimeDir, "utils"));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { module as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCustomEase: () => typeof CustomEase;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useNuxtApp } from "#app";
|
|
2
|
+
export const useCustomEase = () => {
|
|
3
|
+
const { $CustomEase } = useNuxtApp();
|
|
4
|
+
if (!$CustomEase) {
|
|
5
|
+
throw new Error("[useCustomEase] CustomEase not registered! Did you enable it in nuxt.config.ts?");
|
|
6
|
+
}
|
|
7
|
+
return $CustomEase;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDraggable: () => typeof Draggable | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useFlip: () => typeof Flip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useObserver: () => typeof Observer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useScrollToPlugin: () => typeof ScrollToPlugin;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useNuxtApp } from "#app";
|
|
2
|
+
export const useScrollToPlugin = () => {
|
|
3
|
+
const { $ScrollToPlugin } = useNuxtApp();
|
|
4
|
+
if (!$ScrollToPlugin) {
|
|
5
|
+
throw new Error("[useScrollToPlugin] ScrollToPlugin not registered! Did you enable it in nuxt.config.ts?");
|
|
6
|
+
}
|
|
7
|
+
return $ScrollToPlugin;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useScrollTrigger: () => typeof ScrollTrigger;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useNuxtApp } from "#app";
|
|
2
|
+
export const useScrollTrigger = () => {
|
|
3
|
+
const { $ScrollTrigger } = useNuxtApp();
|
|
4
|
+
if (!$ScrollTrigger) {
|
|
5
|
+
throw new Error("[useScrollTrigger] ScrollTrigger not registered! Did you enable it in nuxt.config.ts?");
|
|
6
|
+
}
|
|
7
|
+
return $ScrollTrigger;
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { availablePlugins } from "./utils/available-gsap-plugins.js";
|
|
2
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
3
|
+
export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
4
|
+
const config = useRuntimeConfig().public.gsap;
|
|
5
|
+
const pluginsToRegister = config.plugins || [];
|
|
6
|
+
for (const pluginName of pluginsToRegister) {
|
|
7
|
+
if (availablePlugins[pluginName]) {
|
|
8
|
+
const plugin = await availablePlugins[pluginName]();
|
|
9
|
+
_nuxtApp.provide(pluginName, plugin);
|
|
10
|
+
gsap.registerPlugin(plugin);
|
|
11
|
+
} else {
|
|
12
|
+
throw new Error(`[@nuxt/gsap] Plugin "${pluginName}" not found, available plugins: ${Object.keys(availablePlugins).join(", ")}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This object contains lazy-loaded GSAP plugins for use in the application.
|
|
3
|
+
*/
|
|
4
|
+
export declare const availablePlugins: {
|
|
5
|
+
Draggable: () => Promise<{
|
|
6
|
+
new (target: gsap.DOMTarget, vars?: Draggable.Vars): {
|
|
7
|
+
readonly autoScroll: number;
|
|
8
|
+
readonly deltaX: number;
|
|
9
|
+
readonly deltaY: number;
|
|
10
|
+
readonly endRotation: number;
|
|
11
|
+
readonly endX: number;
|
|
12
|
+
readonly endY: number;
|
|
13
|
+
readonly isDragging: boolean;
|
|
14
|
+
readonly isPressed: boolean;
|
|
15
|
+
readonly isThrowing: boolean;
|
|
16
|
+
readonly lockAxis: boolean;
|
|
17
|
+
readonly maxRotation: number;
|
|
18
|
+
readonly maxX: number;
|
|
19
|
+
readonly maxY: number;
|
|
20
|
+
readonly minX: number;
|
|
21
|
+
readonly minY: number;
|
|
22
|
+
readonly minRotation: number;
|
|
23
|
+
readonly pointerEvent: TouchEvent | PointerEvent;
|
|
24
|
+
readonly pointerX: number;
|
|
25
|
+
readonly pointerY: number;
|
|
26
|
+
readonly rotation: number;
|
|
27
|
+
readonly scrollProxy: any;
|
|
28
|
+
readonly startX: number;
|
|
29
|
+
readonly startY: number;
|
|
30
|
+
readonly target: HTMLElement | SVGElement;
|
|
31
|
+
readonly tween: gsap.core.Tween;
|
|
32
|
+
readonly vars: Draggable.Vars;
|
|
33
|
+
readonly x: number;
|
|
34
|
+
readonly y: number;
|
|
35
|
+
addEventListener(type: Draggable.CallbackType, callback: gsap.Callback): void;
|
|
36
|
+
applyBounds(bounds: gsap.DOMTarget | Draggable.BoundsMinMax | Draggable.BoundsRectangle | Draggable.BoundsRotation): void;
|
|
37
|
+
disable(type?: string | object): /*elided*/ any;
|
|
38
|
+
dispatchEvent(type: Draggable.CallbackType): boolean;
|
|
39
|
+
enable(type?: string | object): /*elided*/ any;
|
|
40
|
+
enabled(value: boolean): /*elided*/ any;
|
|
41
|
+
enabled(): boolean;
|
|
42
|
+
endDrag(event: Event): void;
|
|
43
|
+
getDirection(from: "start" | "velocity" | gsap.DOMTarget): Draggable.Direction;
|
|
44
|
+
hitTest(testObject: Draggable.TestObject, threshold?: number | string): boolean;
|
|
45
|
+
kill(): /*elided*/ any;
|
|
46
|
+
removeEventListener(type: Draggable.CallbackType, callback: gsap.Callback): void;
|
|
47
|
+
startDrag(event: Event, align?: boolean): void;
|
|
48
|
+
timeSinceDrag(): number;
|
|
49
|
+
update(applyBounds?: boolean, sticky?: boolean): /*elided*/ any;
|
|
50
|
+
};
|
|
51
|
+
version: string;
|
|
52
|
+
zIndex: number;
|
|
53
|
+
create(target: gsap.DOMTarget, vars?: Draggable.Vars): Draggable[];
|
|
54
|
+
get(target: gsap.DOMTarget): Draggable;
|
|
55
|
+
hitTest(testObject1: Draggable.TestObject, testObject2: Draggable.TestObject, threshold?: number | string): boolean;
|
|
56
|
+
timeSinceDrag(): number;
|
|
57
|
+
}>;
|
|
58
|
+
EaselPlugin: () => Promise<gsap.plugins.EaselPlugin>;
|
|
59
|
+
Flip: () => Promise<{
|
|
60
|
+
new (): {};
|
|
61
|
+
readonly version: string;
|
|
62
|
+
batch(id?: string): FlipBatch;
|
|
63
|
+
convertCoordinates(fromElement: Element, toElement: Element): gsap.plugins.Matrix2D;
|
|
64
|
+
convertCoordinates(fromElement: Element, toElement: Element, point: gsap.Point2D): gsap.Point2D;
|
|
65
|
+
fit(fromElement: gsap.DOMTarget, toElement: gsap.DOMTarget | Flip.FlipState, vars?: Flip.FitVars): gsap.core.Tween | object | null;
|
|
66
|
+
from(state: Flip.FlipState, vars?: Flip.FromToVars): gsap.core.Timeline;
|
|
67
|
+
getState(targets: gsap.DOMTarget, vars?: Flip.FlipStateVars | string): Flip.FlipState;
|
|
68
|
+
getByTarget(target: Element | string): gsap.core.Timeline | null;
|
|
69
|
+
isFlipping(target: gsap.DOMTarget): boolean;
|
|
70
|
+
killFlipsOf(targets: gsap.DOMTarget, complete?: boolean): void;
|
|
71
|
+
makeAbsolute(targets: gsap.DOMTarget | Flip.FlipState[]): Element[];
|
|
72
|
+
to(state: Flip.FlipState, vars?: Flip.FromToVars): gsap.core.Timeline;
|
|
73
|
+
register(core: typeof gsap): void;
|
|
74
|
+
ElementState: typeof Flip.ElementState;
|
|
75
|
+
FlipState: typeof Flip.FlipState;
|
|
76
|
+
}>;
|
|
77
|
+
MotionPathPlugin: () => Promise<gsap.plugins.MotionPathPlugin>;
|
|
78
|
+
Observer: () => Promise<{
|
|
79
|
+
new (): {
|
|
80
|
+
readonly deltaX: number;
|
|
81
|
+
readonly deltaY: number;
|
|
82
|
+
readonly event: Event;
|
|
83
|
+
readonly isDragging: boolean;
|
|
84
|
+
readonly isEnabled: boolean;
|
|
85
|
+
readonly isPressed: boolean;
|
|
86
|
+
readonly startX?: number;
|
|
87
|
+
readonly startY?: number;
|
|
88
|
+
readonly target: Element;
|
|
89
|
+
readonly vars: Observer.ObserverVars;
|
|
90
|
+
readonly velocityX: number;
|
|
91
|
+
readonly velocityY: number;
|
|
92
|
+
readonly x?: number;
|
|
93
|
+
readonly y?: number;
|
|
94
|
+
readonly axis?: string | null;
|
|
95
|
+
disable(): void;
|
|
96
|
+
enable(): /*elided*/ any;
|
|
97
|
+
kill(): void;
|
|
98
|
+
scrollX(): number;
|
|
99
|
+
scrollX(position: number): void;
|
|
100
|
+
scrollY(): number;
|
|
101
|
+
scrollY(position: number): void;
|
|
102
|
+
};
|
|
103
|
+
readonly isTouch: number;
|
|
104
|
+
readonly eventTypes: string[];
|
|
105
|
+
readonly version: string;
|
|
106
|
+
create(vars: Observer.ObserverVars): Observer;
|
|
107
|
+
getAll(): Observer[];
|
|
108
|
+
getById(id: string): Observer | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
PixiPlugin: () => Promise<gsap.plugins.PixiPlugin>;
|
|
111
|
+
ScrollToPlugin: () => Promise<{
|
|
112
|
+
new (): {};
|
|
113
|
+
config(vars: ScrollToPlugin.ConfigVars): void;
|
|
114
|
+
max(element: gsap.DOMTarget): number;
|
|
115
|
+
offset(element: gsap.DOMTarget, container?: gsap.DOMTarget): number;
|
|
116
|
+
}>;
|
|
117
|
+
ScrollTrigger: () => Promise<{
|
|
118
|
+
new (vars: ScrollTrigger.StaticVars, animation?: gsap.core.Animation): {
|
|
119
|
+
readonly animation?: gsap.core.Animation | undefined;
|
|
120
|
+
readonly callbackAnimation?: gsap.core.Animation | undefined;
|
|
121
|
+
readonly direction: number;
|
|
122
|
+
readonly end: number;
|
|
123
|
+
readonly isActive: boolean;
|
|
124
|
+
readonly pin?: Element;
|
|
125
|
+
readonly progress: number;
|
|
126
|
+
readonly scroller: Element | Window;
|
|
127
|
+
readonly start: number;
|
|
128
|
+
readonly trigger?: Element;
|
|
129
|
+
readonly vars: ScrollTrigger.Vars;
|
|
130
|
+
disable(revert?: boolean, allowAnimation?: boolean): void;
|
|
131
|
+
enable(reset?: boolean, refresh?: boolean): void;
|
|
132
|
+
endAnimation(): void;
|
|
133
|
+
getTween(snap?: boolean): gsap.core.Tween;
|
|
134
|
+
getTrailing(name?: string | boolean | null): ScrollTrigger[];
|
|
135
|
+
getVelocity(): number;
|
|
136
|
+
kill(reset?: boolean, allowAnimation?: boolean): void;
|
|
137
|
+
labelToScroll(label: string): number;
|
|
138
|
+
next(): ScrollTrigger | undefined;
|
|
139
|
+
previous(): ScrollTrigger | undefined;
|
|
140
|
+
refresh(): void;
|
|
141
|
+
scroll(): number;
|
|
142
|
+
scroll(position: number): void;
|
|
143
|
+
tweenTo(position: number): gsap.core.Tween;
|
|
144
|
+
update(reset?: boolean, recordVelocity?: boolean, forceFake?: boolean): void;
|
|
145
|
+
};
|
|
146
|
+
readonly version: string;
|
|
147
|
+
readonly isTouch: number;
|
|
148
|
+
addEventListener(event: "scrollStart" | "scrollEnd" | "refreshInit" | "refresh" | "matchMedia" | "revert", callback: gsap.Callback): void;
|
|
149
|
+
batch(targets: gsap.DOMTarget, vars: ScrollTrigger.BatchVars): ScrollTrigger[];
|
|
150
|
+
clearMatchMedia(name?: string): void;
|
|
151
|
+
clearScrollMemory(scrollRestoration?: string): void;
|
|
152
|
+
config(vars: ScrollTrigger.ConfigVars): void;
|
|
153
|
+
create(vars: ScrollTrigger.StaticVars): ScrollTrigger;
|
|
154
|
+
defaults(vars: ScrollTrigger.StaticVars): ScrollTrigger.StaticVars;
|
|
155
|
+
getAll(): ScrollTrigger[];
|
|
156
|
+
disable(reset?: boolean, kill?: boolean): void;
|
|
157
|
+
enable(): void;
|
|
158
|
+
getById(id: string): ScrollTrigger | undefined;
|
|
159
|
+
getScrollFunc(element: gsap.DOMTarget | Window, horizontal?: boolean): ScrollTrigger.ScrollFunc;
|
|
160
|
+
isInViewport(element: Element | string, ratio?: number, horizontal?: boolean): boolean;
|
|
161
|
+
isScrolling(): boolean;
|
|
162
|
+
killAll(allowListeners?: boolean): void;
|
|
163
|
+
matchMedia(vars: ScrollTrigger.MatchMediaObject): void;
|
|
164
|
+
maxScroll(target: HTMLElement | Window, horizontal?: boolean): number;
|
|
165
|
+
normalizeScroll(enable?: boolean | ScrollTrigger.NormalizeVars | Observer): Observer | undefined;
|
|
166
|
+
normalizeScroll(): Observer | undefined;
|
|
167
|
+
observe(vars: Observer.ObserverVars): Observer;
|
|
168
|
+
positionInViewport(element: Element | string, referencePoint?: string | number, horizontal?: boolean): number;
|
|
169
|
+
refresh(safe?: boolean): void;
|
|
170
|
+
register(core: typeof gsap): void;
|
|
171
|
+
removeEventListener(event: "scrollStart" | "scrollEnd" | "refreshInit" | "refresh" | "matchMedia", callback: gsap.Callback): void;
|
|
172
|
+
saveStyles(targets: gsap.DOMTarget): void;
|
|
173
|
+
scrollerProxy(scroller: gsap.DOMTarget, vars?: ScrollTrigger.ScrollerProxyVars): void;
|
|
174
|
+
snapDirectional(incrementOrArray: number | number[]): ScrollTrigger.SnapDirectionalFunc;
|
|
175
|
+
sort(func?: Function): ScrollTrigger[];
|
|
176
|
+
update(): void;
|
|
177
|
+
}>;
|
|
178
|
+
TextPlugin: () => Promise<gsap.plugins.TextPlugin>;
|
|
179
|
+
RoughEase: () => Promise<gsap.RoughEase>;
|
|
180
|
+
ExpoScaleEase: () => Promise<gsap.ExpoScaleEase>;
|
|
181
|
+
SlowMo: () => Promise<gsap.SlowMo>;
|
|
182
|
+
CustomEase: () => Promise<any>;
|
|
183
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const availablePlugins = {
|
|
2
|
+
Draggable: () => import("gsap/Draggable").then((mod) => mod.Draggable),
|
|
3
|
+
EaselPlugin: () => import("gsap/EaselPlugin").then((mod) => mod.EaselPlugin),
|
|
4
|
+
Flip: () => import("gsap/Flip").then((mod) => mod.Flip),
|
|
5
|
+
MotionPathPlugin: () => import("gsap/MotionPathPlugin").then((mod) => mod.MotionPathPlugin),
|
|
6
|
+
Observer: () => import("gsap/Observer").then((mod) => mod.Observer),
|
|
7
|
+
PixiPlugin: () => import("gsap/PixiPlugin").then((mod) => mod.PixiPlugin),
|
|
8
|
+
ScrollToPlugin: () => import("gsap/ScrollToPlugin").then((mod) => mod.ScrollToPlugin),
|
|
9
|
+
ScrollTrigger: () => import("gsap/ScrollTrigger").then((mod) => mod.ScrollTrigger),
|
|
10
|
+
TextPlugin: () => import("gsap/TextPlugin").then((mod) => mod.TextPlugin),
|
|
11
|
+
RoughEase: () => import("gsap/EasePack").then((mod) => mod.RoughEase),
|
|
12
|
+
ExpoScaleEase: () => import("gsap/EasePack").then((mod) => mod.ExpoScaleEase),
|
|
13
|
+
SlowMo: () => import("gsap/EasePack").then((mod) => mod.SlowMo),
|
|
14
|
+
CustomEase: () => import("gsap/CustomEase").then((mod) => mod.CustomEase)
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { gsap } from 'gsap';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { gsap } from "gsap";
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type ModuleOptions, default } from './module.js'
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type ModuleOptions, default } from './module'
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gsap-nuxt-module",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "GSAP integration for Nuxt.",
|
|
5
|
+
"repository": "LucaArgentieri/gsap-nuxt-module",
|
|
6
|
+
"author": "Luca Argentieri",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types.d.ts",
|
|
12
|
+
"import": "./dist/module.mjs",
|
|
13
|
+
"require": "./dist/module.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/module.cjs",
|
|
17
|
+
"types": "./dist/types.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"prepack": "nuxt-module-build build",
|
|
23
|
+
"dev": "nuxi dev playground",
|
|
24
|
+
"dev:build": "nuxi build playground",
|
|
25
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
26
|
+
"release": "npm run lint && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
27
|
+
"lint": "eslint .",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest watch",
|
|
30
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@nuxt/kit": "^3.15.4",
|
|
34
|
+
"gsap": "^3.12.7"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@nuxt/devtools": "^2.1.0",
|
|
38
|
+
"@nuxt/eslint-config": "^1.1.0",
|
|
39
|
+
"@nuxt/module-builder": "^0.8.4",
|
|
40
|
+
"@nuxt/schema": "^3.15.4",
|
|
41
|
+
"@nuxt/test-utils": "^3.17.0",
|
|
42
|
+
"@types/node": "latest",
|
|
43
|
+
"changelogen": "^0.6.0",
|
|
44
|
+
"eslint": "^9.21.0",
|
|
45
|
+
"nuxt": "^3.15.4",
|
|
46
|
+
"typescript": "~5.7.3",
|
|
47
|
+
"vitest": "^3.0.7",
|
|
48
|
+
"vue-tsc": "^2.2.4"
|
|
49
|
+
}
|
|
50
|
+
}
|