Repository navigation
Add registerDrawingAction: host buttons on a selected drawing - #414
Conversation
Apps can now contribute an action to one drawing: an icon button on the toolbar that floats by a selected drawing (before its settings wheel) and a labelled button at the start of the drawing's settings dialog footer. The seam follows the legend-action pattern: a descriptor registry in the plugin SDK (`registerDrawingAction`, with a per-drawing `when` gate, optional `surfaces` and `order`), a provider both shells hand the renderer through the optional `setDrawingActions` port method, and the native renderer projecting the resolved views into its toolbar and dialog. `run` receives a fresh WidgetContext and the drawing re-read at click time; a multi-selection toolbar leaves the actions out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DR6sEXJjHhjbSfN4Qm4HGL
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DR6sEXJjHhjbSfN4Qm4HGL
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
…ctions # Conflicts: # CHANGELOG.md
|
The CLA check fails because the commits are authored by Generated by Claude Code |
Background
Apps built on Vela can add buttons to the topbar, the right-click menus and the indicator legend, but not to a selected drawing. The toolbar that floats by a selected drawing and its settings dialog are closed to hosts. An app that acts on drawings (an alert on a line, a note, a share link) can only reach them through the right-click menu, where users rarely look for them.
Summary
A new plugin SDK contribution,
registerDrawingAction, built the same way asregisterLegendAction:@luxalgo/vela/plugin):{ id, icon, label, when?(drawing), run(ctx, drawing), surfaces?, order? }.drawingis theSerializedDrawingthatchart.drawings.all()returns.setDrawingActions?(provider)method onIChartRenderer, also onRendererControl. Both shells wire the registry through it withdrawingActionsProviderFor, from cell build and fromrefreshActions().rungets a freshWidgetContext, and reads the drawing again at click time.Docs: the plugin SDK section, the renderer-author tier table, the user drawing guide, and the plugin skill. The changelog entry is under
[Unreleased].End-to-end verification
I tested in the playground (
npm run playground, Chromium via Playwright, live BTCUSDT 1h data from Binance):The playground registers a neutral demo action ("Show drawing info") on line drawings so reviewers can try it.
Checklist
npm run typecheck,npm run lint,npm test, andnpm run buildall passdocs/has been added / updated (for public interface or feature changes)CHANGELOG.mdhas an entry under[Unreleased](for user-visible changes)Future work
Generated by Claude Code