Skip to content

Commit a9f5c9e

Browse files
omachalaOndrej Machala
andauthored
feat: add text overrides and rename toolbar to editor (#15)
## Summary - Add **textOverrides** support for inline text editing in screenshots - Rename `toolbar/` to `editor/` for clarity - Remove 'auto'/'both' color scheme options (keep only light/dark) - Clear selection when picker mode is activated - Remove animation from picker button ## Text Overrides Feature Users can now click on text elements within a picked screenshot and edit the text inline. Changes are: - Saved to config as `textOverrides: { "relative > selector": "new text" }` - Applied during sync capture - Hydrated when re-selecting existing screenshots in the editor --------- Co-authored-by: Ondrej Machala <[email protected]>
1 parent 0b5d148 commit a9f5c9e

File tree

109 files changed

+2666
-1675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2666
-1675
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'heroshot': minor
3+
---
4+
5+
Add text overrides and rename toolbar to editor
6+
7+
- Add textOverrides support for inline text editing in screenshots
8+
- Rename toolbar/ to editor/ for clarity
9+
- Merge sidebar and toolbar into unified EditorBar component
10+
- Add commit-msg hook to block AI co-authors
11+
- Remove sync command, add --clean flag to default command
12+
- Real-time config saving on screenshot changes

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ jobs:
2929
- name: Lint
3030
run: pnpm lint
3131

32-
- name: Lint toolbar
33-
run: pnpm lint:toolbar
32+
- name: Lint editor
33+
run: pnpm lint:editor
3434

3535
- name: Typecheck
3636
run: pnpm typecheck
3737

38-
- name: Typecheck toolbar
39-
run: pnpm typecheck:toolbar
38+
- name: Typecheck editor
39+
run: pnpm typecheck:editor
4040

4141
- name: Svelte warnings check
4242
run: pnpm check:svelte
@@ -47,13 +47,13 @@ jobs:
4747
- name: Unit tests with coverage
4848
run: pnpm vitest run --coverage
4949

50-
- name: Toolbar unit tests with coverage
51-
run: pnpm test:toolbar:coverage
50+
- name: Editor unit tests with coverage
51+
run: pnpm test:editor:coverage
5252

5353
- name: Upload coverage to Codecov
5454
uses: codecov/codecov-action@v4
5555
with:
56-
files: ./coverage/lcov.info,./coverage/toolbar/lcov.info
56+
files: ./coverage/lcov.info,./coverage/editor/lcov.info
5757
fail_ci_if_error: false
5858

5959
- name: Changeset status
@@ -76,21 +76,21 @@ jobs:
7676

7777
- run: pnpm install --frozen-lockfile
7878

79-
- name: Build toolbar
80-
run: pnpm build:toolbar
79+
- name: Build editor
80+
run: pnpm build:editor
8181

8282
- name: Install Playwright browsers
8383
run: pnpm exec playwright install chromium
8484

8585
- name: Run e2e tests
86-
run: pnpm test:toolbar:e2e
86+
run: pnpm test:editor:e2e
8787

8888
- name: Upload test artifacts
8989
if: failure()
9090
uses: actions/upload-artifact@v4
9191
with:
9292
name: playwright-report
93-
path: toolbar/test-results/
93+
path: editor/test-results/
9494
retention-days: 7
9595

9696
# CLI integration tests - run after check passes (parallel with e2e)

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- run: pnpm install --frozen-lockfile
2626

2727
- name: Build
28-
run: pnpm build && pnpm build:toolbar
28+
run: pnpm build && pnpm build:editor
2929

3030
- name: Create Release PR or Publish
3131
uses: changesets/action@v1

.github/workflows/update-screenshots.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
- name: Build heroshot
2424
run: pnpm build
2525

26-
- name: Build toolbar
27-
run: pnpm build:toolbar
26+
- name: Build editor
27+
run: pnpm build:editor
2828

2929
- name: Install Playwright browsers
3030
run: pnpm exec playwright install chromium
3131

32-
- name: Run heroshot sync
32+
- name: Run heroshot
3333
run: node dist/cli.js
3434

3535
- name: Commit updated screenshots

.heroshot/config.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88
"screenshots": [
99
{
1010
"id": "5dytme8m",
11+
"viewports": [
12+
"desktop",
13+
"tablet",
14+
"mobile"
15+
],
1116
"name": "Hero",
1217
"url": "https://heroshot.sh/",
13-
"filename": "hero.png",
1418
"selector": "#VPContent > div.VPHome > div.VPHero.has-image:nth-of-type(1)",
1519
"scroll": {
1620
"x": 0,
1721
"y": 0
18-
},
19-
"viewports": [
20-
"mobile",
21-
"tablet",
22-
"desktop"
23-
]
22+
}
2423
}
2524
]
2625
}

README.md

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
<a href="https://heroshot.sh"><img src="https://img.shields.io/badge/docs-heroshot.sh-blue?style=for-the-badge" alt="docs"></a>
1313
</p>
1414

15-
Documentation screenshots rot. Your UI changes, but the images in your README, docs, and tutorials become outdated. The manual fix is painful: navigate, log in, screenshot, crop, save, commit. Repeat for every image.
15+
Your app changes constantly. New features, design tweaks, bug fixes. Meanwhile, the screenshots in your README and docs quietly become lies.
1616

