@framed-dev/react 0.2.0 → 0.3.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/README.md +62 -233
- package/dist/index.cjs +17247 -73617
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +17269 -73202
- package/dist/index.js.map +1 -0
- package/package.json +17 -65
- package/dist/index.d.cts +0 -761
- package/dist/index.d.ts +0 -761
- package/dist/styles/framed.css +0 -6474
- package/styles.css +0 -525
- package/tailwind.config.js +0 -207
- package/tailwind.preset.js +0 -86
package/README.md
CHANGED
|
@@ -1,83 +1,36 @@
|
|
|
1
|
-
# @framed
|
|
1
|
+
# @framed/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Collect visual feedback and export AI-ready prompts.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@framed/react)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
|
|
9
|
-
## What
|
|
9
|
+
## What it does
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **AI Export** - Copy structured prompts for Bolt, Lovable, Cursor, or any AI coding assistant
|
|
11
|
+
- **Visual selection** — Click any element on your site to attach feedback
|
|
12
|
+
- **Screenshot capture** — Capture and annotate screenshots
|
|
13
|
+
- **Task organization** — Organize and prioritize feedback as tasks
|
|
14
|
+
- **AI export** — Copy structured prompts for Bolt, Lovable, or Cursor
|
|
16
15
|
|
|
17
16
|
## Quick Start
|
|
18
17
|
|
|
19
|
-
### 1. Initialize (sets up database)
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx @framed-dev/cli init
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
This will:
|
|
26
|
-
- Detect your project type (Next.js, Vite, etc.)
|
|
27
|
-
- Collect your Supabase credentials
|
|
28
|
-
- Scaffold basic route files
|
|
29
|
-
|
|
30
|
-
Then run migrations:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npx @framed-dev/cli migrate
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This creates all required database tables, RLS policies, and storage buckets in your Supabase project.
|
|
37
|
-
|
|
38
|
-
### 2. Install SDK
|
|
39
|
-
|
|
40
18
|
```bash
|
|
41
|
-
npm install @framed
|
|
42
|
-
# or
|
|
43
|
-
pnpm add @framed-dev/react
|
|
19
|
+
npm install @framed/react
|
|
44
20
|
```
|
|
45
21
|
|
|
46
|
-
### 3. Configure Tailwind
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
// tailwind.config.js
|
|
50
|
-
const framedPreset = require('@framed-dev/react/tailwind');
|
|
51
|
-
|
|
52
|
-
/** @type {import('tailwindcss').Config} */
|
|
53
|
-
module.exports = {
|
|
54
|
-
presets: [framedPreset],
|
|
55
|
-
content: [
|
|
56
|
-
'./app/**/*.{js,ts,jsx,tsx}',
|
|
57
|
-
'./node_modules/@framed-dev/react/dist/**/*.{js,mjs}',
|
|
58
|
-
],
|
|
59
|
-
};
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### 4. Add Provider & Widget
|
|
63
|
-
|
|
64
22
|
```tsx
|
|
65
|
-
// app/layout.tsx
|
|
66
|
-
import { FramedProvider, FeedbackWidget } from '@framed
|
|
23
|
+
// app/layout.tsx
|
|
24
|
+
import { FramedProvider, FeedbackWidget } from '@framed/react';
|
|
67
25
|
|
|
68
|
-
export default function
|
|
26
|
+
export default function Layout({ children }: { children: React.ReactNode }) {
|
|
69
27
|
return (
|
|
70
28
|
<html lang="en">
|
|
71
29
|
<body>
|
|
72
30
|
<FramedProvider
|
|
73
31
|
config={{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
auth: { mode: 'dev' }, // Change to 'magic_link' for production
|
|
77
|
-
sync: {
|
|
78
|
-
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
79
|
-
apiKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
80
|
-
},
|
|
32
|
+
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
33
|
+
supabaseKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
81
34
|
}}
|
|
82
35
|
>
|
|
83
36
|
{children}
|
|
@@ -89,202 +42,78 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
89
42
|
}
|
|
90
43
|
```
|
|
91
44
|
|
|
92
|
-
### 5. Add Framed Routes (Recommended)
|
|
93
|
-
|
|
94
|
-
Use `FramedApp` with a catch-all route for the complete wizard experience:
|
|
95
|
-
|
|
96
|
-
```tsx
|
|
97
|
-
// app/framed/[[...slug]]/page.tsx
|
|
98
|
-
"use client";
|
|
99
|
-
|
|
100
|
-
import { FramedApp } from '@framed-dev/react';
|
|
101
|
-
import '@framed-dev/react/widget-styles.css';
|
|
102
|
-
|
|
103
|
-
export default function FramedPage() {
|
|
104
|
-
return <FramedApp basename="/framed" />;
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
This provides all routes automatically:
|
|
109
|
-
- `/framed` - Dashboard
|
|
110
|
-
- `/framed/wizard/:id/phase1` - Discovery (Phase 1)
|
|
111
|
-
- `/framed/wizard/:id/phase2` - Detailing (Phase 2)
|
|
112
|
-
- `/framed/wizard/:id/phase3` - Overview (Phase 3)
|
|
113
|
-
- `/framed/wizard/:id/phase4` - Review & Feedback (Phase 4)
|
|
114
|
-
- `/framed/wizard/:id/phase5` - Manage & Maintain (Phase 5)
|
|
115
|
-
- `/framed/wizard/:id/build-spec` - AI Export
|
|
116
|
-
|
|
117
45
|
## Environment Variables
|
|
118
46
|
|
|
119
47
|
```env
|
|
120
|
-
# Required
|
|
121
48
|
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
|
|
122
|
-
NEXT_PUBLIC_SUPABASE_ANON_KEY=
|
|
123
|
-
|
|
124
|
-
# Only needed for migrations (not in client code)
|
|
125
|
-
SUPABASE_SERVICE_ROLE_KEY=eyJ...
|
|
126
|
-
|
|
127
|
-
# Optional: Premium features via Framed.dev API
|
|
128
|
-
NEXT_PUBLIC_FRAMED_LICENSE_KEY=framed_lic_xxx
|
|
49
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbG...
|
|
129
50
|
```
|
|
130
51
|
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
52
|
+
## Database Setup
|
|
53
|
+
|
|
54
|
+
Run this in your Supabase SQL editor:
|
|
55
|
+
|
|
56
|
+
```sql
|
|
57
|
+
create table framed_tasks (
|
|
58
|
+
id uuid primary key default gen_random_uuid(),
|
|
59
|
+
project_id text,
|
|
60
|
+
type text not null,
|
|
61
|
+
status text not null default 'open',
|
|
62
|
+
element jsonb,
|
|
63
|
+
page jsonb not null,
|
|
64
|
+
feedback jsonb not null,
|
|
65
|
+
task jsonb not null,
|
|
66
|
+
attachments jsonb,
|
|
67
|
+
meta jsonb not null,
|
|
68
|
+
created_at timestamptz default now(),
|
|
69
|
+
updated_at timestamptz default now()
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
alter table framed_tasks enable row level security;
|
|
73
|
+
|
|
74
|
+
create policy "Allow all for authenticated users" on framed_tasks
|
|
75
|
+
for all using (auth.role() = 'authenticated');
|
|
154
76
|
```
|
|
155
77
|
|
|
156
|
-
##
|
|
78
|
+
## Configuration
|
|
157
79
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
framedRoutes.dashboard // '/framed'
|
|
165
|
-
framedRoutes.login // '/framed/login'
|
|
166
|
-
framedRoutes.project('123') // '/framed/project/123'
|
|
167
|
-
framedRoutes.review('123') // '/framed/project/123/review'
|
|
168
|
-
framedRoutes.build('123') // '/framed/project/123/build'
|
|
169
|
-
framedRoutes.manage('123') // '/framed/project/123/manage'
|
|
170
|
-
```
|
|
80
|
+
| Prop | Type | Required | Description |
|
|
81
|
+
|------|------|----------|-------------|
|
|
82
|
+
| `supabaseUrl` | `string` | Yes | Your Supabase project URL |
|
|
83
|
+
| `supabaseKey` | `string` | Yes | Your Supabase anon key |
|
|
84
|
+
| `projectId` | `string` | No | Group tasks by project |
|
|
85
|
+
| `theme` | `'light' \| 'dark'` | No | Widget theme (default: light) |
|
|
171
86
|
|
|
172
87
|
## Hooks
|
|
173
88
|
|
|
174
|
-
### useFramed
|
|
175
|
-
|
|
176
|
-
Access the full Framed context:
|
|
177
|
-
|
|
178
|
-
```tsx
|
|
179
|
-
import { useFramed } from '@framed-dev/react';
|
|
180
|
-
|
|
181
|
-
function MyComponent() {
|
|
182
|
-
const {
|
|
183
|
-
tasks,
|
|
184
|
-
openTasks,
|
|
185
|
-
isAuthenticated,
|
|
186
|
-
refreshTasks,
|
|
187
|
-
saveTask,
|
|
188
|
-
features,
|
|
189
|
-
} = useFramed();
|
|
190
|
-
|
|
191
|
-
return <div>{openTasks.length} open tasks</div>;
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### useFramedTasks
|
|
196
|
-
|
|
197
|
-
Simplified access to tasks:
|
|
198
|
-
|
|
199
89
|
```tsx
|
|
200
|
-
import {
|
|
90
|
+
import { useTasks } from '@framed/react';
|
|
201
91
|
|
|
202
92
|
function TaskList() {
|
|
203
|
-
const { tasks, openTasks,
|
|
93
|
+
const { tasks, openTasks, markDone, copyPrompt } = useTasks();
|
|
204
94
|
|
|
205
95
|
return (
|
|
206
|
-
<
|
|
207
|
-
{openTasks.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<button onClick={() => markDone(task.id)}>Done</button>
|
|
211
|
-
</li>
|
|
212
|
-
))}
|
|
213
|
-
</ul>
|
|
96
|
+
<div>
|
|
97
|
+
<p>{openTasks.length} open tasks</p>
|
|
98
|
+
<button onClick={() => copyPrompt()}>Copy AI Prompt</button>
|
|
99
|
+
</div>
|
|
214
100
|
);
|
|
215
101
|
}
|
|
216
102
|
```
|
|
217
103
|
|
|
218
|
-
|
|
104
|
+
### Available hooks
|
|
219
105
|
|
|
220
|
-
|
|
106
|
+
- `useTasks()` — Access tasks, mark done, copy AI prompt
|
|
107
|
+
- `useFramed()` — Access full provider context
|
|
221
108
|
|
|
222
|
-
|
|
109
|
+
## Export to AI Tools
|
|
223
110
|
|
|
224
|
-
|
|
225
|
-
|
|
111
|
+
1. Collect feedback via widget
|
|
112
|
+
2. Open drawer → click **Copy AI Prompt**
|
|
113
|
+
3. Paste in Bolt, Lovable, or Cursor
|
|
114
|
+
4. AI implements the changes
|
|
226
115
|
|
|
227
|
-
|
|
228
|
-
position="bottom-right"
|
|
229
|
-
theme="light"
|
|
230
|
-
hotkey="f"
|
|
231
|
-
/>
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### TasksReadyPanel
|
|
235
|
-
|
|
236
|
-
Display pending tasks with AI export:
|
|
237
|
-
|
|
238
|
-
```tsx
|
|
239
|
-
import { TasksReadyPanel } from '@framed-dev/react';
|
|
240
|
-
|
|
241
|
-
<TasksReadyPanel
|
|
242
|
-
showCopyPrompt
|
|
243
|
-
onTaskClick={(task) => console.log(task)}
|
|
244
|
-
/>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Premium Features
|
|
248
|
-
|
|
249
|
-
Get a license key at [framed.dev](https://framed.dev) for:
|
|
250
|
-
|
|
251
|
-
- **AI-powered task parsing** - Natural language to structured tasks
|
|
252
|
-
- **PageSpeed analysis** - Automated performance reports
|
|
253
|
-
- **SEO audits** - Comprehensive site analysis
|
|
254
|
-
- **Analytics dashboard** - Usage and engagement metrics
|
|
255
|
-
- **White-label branding** - Custom widget appearance
|
|
256
|
-
|
|
257
|
-
## Local Development Mode
|
|
258
|
-
|
|
259
|
-
For development without Supabase:
|
|
260
|
-
|
|
261
|
-
```tsx
|
|
262
|
-
<FramedProvider
|
|
263
|
-
config={{
|
|
264
|
-
projectId: 'dev',
|
|
265
|
-
mode: 'local', // Uses localStorage
|
|
266
|
-
auth: { mode: 'dev' },
|
|
267
|
-
}}
|
|
268
|
-
>
|
|
269
|
-
{children}
|
|
270
|
-
<FeedbackWidget />
|
|
271
|
-
</FramedProvider>
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
This stores all data in localStorage - perfect for prototyping.
|
|
275
|
-
|
|
276
|
-
## CLI Commands
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
# Initialize Framed in your project
|
|
280
|
-
npx @framed-dev/cli init
|
|
281
|
-
|
|
282
|
-
# Run database migrations
|
|
283
|
-
npx @framed-dev/cli migrate
|
|
284
|
-
|
|
285
|
-
# Show migrations without executing
|
|
286
|
-
npx @framed-dev/cli migrate --dry-run
|
|
287
|
-
```
|
|
116
|
+
The prompt includes task details, element selectors, page context, and suggested changes — everything the AI needs to make the fix.
|
|
288
117
|
|
|
289
118
|
## License
|
|
290
119
|
|
|
@@ -294,4 +123,4 @@ MIT
|
|
|
294
123
|
|
|
295
124
|
- [GitHub](https://github.com/framed-dev/framed-widget)
|
|
296
125
|
- [Issues](https://github.com/framed-dev/framed-widget/issues)
|
|
297
|
-
-
|
|
126
|
+
- Docs: Coming soon
|