loopwind 0.12.1 → 0.12.2

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/HELPERS_DEMO.md DELETED
@@ -1,126 +0,0 @@
1
- # Image and Video Helpers - Simple Demo
2
-
3
- ## ✅ What We Added
4
-
5
- Two new helpers for templates:
6
- - `image()` - Embed images (jpg, png, gif, webp, svg)
7
- - `video()` - Embed videos (mp4, mov, etc.) - auto-syncs to current frame
8
-
9
- ## Usage
10
-
11
- ### Images
12
-
13
- ```tsx
14
- export default function Banner({ tw, image }) {
15
- return (
16
- <div style={tw('relative w-full h-full')}>
17
- <img src={image('background.jpg')} />
18
- <h1 style={tw('absolute top-10 left-10')}>Hello World</h1>
19
- </div>
20
- );
21
- }
22
- ```
23
-
24
- **Props format:**
25
- ```json
26
- {
27
- "background": "./path/to/background.jpg"
28
- }
29
- ```
30
-
31
- The renderer automatically detects props that end in image extensions and pre-loads them.
32
-
33
- ### Videos (for video templates)
34
-
35
- ```tsx
36
- export default function VideoOverlay({ tw, video, frame, title }) {
37
- return (
38
- <div style={tw('relative w-full h-full')}>
39
- <img src={video('background.mp4')} />
40
- <h1 style={tw('absolute top-10 left-10 text-white')}>{title}</h1>
41
- </div>
42
- );
43
- }
44
- ```
45
-
46
- **How it works:**
47
- 1. First render pass: Template calls `video('background.mp4')` → marks video as needed
48
- 2. Pre-generation: Extracts all frames from video at template's FPS
49
- 3. Actual render: Returns frame matching current template frame number
50
- 4. Frames are cached in memory for fast access
51
-
52
- **Props format:**
53
- ```json
54
- {
55
- "title": "My Video",
56
- "background": "./path/to/background.mp4"
57
- }
58
- ```
59
-
60
- Then use the `video()` helper with the prop value.
61
-
62
- ## Why This Is Simple
63
-
64
- - **No complex API** - Just `image('path')` and `video('path')`
65
- - **Auto-syncing** - Videos automatically match template frame
66
- - **Caching** - Frames extracted once, reused for all renders
67
- - **Works like QR codes** - Same discovery + pre-generation pattern
68
- - **No timeline controls** - Keep it simple, just background videos
69
-
70
- ## Example: Video with Text Overlay
71
-
72
- ```tsx
73
- // Template: _loopwind/templates/video-overlay/template.tsx
74
- export const meta = {
75
- name: "video-overlay",
76
- type: "video",
77
- size: { width: 1920, height: 1080 },
78
- video: { fps: 30, duration: 3 },
79
- props: { title: "string", background: "string" }
80
- };
81
-
82
- export default function VideoOverlay({ tw, video, frame, progress, title }) {
83
- // Animate title opacity
84
- const opacity = progress < 0.2 ? progress / 0.2 : 1;
85
-
86
- return (
87
- <div style={tw('relative w-full h-full flex items-center justify-center')}>
88
- {/* Background video - auto-syncs to current frame */}
89
- <img
90
- src={video('background')}
91
- style={tw('absolute inset-0 w-full h-full object-cover')}
92
- />
93
-
94
- {/* Animated title */}
95
- <h1
96
- style={{
97
- ...tw('text-6xl font-bold text-white'),
98
- opacity
99
- }}
100
- >
101
- {title}
102
- </h1>
103
- </div>
104
- );
105
- }
106
- ```
107
-
108
- ```json
109
- // props.json
110
- {
111
- "title": "Hello World",
112
- "background": "./my-video.mp4"
113
- }
114
- ```
115
-
116
- ```bash
117
- # Render
118
- loopwind render video-overlay props.json --out output.mp4
119
- ```
120
-
121
- This will:
122
- 1. Extract frames from `my-video.mp4` at 30fps
123
- 2. Render 90 frames (3s × 30fps) with animated title overlay
124
- 3. Encode to MP4
125
-
126
- **Super fast and simple!** 🚀
@@ -1,284 +0,0 @@
1
- # Project Structure
2
-
3
- ## Overview
4
-
5
- **loopwind** is a global CLI tool that operates on project-local templates and outputs.
6
-
7
- Think of it like:
8
- - **Global CLI**: Like `npm` or `git` - installed once, used everywhere
9
- - **Local templates**: Like `node_modules` - each project has its own
10
- - **Local outputs**: Generated assets stay with the project
11
-
12
- ## Directory Structure
13
-
14
- ### Your Project
15
-
16
- When you use `loopwind` in your project, this is the structure:
17
-
18
- ```
19
- my-project/
20
- ├── _loopwind/
21
- │ ├── templates/ # Installed templates (like node_modules)
22
- │ │ ├── banner-hero/
23
- │ │ │ └── template.tsx # Contains export const meta + component
24
- │ │ └── product-card/
25
- │ │ └── template.tsx
26
- │ └── outputs/ # Generated images/videos
27
- │ ├── banner-hero.png
28
- │ └── product-card.png
29
- ├── loopwind.json # Your project's design tokens (optional)
30
- └── package.json
31
- ```
32
-
33
- ### The CLI Package (this repo)
34
-
35
- ```
36
- loopwind/
37
- ├── src/
38
- │ ├── cli.ts # Main CLI entry point
39
- │ ├── commands/ # Command implementations
40
- │ │ ├── add.ts # Install templates
41
- │ │ ├── list.ts # List templates
42
- │ │ ├── render.ts # Render images
43
- │ │ ├── validate.ts # Validate templates
44
- │ │ └── init.ts # Initialize config
45
- │ ├── lib/
46
- │ │ ├── constants.ts # Paths and constants
47
- │ │ ├── utils.ts # Utility functions
48
- │ │ ├── installer.ts # Registry fetching
49
- │ │ ├── renderer.ts # Satori rendering
50
- │ │ └── config.ts # Config handling
51
- │ └── types/
52
- │ ├── template.ts # Template types
53
- │ └── config.ts # Config types
54
- ├── dist/ # Compiled output
55
- ├── package.json
56
- ├── tsconfig.json
57
- └── README.md
58
- ```
59
-
60
- ## How It Works
61
-
62
- ### 1. Global Installation
63
-
64
- ```bash
65
- npm install -g loopwind
66
- ```
67
-
68
- This installs the CLI globally, making the `loopwind` command available anywhere.
69
-
70
- ### 2. Project Usage
71
-
72
- ```bash
73
- cd ~/my-project
74
- loopwind add banner-hero
75
- ```
76
-
77
- This:
78
- 1. Fetches template from registry: `https://design.unpeel.dev/r/banner-hero`
79
- 2. Installs to: `~/my-project/loopwind/templates/banner-hero/`
80
- 3. Creates structure if it doesn't exist
81
-
82
- ### 3. Rendering
83
-
84
- ```bash
85
- loopwind render banner-hero --props '{"title":"Hello"}'
86
- ```
87
-
88
- This:
89
- 1. Loads template from `loopwind/templates/banner-hero/`
90
- 2. Loads config from `loopwind.json` (if exists)
91
- 3. Renders with Satori
92
- 4. Saves to `loopwind/outputs/banner-hero-{timestamp}.png`
93
-
94
- ## Why This Architecture?
95
-
96
- ### Global CLI
97
-
98
- **Benefits:**
99
- - Install once, use everywhere
100
- - Always up to date
101
- - Consistent tooling across projects
102
-
103
- **Like:**
104
- - `npm` - global tool, local packages
105
- - `git` - global tool, local repos
106
- - `tsc` - global TypeScript compiler
107
-
108
- ### Local Templates
109
-
110
- **Benefits:**
111
- - Version controlled with your project
112
- - Different projects can use different template versions
113
- - Team members get the same templates
114
- - No dependency on external registry at runtime
115
-
116
- **Like:**
117
- - `node_modules` - dependencies live with the project
118
- - `.next` - build artifacts live with the project
119
-
120
- ### Local Outputs
121
-
122
- **Benefits:**
123
- - Generated assets stay with the project
124
- - Easy to commit to git (if desired)
125
- - No confusion about where files are
126
- - Works well with build processes
127
-
128
- ## Template Registry
129
-
130
- Templates live online (like npm registry):
131
-
132
- ```
133
- https://design.unpeel.dev/r/banner-hero
134
- ```
135
-
136
- Returns:
137
-
138
- ```json
139
- {
140
- "name": "banner-hero",
141
- "version": "1.0.0",
142
- "description": "A hero banner",
143
- "files": [
144
- {
145
- "path": "banner-hero.tsx",
146
- "content": "..."
147
- },
148
- {
149
- "path": "meta.json",
150
- "content": "..."
151
- }
152
- ]
153
- }
154
- ```
155
-
156
- When you run `loopwind add banner-hero`, it:
157
- 1. Fetches this JSON
158
- 2. Writes files to `loopwind/templates/banner-hero/`
159
- 3. Templates are now local and ready to use
160
-
161
- ## Git Workflow
162
-
163
- ### What to commit?
164
-
165
- **DO commit:**
166
- - `loopwind/templates/` - Your templates (like `node_modules` in some projects)
167
- - `loopwind.json` - Your design configuration
168
-
169
- **DON'T commit:**
170
- - `loopwind/outputs/` - Generated files (usually)
171
-
172
- Example `.gitignore`:
173
-
174
- ```gitignore
175
- # Ignore generated outputs
176
- loopwind/outputs/
177
-
178
- # Keep templates (optional - depends on your workflow)
179
- # loopwind/templates/
180
- ```
181
-
182
- Some teams prefer to commit templates (reproducibility), others prefer to install them (like npm packages).
183
-
184
- ## Comparison to Other Tools
185
-
186
- ### Like Shadcn
187
-
188
- - Registry-based templates
189
- - Install to your project
190
- - You own the code
191
- - Customize freely
192
-
193
- ### Like npm
194
-
195
- - Global CLI tool
196
- - Project-local dependencies (templates)
197
- - Registry for discovery
198
- - Semantic versioning
199
-
200
- ### Like Tailwind
201
-
202
- - Config file for customization
203
- - Design tokens approach
204
- - Build-time generation
205
- - Framework agnostic
206
-
207
- ## Common Workflows
208
-
209
- ### Starting a New Project
210
-
211
- ```bash
212
- mkdir my-project
213
- cd my-project
214
-
215
- # Initialize config
216
- loopwind init
217
-
218
- # Install templates
219
- loopwind add banner-hero
220
- loopwind add product-card
221
-
222
- # Render images
223
- loopwind render banner-hero --props props.json
224
- ```
225
-
226
- ### Sharing with Team
227
-
228
- ```bash
229
- # Developer 1
230
- git add loopwind/templates/
231
- git commit -m "Add banner template"
232
- git push
233
-
234
- # Developer 2
235
- git pull
236
- loopwind list # See all templates
237
- loopwind render banner-hero --props '{"title":"Team Banner"}'
238
- ```
239
-
240
- ### CI/CD Pipeline
241
-
242
- ```yaml
243
- # .github/workflows/generate-images.yml
244
- - name: Install loopwind
245
- run: npm install -g loopwind
246
-
247
- - name: Generate images
248
- run: |
249
- loopwind render banner-hero --props props/hero.json
250
- loopwind render product-card --props props/product.json
251
-
252
- - name: Upload artifacts
253
- uses: actions/upload-artifact@v3
254
- with:
255
- path: loopwind/outputs/
256
- ```
257
-
258
- ## Future Enhancements
259
-
260
- ### Template Versions
261
-
262
- ```bash
263
- loopwind add banner-hero@2.0.0
264
- loopwind update banner-hero
265
- ```
266
-
267
- ### Template Marketplace
268
-
269
- ```bash
270
- loopwind search "hero"
271
- loopwind add @company/custom-banner
272
- ```
273
-
274
- ### Global vs Local
275
-
276
- ```bash
277
- # Install globally (like npm -g)
278
- loopwind add banner-hero --global
279
-
280
- # Install locally (default, like npm install)
281
- loopwind add banner-hero
282
- ```
283
-
284
- This is the **Shadcn for design and marketing** - same philosophy of owning your code, but for design assets!
package/PUBLISHING.md DELETED
@@ -1,171 +0,0 @@
1
- # Publishing Guide
2
-
3
- This guide explains how to publish `loopwind` to npm.
4
-
5
- ## Prerequisites
6
-
7
- 1. npm account (create at https://www.npmjs.com/signup)
8
- 2. npm CLI logged in: `npm login`
9
- 3. Package name availability check: `npm search loopwind`
10
-
11
- ## Pre-publish Checklist
12
-
13
- - [ ] Update version in package.json
14
- - [ ] Run tests (if any): `npm test`
15
- - [ ] Build the project: `npm run build`
16
- - [ ] Check dist/ folder exists and contains compiled files
17
- - [ ] Review .npmignore to ensure only necessary files are published
18
- - [ ] Update CHANGELOG.md (if exists)
19
- - [ ] Commit all changes: `git add . && git commit -m "Release v0.1.0"`
20
- - [ ] Tag release: `git tag v0.1.0`
21
-
22
- ## Publishing Steps
23
-
24
- ### 1. Dry Run
25
-
26
- First, test what will be published:
27
-
28
- ```bash
29
- npm pack --dry-run
30
- ```
31
-
32
- This shows you exactly what files will be included in the package.
33
-
34
- ### 2. Test Locally
35
-
36
- You can test the package locally before publishing:
37
-
38
- ```bash
39
- npm pack
40
- npm install -g ./loopwind-0.1.0.tgz
41
- loopwind --help
42
- ```
43
-
44
- ### 3. Publish to npm
45
-
46
- ```bash
47
- npm publish
48
- ```
49
-
50
- Or if the package name is scoped:
51
-
52
- ```bash
53
- npm publish --access public
54
- ```
55
-
56
- ### 4. Verify
57
-
58
- Check that it's published:
59
-
60
- ```bash
61
- npm view loopwind
62
- ```
63
-
64
- Test installation:
65
-
66
- ```bash
67
- npx loopwind@latest --help
68
- ```
69
-
70
- ## Post-publish
71
-
72
- - [ ] Push git tags: `git push --tags`
73
- - [ ] Create GitHub release with changelog
74
- - [ ] Update documentation
75
- - [ ] Announce on social media / communities
76
-
77
- ## Versioning
78
-
79
- Follow semantic versioning (semver):
80
-
81
- - **Patch** (0.1.1): Bug fixes
82
- - **Minor** (0.2.0): New features, backwards compatible
83
- - **Major** (1.0.0): Breaking changes
84
-
85
- Update version:
86
-
87
- ```bash
88
- npm version patch # 0.1.0 -> 0.1.1
89
- npm version minor # 0.1.0 -> 0.2.0
90
- npm version major # 0.1.0 -> 1.0.0
91
- ```
92
-
93
- ## Package Name Alternatives
94
-
95
- If `loopwind` is taken, consider:
96
-
97
- - `@yourusername/loopwind` (scoped package)
98
- - `design-cli`
99
- - `designkit-cli`
100
- - `loopwind-cli`
101
- - `template-loopwind`
102
-
103
- Check availability:
104
-
105
- ```bash
106
- npm search <package-name>
107
- ```
108
-
109
- ## Unpublishing
110
-
111
- If you need to unpublish (within 72 hours):
112
-
113
- ```bash
114
- npm unpublish loopwind@0.1.0
115
- ```
116
-
117
- Note: Unpublishing is discouraged. Use `npm deprecate` instead for older versions:
118
-
119
- ```bash
120
- npm deprecate loopwind@0.1.0 "Please upgrade to 0.2.0"
121
- ```
122
-
123
- ## CI/CD Publishing (GitHub Actions)
124
-
125
- Create `.github/workflows/publish.yml`:
126
-
127
- ```yaml
128
- name: Publish to npm
129
-
130
- on:
131
- release:
132
- types: [created]
133
-
134
- jobs:
135
- publish:
136
- runs-on: ubuntu-latest
137
- steps:
138
- - uses: actions/checkout@v3
139
- - uses: actions/setup-node@v3
140
- with:
141
- node-version: '18'
142
- registry-url: 'https://registry.npmjs.org'
143
- - run: npm ci
144
- - run: npm run build
145
- - run: npm publish
146
- env:
147
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
148
- ```
149
-
150
- Store your npm token in GitHub repository secrets as `NPM_TOKEN`.
151
-
152
- ## Beta Releases
153
-
154
- Publish beta versions:
155
-
156
- ```bash
157
- npm version prerelease --preid=beta # 0.1.0 -> 0.1.1-beta.0
158
- npm publish --tag beta
159
- ```
160
-
161
- Install beta:
162
-
163
- ```bash
164
- npm install loopwind@beta
165
- ```
166
-
167
- ## Resources
168
-
169
- - [npm Publishing Guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)
170
- - [Semantic Versioning](https://semver.org/)
171
- - [npm CLI Documentation](https://docs.npmjs.com/cli)