Panels
Term.Panels.PanelTerm.Panels.PanelTerm.Panels.PanelTerm.Panels.PanelTerm.Panels.PanelTerm.Panels.PanelTerm.Panels.content_as_renderableTerm.Panels.fix_layout_widthTerm.Panels.makecontent_lineTerm.Panels.parse_layout_argsTerm.Panels.parse_layout_argsTerm.Panels.parse_layout_argsTerm.Panels.parse_layout_argsTerm.Panels.renderTerm.Panels.@nested_panels
Term.Panels.Panel — TypePanelRenderable with a panel surrounding some content:
╭──────────╮
│ my panel │
╰──────────╯When constructing a Panel, several keyword arguments can be used to set its appearance:
- box::Symbol sets the
Boxtype for the Panel's border - style::String sets the box's style (e.g., color)
- title::Union{String,Nothing} sets the Panel's title
- title_style::Union{Nothing,String} sets the title's style
- title_justify::Symbol sets the location of the title
- subtitle::Union{String,Nothing} sets the Panel's subtitle
- subtitle_style::Union{Nothing,String} sets the subtitle's style
- subtitle_justify::Symbol sets the location of the subtitle
- justify::Symbol sets text's alignment (:left, :rigth, :center, :justify)
Term.Panels.Panel — MethodPanel(
content::Union{AbstractString,AbstractRenderable},
::Val{false},
padding::Padding;
height::Union{Nothing,Int} = nothing,
width::Int = 80,
kwargs...,
)Construct a Panel fitting content to it.
Content that is too large to fit in the given width will be trimmed. To avoid trimming, set fit=true when calling panel.
Term.Panels.Panel — MethodPanel(
content::Union{AbstractString,AbstractRenderable},
::Val{true},
padding::Padding;
height::Union{Nothing,Int} = nothing,
width::Union{Nothing,Int} = nothing,
trim::Bool = true,
kwargs...,
)Construct a Panel fitting the content's width.
If the content is larger than the console terminal's width, it will get trimmed to avoid overflow, unless trim=false is given.
Term.Panels.Panel — MethodPanel(
content::Union{AbstractString,AbstractRenderable};
fit::Bool = false,
padding::Union{Nothing,Padding,NTuple} = nothing,
kwargs...,
)Construct a Panel around an AbstractRenderable or AbstractString.
This is the main Panel-creating function, it dispatches to other methods based on the value of fit to either fith the Panel to its content or vice versa.
kwargs can be used to set various aspects of the Panel's appearance like the presence and style of titles, box type etc... see render below.
Term.Panels.Panel — MethodPanel(renderables; kwargs...)Panel constructor for creating a panel out of multiple renderables at once.
Term.Panels.Panel — MethodPanel(;
fit::Bool = false,
height::Int = 2,
width::Int = 80,
padding::Union{Vector,Padding,NTuple} = Padding(0, 0, 0, 0),
kwargs...,
)Construct a Panel with no content.
Examples
julia> Panel(height=5, width=10)
╭────────╮
│ │
│ │
│ │
╰────────╯
julia> Panel(height=3, width=5)
╭───╮
│ │
╰───╯Term.Panels.content_as_renderable — Methodcontent_as_renderable(content, width, Δw, justify)Convert any input content to a renderable
Term.Panels.fix_layout_width — Methodfix_layout_width(panel_call::Expr, depth::Int)::ExprGo through an Expr with a :call to a Panel and add a keyword argument expression with the correct width (using parse_layout_args). Also go through any other argument to the call to fix inner panels' width.
Term.Panels.makecontent_line — Methodmakecontent_line(cline, panel_measure, justify, background, padding, left, right)::SegmentCreate a Panel's content line.
Term.Panels.parse_layout_args — Functionfunction parse_layout_args endParse the arguments of a Expr(:call, :Panel, ...) to add a keyword argument to fix the panel's width. A few diferent menthods are defined to handle different combinations of args/kwargs for the Panel call.
Term.Panels.parse_layout_args — MethodPanel's args did not start with an Expr (e.g. a string)
Term.Panels.parse_layout_args — MethodPanels's first argument was an Expr, nested content!
Term.Panels.parse_layout_args — MethodPanel had no args/kwargs
Term.Panels.render — Methodrender(
content;
box::Symbol = :ROUNDED,
style::String = "default",
title::Union{String,Nothing} = nothing,
title_style::Union{Nothing,String} = nothing,
title_justify::Symbol = :left,
subtitle::Union{String,Nothing} = nothing,
subtitle_style::Union{Nothing,String} = nothing,
subtitle_justify::Symbol = :left,
justify::Symbol = :left,
text_justify::Bool=false,
panel_measure::Measure,
content_measure::Measure,
Δw::Int,
Δh::Int,
padding::Padding,
)::PanelConstruct a Panel's content.
Term.Panels.@nested_panels — Macromacro nested_panels(layout_call)Macro to automate layout of multiple nested Panel. The width of the panels is automatically adjusted based on the depth of eeach nested level.
Uses fix_layout_width recursively to add a keyword argument width to each Panel.