PhiaUi.Components.Editor.Academic (phia_ui v0.1.17)

Copy Markdown View Source

Editor Academic Suite — 6 components for academic and scholarly writing tools.

Provides citation style selection, structure validation, abbreviation management, readability scoring, page numbering, and margin notes for building full-featured academic editors.

Components

Summary

Functions

Renders a table of abbreviation definitions with delete actions.

Renders a <select> dropdown for choosing a citation style.

Renders an absolutely positioned <aside> for side annotations.

Renders a "Page N of M" text display with configurable number format.

Renders a 0-100 progress bar showing readability score with color coding.

Renders a panel showing document structure rule violations.

Functions

abbreviation_manager(assigns)

Renders a table of abbreviation definitions with delete actions.

Each abbreviation is a map with :short and :full keys.

Example

<.abbreviation_manager
  id="abbr-mgr"
  abbreviations={[
    %{short: "HTML", full: "HyperText Markup Language"},
    %{short: "CSS", full: "Cascading Style Sheets"}
  ]}
/>

Attributes

  • id (:string) (required)
  • abbreviations (:list) - Defaults to [].
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

citation_style_selector(assigns)

Renders a <select> dropdown for choosing a citation style.

Example

<.citation_style_selector id="cite-style" value={:apa} />

Attributes

  • id (:string) (required)
  • value (:atom) - Defaults to :apa. Must be one of :apa, :abnt, :mla, :chicago, :harvard, or :ieee.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

margin_note(assigns)

Renders an absolutely positioned <aside> for side annotations.

Must be placed inside a position: relative parent container. The note appears on the specified side of the content area.

Example

<div class="relative">
  <p>Main content here...</p>
  <.margin_note id="note-1" side={:right}>
    This is a side annotation.
  </.margin_note>
</div>

Attributes

  • id (:string) (required)
  • side (:atom) - Defaults to :right. Must be one of :left, or :right.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

page_numbering(assigns)

Renders a "Page N of M" text display with configurable number format.

Formats:

  • :numeric — "Page 1 of 10"
  • :roman — "Page I of X"
  • :letter — "Page A of J"

Example

<.page_numbering current={3} total={15} format={:roman} />

Attributes

  • current (:integer) - Defaults to 1.
  • total (:integer) - Defaults to 1.
  • format (:atom) - Defaults to :numeric. Must be one of :numeric, :roman, or :letter.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

reading_level_indicator(assigns)

Renders a 0-100 progress bar showing readability score with color coding.

  • Red (score < 30): Difficult to read
  • Amber (score 30-59): Moderate readability
  • Green (score >= 60): Easy to read

When no score is provided, shows "Not calculated" placeholder.

Example

<.reading_level_indicator score={72} label="Grade 8" />

Attributes

  • score (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

structure_validator(assigns)

Renders a panel showing document structure rule violations.

Each violation is a map with :rule, :message, and :severity keys. Severity values: :error, :warning, :info.

Example

<.structure_validator
  id="validator"
  violations={[
    %{rule: "abstract", message: "Missing abstract section", severity: :error},
    %{rule: "heading", message: "Consider adding sub-headings", severity: :warning}
  ]}
/>

Attributes

  • id (:string) (required)
  • rules (:list) - Defaults to [].
  • violations (:list) - Defaults to [].
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.