tweenlabs 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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +168 -0
  3. package/bin/cli.js +226 -0
  4. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TweenLabs
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,168 @@
1
+ <!-- SEO Meta Block — paste this in your Next.js layout.tsx or head -->
2
+ <!--
3
+ title: TweenLabs — Premium Open Source GSAP Component Library for Next.js
4
+ description: A free, open-source GSAP animation component library and UI template sandbox built with Next.js 16, React 19, and Lenis. Learn and build modern web animations with reusable, copy-paste ready components.
5
+ keywords: TweenLabs, GSAP component library, GSAP Next.js, GSAP animations React, open source animation library, web animation components, Lenis smooth scroll, GSAP ScrollTrigger components, Next.js animation library
6
+ -->
7
+
8
+ # <img src="public/logo.svg" alt="TweenLabs Logo" width="40" height="40" align="center" /> TweenLabs
9
+
10
+
11
+ > The open-source **GSAP animation component library** for Next.js developers — learn, copy, and contribute modern web animation patterns built with **GSAP 3.15**, **Next.js 16**, and **Lenis**.
12
+
13
+ **[Live Demo](https://tweenlabs.xyz)** • **[Contributing Guide](#contributing)** • **[Roadmap](#roadmap)**
14
+
15
+ ![Next.js](https://img.shields.io/badge/Next.js-16-black?style=flat-square)
16
+ ![GSAP](https://img.shields.io/badge/GSAP-3.15-88CE02?style=flat-square)
17
+ ![React](https://img.shields.io/badge/React-19-61DAFB?style=flat-square)
18
+ ![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)
19
+
20
+ <!-- [Contributors](https://img.shields.io/github/contributors/TweenLabs/TweenLabs?style=flat-square) -->
21
+
22
+ ---
23
+
24
+ ## What is TweenLabs?
25
+
26
+ **TweenLabs** is a community-driven, open-source collection of reusable GSAP animation components for Next.js and React. Every component is production-ready, well-documented, and built to help developers understand *how* advanced web animations work — not just copy code blindly.
27
+
28
+ No paid plugins. No locked content. Just clean, modern animation patterns anyone can learn from and build on.
29
+
30
+ > 🔍 **Looking for a GSAP component library for Next.js?** You found it.
31
+
32
+ ---
33
+
34
+ ## ✨ Animation Components
35
+
36
+ | Component | Description | GSAP Features Used |
37
+ |-----------|-------------|-------------------|
38
+ | **Gravity Drop** | Physics-based falling animations with realistic bounce | `gsap.to`, `ease`, stagger |
39
+ | **Scroll-Triggered Assemblies** | Content reveals synced with scroll position | ScrollTrigger |
40
+ | **Border Reveal Effects** | Inward/outward border animations | Timeline, `clipPath` |
41
+ | **Horizontal Card Showcase** | Smooth carousel and card transitions | ScrollTrigger, `x` transforms |
42
+ | **Page Transitions** | Seamless route change animations | Timeline, Next.js router |
43
+ | **Smooth Scrolling** | Native-feel smooth scroll | Lenis + GSAP ticker |
44
+
45
+ > More components added with every contribution. [See full list →](https://tweenlabs.xyz)
46
+
47
+ ---
48
+
49
+ ## 🛠 Tech Stack
50
+
51
+ - **[Next.js 16](https://nextjs.org/)** – React framework with SSR and App Router
52
+ - **[GSAP 3.15](https://gsap.com/)** – Industry-standard JavaScript animation library
53
+ - **[React 19](https://react.dev/)** – Modern component-based UI
54
+ - **[Lenis 1.3](https://github.com/darkroom-digital/lenis)** – Buttery smooth scroll
55
+ - **[Tailwind CSS 4](https://tailwindcss.com/)** – Utility-first styling
56
+ - **[TypeScript](https://www.typescriptlang.org/)** – Full type safety
57
+
58
+ ---
59
+
60
+ ## 🚀 Quick Start
61
+
62
+ ```bash
63
+ # Install pnpm if you don't have it
64
+ npm install -g pnpm
65
+
66
+ # Clone and run
67
+ git clone https://github.com/TweenLabs/TweenLabs.git
68
+ cd TweenLabs
69
+ pnpm install
70
+ pnpm dev
71
+ ```
72
+
73
+ Open [http://localhost:3000](http://localhost:3000) — pick any animation card and start exploring.
74
+
75
+ ---
76
+
77
+ ## 🤝 Contributing
78
+
79
+ TweenLabs grows with the community. We welcome new components, bug fixes, docs, performance improvements, and accessibility enhancements.
80
+
81
+ ### Steps
82
+
83
+ ```bash
84
+ # 1. Fork the repo, then clone your fork
85
+ git clone https://github.com/YOUR_USERNAME/TweenLabs.git
86
+
87
+ # 2. Create a branch
88
+ git checkout -b feat/your-animation-name
89
+
90
+ # 3. Install & run
91
+ pnpm install && pnpm dev
92
+
93
+ # 4. Make changes, then commit
94
+ git commit -m "feat: add [animation name]"
95
+
96
+ # 5. Push and open a PR
97
+ git push origin feat/your-animation-name
98
+ ```
99
+
100
+ ### Adding a New Component
101
+
102
+ - Follow the folder pattern: `src/app/XX-component-name/`
103
+ - Include a `page.tsx` with your animation
104
+ - Add inline comments explaining the GSAP logic
105
+ - Reference `gsapskills.md` for best practices
106
+
107
+ ### Good First Contributions
108
+
109
+ - ✅ Add explanatory comments to existing animations
110
+ - ✅ Test on mobile/tablet and report issues
111
+ - ✅ Create animation variants with different easing curves
112
+ - ✅ Improve accessibility (`prefers-reduced-motion`, ARIA)
113
+ - ✅ Write or improve docs
114
+
115
+ ### Code Guidelines
116
+
117
+ - Use CSS transforms (`x`, `y`, `scale`) — never layout properties
118
+ - Always respect `prefers-reduced-motion`
119
+ - TypeScript only — no `any` types
120
+ - Write descriptive commit messages
121
+
122
+ ---
123
+
124
+ ## 🗺 Roadmap
125
+
126
+ - [ ] Export as npm package (`@tweenlabs/components`)
127
+ - [ ] Storybook integration for isolated component previews
128
+ - [ ] Unit tests for animation logic
129
+ - [ ] FLIP, Draggable, MorphSVG animation patterns
130
+ - [ ] Community showcase gallery
131
+ - [ ] Animation starter templates for common use cases
132
+
133
+ ---
134
+
135
+ ## 📚 Learn More
136
+
137
+ New to GSAP? These resources pair perfectly with this repo:
138
+
139
+ - [GSAP Official Docs](https://gsap.com/docs/) — start here
140
+ - [GSAP + React Guide](https://gsap.com/resources/React/) — useGSAP hook
141
+ - [ScrollTrigger Docs](https://gsap.com/docs/v3/Plugins/ScrollTrigger/) — scroll animations
142
+ - [Next.js Docs](https://nextjs.org/docs) — framework reference
143
+ - [Lenis Docs](https://lenis.studiofreight.com/) — smooth scroll setup
144
+
145
+ ---
146
+
147
+ ## 📜 License
148
+
149
+ [MIT](LICENSE) — free to use in personal and commercial projects.
150
+
151
+ ---
152
+
153
+ ## 🌟 Contributors
154
+
155
+ Thanks to everyone building this together. ❤️
156
+
157
+ <!-- Add contributor grid here once you have 5+ contributors -->
158
+
159
+ ---
160
+
161
+ **Built in public. Animated with love. Open to all. 🚀**
162
+
163
+ <!--
164
+ SEARCH TAGS (do not remove — improves GitHub discoverability):
165
+ tweenlabs, gsap animation library, gsap component library, gsap nextjs, gsap react components,
166
+ open source animation, web animation components, lenis smooth scroll, scrolltrigger examples,
167
+ next.js animation, gsap copy paste components, gsap learning, gsap playground
168
+ -->
package/bin/cli.js ADDED
@@ -0,0 +1,226 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const { execSync } = require("child_process");
6
+ const https = require("https");
7
+ const readline = require("readline");
8
+
9
+ // Simple Terminal Colors
10
+ const colors = {
11
+ reset: "\x1b[0m",
12
+ bold: "\x1b[1m",
13
+ green: "\x1b[32m",
14
+ cyan: "\x1b[36m",
15
+ yellow: "\x1b[33m",
16
+ red: "\x1b[31m",
17
+ gray: "\x1b[90m",
18
+ };
19
+
20
+ // Help text
21
+ const helpText = `
22
+ ${colors.bold}${colors.cyan}TweenLabs CLI${colors.reset} - Install premium GSAP components directly into your codebase.
23
+
24
+ ${colors.bold}Usage:${colors.reset}
25
+ npx tweenlabs list List all available components
26
+ npx tweenlabs add <component-slug> Install a specific component
27
+ npx tweenlabs add all Install all components
28
+
29
+ ${colors.bold}Examples:${colors.reset}
30
+ npx tweenlabs list
31
+ npx tweenlabs add 11-magnetic-dock
32
+ npx tweenlabs add magnetic-dock
33
+ npx tweenlabs add all
34
+
35
+ ${colors.bold}Options:${colors.reset}
36
+ --help, -h Show this help message
37
+ --version, -v Show version
38
+ `;
39
+
40
+ // Helper to make GET requests without external dependencies
41
+ function fetchJson(url) {
42
+ return new Promise((resolve, reject) => {
43
+ const client = url.startsWith("https") ? https : require("http");
44
+ client.get(url, {
45
+ headers: { "User-Agent": "tweenlabs-cli" }
46
+ }, (res) => {
47
+ if (res.statusCode !== 200) {
48
+ reject(new Error(`Server returned status code ${res.statusCode}`));
49
+ return;
50
+ }
51
+ let data = "";
52
+ res.on("data", (chunk) => { data += chunk; });
53
+ res.on("end", () => {
54
+ try {
55
+ resolve(JSON.parse(data));
56
+ } catch (err) {
57
+ reject(err);
58
+ }
59
+ });
60
+ }).on("error", reject);
61
+ });
62
+ }
63
+
64
+ // Helper for interactive user input
65
+ function askQuestion(query) {
66
+ const rl = readline.createInterface({
67
+ input: process.stdin,
68
+ output: process.stdout,
69
+ });
70
+ return new Promise((resolve) =>
71
+ rl.question(query, (ans) => {
72
+ rl.close();
73
+ resolve(ans.trim());
74
+ })
75
+ );
76
+ }
77
+
78
+ // Detect client's package manager
79
+ function detectPackageManager() {
80
+ if (fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml"))) return "pnpm";
81
+ if (fs.existsSync(path.join(process.cwd(), "yarn.lock"))) return "yarn";
82
+ if (fs.existsSync(path.join(process.cwd(), "bun.lockb"))) return "bun";
83
+ return "npm";
84
+ }
85
+
86
+ async function main() {
87
+ const args = process.argv.slice(2);
88
+
89
+ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
90
+ console.log(helpText);
91
+ process.exit(0);
92
+ }
93
+
94
+ if (args.includes("--version") || args.includes("-v")) {
95
+ console.log("1.0.0");
96
+ process.exit(0);
97
+ }
98
+
99
+ if (args[0] === "list") {
100
+ console.log(`\n${colors.cyan}🔍 Fetching available components list...${colors.reset}`);
101
+ const domain = process.env.TWEENLABS_REGISTRY_URL || "https://tweenlabs.xyz";
102
+ const url = `${domain}/api/registry/list`;
103
+ try {
104
+ const data = await fetchJson(url);
105
+ console.log(`\n${colors.bold}${colors.green}Available TweenLabs Components:${colors.reset}\n`);
106
+ for (const comp of data.components) {
107
+ console.log(` ${colors.bold}${colors.cyan}* ${comp.name}${colors.reset}`);
108
+ console.log(` Slug: ${comp.slug} (or ${comp.cleanSlug})`);
109
+ console.log(` Desc: ${comp.description}\n`);
110
+ }
111
+ process.exit(0);
112
+ } catch (err) {
113
+ console.error(`\n${colors.red}❌ Failed to fetch components list.${colors.reset}`);
114
+ console.error(colors.gray + `Details: ${err.message}` + colors.reset);
115
+ process.exit(1);
116
+ }
117
+ }
118
+
119
+ if (args[0] !== "add") {
120
+ console.log(`${colors.red}Error: Unknown command "${args[0]}". Did you mean "add" or "list"?${colors.reset}`);
121
+ console.log(helpText);
122
+ process.exit(1);
123
+ }
124
+
125
+ const componentSlug = args[1];
126
+ if (!componentSlug) {
127
+ console.log(`${colors.red}Error: Please specify a component slug to add.${colors.reset}`);
128
+ console.log(colors.gray + "Example: npx tweenlabs add 11-magnetic-dock" + colors.reset);
129
+ process.exit(1);
130
+ }
131
+
132
+ console.log(`\n${colors.cyan}🔍 Fetching ${colors.bold}${componentSlug}${colors.reset}${colors.cyan} registry data...${colors.reset}`);
133
+
134
+ // Determine registry domain (allow local testing via env variable)
135
+ const domain = process.env.TWEENLABS_REGISTRY_URL || "https://tweenlabs.xyz";
136
+ const url = `${domain}/api/registry/${componentSlug}`;
137
+
138
+ let componentData;
139
+ try {
140
+ componentData = await fetchJson(url);
141
+ } catch (err) {
142
+ console.error(`\n${colors.red}❌ Failed to fetch component. Make sure the slug is correct and the server is running.${colors.reset}`);
143
+ console.error(colors.gray + `Details: ${err.message}` + colors.reset);
144
+ process.exit(1);
145
+ }
146
+
147
+ console.log(`${colors.green}✓ Component found: ${colors.bold}${componentData.className}${colors.reset}`);
148
+
149
+ // Resolve target directory
150
+ let targetDir = path.join(process.cwd(), "src", "components");
151
+ if (!fs.existsSync(path.join(process.cwd(), "src"))) {
152
+ targetDir = path.join(process.cwd(), "components");
153
+ }
154
+
155
+ const userPathAnswer = await askQuestion(
156
+ `📁 Where should the component be installed? ${colors.gray}(default: ${targetDir})${colors.reset}: `
157
+ );
158
+ if (userPathAnswer) {
159
+ targetDir = path.resolve(process.cwd(), userPathAnswer);
160
+ }
161
+
162
+ // Create target directory if it doesn't exist
163
+ if (!fs.existsSync(targetDir)) {
164
+ fs.mkdirSync(targetDir, { recursive: true });
165
+ }
166
+
167
+ // Write component files
168
+ console.log(`\n${colors.cyan}💾 Writing component files...${colors.reset}`);
169
+ for (const file of componentData.files) {
170
+ const filePath = path.join(targetDir, file.name);
171
+ fs.writeFileSync(filePath, file.content, "utf-8");
172
+ console.log(`${colors.green} → Created: ${colors.bold}${path.relative(process.cwd(), filePath)}${colors.reset}`);
173
+ }
174
+
175
+ // Check and install dependencies
176
+ const dependencies = componentData.dependencies || [];
177
+ if (dependencies.length > 0) {
178
+ // Read package.json to see if dependencies are already installed
179
+ let pkgJson = {};
180
+ try {
181
+ pkgJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
182
+ } catch (err) {
183
+ // Ignore
184
+ }
185
+
186
+ const allDeps = { ...pkgJson.dependencies, ...pkgJson.devDependencies };
187
+ const missingDeps = dependencies.filter((dep) => !allDeps[dep]);
188
+
189
+ if (missingDeps.length > 0) {
190
+ const pm = detectPackageManager();
191
+ console.log(`\n${colors.yellow}📦 Missing dependencies: ${colors.bold}${missingDeps.join(", ")}${colors.reset}`);
192
+
193
+ const installConfirm = await askQuestion(
194
+ `Do you want to install them using ${colors.bold}${pm}${colors.reset}? (y/n) ${colors.gray}[y]${colors.reset}: `
195
+ );
196
+
197
+ if (!installConfirm || installConfirm.toLowerCase() === "y" || installConfirm.toLowerCase() === "yes") {
198
+ console.log(`${colors.cyan}Installing dependencies using ${pm}...${colors.reset}`);
199
+ let installCmd = "";
200
+ if (pm === "pnpm") installCmd = `pnpm add ${missingDeps.join(" ")}`;
201
+ else if (pm === "yarn") installCmd = `yarn add ${missingDeps.join(" ")}`;
202
+ else if (pm === "bun") installCmd = `bun add ${missingDeps.join(" ")}`;
203
+ else installCmd = `npm install ${missingDeps.join(" ")}`;
204
+
205
+ try {
206
+ execSync(installCmd, { stdio: "inherit" });
207
+ console.log(`${colors.green}✓ Dependencies installed successfully!${colors.reset}`);
208
+ } catch (err) {
209
+ console.error(`${colors.red}❌ Failed to install dependencies. Please run "${installCmd}" manually.${colors.reset}`);
210
+ }
211
+ } else {
212
+ console.log(`${colors.yellow}⚠️ Skipping installation. Please make sure to install ${missingDeps.join(", ")} manually.${colors.reset}`);
213
+ }
214
+ } else {
215
+ console.log(`\n${colors.green}✓ All dependencies (${dependencies.join(", ")}) already installed.${colors.reset}`);
216
+ }
217
+ }
218
+
219
+ console.log(`\n${colors.green}${colors.bold}🎉 Installation complete!${colors.reset}`);
220
+ console.log(`You can now import and use the ${colors.bold}${componentData.className}${colors.reset} component in your project.\n`);
221
+ }
222
+
223
+ main().catch((err) => {
224
+ console.error("CLI unexpected error:", err);
225
+ process.exit(1);
226
+ });
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "tweenlabs",
3
+ "version": "0.1.0",
4
+ "bin": {
5
+ "tweenlabs": "bin/cli.js"
6
+ },
7
+ "files": [
8
+ "bin",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
12
+ "scripts": {
13
+ "dev": "next dev",
14
+ "build": "node scripts/generate-llms-full.js && next build",
15
+ "vercel-build": "convex deploy --cmd \"node scripts/generate-llms-full.js && next build\"",
16
+ "start": "next start",
17
+ "lint": "eslint"
18
+ },
19
+ "dependencies": {
20
+ "@convex-dev/better-auth": "^0.12.4",
21
+ "@gsap/react": "^2.1.2",
22
+ "better-auth": "^1.6.19",
23
+ "convex": "^1.41.0",
24
+ "gsap": "^3.15.0",
25
+ "lenis": "^1.3.23",
26
+ "next": "16.2.7",
27
+ "react": "19.2.4",
28
+ "react-dom": "19.2.4"
29
+ },
30
+ "devDependencies": {
31
+ "@biomejs/biome": "^2.5.0",
32
+ "@tailwindcss/postcss": "^4",
33
+ "@types/node": "^20",
34
+ "@types/react": "^19",
35
+ "@types/react-dom": "^19",
36
+ "eslint": "^9",
37
+ "eslint-config-next": "16.2.7",
38
+ "sharp": "^0.35.1",
39
+ "tailwindcss": "^4",
40
+ "typescript": "^5"
41
+ },
42
+ "pnpm": {
43
+ "ignoredBuiltDependencies": [
44
+ "sharp",
45
+ "unrs-resolver"
46
+ ],
47
+ "overrides": {
48
+ "postcss": "^8.5.10"
49
+ }
50
+ }
51
+ }