MingaEditor.HoverPopup (Minga v0.1.0)

Copy Markdown View Source

Immutable lifecycle value for hover content.

The value owns replacement, dismissal, focus, scrolling, expansion, and the optional open action. MingaEditor.HoverPopup.Presenter owns geometry.

Summary

Types

Action available from a focused hover popup.

t()

A hover popup lifecycle value.

Functions

Dismisses hover content.

Returns true when the popup can toggle to an expanded view.

Focuses the hover popup for scrolling.

Creates a lifecycle value from already parsed presentation content.

Creates hover content anchored at the cursor using pure markdown parsing.

Returns true when the popup exposes an Open action.

Returns a stable action name for native frontend metadata.

Replaces any prior popup value with newly produced hover content.

Scrolls content down by three lines.

Scrolls content up by three lines.

Toggles between collapsed and expanded content, resetting scroll.

Sets the action to execute when the popup's Open action is accepted.

Types

open_action()

@type open_action() ::
  atom()
  | {:goto_location, String.t(), non_neg_integer(), non_neg_integer()}
  | {:open_session, String.t(), String.t() | nil}

Action available from a focused hover popup.

t()

@type t() :: %MingaEditor.HoverPopup{
  alt_content_lines: [MingaAgent.Markdown.parsed_line()] | nil,
  anchor_col: non_neg_integer(),
  anchor_row: non_neg_integer(),
  content_lines: [MingaAgent.Markdown.parsed_line()],
  expanded?: boolean(),
  focused: boolean(),
  open_action: open_action() | nil,
  scroll_offset: non_neg_integer()
}

A hover popup lifecycle value.

Functions

dismiss(popup)

@spec dismiss(t() | nil) :: nil

Dismisses hover content.

expandable?(hover_popup)

@spec expandable?(t()) :: boolean()

Returns true when the popup can toggle to an expanded view.

focus(popup)

@spec focus(t()) :: t()

Focuses the hover popup for scrolling.

from_parsed_lines(content_lines, cursor_row, cursor_col, alternate \\ nil)

Creates a lifecycle value from already parsed presentation content.

new(markdown_text, cursor_row, cursor_col, opts \\ [])

@spec new(String.t(), non_neg_integer(), non_neg_integer(), keyword()) :: t()

Creates hover content anchored at the cursor using pure markdown parsing.

open_action?(hover_popup)

@spec open_action?(t()) :: boolean()

Returns true when the popup exposes an Open action.

open_action_name(action)

@spec open_action_name(open_action() | nil) :: String.t()

Returns a stable action name for native frontend metadata.

replace(current, popup)

@spec replace(t() | nil, t()) :: t()

Replaces any prior popup value with newly produced hover content.

scroll_down(popup)

@spec scroll_down(t()) :: t()

Scrolls content down by three lines.

scroll_up(popup)

@spec scroll_up(t()) :: t()

Scrolls content up by three lines.

toggle_expand(popup)

@spec toggle_expand(t()) :: t()

Toggles between collapsed and expanded content, resetting scroll.

with_open_action(popup, action)

@spec with_open_action(t(), open_action()) :: t()

Sets the action to execute when the popup's Open action is accepted.