Commit Graph

13 Commits (3057c65d276404cf1c53b86038881ff00ecedc42)

Author SHA1 Message Date
mula.liu 3057c65d27 fix(drop): stop the drag-end fallback from eating the drop it waits for
0.1.11 made a dragged row do nothing on every button. The release added to
`dragEnd` landed the gesture immediately, and on macOS the native drop is
reported *after* the button is up: the fallback consumed the gesture with
`dragEnd`'s own position - which Chromium reports as the origin, not as where
the pointer stopped - and the drop that followed was read as a finished
gesture and thrown away. Three buttons, no feedback, on both platforms.

The fallback now waits, and only claims the gesture when it can actually name
a button. A release that aims nowhere stands back, so a real drop that arrives
later still runs, and `landed` keeps the two from both acting. A position of
(0, 0) is treated as no position reported, which is what it is on Chromium, and
answered with the last position the drag moved through.

A row dragged out of the window now carries the file rather than the row. Left
alone the engine photographs whatever is under the pointer, and a Recent row is
a thumbnail, a name, an age, a folder path and five hover buttons - a strip of
the list, which reads as the whole list coming along. The ghost is the file: the
picture the list already decoded, or the extension when there is no picture,
with the name under it, matching the figure the ring draws for a file it is
about to convert.

Rebuilt both 0.1.11 installers from this tree.
2026-11-07 00:53:09 +08:00
mula.liu 2bf63f2366 fix(drop): let Windows finish a row dropped on a button, and spend every button alike
A row dragged from Recent onto any of the three buttons did nothing on
Windows, and reported itself as a refusal. Both delivery paths can stay
silent on that platform, so the gesture now ends in `dragEnd`, which always
arrives and carries a point to hit-test.

The two paths are silent for two separate reasons. A Recent row is a real
file drag, and WebView2 registers its own OLE drop target on the window, so
the DOM drop never reaches the page; that target then reads only `CF_HDROP`,
which an in-page drag does not carry, so `enter_is_valid` stays false and the
native `over`/`drop`/`leave` are withheld too. `landed` keeps the fallback an
execution rather than a second one, and a release outside the window runs
nothing, because the hit-test has slack around every button and the row was
meant for Explorer.

An idle ring also stops getting in the way. It is borderless and always on
top, so one left open from a previous drop sits over the buttons; macOS
passes mouse events through its transparent pixels and Windows hands the
gesture to whichever HWND is under the pointer. Starting a row drag now puts
such a ring aside, while a ring owned by an in-flight Shift-drag gesture keeps
waiting for the release that decides its fate.

The availability rule stops being OCR's alone. `lib/dropCapabilities` answers
one question - can this button serve these files - and the button's spent
state, its candidacy while a drag is in flight, and the drop itself all ask
it, so Convert spends for a `.key` the way OCR spends for a PDF, on both
platforms, whichever drag source carried the file. Tools never spends: its
ring ends in Open, Reveal and Send. An unknown payload is not a refusal,
because spending on an empty path list would disable a gesture that works.

Two other reports this round were not about the drag at all:

- A file received over the LAN now reveals itself only when "show results in
  Finder" is on, the way a finished conversion already behaves, and a batch
  reveals once at its last file rather than once per file.
- Missing runtime components install as one request. Installs run one after
  another because the package managers hold a single lock, and one package
  answering two rows - Poppler for both PDF rows on Windows - is installed
  once. The panel re-reads the machine afterwards either way, since a batch
  that stopped at its first failure may have landed everything before it.
2026-11-06 23:13:53 +08:00
mula.liu 84c4056a0d feat(ui): spend the OCR button instead of explaining it, and unify how the app speaks
Two changes, one goal: the same gesture and the same news should look and read the
same way wherever they happen.

