You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(web): mount() text I/O + per-range diagnostics (gh#1, gh#2) (v0.4.0)
Surface text I/O and precise diagnostics across the FFI to the web mount() controller, and add the shared Editor methods for all platforms.
gh#1: cross-realm WASM<->JS bridge — push buffer text out via hone_editor_set_buffer_text (drives getText/onTextChange); pull setText/setCursor through the editor's poll loop (has_/take_pending_*). Adds getText/setText/onTextChange/setCursor/focus.
gh#2: setRangeDiagnostics/clearRangeDiagnostics — severity-colored squiggles + hover tooltip on web (full, pointer hit-tested), wavy-underline rendering on macOS; link-resolving stubs on ios/windows/linux/android/harmonyos (same status as their line-diagnostics).
+10 FFI functions in the perry.nativeLibrary manifest; 15 new tests in tests/web-controller.test.ts; web bundle rebuild verified.
Run Windows interactive demo: `cd native/windows && cargo run --example demo_editor`
177
194
Run iOS interactive demo: `cd native/ios && cargo run --example demo_editor_ios`
178
195
Run Android interactive demo: `cd native/android && bash run-demo.sh`
179
-
Build for web: `bun run examples/web/build.ts` — produces `examples/web/dist/{hone-editor.wasm, hone-editor.js, index.html}`. The build orchestrates: (1) `perry compile examples/web/entry.ts --target web --output hone-editor.wasm` for the raw WASM; (2) a second Perry compile to .html to extract the JS runtime bridge; (3) bundles `native/web/dom-ffi.ts` + the bridge + a `mount()` API into `hone-editor.js`. Consumers: `import { mount } from './hone-editor.js'; await mount(document.getElementById('editor'));`
196
+
Build for web: `bun run examples/web/build.ts` — produces `examples/web/dist/{hone-editor.wasm, hone-editor.js, index.html}`. The build orchestrates: (1) `perry compile examples/web/entry.ts --target web --output hone-editor.wasm` for the raw WASM; (2) a second Perry compile to .html to extract the JS runtime bridge; (3) bundles `native/web/dom-ffi.ts` + the bridge + a `mount()` API into `hone-editor.js`. Consumers: `import { mount } from './hone-editor.js'; const ed = await mount(document.getElementById('editor'));`. The returned controller exposes overlay setters plus `getText()`, `setText(v)`, `onTextChange(cb)`, `setCursor(line,col)`, `focus()` (gh#1) and `setRangeDiagnostics(json)` / `clearRangeDiagnostics()` (gh#2).
ed.setLineDiagnostics('5:2:#f87171:cursorLine is implicitly typed as number — declare it\\n13:1:#f87171:Type \\'string\\' is not assignable to parameter of type \\'number\\'');
0 commit comments