Registers a chart instance for live updates.
The chart's current Maidr config (keyed by initial.id)
Invoked whenever the chart's data changes
How the chart can be reached from outside. One with no
navigator cannot be navigated; one with no probe reads as a chart
the reader is not inside; one with no commands runs no commands
A disposable that unregisters the instance
Replaces all data for a registered chart and notifies it.
The manager stores the passed reference without cloning; callers must not mutate the object after handing it over. (Consumers clone before giving it to the model layer, which does take ownership.)
The full replacement config; the target chart is maidr.id
True when a registered chart was updated
Replaces the stored data for a chart without notifying it. Used to keep the registry in sync with externally-driven updates (e.g. React prop changes on non-live charts).
Like setData, the reference is stored without cloning; callers must not mutate the object after handing it over.
The replacement config
Appends a single data point to a registered chart and notifies it.
The data point to append
Target chart (id) and layer/group; id may be omitted
when exactly one chart is registered
True when the point was merged and the chart notified
Moves a registered chart's cursor to a position the host chose.
The inbound half of the navigation contract: onNavigate tells the host
where the reader is, and this tells MAIDR where the host's own chart was
clicked, in the same {layerId, row, col} or {layerId, pointIndex}
currency. A chart the reader is inside moves and announces the mark at
once; a chart the reader is not focused on keeps the target and lands on
it when they next focus in, so a colleague can point at a mark before the
reader arrives. Passing null withdraws a kept target -- the host's
selection was cleared, and the reader should not be pulled to a mark that
is no longer selected.
The position, or null to withdraw a kept one
Where to deliver it, and who asked
Optionalid?: stringTarget chart; may be omitted when exactly one chart is registered
Who asked a chart to move, and whether to take the reader there, as LiveNavigator is told it.
OptionalbyAgent?: booleanAn in-browser agent asked, through the WebMCP tools, rather than the host
page. A target kept for the reader's next focus-in remembers which of the
two set it, so the reader switching agent access off can drop the
agent's and leave the host's. With null, only a target an agent kept
is withdrawn.
Optionalfocus?: booleanThe reader asked to be taken there: a reader who is not in the chart is
moved into it. The target is kept exactly as without this, then the chart
moves keyboard focus to its own focusable element and enters at once --
the focus-in a Tab to it makes, run without waiting a tick -- which
applies the target and announces it as it would for that Tab. So
LiveDataManager.inspect, asked right after, says whether the
reader arrived. Focus is never taken from a dialog in the chart's own
document -- a MAIDR dialog, in this chart or another, or one of the
page's own -- nor moved from elsewhere in the chart; a page that frames
the chart keeps its dialogs in another document, which the chart cannot
see, so that page must not ask while one is open. A page of its own
that does not have the browser's focus is left as it is: no page can
take that focus from the browser's own panels, and moving the page's
focus there would only drop the reader into the chart behind their
back. In a frame, focus is asked for regardless, since that is how a
frame receives it -- where the browser allows: WebKit does not without
the reader's own click or key -- and a frame that still does not have
it puts its own focus back. Either way, if the page does not have the
browser's focus, nothing is entered and the target stays kept for the
reader's next entry. Ignored with null, and for a reader already in
the chart.
True when a registered chart accepted the target
Returns the current data for a registered chart.
The chart id
The stored Maidr config, or undefined when not registered
Lists the ids of every registered chart, in registration order.
A fresh array; changing it does not affect the registry
Reports where the reader is in a registered chart, without moving or announcing anything.
A probe that throws is treated as a chart the reader is not inside: the question is advisory, and a caller asking it should never be the reason a page errors.
The chart id
Whether the reader is inside the chart, the text last spoken
for their position, and whether a MAIDR dialog holds their focus;
{ inChart: false, position: null, blocked: false } for a chart
that registered no probe, and null for an id that is not registered
Runs one of the reader's commands on a registered chart, through the executor the command palette uses: now while the reader is in the chart, or on their next focus-in while they are not.
The chart id
The keymap's name for the command
How to run it
How a caller asks a chart to run a command, as LiveCommandChannel.run is told it.
Optionalfocus?: booleanThe reader asked for it to happen now: a reader who is not in the chart is moved into it. The command is kept exactly as without this, then the chart takes keyboard focus and enters at once, as LiveNavigateOptions.focus describes, and the entry runs it as it runs kept commands for a reader who Tabs in. As there, a page that does not have the browser's focus enters nothing, and the command stays kept.
What became of it, or null for an id that is not registered or
a chart that registered no command channel
Reports a registered chart's command side -- the reader's modes, whether a command would be refused as blocked, and how many are waiting -- without changing or announcing anything.
A channel that throws reads as one that cannot say, for the reason inspect gives.
The chart id
The state; { modes: null, blocked: false, pending: 0 } for a
chart that registered no command channel, and null for an id that is
not registered
Drops everything an agent left waiting for the reader's next focus-in on every registered chart -- the target it kept and the commands it kept -- applying none of it, for when the agent is no longer allowed to ask, such as when the reader switched its tools off. A target the host page kept is the page's, and stays.
A channel that throws is reported and skipped, so one chart cannot keep the others' requests alive, nor its target its own commands.
Global registry that routes realtime data updates to mounted chart instances.
Each
<Maidr>instance registers itself by chart id. External producers (script-tag consumers viawindow.maidrLive, or React consumers via thedataprop) push updates through setData / appendData; the manager merges them and notifies the owning instance, which refreshes its model in place.