Commit Graph

6 Commits

Author SHA1 Message Date
Mohamed Aziz Mejri
352d4330ed Visual editor (Pro only) (#1828)
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prototype visual editing mode for the preview app. Toggle the mode, pick
elements (single or multiple), and edit margin, padding, border,
background, static text, and text styles with live updates, then save
changes back to code.

- **New Features**
- Pen tool button to enable/disable visual editing in the preview and
toggle single/multi select; pro-only.
- Inline toolbar anchored to the selected element for Margin (X/Y),
Padding (X/Y), Border (width/radius/color), Background color, Edit Text
(when static), and Text Style (font size/weight/color/font family).
- Reads computed styles from the iframe and applies changes in real
time; auto-appends px; overlay updates on scroll/resize.
- Save/Discard dialog batches edits and writes Tailwind classes to
source files via IPC; uses AST/recast to update className and text,
replacing conflicting classes by prefix; supports multiple components.
- New visual editor worker to get/apply styles and enable inline text
editing via postMessage; selector client updated for coordinates
streaming and highlight/deselect.
- Proxy injects the visual editor client; new atoms track selected
component, coordinates, and pending changes; component analysis flags
dynamic styling and static text.
  - Uses runtimeId to correctly target and edit duplicate components.

- **Dependencies**
  - Added @babel/parser for AST-based text updates.
  - Added recast for safer code transformations.

<sup>Written for commit cdd50d33387a29103864f4743ae7570d64d61e93.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-09 13:09:19 -08:00
Will Chen
d837abe5e6 Inject proxy script in all routes (#1623)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Broaden injection to extensionless and .html routes, gate by
Content-Type, and conditionally strip caching/compression headers only
when injecting.
> 
> - **Proxy HTML injection**:
> - Update `needsInjection(pathname)` to inject for routes without
extensions and `.html` files (e.g., `/`, `/foo`, `/foo/bar`, `*.html`).
> - Only request uncompressed content and remove `if-none-match` when
`needsInjection(target.pathname)` is true.
> - During upstream response, inject only if `Content-Type` includes
`text/html`; otherwise pass through without modification.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2986ceccea64e7881a2197a2a0b202216f21d27d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-24 13:56:24 -07:00
Will Chen
03c200b932 Fix proxy server: remove URL param so it doesn't interfere with Next.js (#753)
Fixes #748
2025-07-31 15:18:37 -07:00
Will Chen
c1aa6803ce Click to edit UI (#385)
- [x] add e2e test - happy case (make sure it clears selection and next
prompt is empty, and preview is cleared); de-selection case
- [x] shim - old & new file
- [x] upgrade path
- [x] add docs
- [x] add try-catch to parser script
- [x] make it work for next.js
- [x] extract npm package
- [x] make sure plugin doesn't apply in prod
2025-06-11 13:05:27 -07:00
Will Chen
bc8166c274 Fix proxy server injection for gzip content (#190)
Some dev servers like next.js use Gzip which breaks our content
injection so we avoid getting gzipped response when we need to do the
shim injection.
2025-05-19 14:11:55 -07:00
Will Chen
5966dd7f4b Proxy server to inject shim (#178)
things to test:

- [x] allow real URL to open in new window
- [x] packaging in electron?
- [ ] does it work on windows?
- [x] make sure it works with older apps
- [x] what about cache / reuse? - maybe use a bigger range of ports??
2025-05-16 23:28:26 -07:00