17-
**Heroshot treats screenshots as code** - define them once, regenerate with one command.
17+
The manual fix is tedious: open browser, navigate, log in, screenshot, crop, save, commit. Now do that for every image. Now do it again next month.
1818

19-
- **Visual picker** - Point and click to select elements, generates config for you
20-
- **Multi-variant** - Desktop, tablet, mobile + light/dark from a single definition
21-
- **CI/CD ready** - Automate updates with encrypted session support
19+
**Heroshot fixes this.** Define your screenshots once - point and click, no CSS selectors - and regenerate them with one command whenever you need.
2220

2321
<table align="center">
2422
<tr>
@@ -43,57 +41,48 @@ Documentation screenshots rot. Your UI changes, but the images in your README, d
4341
</tr>
4442
</table>
4543

44+
<p align="center"><em>6 screenshots from one config entry - always in sync with the live site.</em></p>
45+
4646
## Get Started
4747

4848
```bash
4949
npx heroshot
5050
```
5151

52-
**First run** opens an interactive browser:
52+
That's it. First time, a browser opens with a visual picker. Navigate to your app, click on elements you want to capture, name them, close when done.
5353

54-
1. Navigate to any URL
55-
2. Click on elements you want to screenshot
56-
3. Name your screenshots and adjust settings
57-
4. Close the browser when done
54+
Your screenshots land in `heroshots/` and a config is saved to `.heroshot/config.json`.
5855

59-
**Subsequent runs** regenerate all screenshots headlessly:
56+
Next time you run `npx heroshot`, it regenerates everything headlessly. No browser, no clicking - just fresh screenshots.
6057

61-
```bash
62-
npx heroshot
63-
```
58+
## What Makes It Useful
6459

65-
**Reconfigure** anytime by running:
66-
67-
```bash
68-
npx heroshot config
69-
```
60+
**Point and click, not CSS selectors.** The visual picker figures out how to find elements. You just click what you want.
7061

71-
## Why heroshot?
62+
**Light and dark mode in one go.** If your site has themes, heroshot captures both variants automatically. One config, two screenshots.
7263

73-
Heroshot automates **documentation screenshots** - not visual regression testing. Define once, generate everywhere.
64+
**Desktop, tablet, mobile from one definition.** Add `"viewports": ["desktop", "tablet", "mobile"]` and get all three sizes. Combined with both color schemes, that's 6 screenshots from one entry.
7465

75-
**The math:** 3 components × 5 pages × 3 viewports × 2 color schemes = **90 screenshots** from one config.
66+
**Log in once, capture forever.** First time, log into your app manually. Heroshot encrypts and saves your session. Headless runs are already authenticated - no login scripts needed.
7667

77-
- **Visual picker** - Point and click to select elements, no DevTools needed
78-
- **Viewport variants** - Desktop, tablet, mobile from a single definition
79-
- **Light & Dark mode** - Both color schemes captured automatically
80-
- **Pixel-perfect** - Element-precise capture with masked padding
81-
- **One command** - Regenerate all screenshots when your UI changes
82-
- **CI ready** - Automate updates with encrypted session support
68+
**CI-ready.** Export your session key, add it to GitHub secrets, run `heroshot` in a workflow. Screenshots update automatically.
8369

8470
## Automated Updates
8571

86-
Run heroshot in CI to keep screenshots always current. See the [full guide](https://heroshot.sh/docs/guide/automated-updates).
72+
Keep screenshots always current by running heroshot in CI. Quick setup:
8773

88-
**Quick setup:**
74+
```bash
75+
# Get your session key (for authenticated sites)
76+
npx heroshot session-key
77+
78+
# Add to GitHub secrets
79+
gh secret set HEROSHOT_SESSION_KEY
80+
```
8981

90-
1. Get your session key: `npx heroshot session-key`
91-
2. Add as GitHub secret: `gh secret set HEROSHOT_SESSION_KEY`
92-
3. Create workflow:
82+
Then create `.github/workflows/heroshot.yml`:
9383

9484
```yaml
95-
# .github/workflows/heroshot.yaml
96-
name: Heroshot
85+
name: Update Screenshots
9786

9887
on:
9988
workflow_dispatch:
@@ -106,20 +95,26 @@ jobs:
10695
- uses: actions/setup-node@v4
10796
with:
10897
node-version: 20
109-
- run: npx heroshot --session-key=${{ secrets.HEROSHOT_SESSION_KEY }}
98+
- run: npx heroshot
99+
env:
100+
HEROSHOT_SESSION_KEY: ${{ secrets.HEROSHOT_SESSION_KEY }}
110101
- run: |
111102
git config user.name "github-actions[bot]"
112103
git config user.email "github-actions[bot]@users.noreply.github.com"
113104
git add heroshots/
114105
git diff --staged --quiet || git commit -m "chore: update screenshots" && git push
115106
```
116107
117-
---
108+
Go to Actions → Update Screenshots → Run workflow. Done.
118109
119-
**Status:** Early alpha. [See releases](https://github.com/omachala/heroshot/releases) for current version.
110+
For more options (scheduled runs, PR creation, debugging), see the [full CI guide](https://heroshot.sh/docs/guide/automated-updates).
111+
112+
## Learn More
120113
121114
**Docs:** [heroshot.sh](https://heroshot.sh)
122115
116+
**Status:** Early alpha. [See releases](https://github.com/omachala/heroshot/releases) for current version.
117+
123118
## License
124119
125120
MIT

0 commit comments

Comments
 (0)