diff --git a/apps/app/package.json b/apps/app/package.json
index 08a4913..0cce0d8 100644
--- a/apps/app/package.json
+++ b/apps/app/package.json
@@ -15,6 +15,6 @@
"react-dom": "19.3.1",
"svgo": "4.1.0",
"tesseract.js-core": "7.0.0",
- "tipjar": "1.2.0"
+ "tipjar": "2.2.0"
}
}
diff --git a/apps/app/src/App.tsx b/apps/app/src/App.tsx
index 51b5f6e..f3e6e39 100644
--- a/apps/app/src/App.tsx
+++ b/apps/app/src/App.tsx
@@ -68,7 +68,7 @@ import { bounds, effective, fromSlider, snap, step, toSlider, type Zoom } from '
import { sampleImage } from './lib/sample'
import { track } from './lib/track'
import { Canvas, type Overlays, type SelectMode, type Tool, type ViewMode } from './components/Canvas'
-import { ShortcutsDialog } from './components/Shortcuts'
+import { REDO_KEYS, ShortcutsDialog, UNDO_KEYS } from './components/Shortcuts'
import { ExportOptions } from './components/ExportOptions'
import { CLEAN_TOOLS, EDIT_TOOLS, ModeSwitch, ToolRail, useWide, type WorkMode } from './components/Workspace'
import { Dock, DOCK_ICON, MoreMenu, type DockSlot } from './components/Dock'
@@ -1229,10 +1229,6 @@ export default function App() {
tools={EDIT_TOOLS(strokes, lineTrace)}
tool={tool}
onTool={chooseTool}
- canUndo={history.past.length > 0}
- canRedo={history.future.length > 0}
- onUndo={() => historyStep('undo')}
- onRedo={() => historyStep('redo')}
/>
)
const cleanRail = (
@@ -1240,10 +1236,6 @@ export default function App() {
tools={CLEAN_TOOLS(settings.removeBackground)}
tool={cleanTool}
onTool={chooseCleanTool}
- canUndo={history.past.length > 0}
- canRedo={history.future.length > 0}
- onUndo={() => historyStep('undo')}
- onRedo={() => historyStep('redo')}
/>
)
const modeRail = workMode === 'edit' ? rail : workMode === 'clean' ? cleanRail : null
@@ -1659,6 +1651,42 @@ export default function App() {
]
: [view('image', 'Image'), view('type', 'Type'), view('tune', 'Tune'), view('export', 'Export')]
+ /** Split, Difference and Vector: beside the mode tabs on a wide screen, in the canvas's foot on a phone. Active in the primary buttons' mustard. */
+ const compare = (
+
+ {(
+ [
+ ['split', 'Split'],
+ ['difference', 'Difference'],
+ ['vector', 'Vector'],
+ ] as const
+ ).map(([v, label]) => (
+ {
+ viewChosen.current = true
+ setMode(v)
+ }}
+ aria-label={label}
+ className={`px-2.5 py-1 text-[13px] sm:px-3 ${mode === v ? 'bg-mark font-medium text-mark-ink' : 'bg-paper-sunk hover:bg-paper'}`}
+ >
+ {/* "Diff" on a phone, so the row fits one line. */}
+ {v === 'difference' ? (
+ <>
+ Diff
+ {label}
+ >
+ ) : (
+ label
+ )}
+
+ ))}
+
+ )
+
return (
{/* On a phone the page scrolls under it until a trace opens; then the layout fits the screen. */}
-
+
{/* The landing page and docs live beside the app, at the site root. */}
@@ -1696,7 +1724,7 @@ export default function App() {
Image to SVG, in your browser.
- {/* A phone's undo and redo: on a wide screen they are at the foot of the tool rail. */}
+ {/* A phone's undo and redo: on a wide screen they are in the mode bar above the canvas. */}
{docked && workMode !== 'trace' && (
historyStep('undo')}>
@@ -1747,6 +1775,25 @@ export default function App() {
{/* The mode switcher, above the canvas; a phone switches modes and tools in the dock instead. */}
+ {workMode !== 'clean' && (
+ <>
+
+ {compare}
+ >
+ )}
+ {workMode !== 'trace' && (
+ <>
+
+
+ historyStep('undo')}>
+
+
+ historyStep('redo')}>
+
+
+
+ >
+ )}
{modeRail && wide && modeRail}
@@ -1834,44 +1881,11 @@ export default function App() {
)}
- {/* One row, the same height as the sidebar's footer beside it (lg). The hint shows where there's room for it
- (each view's button carries it as a tooltip too) and shortens rather than wrapping. */}
-
-
- {(
- [
- ['split', 'Split'],
- ['difference', 'Difference'],
- ['vector', 'Vector'],
- ] as const
- ).map(([v, label]) => (
- {
- viewChosen.current = true
- setMode(v)
- }}
- aria-label={label}
- className={`px-2.5 py-1 text-[13px] sm:px-3 ${mode === v ? 'bg-paper font-medium text-accent' : 'bg-paper-sunk hover:bg-paper'}`}
- >
- {/* "Diff" on a phone, so the row fits one line. */}
- {v === 'difference' ? (
- <>
- Diff
- {label}
- >
- ) : (
- label
- )}
-
- ))}
-
-
- {COMPARE_HINT[mode]}
-
+ {/* One row, the same height as the sidebar's footer beside it (lg): the overlays and zoom on the left (a wide screen has
+ Split, Difference and Vector above, beside the modes). The hint shows where there's room for it, at the right
+ (each view's button carries it as a tooltip too), and shortens rather than wrapping. */}
+
+ {!wide && compare}
+
+ {COMPARE_HINT[mode]}
+
>
) : (
@@ -2185,20 +2202,18 @@ export default function App() {
)}
- {/* No room for a page footer, so one quiet line ends the sidebar. A phone has these in the header's menu. */}
-
-
+ {/* No room for a page footer, so one quiet line ends the sidebar. A phone has these in the header's menu; Support is the header's tip button. */}
+
+ {/* New tabs, so a trace in progress stays open. */}
+
Docs
-
+
Privacy
-
+
Source
-
- Support Inlay
-
diff --git a/apps/app/src/components/Dock.tsx b/apps/app/src/components/Dock.tsx
index 7903bef..2a358c2 100644
--- a/apps/app/src/components/Dock.tsx
+++ b/apps/app/src/components/Dock.tsx
@@ -346,13 +346,13 @@ export function MoreMenu(p: { theme: 'light' | 'dark'; onTheme: () => void; supp
>
{p.theme === 'dark' ? 'Use light theme' : 'Use dark theme'}
-
+
Docs
-
+
Privacy
-
+
Source
diff --git a/apps/app/src/components/Support.tsx b/apps/app/src/components/Support.tsx
index a850a9f..d32caad 100644
--- a/apps/app/src/components/Support.tsx
+++ b/apps/app/src/components/Support.tsx
@@ -3,22 +3,30 @@ import 'tipjar/style.css'
/** Where tips go: the same Ko-fi page as the site's footer and the README. */
export const SUPPORT_URL = 'https://ko-fi.com/mtblck'
+/** Inlay's source, for a star. */
+export const SOURCE_URL = 'https://github.com/mtblck/inlaytrace'
-// tipjar() escapes everything and checks the link, so its markup is safe to set
+// tipjar() escapes everything and checks the links, so its markup is safe to set
// as HTML. Built once: nothing in it changes. Themed in index.css (.tipjar).
+// With `links` the button opens a menu (the browser's popover, no script). No star
+// count: fetching it from the browser needs api.github.com in the CSP's connect-src.
const markup = tipjar({
- href: SUPPORT_URL,
label: 'Support',
- description: 'Inlay on Ko-fi',
icon: 'heart',
position: 'inline',
newTab: true,
+ menuId: 'support-menu',
+ links: [
+ { href: SUPPORT_URL, label: 'Tip on Ko-fi', icon: 'coffee' },
+ { href: SOURCE_URL, label: 'Star on GitHub', icon: 'star' },
+ ],
})
/**
- * The header's tip button. Inlay is free; this is the one way to give back.
- * Inline beside the theme toggle rather than floating, so it never covers the
- * canvas or the phone's export bar. Icon-only under 600px (tipjar's `auto`).
+ * The header's tip button, a menu of Ko-fi and the GitHub repo. Inlay is free;
+ * this is the one way to give back. Inline beside the theme toggle rather than
+ * floating, so it never covers the canvas or the phone's export bar. Icon-only
+ * under 600px (tipjar's `auto`).
*/
export function Support() {
return
diff --git a/apps/app/src/components/Workspace.tsx b/apps/app/src/components/Workspace.tsx
index f957f23..4cfc609 100644
--- a/apps/app/src/components/Workspace.tsx
+++ b/apps/app/src/components/Workspace.tsx
@@ -9,13 +9,12 @@
*/
import { useSyncExternalStore, type ReactNode } from 'react'
import type { Tool } from './Canvas'
-import { REDO_KEYS, UNDO_KEYS } from './Shortcuts'
export type WorkMode = 'clean' | 'trace' | 'edit'
export const MODE_LABEL: Record = { clean: 'Clean up', trace: 'Trace', edit: 'Edit' }
-/** The mode tabs, above the canvas. `edited` marks Edit when the drawing has shape edits. */
+/** The mode tabs, above the canvas, the active one in the primary buttons' mustard. `edited` marks Edit when the drawing has shape edits. */
export function ModeSwitch({ modes, mode, onMode, edited }: { modes: WorkMode[]; mode: WorkMode; onMode: (m: WorkMode) => void; edited: boolean }) {
return (
@@ -27,11 +26,11 @@ export function ModeSwitch({ modes, mode, onMode, edited }: { modes: WorkMode[];
aria-selected={mode === m}
aria-controls={`panel-${m}`}
onClick={() => onMode(m)}
- className={`flex items-center px-2.5 py-1 text-[13px] sm:px-3.5 ${mode === m ? 'bg-paper font-medium text-accent' : 'bg-paper-sunk text-ink hover:bg-paper'}`}
+ className={`flex items-center px-2.5 py-1 text-[13px] sm:px-3.5 ${mode === m ? 'bg-mark font-medium text-mark-ink' : 'bg-paper-sunk text-ink hover:bg-paper'}`}
>
{MODE_LABEL[m]}
{m === 'edit' && edited && (
-
+
(edited)
)}
@@ -117,10 +116,10 @@ export const CLEAN_TOOLS = (removeBackground: boolean): RailTool(p: { tools: RailTool[]; tool: T; onTool: (t: T) => void; canUndo: boolean; canRedo: boolean; onUndo: () => void; onRedo: () => void }) {
+export function ToolRail(p: { tools: RailTool[]; tool: T; onTool: (t: T) => void }) {
const btn = 'grid size-8 place-items-center lg:size-9 rounded-md disabled:cursor-not-allowed disabled:text-ink-faint'
return (
@@ -142,14 +141,6 @@ export function ToolRail(p: { tools: RailTool[]; tool: T; o
))}
-
-
- {icon('M6 4L3 7l3 3M3 7h7.5a4 4 0 010 8H8')}
-
-
- {icon('M12 4l3 3-3 3M15 7H7.5a4 4 0 000 8H10')}
-
-
)
}
diff --git a/apps/app/src/index.css b/apps/app/src/index.css
index 09040fd..3abd849 100644
--- a/apps/app/src/index.css
+++ b/apps/app/src/index.css
@@ -34,6 +34,8 @@
--c-on-mat-strong: #eef2ee;
/* The phone's dock: white on the paper, so it reads as a bar of its own. */
--c-dock: #ffffff;
+ /* The header: a light grey band, to break up the paper below it. */
+ --c-header: #e8ece9;
/* Its height above the phone's own inset (the iPhone home bar). */
--dock-h: calc(70px + env(safe-area-inset-bottom));
}
@@ -41,6 +43,7 @@
:root[data-theme='dark'] {
color-scheme: dark;
--c-dock: #1b2a24;
+ --c-header: #131e1a;
--c-paper: #131e1a;
--c-paper-sunk: #1b2a24;
--c-ink: #eef2ee;
@@ -63,6 +66,7 @@
@theme inline {
--color-paper: var(--c-paper);
--color-paper-sunk: var(--c-paper-sunk);
+ --color-header: var(--c-header);
--color-ink: var(--c-ink);
--color-ink-muted: var(--c-ink-muted);
--color-ink-faint: var(--c-ink-faint);
@@ -245,6 +249,8 @@
--tipjar-font-size: 13px;
--tipjar-icon-size: 14px;
--tipjar-shadow: none;
+ --tipjar-menu-radius: 10px;
+ --tipjar-menu-gap: 6px;
}
/* Over the canvas while it's tracing or optimising. Fades in after a beat, so a quick
@@ -390,3 +396,17 @@
display: block;
}
}
+
+/* The header tip button's menu (Ko-fi and the GitHub repo) hangs from the button's right edge, at the
+ header's right. Unlayered, so it wins over tipjar's own (unlayered) stylesheet. */
+@supports (position-area: bottom) {
+ header .tipjar-list[data-position='inline'] {
+ position-area: bottom span-left;
+ box-shadow: 0 8px 18px -8px rgb(0 0 0 / 0.5);
+ }
+}
+
+/* On the light header's grey, hovers take a deeper grey so they still show. */
+:root:not([data-theme='dark']) header.app-header {
+ --c-paper-sunk: #dae0dc;
+}
diff --git a/apps/site/package.json b/apps/site/package.json
index 4202e6b..8e3b20f 100644
--- a/apps/site/package.json
+++ b/apps/site/package.json
@@ -12,6 +12,6 @@
"dependencies": {
"@astrojs/starlight": "0.42.11",
"astro": "7.4.11",
- "tipjar": "1.2.0"
+ "tipjar": "2.2.0"
}
}
diff --git a/package-lock.json b/package-lock.json
index 4165f3c..b0b7a92 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -54,7 +54,7 @@
"react-dom": "19.3.1",
"svgo": "4.1.0",
"tesseract.js-core": "7.0.0",
- "tipjar": "1.2.0"
+ "tipjar": "2.2.0"
}
},
"apps/site": {
@@ -64,7 +64,7 @@
"dependencies": {
"@astrojs/starlight": "0.42.11",
"astro": "7.4.11",
- "tipjar": "1.2.0"
+ "tipjar": "2.2.0"
}
},
"node_modules/@andrewbranch/untar.js": {
@@ -8299,9 +8299,9 @@
}
},
"node_modules/tipjar": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/tipjar/-/tipjar-1.2.0.tgz",
- "integrity": "sha512-5M/yHG9WEUcxahX9uNiKh84AoyaMzdjLMaSDOTorLBdnR8rr400W66m7oT5OlXwqM4Y9CLq7GiG9IE2jYbhQEA==",
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tipjar/-/tipjar-2.2.0.tgz",
+ "integrity": "sha512-H26cleX8ae+KD2N/bt8Ev5tI4uyAlQ8JKfYjyNNwi+MRdq/xphcW9+/ZymxroxmdVmTLmV2HVj+F5C2Cp/6XNQ==",
"license": "MIT",
"engines": {
"node": ">=22"
diff --git a/scripts/verify.mjs b/scripts/verify.mjs
index 5659c42..016295f 100644
--- a/scripts/verify.mjs
+++ b/scripts/verify.mjs
@@ -624,7 +624,9 @@ const csp = response?.headers()['content-security-policy'] ?? ''
check(!csp.includes("'wasm-unsafe-eval'"), "the app page's CSP allows no WebAssembly (only the AI worker may)")
check(/worker-src[^;]*'self'/.test(csp) && !csp.includes("'sha256-"), "the app gets its own CSP (workers allowed), not the site's")
check((await page.getByRole('link', { name: 'Inlay', exact: true }).getAttribute('href')) === '/', 'the Inlay wordmark leads to the landing page')
-check((await page.getByRole('navigation', { name: 'About Inlay' }).getByRole('link', { name: 'Privacy' }).getAttribute('href')) === '/privacy/', 'the app links to the privacy page')
+const privacyLink = page.getByRole('navigation', { name: 'About Inlay' }).getByRole('link', { name: 'Privacy' })
+check((await privacyLink.getAttribute('href')) === '/privacy/' && (await privacyLink.getAttribute('target')) === '_blank', 'the app links to the privacy page, in a new tab')
+check((await page.getByRole('navigation', { name: 'About Inlay' }).getByRole('link', { name: /Support/ }).count()) === 0, 'the sidebar footer leaves Support to the header')
await shot(page, '01-empty')
await page.getByRole('button', { name: 'Try a sample' }).click()
@@ -647,7 +649,10 @@ check((await page.locator('[data-rail]').count()) === 0, 'Trace mode has no tool
await page.getByRole('tab', { name: /Edit/ }).click()
check(await viewIs('Vector'), 'starting to edit switches to Vector, hiding the original')
const rail = page.locator('[data-rail]')
-check((await rail.getByRole('radio').count()) === 8 && (await rail.getByRole('button', { name: 'Undo' }).count()) === 1, 'Edit mode shows the tool rail: Select, Nodes, Mirror, Fill, Pen, Shape, Eraser, Knife, Undo and Redo')
+check((await rail.getByRole('radio').count()) === 8 && (await rail.getByRole('button', { name: 'Undo' }).count()) === 0, 'Edit mode shows the tool rail: Select, Nodes, Mirror, Fill, Pen, Shape, Eraser and Knife')
+// The mode bar: the modes, then Split/Difference/Vector, then Undo and Redo.
+const modeBar = page.locator('[data-workspace]')
+check((await modeBar.getByRole('radiogroup', { name: 'Compare' }).count()) === 1 && (await modeBar.getByRole('group', { name: 'History' }).getByRole('button', { name: 'Undo' }).count()) === 1, 'the mode bar holds the compare views and Undo and Redo')
await rail.getByRole('radio', { name: 'Nodes' }).click()
check((await page.locator('#panel-edit h2').first().innerText()) === 'Nodes', 'the panel follows the rail’s tool')
// Leaving Edit puts its tools away: back on Select, nothing selected, so Delete can't act unseen.
@@ -859,12 +864,15 @@ check(closed, 'Esc closes the shortcuts panel')
const cut = await page.getByRole('radiogroup', { name: 'Image type' }).locator('.field-hint').evaluateAll((els) => els.filter((e) => e.scrollWidth > e.clientWidth + 1).map((e) => e.textContent))
check(cut.length === 0, `every preset's description fits (${cut.join(', ') || 'none cut off'})`)
-// Inlay is free: the header has a tip button (tipjar) to Ko-fi, in a new tab, and nothing to sign in to or buy.
-const tip = page.locator('header a.tipjar')
+// Inlay is free: the header has a tip button (tipjar) opening a menu of Ko-fi and the GitHub repo, each in a new tab, and nothing to sign in to or buy.
+const tip = page.locator('header button.tipjar')
+await tip.click()
+const tipLinks = await page.locator('.tipjar-list a').evaluateAll((els) => els.map((a) => `${a.getAttribute('href')} ${a.getAttribute('target')}`))
check(
- (await tip.count()) === 1 && (await tip.getAttribute('href')) === 'https://ko-fi.com/mtblck' && (await tip.getAttribute('target')) === '_blank' && (await tip.innerText()).includes('Support'),
- 'the header has a Support button linking to Ko-fi in a new tab',
+ (await tip.innerText()).includes('Support') && tipLinks.join() === 'https://ko-fi.com/mtblck _blank,https://github.com/mtblck/inlaytrace _blank' && (await page.locator('.tipjar-list').isVisible()),
+ `the header's Support button opens Ko-fi and the GitHub repo, in new tabs (${tipLinks.join(', ')})`,
)
+await page.keyboard.press('Escape')
check(apiRequests.length === 0, `the app never calls /api: no sign-in, credits or HD (${apiRequests.join(', ') || 'no calls'})`)
// Header icons: the keyboard opens the same panel; the tooltip shows on keyboard focus; sun/moon switches theme.