Pure-function HTML scraper for PhoenixLiveGantt output. Takes the rendered
HTML string (as produced by PhoenixLiveGantt.gantt/1 →
Phoenix.HTML.Safe.to_iodata/1) and returns a structured geometry
map.
Used by tests, the mix phoenix_live_gantt.dump task, and any
IEx debugging session where "what does this chart actually look
like?" needs a structured answer rather than blind regex.
Path-string parsing is delegated to PhoenixLiveGantt.PathFormat,
which is also what the renderer uses to build paths — so parser and
builder always speak the same format.
Output shape
inspect_html/1 returns a map with these keys:
rows— event ids in document order, e.g.["wf-task-1", "wf-task-2", ...].row_positions—%{event_id => %{top:, height:, center:, bottom:}}, the px geometry of each label row (group headers advance y but get no entry of their own).bars—%{event_id => %{kind: :bar | :milestone, left:, width:, right:, top:, bottom:, parent_id:, ...}}. Milestones also carry ahit_box.parent_map—%{child_id => parent_id}scraped fromdata-parent-id, i.e. the sub-project tree (only EXPANDED sub-projects appear).subproject_frames— list of the translucent backing rectangles drawn behind expanded sub-projects:%{left_px:, top_y:, width:, height:, background_color:}.connectors— list of connector maps:%{ from: "wf-task-1", to: "wf-task-2", type: :fs | :ss | :ff | :sf, critical: bool, invalid: bool, raw_path: "M 100 20 H 110 V 60 H 156", segments: %{kind: :forward | :detour, x1: ..., y1: ..., ...} }arrowheads— list of arrowhead-overlay tips, one per connector:%{from:, to:, tip_x:, tip_y:}.edges— off-screen edge-indicator counts:%{earlier: int, later: int}.
All numeric values are integers (or floats if the path uses decimals).
Summary
Functions
Returns the arrow tip x (where the arrowhead sits).
Direct children of id (one level deep).
All connectors emerging from the given source id.
All connectors landing on the given target id.
Parse a PhoenixLiveGantt HTML render into a structured geometry map. See module doc for the output shape.
Returns the parent_id of id, or nil if it's top-level.
Returns the SOURCE attach y for a connector — the y where the arrow
emerges from the source bar's edge. Same for both forward and detour
shapes (it's segments.y1).
True iff id has at least one child currently in the DOM — i.e. an EXPANDED
sub-project. parent_map is scraped from rendered children, so a COLLAPSED
sub-project returns false even though its roll-up bar is on screen. Use it to
assert that a sub-project's children rendered, not as a general "is this a
sub-project" check.
Returns the TARGET attach y — where the arrow lands at the target.
Functions
Returns the arrow tip x (where the arrowhead sits).
Direct children of id (one level deep).
All connectors emerging from the given source id.
All connectors landing on the given target id.
Parse a PhoenixLiveGantt HTML render into a structured geometry map. See module doc for the output shape.
Returns the parent_id of id, or nil if it's top-level.
Returns the SOURCE attach y for a connector — the y where the arrow
emerges from the source bar's edge. Same for both forward and detour
shapes (it's segments.y1).
True iff id has at least one child currently in the DOM — i.e. an EXPANDED
sub-project. parent_map is scraped from rendered children, so a COLLAPSED
sub-project returns false even though its roll-up bar is on screen. Use it to
assert that a sub-project's children rendered, not as a general "is this a
sub-project" check.
Returns the TARGET attach y — where the arrow lands at the target.