@promptui-lib/codegen 0.1.0 → 0.1.3
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 +502 -0
- package/dist/frameworks/bootstrap.template.d.ts +2 -2
- package/dist/frameworks/bootstrap.template.d.ts.map +1 -1
- package/dist/frameworks/bootstrap.template.js +30 -5
- package/dist/frameworks/flutter.template.d.ts +10 -0
- package/dist/frameworks/flutter.template.d.ts.map +1 -0
- package/dist/frameworks/flutter.template.js +217 -0
- package/dist/frameworks/index.d.ts +4 -2
- package/dist/frameworks/index.d.ts.map +1 -1
- package/dist/frameworks/index.js +19 -1
- package/dist/frameworks/mui.template.d.ts +2 -2
- package/dist/frameworks/mui.template.d.ts.map +1 -1
- package/dist/frameworks/mui.template.js +36 -7
- package/dist/frameworks/swiftui.template.d.ts +10 -0
- package/dist/frameworks/swiftui.template.d.ts.map +1 -0
- package/dist/frameworks/swiftui.template.js +247 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mappings/component-mappings.d.ts +61 -0
- package/dist/mappings/component-mappings.d.ts.map +1 -0
- package/dist/mappings/component-mappings.js +1093 -0
- package/dist/mappings/index.d.ts +6 -0
- package/dist/mappings/index.d.ts.map +1 -0
- package/dist/mappings/index.js +5 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/desireemenezes/promptUI/main/logo.png" alt="PromptUI Logo" width="200" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">PromptUI</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@promptui-lib/cli"><img src="https://img.shields.io/npm/v/@promptui-lib/cli.svg" alt="npm version" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@promptui-lib/cli"><img src="https://img.shields.io/npm/dm/@promptui-lib/cli.svg" alt="npm downloads" /></a>
|
|
10
|
+
<img src="https://img.shields.io/badge/license-proprietary-red.svg" alt="license" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<strong>Transform Figma designs into production-ready code in seconds.</strong>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
100% deterministic. No AI. Same input = same output, always.
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What is it?
|
|
24
|
+
|
|
25
|
+
**PromptUI** is a library that automatically converts your Figma designs into clean, production-ready code.
|
|
26
|
+
|
|
27
|
+
Supports multiple frameworks:
|
|
28
|
+
- **React + SCSS** (BEM methodology)
|
|
29
|
+
- **Material UI** (MUI)
|
|
30
|
+
- **Tailwind CSS**
|
|
31
|
+
- **Bootstrap**
|
|
32
|
+
- **Flutter** (Dart StatelessWidgets)
|
|
33
|
+
- **SwiftUI** (iOS/macOS Views)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g @promptui-lib/cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## How It Works
|
|
46
|
+
|
|
47
|
+
### 1. Mark your components in Figma
|
|
48
|
+
|
|
49
|
+
In Figma, add `#` at the beginning of frame names you want to export:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
#Button → Will be exported as component
|
|
53
|
+
#CardProduct → Will be exported as component
|
|
54
|
+
#HeaderNav → Will be exported as component
|
|
55
|
+
Button → Ignored (no #)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Configure the project
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx @promptui-lib/cli init
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Set your credentials:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
export FIGMA_TOKEN=your_token_here
|
|
68
|
+
export FIGMA_FILE_ID=file_id_here
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Generate components
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# React + SCSS
|
|
75
|
+
npx @promptui-lib/cli generate
|
|
76
|
+
|
|
77
|
+
# Bootstrap
|
|
78
|
+
npx @promptui-lib/cli generate bootstrap
|
|
79
|
+
|
|
80
|
+
# Material UI
|
|
81
|
+
npx @promptui-lib/cli generate mui
|
|
82
|
+
|
|
83
|
+
# Tailwind CSS
|
|
84
|
+
npx @promptui-lib/cli generate tailwind
|
|
85
|
+
|
|
86
|
+
# Flutter
|
|
87
|
+
npx @promptui-lib/cli generate flutter
|
|
88
|
+
|
|
89
|
+
# SwiftUI
|
|
90
|
+
npx @promptui-lib/cli generate swiftui
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Examples
|
|
96
|
+
|
|
97
|
+
### Example 1: Button with React + SCSS
|
|
98
|
+
|
|
99
|
+
**In Figma:** Frame named `#Button`
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
#Button (Frame)
|
|
103
|
+
├── Padding: 12px 24px
|
|
104
|
+
├── Background: #3B82F6
|
|
105
|
+
├── Border Radius: 8px
|
|
106
|
+
└── label (Text: "Click me")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Command:**
|
|
110
|
+
```bash
|
|
111
|
+
npx @promptui-lib/cli generate
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Result:**
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
// src/components/atoms/Button/button.tsx
|
|
118
|
+
import type { ReactNode } from 'react';
|
|
119
|
+
import './button.scss';
|
|
120
|
+
|
|
121
|
+
export interface IButtonProps {
|
|
122
|
+
children?: ReactNode;
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const Button = ({ children, className = '' }: IButtonProps) => {
|
|
127
|
+
return (
|
|
128
|
+
<button className={`button ${className}`.trim()}>
|
|
129
|
+
<span className="button__label">{children}</span>
|
|
130
|
+
</button>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```scss
|
|
136
|
+
// src/components/atoms/Button/button.scss
|
|
137
|
+
.button {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
padding: $spacing-sm $spacing-lg;
|
|
142
|
+
background-color: $color-primary;
|
|
143
|
+
border-radius: $radius-medium;
|
|
144
|
+
|
|
145
|
+
&__label {
|
|
146
|
+
color: $color-text-inverse;
|
|
147
|
+
font-weight: $font-weight-medium;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Example 2: Card with Bootstrap
|
|
155
|
+
|
|
156
|
+
**In Figma:** Frame named `#CardProduct`
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
#CardProduct (Frame)
|
|
160
|
+
├── image (Rectangle)
|
|
161
|
+
├── content (Frame)
|
|
162
|
+
│ ├── title (Text: "Product Name")
|
|
163
|
+
│ ├── description (Text: "Lorem ipsum...")
|
|
164
|
+
│ └── price (Text: "$99.00")
|
|
165
|
+
└── button (Instance of #Button)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Command:**
|
|
169
|
+
```bash
|
|
170
|
+
npx @promptui-lib/cli generate bootstrap
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Result:**
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
// src/components/molecules/CardProduct/card-product.tsx
|
|
177
|
+
import type { ReactNode } from 'react';
|
|
178
|
+
|
|
179
|
+
export interface ICardProductProps {
|
|
180
|
+
children?: ReactNode;
|
|
181
|
+
className?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export const CardProduct = ({ children, className = '' }: ICardProductProps) => {
|
|
185
|
+
return (
|
|
186
|
+
<div className={`card ${className}`.trim()}>
|
|
187
|
+
<img className="card-img-top" alt="Product" />
|
|
188
|
+
<div className="card-body">
|
|
189
|
+
<h5 className="card-title fw-bold">Product Name</h5>
|
|
190
|
+
<p className="card-text text-muted">Lorem ipsum...</p>
|
|
191
|
+
<p className="h4 text-primary fw-bold">$99.00</p>
|
|
192
|
+
<button className="btn btn-primary w-100">Buy Now</button>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
### Example 3: Header with Tailwind CSS
|
|
202
|
+
|
|
203
|
+
**In Figma:** Frame named `#HeaderNav`
|
|
204
|
+
|
|
205
|
+
**Command:**
|
|
206
|
+
```bash
|
|
207
|
+
npx @promptui-lib/cli generate tailwind
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Result:**
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
// src/components/organisms/HeaderNav/header-nav.tsx
|
|
214
|
+
export const HeaderNav = ({ className = '' }: IHeaderNavProps) => {
|
|
215
|
+
return (
|
|
216
|
+
<header className={`flex items-center justify-between px-6 py-4 bg-white shadow-sm ${className}`.trim()}>
|
|
217
|
+
<div className="flex items-center gap-2">
|
|
218
|
+
<img src="/logo.svg" className="h-8 w-8" alt="Logo" />
|
|
219
|
+
<span className="text-xl font-bold text-gray-900">Brand</span>
|
|
220
|
+
</div>
|
|
221
|
+
<nav className="flex items-center gap-8">
|
|
222
|
+
<a className="text-gray-600 hover:text-gray-900">Home</a>
|
|
223
|
+
<a className="text-gray-600 hover:text-gray-900">Products</a>
|
|
224
|
+
<a className="text-gray-600 hover:text-gray-900">About</a>
|
|
225
|
+
</nav>
|
|
226
|
+
<button className="px-4 py-2 bg-blue-500 text-white rounded-lg">
|
|
227
|
+
Sign In
|
|
228
|
+
</button>
|
|
229
|
+
</header>
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Example 4: Button with Flutter
|
|
237
|
+
|
|
238
|
+
**In Figma:** Frame named `#Button`
|
|
239
|
+
|
|
240
|
+
**Command:**
|
|
241
|
+
```bash
|
|
242
|
+
npx @promptui-lib/cli generate flutter
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Result:**
|
|
246
|
+
|
|
247
|
+
```dart
|
|
248
|
+
/// Button
|
|
249
|
+
/// Generated by PromptUI (Flutter)
|
|
250
|
+
|
|
251
|
+
import 'package:flutter/material.dart';
|
|
252
|
+
|
|
253
|
+
class Button extends StatelessWidget {
|
|
254
|
+
const Button({super.key});
|
|
255
|
+
|
|
256
|
+
@override
|
|
257
|
+
Widget build(BuildContext context) {
|
|
258
|
+
return Container(
|
|
259
|
+
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 24),
|
|
260
|
+
decoration: BoxDecoration(
|
|
261
|
+
color: Theme.of(context).primaryColor,
|
|
262
|
+
borderRadius: BorderRadius.circular(8),
|
|
263
|
+
),
|
|
264
|
+
child: Text('Click me'),
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
### Example 5: Button with SwiftUI
|
|
273
|
+
|
|
274
|
+
**In Figma:** Frame named `#Button`
|
|
275
|
+
|
|
276
|
+
**Command:**
|
|
277
|
+
```bash
|
|
278
|
+
npx @promptui-lib/cli generate swiftui
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Result:**
|
|
282
|
+
|
|
283
|
+
```swift
|
|
284
|
+
/// Button
|
|
285
|
+
/// Generated by PromptUI (SwiftUI)
|
|
286
|
+
|
|
287
|
+
import SwiftUI
|
|
288
|
+
|
|
289
|
+
struct Button: View {
|
|
290
|
+
var body: some View {
|
|
291
|
+
Text("Click me")
|
|
292
|
+
.padding(.horizontal, 24)
|
|
293
|
+
.padding(.vertical, 8)
|
|
294
|
+
.background(.blue)
|
|
295
|
+
.foregroundColor(.white)
|
|
296
|
+
.cornerRadius(8)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
#Preview {
|
|
301
|
+
Button()
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Commands
|
|
308
|
+
|
|
309
|
+
| Command | Description |
|
|
310
|
+
|---------|-------------|
|
|
311
|
+
| `npx @promptui-lib/cli init` | Configure the project |
|
|
312
|
+
| `npx @promptui-lib/cli generate` | Generate components (React + SCSS) |
|
|
313
|
+
| `npx @promptui-lib/cli generate bootstrap` | Generate with Bootstrap |
|
|
314
|
+
| `npx @promptui-lib/cli generate mui` | Generate with Material UI |
|
|
315
|
+
| `npx @promptui-lib/cli generate tailwind` | Generate with Tailwind CSS |
|
|
316
|
+
| `npx @promptui-lib/cli generate flutter` | Generate with Flutter/Dart |
|
|
317
|
+
| `npx @promptui-lib/cli generate swiftui` | Generate with SwiftUI |
|
|
318
|
+
| `npx @promptui-lib/cli sync tokens` | Sync design tokens |
|
|
319
|
+
|
|
320
|
+
## Options
|
|
321
|
+
|
|
322
|
+
| Option | Description |
|
|
323
|
+
|--------|-------------|
|
|
324
|
+
| `-p, --preview` | Preview without saving |
|
|
325
|
+
| `-o, --output <dir>` | Output directory |
|
|
326
|
+
| `-f, --force` | Overwrite existing files |
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Atomic Design
|
|
331
|
+
|
|
332
|
+
Components are automatically organized:
|
|
333
|
+
|
|
334
|
+
| Layer | Description | Examples |
|
|
335
|
+
|-------|-------------|----------|
|
|
336
|
+
| **atoms** | Simple components | Button, Input, Label, Icon |
|
|
337
|
+
| **molecules** | Medium compositions | Card, SearchBar, FormField |
|
|
338
|
+
| **organisms** | Complex compositions | Header, Footer, Sidebar |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Configuration
|
|
343
|
+
|
|
344
|
+
Create `promptui.config.json`:
|
|
345
|
+
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"figma": {
|
|
349
|
+
"fileId": "your-file-id"
|
|
350
|
+
},
|
|
351
|
+
"output": {
|
|
352
|
+
"basePath": "src/components"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Figma Support
|
|
360
|
+
|
|
361
|
+
### What We Extract from Figma
|
|
362
|
+
|
|
363
|
+
| Element | Supported | Notes |
|
|
364
|
+
|---------|-----------|-------|
|
|
365
|
+
| **Colors** | ✅ Yes | RGB, Hex, tokens |
|
|
366
|
+
| **Spacing** | ✅ Yes | Padding, margin, gap |
|
|
367
|
+
| **Typography** | ✅ Yes | Font size, weight, family |
|
|
368
|
+
| **Border Radius** | ✅ Yes | All corners |
|
|
369
|
+
| **Shadows** | ✅ Yes | Drop shadow, inner shadow |
|
|
370
|
+
| **Layout** | ✅ Yes | Auto Layout → Flexbox |
|
|
371
|
+
| **SVG/Icons** | ✅ Yes | Exported as inline SVG |
|
|
372
|
+
| **Images** | ⚠️ Partial | Placeholder generated |
|
|
373
|
+
| **Gradients** | ⚠️ Partial | Linear gradients |
|
|
374
|
+
| **Animations** | ❌ No | Not available via Figma API |
|
|
375
|
+
| **Prototype Links** | ❌ No | Prototype data only |
|
|
376
|
+
|
|
377
|
+
### Bootstrap Components Mapping
|
|
378
|
+
|
|
379
|
+
Name your Figma frames to auto-map to Bootstrap components:
|
|
380
|
+
|
|
381
|
+
| Figma Frame Name | Bootstrap Output |
|
|
382
|
+
|------------------|------------------|
|
|
383
|
+
| `#Alert` | `<div class="alert">` |
|
|
384
|
+
| `#Badge` | `<span class="badge">` |
|
|
385
|
+
| `#Breadcrumb` | `<nav class="breadcrumb">` |
|
|
386
|
+
| `#Button` | `<button class="btn">` |
|
|
387
|
+
| `#ButtonGroup` | `<div class="btn-group">` |
|
|
388
|
+
| `#Card` | `<div class="card">` |
|
|
389
|
+
| `#Carousel` | `<div class="carousel">` |
|
|
390
|
+
| `#Collapse` | `<div class="collapse">` |
|
|
391
|
+
| `#Dropdown` | `<div class="dropdown">` |
|
|
392
|
+
| `#ListGroup` | `<ul class="list-group">` |
|
|
393
|
+
| `#Modal` | `<div class="modal">` |
|
|
394
|
+
| `#Navbar` | `<nav class="navbar">` |
|
|
395
|
+
| `#Nav` or `#Tabs` | `<ul class="nav">` |
|
|
396
|
+
| `#Offcanvas` | `<div class="offcanvas">` |
|
|
397
|
+
| `#Pagination` | `<nav class="pagination">` |
|
|
398
|
+
| `#Progress` | `<div class="progress">` |
|
|
399
|
+
| `#Spinner` | `<div class="spinner">` |
|
|
400
|
+
| `#Toast` | `<div class="toast">` |
|
|
401
|
+
| `#Tooltip` | `data-bs-toggle="tooltip"` |
|
|
402
|
+
|
|
403
|
+
### Material UI Components Mapping
|
|
404
|
+
|
|
405
|
+
| Figma Frame Name | MUI Output |
|
|
406
|
+
|------------------|------------|
|
|
407
|
+
| `#Alert` | `<Alert>` |
|
|
408
|
+
| `#Avatar` | `<Avatar>` |
|
|
409
|
+
| `#Badge` | `<Badge>` |
|
|
410
|
+
| `#Breadcrumb` | `<Breadcrumbs>` |
|
|
411
|
+
| `#Button` | `<Button>` |
|
|
412
|
+
| `#Card` | `<Card>` |
|
|
413
|
+
| `#Checkbox` | `<Checkbox>` |
|
|
414
|
+
| `#Chip` | `<Chip>` |
|
|
415
|
+
| `#Dialog` or `#Modal` | `<Dialog>` |
|
|
416
|
+
| `#Drawer` | `<Drawer>` |
|
|
417
|
+
| `#Input` or `#TextField` | `<TextField>` |
|
|
418
|
+
| `#List` | `<List>` |
|
|
419
|
+
| `#Menu` | `<Menu>` |
|
|
420
|
+
| `#Pagination` | `<Pagination>` |
|
|
421
|
+
| `#Progress` | `<LinearProgress>` |
|
|
422
|
+
| `#Radio` | `<Radio>` |
|
|
423
|
+
| `#Select` | `<Select>` |
|
|
424
|
+
| `#Slider` | `<Slider>` |
|
|
425
|
+
| `#Snackbar` | `<Snackbar>` |
|
|
426
|
+
| `#Switch` | `<Switch>` |
|
|
427
|
+
| `#Table` | `<Table>` |
|
|
428
|
+
| `#Tabs` | `<Tabs>` |
|
|
429
|
+
| `#Tooltip` | `<Tooltip>` |
|
|
430
|
+
|
|
431
|
+
### Form Components
|
|
432
|
+
|
|
433
|
+
| Figma Frame Name | React + SCSS | Bootstrap | MUI |
|
|
434
|
+
|------------------|--------------|-----------|-----|
|
|
435
|
+
| `#Input` | `<input>` | `<input class="form-control">` | `<TextField>` |
|
|
436
|
+
| `#Select` | `<select>` | `<select class="form-select">` | `<Select>` |
|
|
437
|
+
| `#Checkbox` | `<input type="checkbox">` | `<input class="form-check-input">` | `<Checkbox>` |
|
|
438
|
+
| `#Radio` | `<input type="radio">` | `<input class="form-check-input">` | `<Radio>` |
|
|
439
|
+
| `#Switch` | `<input type="checkbox">` | `<div class="form-switch">` | `<Switch>` |
|
|
440
|
+
| `#Textarea` | `<textarea>` | `<textarea class="form-control">` | `<TextField multiline>` |
|
|
441
|
+
| `#FormGroup` | `<div class="form-group">` | `<div class="mb-3">` | `<FormControl>` |
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## For Designers
|
|
446
|
+
|
|
447
|
+
### Figma Rules
|
|
448
|
+
|
|
449
|
+
1. **`#` prefix** - Add to frame name to export
|
|
450
|
+
2. **Auto Layout** - Always use to maintain structure
|
|
451
|
+
3. **Descriptive names** - `title`, `content`, not "Frame 1"
|
|
452
|
+
4. **PascalCase** - `#ButtonPrimary`, not `#button-primary`
|
|
453
|
+
|
|
454
|
+
### Correct structure example
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
#CardProduct (Frame, Auto Layout Vertical)
|
|
458
|
+
├── image (Rectangle, Aspect Ratio 16:9)
|
|
459
|
+
├── content (Frame, Auto Layout Vertical, Padding 16px)
|
|
460
|
+
│ ├── title (Text, Heading/H3)
|
|
461
|
+
│ ├── description (Text, Body/Small)
|
|
462
|
+
│ └── price (Text, Heading/H2)
|
|
463
|
+
└── actions (Frame, Auto Layout Horizontal)
|
|
464
|
+
└── button (Instance of #Button)
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Environment Variables
|
|
470
|
+
|
|
471
|
+
| Variable | Description |
|
|
472
|
+
|----------|-------------|
|
|
473
|
+
| `FIGMA_TOKEN` | Figma access token |
|
|
474
|
+
| `FIGMA_FILE_ID` | Figma file ID |
|
|
475
|
+
|
|
476
|
+
### How to get Figma Token
|
|
477
|
+
|
|
478
|
+
1. Go to [Figma Account Settings](https://www.figma.com/settings)
|
|
479
|
+
2. Navigate to "Personal Access Tokens"
|
|
480
|
+
3. Create a new token
|
|
481
|
+
|
|
482
|
+
### How to get File ID
|
|
483
|
+
|
|
484
|
+
The File ID is in your Figma file URL:
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
https://www.figma.com/file/ABC123xyz/MyProject
|
|
488
|
+
^^^^^^^^^^^
|
|
489
|
+
This is the File ID
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
## Author
|
|
495
|
+
|
|
496
|
+
**Desiree Menezes** - [@desireemenezes](https://github.com/desireemenezes)
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## License
|
|
501
|
+
|
|
502
|
+
Proprietary - All rights reserved.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bootstrap Template
|
|
3
|
-
*
|
|
3
|
+
* Generates React components with Bootstrap classes
|
|
4
4
|
*/
|
|
5
5
|
import type { IComponentAST } from '@promptui-lib/core';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Generates React component with Bootstrap classes
|
|
8
8
|
*/
|
|
9
9
|
export declare function generateBootstrapComponent(ast: IComponentAST): string;
|
|
10
10
|
//# sourceMappingURL=bootstrap.template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.template.d.ts","sourceRoot":"","sources":["../../src/frameworks/bootstrap.template.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.template.d.ts","sourceRoot":"","sources":["../../src/frameworks/bootstrap.template.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AA2RlF;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAkDrE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bootstrap Template
|
|
3
|
-
*
|
|
3
|
+
* Generates React components with Bootstrap classes
|
|
4
4
|
*/
|
|
5
|
+
import { getComponentMapping, extractComponentType } from '../mappings/index.js';
|
|
5
6
|
/**
|
|
6
7
|
* Mapeamento de tokens SCSS → Bootstrap classes
|
|
7
8
|
*/
|
|
@@ -255,21 +256,45 @@ function generateBootstrapJSX(node, styles, indent = 2) {
|
|
|
255
256
|
].join('\n');
|
|
256
257
|
}
|
|
257
258
|
/**
|
|
258
|
-
*
|
|
259
|
+
* Gets Bootstrap-specific tag and classes based on component type
|
|
260
|
+
*/
|
|
261
|
+
function getBootstrapMapping(componentName) {
|
|
262
|
+
const componentType = extractComponentType(componentName);
|
|
263
|
+
if (!componentType)
|
|
264
|
+
return null;
|
|
265
|
+
const mapping = getComponentMapping(componentType);
|
|
266
|
+
if (!mapping)
|
|
267
|
+
return null;
|
|
268
|
+
return mapping.bootstrap;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Generates React component with Bootstrap classes
|
|
259
272
|
*/
|
|
260
273
|
export function generateBootstrapComponent(ast) {
|
|
261
|
-
//
|
|
274
|
+
// Create styles map by selector
|
|
262
275
|
const stylesMap = new Map();
|
|
263
276
|
for (const block of ast.styles) {
|
|
264
277
|
stylesMap.set(block.selector, block.properties);
|
|
265
278
|
}
|
|
279
|
+
// Check for component mapping
|
|
280
|
+
const mapping = getBootstrapMapping(ast.name);
|
|
266
281
|
// Props interface
|
|
267
282
|
const propsInterface = `export interface I${ast.name}Props {
|
|
268
283
|
children?: ReactNode;
|
|
269
284
|
className?: string;
|
|
270
285
|
}`;
|
|
271
|
-
// JSX
|
|
272
|
-
|
|
286
|
+
// JSX - use mapping if available
|
|
287
|
+
let jsx;
|
|
288
|
+
if (mapping) {
|
|
289
|
+
const baseClasses = mapping.classes.join(' ');
|
|
290
|
+
const extraAttrs = mapping.wrapper ? ` ${mapping.wrapper}` : '';
|
|
291
|
+
jsx = ` <${mapping.tag} className={\`${baseClasses} \${className}\`.trim()}${extraAttrs}>
|
|
292
|
+
{children}
|
|
293
|
+
</${mapping.tag}>`;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
jsx = generateBootstrapJSX(ast.jsx, stylesMap);
|
|
297
|
+
}
|
|
273
298
|
// Component
|
|
274
299
|
const component = `export const ${ast.name} = ({
|
|
275
300
|
children,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flutter Template
|
|
3
|
+
* Generates Flutter/Dart widgets from Figma designs
|
|
4
|
+
*/
|
|
5
|
+
import type { IComponentAST } from '@promptui-lib/core';
|
|
6
|
+
/**
|
|
7
|
+
* Generates Flutter StatelessWidget
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateFlutterComponent(ast: IComponentAST): string;
|
|
10
|
+
//# sourceMappingURL=flutter.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flutter.template.d.ts","sourceRoot":"","sources":["../../src/frameworks/flutter.template.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AA0NlF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAwBnE"}
|