Dropping a file OCR cannot read used to be answered after the fact - the drop ran,
refused, and popped "文字识别仅支持图片格式". The user had to do the wrong thing
first and then be told. Now the decision happens when the drag starts: MainWindow
records the files in flight (`dragPaths`, from the native `enter` payload or from a
Recent row's `dragstart`) and marks the button spent for the whole gesture with
`is-drop-unavailable`, so the refusal is visible before the pointer is committed and
releasing on it is inert and silent. Both drag sources were verified in a production
build, including the reverse case: an image still lights the button and opens the
editor. `over` carries no paths and `dataTransfer` is unreadable during `dragover`,
so the paths have to be registered at the start - a later refactor that reads them
from the move event gets nothing.

The audit that followed found the same class of problem in the messaging, and worse:
the app said one thing three ways.

Prompts were the largest gap. A Rust-authored sentence reached the screen verbatim,
so a Chinese interface answered Convert with `Saved 1 file.`, and macOS's first-run
write-permission failure was one long English line. Rust now names the outcome or the
failure (`outcomeSaved`, `errCaptureBlocked`) and the interface words it; `translate`
still returns an unknown key unchanged, so genuine technical detail - `ffmpeg exited
with status 137` - is reported as it is rather than flattened into a generic line.
`feedback.test.ts` scans the Rust sources and fails on any code without wording in
both languages, and on any outcome the worder does not know; both directions were
checked by breaking them. It also asserts the two dictionaries list identical keys,
which was silently false before.

Durations were arbitrary: the identical share result showed for 2.6s in the ring and
3.6s in the main window, one file's `processing` message lived 12s in one branch and
120s in another, and generic errors used 2200/2400/3000/3200/3800. `FEEDBACK` is now
the only ladder, and `hold` is reserved for tasks that report progress and must not
expire mid-task.

Error text had three normalisation idioms, two inside the same file; `messageFrom()`
is the only one left. Share failures reported twice at once - a banner saying "could
not send" plus a toast naming a different reason - and now report once, in the panel,
with the real reason. The editor's failure notices wore a green check and lasted 1.4s;
a clipboard refusal was silent, and an OCR failure printed into the text box as though
it had been read from the image.

Disabled controls were dimmed at nine different opacities across the app, three
buttons were disabled in JS with no CSS at all, and several `:hover` rules answered a
disabled control. `--dimmed` plus `cursor: default` and `:not(:disabled)` hovers is now
the single treatment, and the OCR drop-target state joins it. Every transient message
is a live region, three unlabeled icon buttons are named, Escape closes the settings
sheet and the first-run panel, the main toast is raised above every sheet of its
window, and nine raw px font sizes went back onto the type ladder.

Out of scope, deliberately: the accent is still ~87 literals rather than one variable,
and the muted warm greys are still written many ways. Both need a visual pass, not a
search and replace.
2026-11-01 16:18:20 +08:00
mula.liu 45325f0a6c feat(ui): quiet the drop gesture, and refuse files OCR cannot read
Four changes to how the main window answers a drag.

The tray row said "识别图片文字…" where the window says 文字识别, and the ellipsis
made it read like a preview rather than a command. It now carries the same words
as the button, in both languages.

OCR refuses a file it cannot read instead of handing it to the format ring. The
fallback was meant to be helpful - "the format ring is more useful than a failing
OCR run" - but from the user's side it looked like the button they dropped on had
ignored their file and opened something else. A drop on OCR is now either a read
or a refusal that names the reason.

Dragging an outside file and dragging a Recent row are now the same interaction.
The panel used to scale, recolour and swap its heading when a file entered the
window from Finder, while a row dragged from the list did none of that, because
an in-webview drag raises no native drag events. The panel no longer animates at
all: the is-dragging class, its two rules, and the transition they drove are
gone, and feedback lives only on the three buttons, which both paths already
share.

Releasing off a button no longer pops the toast. 0.1.9 added it to explain why
nothing had run, but it fired at the pointer, in a place the user had not chosen
to aim at, and the buttons already show where a drop lands. Off a button,
nothing happens, silently, on both paths.

The version comparison test gains the patch-component case: 0.1.10 is the first
release whose patch number reaches two digits, and the rule was only asserted for
the minor position.
2026-11-01 12:48:36 +08:00
mula.liu e6818e029e feat(ui): drop onto a button, and read the panels again
Three changes to the main window, requested together.

A file drop is now aimed. The three buttons are the only drop targets and the
button you release on is the action it runs; a release anywhere else on the
panel runs nothing and says so, instead of opening an action ring nobody asked
for. This replaces the old fallback in both delivery paths - the DOM handler and
the native webview drop - because two routes to the same gesture must not have
two different rules. dropFiles therefore takes a required action rather than an
optional one, and the actions ring is still reachable from the Shift-drag
gesture and from a file type with no convertible formats.

Recent rows can be dragged back onto those buttons. A row leaves Shift as a real
file drag, so one gesture can be reported twice, once by the DOM and once by the
native events, and which arrives first depends on the engine; recentDrag.landed
lets only the first through. The hint under the buttons names the affordance,
which is otherwise invisible, and all three buttons light up as candidates for as
long as any drag is in flight - a native one via dragging, an internal one via
rowDragging, since a row drag inside the webview does not raise native events.

Type sizes are on one ladder now (--text-3xs to --text-hero) instead of being
invented per rule, which is how the settings drawer drifted down to 7-8px. 92
declarations under 12px became one. The drawer is wider, its tabs are pills, and
the runtime, share, setup and radial surfaces moved onto the same scale.

The capture-behaviour setting is removed: the CaptureAfter enum, its field, its
command and its UI. A finished capture always shows the result card, falling back
to the editor when a card window cannot be created. Stored settings that still
carry captureAfter load unchanged, because the struct does not deny unknown
fields.

Also dropped 23 i18n keys no surface used, one dead re-export in history.ts, and
a stale .home-drop p rule that was outranking the new hint and sizing it as body
copy. tsconfig now turns on noUnusedLocals, noUnusedParameters and
noFallthroughCasesInSwitch, which is what keeps the dead imports from coming
back; the tree already passes all three.
2026-11-01 12:02:24 +08:00
mula.liu df35111326 release: prepare Shift 0.1.8 2026-10-27 18:45:32 +08:00
mula.liu 22ff93a5fc fix(updates): make install and discard read as one decision
The row under a verified download took both controls from the Runtime tab, where
rows are dense: .runtime-install is 27px tall at 8.5px text and .settings-link is
a bare 8.5px text link with no box at all. In the Updates panel, whose own status
text, artifact chip and version pill are 12px, that produced an orange pill beside
floating text - the pair did not look like one choice, and the text link did not
read as a button you could press.

They get their own .update-action now, sized to the 12px scale the panel already
uses, and both take the same box so the eye groups them. The commit variant wears
the app's existing primary gradient, so the action that does something is the loud
one and Discard stays the quiet alternative.

"放弃" also stops competing at the moment it stops meaning anything: once the
handoff script is written the app is counting down to exit, so the row collapses
to the single control still in play. update_clear only resets the status, so this
is presentation, not a saved deletion.

updateInstalling was a whole sentence inside a fixed-height pill, which is what
made that button stretch unevenly against its neighbour. It is "正在安装…" now;
the panel's own closing paragraph already says Shift will restart and interrupt a
running conversion, so the button does not have to repeat it.
2026-10-26 16:22:34 +08:00
mula.liu c98d554a88 release: 0.1.3 — the Recent list survives an upgrade
The Updates tab drops the "installs the ... artifact" chip, and the state label
now leads the status row instead of floating right, since the version it used to
sit beside moved into the header.

The file list no longer disappears on upgrade:

- The library already lived in the app data directory, outside the bundle, so an
  in-app update or reinstall never touched `history.json`. What it never had was a
  bridge from the store 0.1 used: that list lived in the webview's own storage,
  which a reinstall does not survive, so the first launch of a newer build showed
  an empty Recent list over files that were all still on disk.
- `history_import` merges those rows once, on the first launch after an upgrade.
  An entry the library already lists keeps its own timestamp, the kind is
  re-derived from the file rather than taken from the older store's guess, and the
  legacy key is dropped only after the merge succeeds so a later upgrade cannot
  resurrect rows the user has since removed.
- `HistoryEntry.kind`/`.at` gained serde defaults, so a row from the older store
  degrades to a usable entry instead of failing the whole import.

Verified on this machine that the legacy `shift.recent` key is still present in the
installed app's webview store, so the import has rows to adopt.

Gates: cargo fmt --check clean, `cargo test --lib` 149 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 38 passed, `pnpm build` ok.
2026-10-26 04:02:31 +08:00
mula.liu 15498482fa release: 0.1.2 — install the update in place, and lead the tab with the host
Updates now finish without leaving the app. After the SHA256 gate, macOS replaces
its own `.app` from the downloaded disk image and Windows runs the same NSIS
installer with `/S`; both from a detached helper that waits for this process to
exit and then opens the new copy.

- `update.rs`: `bundle_path` (is this a bundled run?), `can_replace` (is the
  enclosing folder writable — checked before quitting, not after), and the two
  handoff scripts. Every macOS failure path still `open`s the bundle it had, so a
  failed swap leaves Shift running rather than closed.
- `windows-installer.nsi`: `${Silent}` skips the "Shift is running, close it?"
  box, which would otherwise abort an update nobody is there to answer.
- `useUpdate.ts`: a failed install reports its own error and keeps the verified
  download, instead of downgrading a "ready" status to "error".

The Updates tab now leads with two lines above everything else: system,
architecture and running version, then the feed URL. The header no longer repeats
the version in the status row.

Verified end to end on macOS: a 0.1.1 bundle swapped by the published 0.1.2 image,
`codesign --verify --deep --strict` clean afterwards, image detached, and the
busy-image path shown to reopen the old copy.

Gates: cargo fmt --check clean, `cargo test --lib` 146 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 34 passed, `pnpm build` ok.
2026-10-26 03:41:47 +08:00
mula.liu b732b91ea6 release: 0.1.1 — update channel, settings/UI trims, macOS + Windows x64 only
Update path
- `src-tauri/src/update.rs`: manifest fetch, semver compare, optional ed25519
  signature check against a key baked in at build time, then a size + SHA256
  gate before an installer can run. `UpdateStatus` now reports the artifact key
  it resolved so the UI can name what it will install.
- Settings → Updates panel shows the feed, the check/download state machine, and
  the local OS, architecture and release artifact for this machine.
- `scripts/publish-release.sh` + `scripts/release-key.py` publish installers and a
  signed `shift-update.json` onto an orphan `releases` branch.

Scope trims requested for this release
- Settings: the Radial rings tab is gone, so ring orders are read from
  `settings.json` with no in-app editor for now.
- Main window: the update entry in the header bar is gone; updates live in
  Settings → Updates only.
- Release targets are macOS universal and Windows x64. ARM64 and Linux stay
  buildable and are no longer published; `docs/RELEASE.md` records the decision.

Gates: cargo fmt --check clean, `cargo test --lib` 142 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 34 passed, `pnpm build` ok.
2026-10-26 03:06:46 +08:00
mula.liu c6eff4e131 修复bug 2026-10-25 12:24:05 +08:00
Shift b47670f391 fix(editor,drag,hotkeys): unified editor header, drop-to-button routing, single-instance hotkey ownership 2026-10-21 10:07:16 +08:00
Shift 0eb75595c6 baseline: capture workspace state (bug fixes in progress) 2026-10-21 08:54:54 +08:00