Skip to content

ui

panel_flowdash.ui

answer_card

The card of an answer in the Explore view or a chat: what it shows, where it came from, and where it can go.

A card has a human title and a caption ("13 rows · from turbines · line chart"), and tabs for the answer itself (Chart, Number or Data), the rows it was built from (Data) and the query that made them (SQL). Its footer adds it to a dashboard or report with a split button that remembers the last pick, refines it in a follow-up, copies or downloads its rows, and holds the rest in ⋮. On a phone the tabs, Copy and Download move into ⋮ and Add to… opens a bottom sheet.

The card only shows what :class:~panel_flowdash.explore.ExploreFeed hands it; the feed knows the exploration, the targets and how to add.

COPY_ROWS = 1000 module-attribute

MAX_ROWS = 50 module-attribute

MENTION_PATTERN = '@(?P<label>"(?:[^"\\\\]|\\\\.)*"|[^\\s"]\\S*)(?:\\s*\\((?P<node>[^()\\s]+)\\))?' module-attribute

RECENT_SHOWN = 3 module-attribute

SNACKBAR_MS = 8000 module-attribute

TABS = {'chart': ('Chart', 'bar_chart'), 'number': ('Number', 'pin'), 'data': ('Data', 'table_rows'), 'sql': ('SQL', 'code')} module-attribute

AddTarget dataclass

Somewhere an answer can be added: a new or existing dashboard or report.

asset_id instance-attribute
detail = '' class-attribute instance-attribute
icon property
kind instance-attribute
last_used = False class-attribute instance-attribute
new property
title instance-attribute

AddToMenu

Bases: Viewer

The targets of Add to…: New, recent dashboards and recent reports, and a search for the rest.

On a wide window it is a popup opening upwards from the button, so it does not cover the card's title; on a phone a bottom sheet.

parts property

The popup and the sheet, which go beside the button opening them: the popup anchors to it.

popup = pmui.Popup(body, anchor_origin={'vertical': 'top', 'horizontal': 'left'}, transform_origin={'vertical': 'bottom', 'horizontal': 'left'}, modal=False, label='Add to', css_classes=['fd-add-to-menu'], sx=self._paper_sx(400)) instance-attribute
search = pmui.TextInput(placeholder='Find another dashboard or report…', size='small', sizing_mode='stretch_width', margin=(4, 12, 8, 12), css_classes=['fd-add-to-search']) instance-attribute
close()
offer(targets, new_title, phone=False)

Open with targets; a new dashboard or report would be titled new_title.

AnswerCard

Bases: Viewer

One answer as a card: title, caption, tabs, and its actions.

The callables come from the feed: data returns the rows the answer was built from, or None; placed says where the answer is, e.g. "On Fleet Overview"; primary names the target the main button adds to directly, or None to make it open the menu; targets lists the menu's; add adds the answer to a target; refine hands the card to the composer. Without add or refine their buttons are left out.

add_button = pmui.Button(label='Add to…', icon='add', variant='contained', size='small', margin=0, sx=_MAIN_SX, css_classes=['answer-card-add']) instance-attribute
add_caret = pmui.Button(label='', icon='arrow_drop_down', variant='contained', size='small', margin=0, description='Other dashboards and reports', sx=_CARET_SX, css_classes=['answer-card-add-more']) instance-attribute
builds_on_button = None instance-attribute
copy_button = pmui.Button(icon='content_copy', label='', variant='text', color='default', sx=_ICON_ONLY_SX, description='Copy the data', size='small', margin=0, visible=self._frame is not None and not compact, css_classes=['answer-card-copy', 'answer-card-desktop']) instance-attribute
download = pmui.FileDownload(callback=self._csv, filename=f'{filename}.csv', label='', icon='download', variant='text', color='default', size='small', description='Download the data as CSV', margin=0, visible=self._frame is not None and not compact, sx=_ICON_ONLY_SX, css_classes=['answer-card-download', 'answer-card-desktop']) instance-attribute
key = key instance-attribute
kind = kind instance-attribute
menu = AddToMenu(self._pick) instance-attribute
more = pmui.MenuButton(icon='more_vert', label='', variant='text', size='small', color='default', description='More', margin=0, sx=_ICON_ONLY_SX, css_classes=['answer-card-more']) instance-attribute
placed_chip = pmui.Chip(label='', icon='check', size='small', color='success', variant='outlined', visible=False, margin=(0, 0, 0, 8), css_classes=['answer-card-placed']) instance-attribute
refine_button = pmui.Button(label='' if compact else 'Refine', description='Refine', icon='edit_note', variant='text', size='small', margin=0, visible=refine is not None, sx=_ICON_ONLY_SX if compact else _ICON_SX, css_classes=['answer-card-refine']) instance-attribute
tab = param.Selector(default='chart', objects=list(TABS), doc='The tab shown.') class-attribute instance-attribute
tab_buttons = pmui.RadioButtonGroup(options={TABS[k][0]: k for k in tabs}, value=kind, size='small', margin=0, visible=len(tabs) > 1 and not compact, sx=_TABS_SX, css_classes=['answer-card-tabs', 'answer-card-desktop']) instance-attribute
tabs = tabs instance-attribute
title = param.String(doc="The card's title, in words.") class-attribute instance-attribute
open_menu()

Open the menu of everywhere the answer can go: a popup, or a bottom sheet on a phone.

refresh()

Say again where the answer is and what the main button adds to.

show_tab(name)

Show the tab name: "chart", "number", "data" or "sql".

"chart" and "number" both mean the answer itself. A tab the card does not have is ignored.

update_data()

Read the rows again, e.g. after the answer's node ran anew.

ClipboardText

Bases: JSComponent

Holds the text a Copy button puts on the clipboard, which the button's own click reads.

The browser only lets a click write to the clipboard, so the text waits here, kept up to date, and the button's js_on_click copies it with :func:copy_on_click. It renders nothing, but must be on the page.

text = param.String(default='') class-attribute instance-attribute
copy()

Copy the text from the server, e.g. for a menu item; the browser allows it just after a click.

HoverArea

Bases: JSComponent

Holds a control and says whether the pointer, or the keyboard's focus, is on it.

hovered = param.Boolean(default=False, doc='Whether the pointer or the focus is on the control.') class-attribute instance-attribute
object = Child() class-attribute instance-attribute

Snackbar

Bases: Viewer

A short confirmation at the foot of the page with up to two actions, gone after a while.

open_button = pmui.Button(label='Open', variant='text', size='small', margin=0, css_classes=['fd-snackbar-open'], sx={'textTransform': 'none', 'color': 'primary.light'}) instance-attribute
paper = pn.Row(self.text, self.open_button, self.undo_button, self._close, visible=False, margin=0, styles=_SNACKBAR_STYLES, css_classes=['fd-snackbar']) instance-attribute
text = text_typography('', variant='body2', margin=(6, 8, 6, 0), sx={'color': 'inherit'}) instance-attribute
undo_button = pmui.Button(label='Undo', variant='text', size='small', margin=0, css_classes=['fd-snackbar-undo'], sx={'textTransform': 'none', 'color': 'primary.light'}) instance-attribute
hide()
show(text, on_open=None, on_undo=None, open_label='Open')

Say text, with Open and Undo where they are given.

answer_kind(title, component_id, role, tabular)

Return the tab an answer shows itself on: "chart", "number" or "data".

card_time(timestamp)

Return when a query ran, as the card says it: the time today, else the date and time.

copy_on_click(button, clip)

Make a click on button copy the text clip holds.

derive_title(question, limit=60)

Return a card title made from the question asked: its first sentence, capitalised, without the question mark.

find_sql(editor, nodes)

Return the first of nodes whose config holds a query, as the query and the node.

A host's SQL component keeps its query in its config's sql, as Lumen's does.

format_value(value, column='')

Return a cell's value as people read it: thousands separated, a few decimals, years as years.

frame_text(frame, sep='\t', max_rows=None)

Return frame, or its first max_rows rows, as delimited text with a header, as Copy puts it on the clipboard.

humanize(name)

Return a column name in words: capacity_mw reads "Capacity (MW)", tCap "T cap".

sql_html(sql)

Return sql as a pre block, its keywords, numbers and strings marked for colour.

table_html(frame, labels=None, max_rows=MAX_ROWS)

Return frame as an HTML table with headers in words over the column names, numbers formatted.

labels gives a column's label where the host knows a better one than :func:humanize. The table ends with the rows it holds; at most max_rows are shown.

chat_dashboards

From a chat's answers to dashboards and reports: where to add an answer, and making one from several.

A chat, a dashboard of kind "chat", builds its answers in an exploration like any Explore view, but its "Add to…" asks where to: a new dashboard or a new report named from the question, or one of the person's recent dashboards and reports, the one the chat last added to first (:class:AddTargetDialog). On a report the answer becomes a block at its end. "Make a dashboard" makes a new one from the answers picked, a dashboard laid out, a report with a block per answer (:class:MakeDashboardDialog). Both copy through :class:~panel_flowdash.agent.exploration.ExplorationOps.

NEW_DASHBOARD = '__new__' module-attribute

NEW_KINDS = {NEW_DASHBOARD: DASHBOARD_KIND, NEW_REPORT: REPORT_KIND} module-attribute

NEW_REPORT = '__new_report__' module-attribute

logger = logging.getLogger(__name__) module-attribute

AddTargetDialog

Bases: _ChatDialog

Asks where a chat's answer goes: a new dashboard or report, or a recent one, the last pick first.

answer property

The answer being added, as its run and node.

target = pmui.Select(label='Add to', groups={'New': {'New dashboard': NEW_DASHBOARD}}, value=NEW_DASHBOARD, sizing_mode='stretch_width', css_classes=['fd-add-target']) instance-attribute
offer(run, node, question=None)

Open the dialog for adding the answer node of run run, asked as question.

MakeDashboardDialog

Bases: _ChatDialog

Picks a chat's answers and makes one new dashboard, laid out, or report from them.

confirm_label = 'Make' class-attribute instance-attribute
empty = pmui.Typography('This chat has no answers to make a dashboard from yet.', variant='body2', visible=False, margin=(0, 10)) instance-attribute
kind = pmui.RadioButtonGroup(options={'Dashboard': DASHBOARD_KIND, 'Report': REPORT_KIND}, value=DASHBOARD_KIND, size='small', margin=(0, 10, 8, 10), css_classes=['fd-make-kind']) instance-attribute
picked = pmui.CheckBoxGroup(options={}, value=[], inline=False, margin=(0, 10), css_classes=['fd-make-answers']) instance-attribute
offer()

Open the dialog with the chat's answers, picking those added somewhere, else all.

chat_page

The chat page's chrome: the chat bar, the "In this chat" outline and the composer's scope chip.

A chat is read, not edited like a dashboard, so it has none of a dashboard's chrome (Dashboard | Report, Edit, Refresh, full screen). Its bar holds the editable title, how many answers it has and when it was last asked, Make a dashboard and an overflow menu; on a phone it is a back button, the title and the menu. The outline lists the chat's answers to the right of the reading column at desktop width and marks the one in view. The scope chip in the composer is the one place to see and change the data the chat reads.

OUTLINE_BREAKPOINT = 1280 module-attribute

READING_WIDTH = 820 module-attribute

ChatBar

Bases: Viewer

The bar above a chat: its title, answer count and time, Make a dashboard and a menu.

back = pmui.IconButton(icon='arrow_back', description='Back to chats', size='small', margin=(0, 4, 0, 0), stylesheets=[_ON_PHONE_ONLY], css_classes=['fd-chat-back']) instance-attribute
editable = param.Boolean(default=True, doc='Whether the title may be changed.') class-attribute instance-attribute
field = pmui.TextInput(visible=False, size='small', margin=0, sizing_mode='stretch_width', max_width=520, css_classes=['fd-chat-title-field']) instance-attribute
heading = pmui.Typography('', variant='subtitle1', disable_math=True, margin=0, sx={'fontWeight': 500, 'fontSize': '1.05rem', 'whiteSpace': 'nowrap', 'overflow': 'hidden', 'textOverflow': 'ellipsis'}, align='center', min_width=0, styles={'flex': '0 1 auto', 'min-width': '0'}, css_classes=['fd-chat-title']) instance-attribute
make = make instance-attribute
menu = pmui.MenuButton(label='', icon='more_vert', variant='text', color='default', size='small', margin=(0, 0, 0, 8), sx=_OVERFLOW_SX, description='More chat actions', css_classes=['fd-chat-menu']) instance-attribute
meta = param.String(default='', doc='How many answers it has and when it was last asked.') class-attribute instance-attribute
note = pmui.Typography('', variant='caption', margin=(0, 8), align='center', sx={'color': 'text.secondary', 'whiteSpace': 'nowrap'}, stylesheets=[_OFF_PHONE], css_classes=['fd-chat-meta']) instance-attribute
rename = pmui.IconButton(icon='edit', description='Rename the chat', size='small', margin=(0, 4), sx={'color': 'text.secondary', '& .MuiSvgIcon-root, & .material-icons': {'fontSize': 16}}, stylesheets=[_OFF_PHONE], css_classes=['fd-chat-rename']) instance-attribute
title = param.String(default='', doc="The chat's title.") class-attribute instance-attribute
start_rename()

Swap the title for a field to type the new one in; Enter keeps it.

ChatOutline

Bases: Viewer

The chat's answers, listed to the right of the reading column, with the one in view marked.

active = param.Integer(default=None, allow_None=True, doc='The index of the answer in view.') class-attribute instance-attribute
items = param.List(default=[], doc='Dicts with a ``label``, an ``icon`` and a ``key``.') class-attribute instance-attribute
list = pmui.MenuList(items=[], dense=True, margin=0, sizing_mode='stretch_width') instance-attribute

ScopeChip

Bases: Viewer

The chat's scope in its composer: the data it reads, and a menu to add or take some out.

button = pmui.MenuButton(label='', icon='dataset', variant='outlined', color='default', size='small', margin=0, css_classes=['fd-chat-scope']) instance-attribute
highlighted = param.Boolean(default=False, doc='Whether the chip is pointed out, e.g. by a notice.') class-attribute instance-attribute
offered = param.List(default=[], item_type=DataChip, doc='The data chips that may be added.') class-attribute instance-attribute
scope = param.List(default=[], item_type=DataChip, doc='The data chips the chat is scoped to.') class-attribute instance-attribute

answers_meta(count, last, working, now=None)

Return the chat bar's note: "3 answers · today 10:45", or "working" while asking.

chat_steps

The chat page's answers: "What I did" in plain words, notices, and a failed run's Retry.

:class:AnswerChat is panel-agents' AgentChat in its document layout, with each run's tool and model calls folded into one :class:WhatIDid block instead of a row per call. Collapsed, the block is one sentence built from the steps ("Looked at turbines · drew a chart · 3.6 s"); open, it lists each step in plain words (see :mod:panel_flowdash.agent.step_text) with what it touched and its time, and the model and call count at its foot, with the model calls and the trace one click further. It opens itself while the answer is made and when a step failed. Tokens and cost are never shown under an answer.

A step can raise a notice (:class:~panel_flowdash.agent.step_text.ChatNotice), shown under the block with its actions, e.g. data outside the chat's scope; a run that stopped with an error shows one with Retry, Retry with another model and Show details.

TICK_MS = 1000 module-attribute

AnswerChat

Bases: AgentChat

An AgentChat whose runs say what they did in a :class:WhatIDid block each.

It overrides AgentChat internals, which is why panel-agents is capped below 0.2. _regroup is panel-agents' own with WhatIDid in place of its step row; once panel-agents' step_group factory (panel-extensions/panel-agents#69) is released, step_group=WhatIDid replaces the copy, with WhatIDid.update hiding its members' messages.

column_width = param.Integer(default=None, allow_None=True, doc='The width of the reading column the messages and the composer are centred in.') class-attribute instance-attribute
footer_lead = param.List(default=[], doc="Shown first in the composer's footer, before the model picker, e.g. the chat's scope chip.") class-attribute instance-attribute
on_notice_action = param.Callable(default=None, allow_None=True, doc="\n Called with a notice's :class:`~panel_flowdash.agent.step_text.NoticeAction`,\n the run id and, for a menu, the item picked, for actions the chat does\n not carry out itself.") class-attribute instance-attribute
on_show_sql = param.Callable(default=None, allow_None=True, doc="\n Called with a run id and the tool call that ran SQL to show the SQL on\n the run's card. None leaves the link out.") class-attribute instance-attribute
on_trace = param.Callable(default=None, allow_None=True, doc='Called with a run id to open its trace. None leaves Open the trace out.') class-attribute instance-attribute
queue_note = pmui.Typography('', disable_math=True, variant='caption', visible=False, margin=(0, 0, 4, 0), sx={'color': 'text.secondary', 'textAlign': 'center', 'display': 'block'}, sizing_mode='stretch_width', css_classes=['fd-queued-question']) instance-attribute
queued = param.String(default=None, allow_None=True, doc='The question typed while an answer was being made, asked once it is done.') class-attribute instance-attribute
scope_notice = param.Boolean(default=False, doc="\n Whether the latest answer raised a notice pointing at the chat's scope\n (``ChatNotice.highlight_scope``), until the next question is asked.") class-attribute instance-attribute
waiting_placeholder = param.String(default='Type your next question; it waits until this answer is done', doc="The composer's placeholder while an answer is being made.") class-attribute instance-attribute
can_trace(run_id)
notice_action(action, run_id, picked=None)

Carry out a notice's action, or hand it to on_notice_action.

open_trace(run_id)
submit(text) async

Notice

Bases: Viewer

A notice under an answer: what happened, and what to do about it.

buttons = [] instance-attribute
details = pn.pane.HTML(f'''<pre class="fd-notice-details-text">{escape(notice.details or '')}</pre>''', visible=False, margin=(8, 0, 0, 0), sizing_mode='stretch_width', stylesheets=[_DETAILS_CSS], css_classes=['fd-notice-details']) instance-attribute
notice = notice instance-attribute
toggle_details()

WhatIDid

The steps of one run as one block: a sentence that opens to a row per step.

It stands in for panel-agents' folded step group, so it has the group's message, calls, expanded, update, toggle and release.

body = pn.Column(self.steps, self.sql_links, self.foot, self.model_calls, margin=0, sizing_mode='stretch_width', visible=False) instance-attribute
box = pn.Column(pn.Row(self.header, self.failed_note, margin=0), self.body, margin=0, sizing_mode='stretch_width', css_classes=['fd-what-i-did'], stylesheets=[_BOX_CSS]) instance-attribute
calls = [] instance-attribute
chat = chat instance-attribute
expanded = False instance-attribute
failed_note = pmui.Typography('', variant='body2', visible=False, margin=(0, 0, 0, 4), sx={'color': 'error.main', 'whiteSpace': 'nowrap', 'alignSelf': 'center'}, css_classes=['fd-what-i-did-failed']) instance-attribute
foot = pn.Row(self.model_label, pn.layout.HSpacer(), self.models_button, self.trace_button, margin=(4, 0, 0, 32), sizing_mode='stretch_width', css_classes=['fd-what-i-did-foot']) instance-attribute
header = pmui.Button(variant='text', size='small', margin=0, sx=_HEADER_SX, css_classes=['fd-what-i-did-summary'], stylesheets=[_SPIN_CSS], on_click=lambda _event: self.toggle()) instance-attribute
message = pmui.ChatMessage(pn.Column(self.box, self.notices, self.placeholder, margin=0, sizing_mode='stretch_width'), **chat._message_params(user, None, compact=True, css_classes=['fd-what-i-did-message'])) instance-attribute
model_calls = pn.pane.HTML('', margin=0, visible=False, stylesheets=[_CSS], css_classes=['fd-model-call-list']) instance-attribute
model_calls_of property
model_label = pmui.Typography('', variant='caption', margin=0, disable_math=True, sx={'color': 'text.secondary', 'alignSelf': 'center'}) instance-attribute
models_button = pmui.Button(label='Show model calls', variant='text', size='small', margin=0, sx={'textTransform': 'none'}, css_classes=['fd-show-model-calls'], on_click=lambda _event: self._toggle_models()) instance-attribute
notice_views = [] instance-attribute
notices = pn.Column(margin=0, sizing_mode='stretch_width', css_classes=['fd-notices']) instance-attribute
placeholder = pn.pane.HTML(_PLACEHOLDER_HTML, margin=(12, 0, 0, 0), sizing_mode='stretch_width', visible=False, stylesheets=[_PLACEHOLDER_CSS], css_classes=['fd-answer-placeholder']) instance-attribute
run_id property
steps = pn.pane.HTML('', margin=0, sizing_mode='stretch_width', stylesheets=[_CSS], css_classes=['fd-steps']) instance-attribute
tool_calls property
trace_button = pmui.Button(label='Open the trace', variant='text', size='small', margin=0, sx={'textTransform': 'none'}, css_classes=['fd-open-trace'], on_click=lambda _event: self.chat.open_trace(self.run_id)) instance-attribute
release()
toggle()
update(calls)

chats

The signed-in person's chats: the Chats rail section and the page listing them.

A chat is a :class:~panel_flowdash.asset_store.AssetModel of kind "chat", private to its owner and kept out of every dashboard listing. It opens at its dashboard route, on the Explore view.

CHATS_ORDER = -1 module-attribute

CHATS_ROUTE = 'chats' module-attribute

CHATS_SECTION_ID = 'chats' module-attribute

ChatList

Bases: Viewer

The Chats page: the session's chats, newest first, each with Rename and Delete.

chats property

The chats listed, in order.

refresh()

List the session's chats again.

chat_items(ctx)

List the session's chats as rail items, newest first, with when each last changed.

chats_section()

Build the built-in Chats section, listed when FlowDashApp.chats is on.

own_chats(app)

Return the chats of the session's identity, most recently updated first.

choice_group

A single-choice list of options with a title and a description each, as an ARIA radio group.

ChoiceGroup

Bases: JSComponent

Pick one of items, each {"label": ..., "description": ..., "icon": ...}.

It is a radiogroup labelled label whose options are radio elements with aria-checked, reached with one Tab stop: the arrow keys move between the options and choose, Home and End go to the first and the last, and Enter or Space chooses the focused option.

index = param.Integer(default=0, bounds=(0, None), doc='The index of the chosen option.') class-attribute instance-attribute
items = param.List(default=[], doc='The options: dicts with a label, a description and an icon.') class-attribute instance-attribute
label = param.String(default='', doc='The accessible name of the group.') class-attribute instance-attribute

choice_widgets

The widgets the inspector's config form uses for fields that offer choices.

EMPTY = 'Not set' module-attribute

ChoiceMultiSelect

Bases: _KeepValue, MultiChoice

A multi-select of a list field's choices.

ChoiceSelect

Bases: _KeepValue, Select

A dropdown of a field's choices.

OptionalFloatInput

Bases: _ShowsNone, FloatInput

A number field that may be left empty.

value = param.Number(default=None, allow_None=True) class-attribute instance-attribute

OptionalIntInput

Bases: _ShowsNone, IntInput

An integer field that may be left empty.

value = param.Integer(default=None, allow_None=True) class-attribute instance-attribute

SuggestInput

Bases: _KeepValue, AutocompleteInput

A text field suggesting a field's choices.

choice_widget(parameter, choices, current)

Return the pn.Param widget spec for a field with choices holding current.

A list field gets a multi-select, a field restricted to its choices a dropdown, and any other a text field suggesting them. A dropdown offers an empty option when the field may be left empty. A current value that is not among the choices stays selectable, marked as not available, so showing the form never changes the config.

form_widgets(state, names, choices)

Return the widget specs of the fields of state among names that need one.

Fields with choices get :func:choice_widget, others :func:plain_widget where Panel's default would not let them be left empty.

plain_widget(parameter, current)

Return the widget spec for a field without choices, or None for Panel's default.

A list selector is a multi-select and a selector a dropdown, either keeping a value its objects no longer hold, marked as not available, and a dropdown offering an empty option if the selector allows None. An optional number shows None as empty rather than as 0 or its lower bound. A number format, a list of thresholds, a text field marked as code and a spec with settings get their own editors, see :mod:panel_flowdash.ui.number_widgets, :mod:panel_flowdash.ui.code_field and :mod:panel_flowdash.ui.spec_field.

setting_choices(choices, name)

Return the choices of the settings of the spec field name, by setting path.

widgets_key(widgets)

Return a comparable summary of widget specs, to tell whether a form must be rebuilt.

A spec field takes new choices in place, so they are left out.

code_field

A compact code field for config parameters holding code, SQL, JSON or Markdown.

A text param declares the field with its FlowDash metadata::

sql = param.String(metadata={"flowdash": {"widget": "code", "language": "sql"}})

and a JSON-schema property with "x-flowdash": {"widget": "code", "language": "sql"}. The inspector shows a read-only snippet of the first few lines with its line count, check status and an Edit button opening the full text in the editor's code panel under the canvas when it has room for one, see :class:~panel_flowdash.ui.code_panel.CodePanel, or in a dialog.

ACE_THEME_CSS = '\n.ace_editor .ace_marker-layer .ace_active-line,\n.ace_editor .ace_gutter-active-line {\n background: var(--mui-palette-action-hover, rgba(0, 0, 0, 0.04)) !important;\n}\n.ace_editor .ace_marker-layer .ace_selection {\n background: rgba(var(--mui-palette-primary-mainChannel, 0 114 181) / 0.3) !important;\n}\n' module-attribute

CODE_WIDGET = 'code' module-attribute

FORMATTERS = {'json': format_json} module-attribute

AceFocus

Bases: JSComponent

Focuses the Ace editor with the :attr:focus_class CSS class when :attr:focus is bumped.

The editor may render in a dialog, outside this component's layout, once the dialog opens, so it is looked for across the page until it shows.

focus = param.Integer(default=0) class-attribute instance-attribute
focus_class = param.String(default='') class-attribute instance-attribute

AceTools

Bases: JSComponent

Adds diagnostics, completions and a Run key to the Ace editor with :attr:target_class.

Each diagnostic, {"row", "column", "end_column", "text", "suggestion"} with 0-based rows and columns, gets an error marker in the gutter, a squiggle under its text and its message in a line under it, with a button applying the suggestion if it has one. :attr:completions, {"value", "meta"} each, are offered while typing. Ctrl+Enter (Cmd+Enter on macOS) sends a run message with the editor's text, and with :attr:can_format Shift+Alt+F a format message. Setting :attr:replacement puts its text in the editor as one edit, which Ctrl+Z undoes. The component itself shows the cursor position, e.g. Ln 5, Col 19.

can_format = param.Boolean(default=False, doc='Whether Shift+Alt+F sends a format message.') class-attribute instance-attribute
closing = param.Integer(default=0, doc='Bumped to close the completion popup.') class-attribute instance-attribute
completions = param.List(default=[]) class-attribute instance-attribute
diagnostics = param.List(default=[]) class-attribute instance-attribute
focus = param.Integer(default=0) class-attribute instance-attribute
on_format = on_format instance-attribute
on_run = on_run instance-attribute
replacement = param.Dict(default={}, doc='``{text, seq}``: the text to put in the editor, once per ``seq``.') class-attribute instance-attribute
scroll_margin = param.Integer(default=0, doc='Pixels the editor scrolls past its last line, so it clears what is below.') class-attribute instance-attribute
target_class = param.String(doc='The CSS class of the CodeEditor to extend.') class-attribute instance-attribute
replace(text)

Put text in the editor as one edit, which Ctrl+Z undoes.

CodeField

Bases: CompositeWidget

A read-only code snippet with line count, check status and an Edit button.

Clicking Edit calls :attr:on_edit when set, otherwise opens a large Ace dialog where edits are applied when the editor loses focus. :attr:unsent is True while the editor holds text it has not applied yet.

check_status = param.Parameter(default=None, doc='\n Optional ``(kind, label)`` pair shown in the snippet footer, where\n *kind* is ``"ok"``, ``"error"`` or ``"warning"``.') class-attribute instance-attribute
edit_button = pmui.Button(label='Edit', icon='edit', variant='text', size='small', margin=0, sx={'minWidth': 0, 'textTransform': 'none', 'py': '2px', 'px': '8px', 'fontSize': '0.75rem', 'flexShrink': 0}, css_classes=['fd-code-expand', 'fd-code-edit']) instance-attribute
expand_button = self.edit_button instance-attribute
language = param.String(default='text') class-attribute instance-attribute
on_edit = param.Callable(default=None, doc='\n Optional callback invoked as ``on_edit(field)`` when Edit is clicked,\n replacing the default dialog.') class-attribute instance-attribute
unsent = param.Boolean(default=False, doc='\n Whether text typed into the editor has not been applied yet.') class-attribute instance-attribute
value = param.String(default='', allow_None=True) class-attribute instance-attribute
open_dialog()

Open the full-size code dialog and focus its editor.

code_formatter(parameter)

Return what formats the code field parameter: its own formatter or its language's, if any.

code_language(parameter)

Return the language a text param is edited as code in, or None if it is plain text.

format_json(text)

Return the JSON text indented by two spaces, keys in the order written.

Raises:

Type Description
ValueError

If text is not valid JSON.

register_formatter(language, formatter)

Format every code field in language with formatter, or with none if it is None.

The registry is global to the process, so it applies to every app and session served.

A formatter takes the text and returns it formatted, raising an exception if it cannot, e.g. lambda sql: sqlglot.transpile(sql, pretty=True)[0]. A code field may declare its own, which takes precedence::

sql = param.String(metadata={"flowdash": {
    "widget": "code", "language": "sql", "formatter": format_sql}})

code_panel

The code panel docked under the canvas, or in the sidecar's Spec tab: a node's spec beside its result.

The editor opens it for one node, see :meth:~panel_flowdash.editor.FlowDash.open_code_panel, and while it is open it follows the node selected on the canvas. It edits the node's spec, what the node does rather than its settings, which stay in the inspector: a code field, e.g. a query, as text, or a dict declaring a spec form, e.g. a chart spec, as a form of its settings, as YAML or as JSON, see :class:~panel_flowdash.ui.spec_field.SpecEditor. The browser remembers the view picked. A node without a spec shows its result only, beside what defines it, read only, if its component has a __flowdash_definition__ hook, see :func:~panel_flowdash.ui.node_preview.call_definition_hook.

Format (Shift+Alt+F) lays out a spec's text, or code whose field or language has a formatter, see :func:~panel_flowdash.ui.code_field.register_formatter, as an edit of the draft that Ctrl+Z undoes.

The edit is a draft until Run (or Ctrl+Enter) applies it as one edit. With "Run on change" on, the default for a spec, a form edit runs at once, spec text once it parses and typing pauses, and code after a pause in typing. A component with a check_config has the draft checked first, see :class:~panel_flowdash.ui.config_draft.ConfigDraft: a draft that fails stays in the editor with the problems marked on their lines, and the result keeps showing the node's last good output. While the result does not match the draft, or a run is in flight, the result is dimmed under a badge saying so. Drafts not run are kept per node and field while the panel shows another node or is closed.

FORMAT_SHORTCUT = 'Shift+Alt+F' module-attribute

HEADER_HEIGHT = 48 module-attribute

MAX_ROWS = 500 module-attribute

MIN_PANE_HEIGHT = 140 module-attribute

MIN_PANE_WIDTH = 240 module-attribute

RUN_DELAY = 0.8 module-attribute

RUN_ON_CHANGE = {'spec': True, 'code': False} module-attribute

SPEC_VIEWS = {'Form': 'form', 'YAML': 'yaml', 'JSON': 'json'} module-attribute

SPLIT_SIZES = (40.0, 60.0) module-attribute

STACKED_SIZES = (60.0, 40.0) module-attribute

STALE_DELAY = 0.3 module-attribute

TEXT_VIEWS = {'YAML': 'yaml', 'JSON': 'json'} module-attribute

logger = logging.getLogger(__name__) module-attribute

CodePanel

Bases: Viewer

Edits the spec of one node beside the node's result, applying the draft on Run.

can_dock_bottom = param.Boolean(default=True, doc='Whether the window is wide enough to offer moving the panel under the canvas.') class-attribute instance-attribute
close_button = pmui.IconButton(icon='close', description='Close the code panel', size='small', margin=(0, 8, 0, 2), align='center', css_classes=['fd-code-close']) instance-attribute
code = CodeEditor(value='', value_input='', language='text', on_keyup=False, keyboard_accessible=True, soft_wrap=True, sizing_mode='stretch_both', min_height=80, margin=0, css_classes=[_EDITOR_CLASS], stylesheets=[ACE_THEME_CSS]) instance-attribute
collapse_button = pmui.IconButton(icon='expand_more', description='Collapse the code panel', size='small', margin=(0, 2), align='center', css_classes=['fd-code-collapse']) instance-attribute
collapsed = param.Boolean(default=False, doc='Whether only the header is shown.') class-attribute instance-attribute
definition = CodeEditor(value='', language='text', readonly=True, sizing_mode='stretch_both', min_height=80, margin=0, visible=False, css_classes=['fd-code-definition'], stylesheets=[ACE_THEME_CSS]) instance-attribute
dirty = param.Boolean(default=False, doc="Whether the draft differs from the node's config.") class-attribute instance-attribute
discard_button = pmui.IconButton(icon='undo', description='Discard the draft', size='small', margin=(0, 2), align='center', visible=False, css_classes=['fd-code-discard']) instance-attribute
discard_stale_button = pmui.Button(label='Discard', variant='text', size='small', margin=(0, 4, 4, 0), sx={'textTransform': 'none'}, css_classes=['fd-code-discard-stale']) instance-attribute
dock = param.Selector(default='bottom', objects=['bottom', 'sidecar'], doc="\n Where the panel is shown: under the canvas, or in the sidecar's Spec\n tab, where its code and result are stacked.") class-attribute instance-attribute
dock_button = pmui.IconButton(icon='view_sidebar', description='Open in sidecar', size='small', margin=(0, 2), align='center', css_classes=['fd-code-dock-toggle']) instance-attribute
editor = param.Parameter(doc='The FlowDash editor holding the node.') class-attribute instance-attribute
expand_button = pmui.IconButton(icon='expand_less', description='Expand the code panel', size='small', margin=(0, 2), align='center', visible=False, css_classes=['fd-code-expand-panel']) instance-attribute
field = param.String(default=None, allow_None=True, doc='The spec field edited, a code field or a spec dict; None for a node without one.') class-attribute instance-attribute
field_toggle = pmui.RadioButtonGroup(options={}, size='small', margin=(0, 12, 0, 0), align='center', visible=False, styles={'min-width': '0', 'overflow-x': 'auto', 'flex': '0 1 auto'}, sx={'flexWrap': 'nowrap', '& .MuiToggleButton-root': {'py': '1px', 'px': '10px', 'fontSize': '0.75rem', 'lineHeight': '20px', 'textTransform': 'none', 'whiteSpace': 'nowrap'}}, css_classes=['fd-code-field-switch']) instance-attribute
fix_json_button = pmui.Button(label='Fix in YAML', variant='text', size='small', margin=(0, 12, 4, 12), sx={'textTransform': 'none'}, css_classes=['fd-code-fix-json']) instance-attribute
format_button = pmui.Button(label='Format', icon='format_align_left', variant='text', size='small', margin=(0, 8, 0, 0), align='center', visible=False, description=f'Format the code ({FORMAT_SHORTCUT})', sx={'textTransform': 'none', 'py': '1px', 'fontSize': '0.75rem'}, css_classes=['fd-code-format']) instance-attribute
has_drafts property

Whether an edit typed in the panel has not been run, shown or held for later.

instance_id = param.String(default=None, allow_None=True, doc='The node shown.') class-attribute instance-attribute
keep_draft_button = pmui.Button(label='Keep draft', variant='text', size='small', margin=(0, 4, 4, 12), sx={'textTransform': 'none'}, css_classes=['fd-code-keep-draft']) instance-attribute
on_close = param.Callable(default=None, doc="Called when the panel's close button is pressed.") class-attribute instance-attribute
outputs = pmui.RadioButtonGroup(options=[], size='small', margin=(0, 12, 0, 0), align='center', sx={'& .MuiToggleButton-root': {'py': '1px', 'px': '10px', 'fontSize': '0.75rem', 'lineHeight': '20px', 'textTransform': 'none'}}, css_classes=['fd-code-outputs']) instance-attribute
run_button = pmui.Button(label='Run', icon='play_arrow', variant='contained', size='small', margin=(0, 4), align='center', description='Run the draft (Ctrl+Enter)', css_classes=['fd-code-run'], sx={'textTransform': 'none'}) instance-attribute
run_on_change = param.Boolean(default=False, doc='\n Whether an edit runs the draft without pressing Run, for the field\n shown. It starts on for a spec and off for code, see\n :data:`RUN_ON_CHANGE`, and is remembered for each while the panel lives.') class-attribute instance-attribute
run_switch = pmui.Switch(label='Run on change', value=self.param.run_on_change, margin=(0, 8), size='small', align='center', stylesheets=['.MuiFormControlLabel-label { font-size: 0.8125rem; white-space: nowrap; }'], css_classes=['fd-code-run-on-change']) instance-attribute
running = param.Boolean(default=False, doc='Whether a run of the draft is in flight.') class-attribute instance-attribute
spec_editor = SpecEditor(mode='form', syntax=self.spec_text, margin=0) instance-attribute
spec_text = param.Selector(default='yaml', objects=list(TEXT_VIEWS.values()), doc="The syntax of a spec's text, the one last picked; a spec without a form shows it.") class-attribute instance-attribute
spec_tools = AceTools(target_class=_SPEC_TEXT_CLASS, on_run=self.run, on_format=self.format, scroll_margin=8, margin=0, align='center') instance-attribute
spec_view = param.Selector(default='form', objects=list(SPEC_VIEWS.values()), doc='The view of a spec: its form, or its text as YAML or JSON.') class-attribute instance-attribute
stale = param.Selector(default=None, objects=[None, 'draft', 'running'], doc='\n Whether the result shown does not match the draft: a ``"draft"`` not\n run, or ``"running"``.') class-attribute instance-attribute
stale_run_button = pmui.Button(label='Run', icon='play_arrow', variant='text', size='small', margin=(0, 4, 0, 0), align='center', description='Run the draft (Ctrl+Enter)', sx={'textTransform': 'none', 'py': '1px', 'fontSize': '0.75rem'}, css_classes=['fd-code-stale-run']) instance-attribute
tools = AceTools(target_class=_EDITOR_CLASS, on_run=self.run, on_format=self.format, scroll_margin=8, margin=0, align='center') instance-attribute
view_toggle = pmui.RadioButtonGroup(options=SPEC_VIEWS, value=self.spec_view, size='small', margin=(0, 12, 0, 0), align='center', sx={'& .MuiToggleButton-root': {'py': '1px', 'px': '10px', 'fontSize': '0.75rem', 'lineHeight': '20px', 'textTransform': 'none'}}, css_classes=['fd-code-spec-view']) instance-attribute
can_edit(instance_id, field=None)

Whether the panel can show the node instance_id, editing its spec field field.

Without a field it shows the node's result only.

discard()

Put the node's spec back in the editor, dropping the draft.

discard_stale_draft()

Drop the held draft written against an older version of the field.

drafted_fields(instance_id)

Return the spec fields of the node instance_id holding an edit that was not run.

drop_all_drafts()

Forget every draft, the one shown included.

drop_drafts(instance_id)

Forget the drafts held for the node instance_id, e.g. once it is removed.

format(text=None)

Lay out the text in the editor, as an edit of the draft that Ctrl+Z undoes.

text is the editor's text as sent with Shift+Alt+F, which may be ahead of what the server has. Text that does not parse is left as it is, with the problem said under it.

keep_stale_draft()

Show the held draft written against an older version of the field.

open(instance_id, field=None, focus=True)

Show the node instance_id, editing its spec field field, keeping the draft if it is already shown.

Another node's draft not run yet is held until it is shown again. With focus, as when asked for rather than following the selection, a collapsed panel expands and the editor takes the keyboard.

release()

Stop following the node shown, e.g. before closing the panel, holding an unrun draft.

run(text=None)

Apply the draft to the node, after its check passes if the component has one.

text is the editor's text as sent with Ctrl+Enter, which may be ahead of what the server has. Spec text that is not a valid spec is not run; the problem is shown under it.

stale_states()

Return the nodes whose result does not match their spec: "draft" or "running".

A node has a draft not run while it is shown with one, or holds one for later.

toggle_dock()

Move the panel into the sidecar's Spec tab, or back under the canvas.

ViewFrame

Bases: JSComponent

Holds a node's own view and tells it the size it gets.

Panel 1.11's Vega pane observes its container, but misses one that narrows after a layout pass already updated its box, e.g. when the code panel's split is dragged. So the frame still dispatches a window resize whenever its own size changes; drop that once test_the_chart_follows_its_container_without_window_resizes passes.

object = Child() class-attribute instance-attribute

color_scheme

Follow the browser's colour scheme until the user picks light or dark.

STORAGE_KEY = 'flowdash.color_scheme' module-attribute

ColorSchemeFollower

Bases: JSComponent

Keeps a page's dark_theme on the browser's prefers-color-scheme.

Once the user toggles the theme, their pick wins: it is remembered in the browser's localStorage and used on later visits, and changes of the system scheme are ignored from then on.

choice = param.Selector(default=None, objects=[None, 'light', 'dark'], doc="The scheme the user picked, which wins over the system's.") class-attribute instance-attribute
following property writable

Whether the page's scheme is kept on the system's or the user's pick.

system_dark = param.Boolean(default=None, allow_None=True, doc='Whether the browser prefers a dark scheme.') class-attribute instance-attribute

command_palette

The command palette: Ctrl/Cmd+K search over dashboards, components and actions, plus shortcuts.

PLACEHOLDER = 'Search dashboards, components and actions' module-attribute

SHORTCUTS = [{'group': 'Viewing', 'label': 'Search and commands', 'keys': ['Mod', 'K']}, {'group': 'Viewing', 'label': 'Refresh', 'keys': ['R']}, {'group': 'Viewing', 'label': 'Edit mode', 'keys': ['E']}, {'group': 'Viewing', 'label': 'Full screen', 'keys': ['F']}, {'group': 'Viewing', 'label': 'Keyboard shortcuts', 'keys': ['?']}, {'group': 'Editing', 'label': 'Save', 'keys': ['Mod', 'S']}, {'group': 'Editing', 'label': 'Undo', 'keys': ['Mod', 'Z']}, {'group': 'Editing', 'label': 'Redo', 'keys': ['Mod', 'Shift', 'Z']}, {'group': 'Editing', 'label': 'Dataflow and Layout side by side', 'keys': ['S']}, {'group': 'Editing', 'label': 'Search components, opening a folded palette', 'keys': ['/']}, {'group': 'Editing', 'label': 'Show or hide node previews', 'keys': ['P']}, {'group': 'Editing', 'label': 'Collapse or expand all nodes', 'keys': ['C']}, {'group': 'Editing', 'label': 'Clear the selection, then back to view mode', 'keys': ['Esc']}] module-attribute

logger = logging.getLogger(__name__) module-attribute

CommandPalette

Bases: JSComponent

A search field that opens a command palette, and the app's keyboard shortcuts.

The field and the dialog are rendered in the browser, which also matches and ranks the results. When the palette opens it asks on_open for :attr:items, so the server sends the list once per opening, and a chosen item comes back as its id through on_command.

Shortcuts are registered on the document and ignored while typing in a text field: Ctrl/Cmd+K opens the palette, ? lists the shortcuts, and R (refresh), E (edit), Esc (back to view, outside dialogs), S (split view, in edit mode), Ctrl/Cmd+S (save, in edit mode) and Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z or Ctrl+Y (undo and redo, in edit mode) are sent to on_command as shortcut:<name>. F and the action:fullscreen item toggle the dashboard's full screen in the browser, which only grants it during the key press or click.

ask_label = param.String(default=None, allow_None=True, doc='\n When set, a query is also offered as a question for an assistant, in\n an item titled with this label and the query. It comes first when the\n query reads like a sentence or matches nothing, and runs as\n ``ask:<query>``.') class-attribute instance-attribute
compact = param.Boolean(default=False, doc="\n Whether the search field shrinks to an icon button unless the window\n is very wide, leaving the top bar to a dashboard's actions.") class-attribute instance-attribute
items = param.List(default=[], doc='\n Palette entries, each a dict with ``id``, ``group``, ``title`` and\n optionally ``subtitle``, ``icon``, ``keywords``, ``keys`` (shortcut\n chips) and ``hint`` (text on the right).') class-attribute instance-attribute
on_command = on_command instance-attribute
on_open = on_open instance-attribute
placeholder = param.String(default=PLACEHOLDER, doc='Text in the search field.') class-attribute instance-attribute
shortcuts = param.List(default=SHORTCUTS, doc='Shortcuts listed beside the results.') class-attribute instance-attribute

CommandPaletteController

Builds the palette's items from an app's state and runs the chosen ones.

Every action goes through the same methods as the matching button, so permissions and the unsaved-changes dialog apply as they do there.

ask property writable

Called with the query when the user asks the assistant from the palette.

palette = CommandPalette(on_open=self.items, on_command=self.run, margin=(0, 8), align='center') instance-attribute
install(app) classmethod

Place a palette in the app shell's search slot; None without a shell.

items()

Return every entry the palette offers now, in group order.

run(command)

Run the item or shortcut with id command, if it applies now.

config_draft

Config edits held back until the component's check_config passes.

The inspector edits a draft of a node's config when its component declares a check. Each change runs the check on the draft, the latest change winning; a draft that passes is applied to the node, one that fails stays in the form with the problems shown beside it. Warnings of the check show too, but do not hold the draft back. A change to the node's wiring checks it again, since the check sees the node's inputs.

ConfigDraft

Changes to one node's config that wait for its component's check.

Parameters:

Name Type Description Default
editor FlowDash

The editor holding the node.

required
instance_id str

The node.

required
runs dict[str, int]

The latest check run per node, shared by every draft of an inspector so a check started from a form that has since been rebuilt does not overwrite a newer one.

required
results dict[str, tuple[dict, tuple, CheckResult]] | None

The node config and wiring last checked and what the check found, per node, shared the same way, so selecting a node again does not run its check again while its config and wiring are unchanged.

None
alert = pn.Column(margin=0, sizing_mode='stretch_width') instance-attribute
busy property

Whether a check of an edit has not finished, so the node's config may still change.

instance_id = instance_id instance-attribute
on_result = None instance-attribute
state = None instance-attribute
bind(config_state, names)

Make :attr:state, a copy of config_state for a form to edit, and return its releases.

Values the node gets from elsewhere, e.g. from the agent, are copied into the draft, replacing a pending change to the same field. A check still running is then dropped, and the node's config with the rest of the draft, if any, is checked again.

check(run, pending) async

Check pending and apply it if it passes and no newer change was made meanwhile.

Checks of the node are coalesced, see :func:~panel_flowdash.config_check.recheck_node, so a burst of edits or rewiring runs one check at a time.

propose(patch)

Add patch to the draft and check it, applying the draft if the check passes.

rewired()

Check the draft again if the node's inputs were connected or disconnected meanwhile.

settle(timeout=30) async

Wait until no edit waits for its check, and return whether that happened in time.

show_current()

Show what the check says about the node's config, checking it unless it was already.

controls_bar

The dashboard's controls: a slim row above the tiles, or a collapsible panel beside them.

NARROW_BREAKPOINT = 768 module-attribute

POSITIONS = ('top', 'left') module-attribute

STICKY_CLASS = 'fd-controls-sticky' module-attribute

ControlsBar

Bases: Viewer

The views of the components shown beside the tiles: a top bar and a sidebar.

Components in the top bar sit in one slim row above the tile grid that wraps on narrow screens; those in the sidebar are stacked in a panel left of the grid that collapses to a narrow strip. Controls (components registered with sidebar=True) go where the dashboard's controls_position says unless they were moved, and controls, KPIs and text can be moved between the grid and either area (see :func:panel_flowdash.ui.tile_layout.move_to_area). Either way the inputs use Material UI's small size and the areas take no room while they are empty (or the editor's controls_bar is off, except in full screen, where nothing around the editor is visible). :meth:sync re-reads the editor, which calls it whenever its components change, and :meth:layout places the areas around the tile grid.

beside_canvas = param.Boolean(default=False, doc="\n Whether the grid is shown beside the canvas (the editor's Split tab).\n The pane is too narrow for a sidebar there, so its components sit in\n the row above the grid too.") class-attribute instance-attribute
collapsed = param.Boolean(default=False, doc='Whether the sidebar is collapsed.') class-attribute instance-attribute
controls property

The component views currently shown beside the grid, top bar first.

editing = param.Boolean(default=False, doc='Whether the tiles are being arranged, which gives each component a drag handle.') class-attribute instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose controls are shown.') class-attribute instance-attribute
grid_placed property

Whether the grid is placed as :attr:side says, or :meth:layout must place it again.

keys = {} instance-attribute
placed = param.Dict(default={}, doc='The area of each component shown beside the grid, by instance id.') class-attribute instance-attribute
position = param.Selector(default='top', objects=list(POSITIONS), doc='Where controls that were not moved go: the top bar or the sidebar.') class-attribute instance-attribute
side property

Whether the sidebar (open or collapsed) is shown, which :meth:layout places left of the grid.

uid property

The suffix of the CSS classes that mark this bar's areas on the page.

visible property

Whether there are controls to show.

hold()

Keep the grid where it is placed until the block ends, whatever the sidebar holds meanwhile.

Loading a dashboard empties the sidebar and fills it again. When that moved the grid out of the sidebar's row and back inside one held Bokeh patch, the patch referenced a TileGrid id the browser had never received, so it was dropped ("reference ... isn't known") and the previous dashboard stayed on screen. :meth:layout places the grid for the sidebar as it is once the last hold ends.

layout(grid)

Return the workspace items placing the areas around grid.

sync()

Re-read the editor's areas and lay them out; return whether the sidebar came or went.

When it did, the caller places the areas around the grid again with :meth:layout.

sync_notes(only=None)

Show each component's provenance and filter notes anew, or those of only, after an edit or a change of mode.

NarrowQuery

Bases: PhoneQuery

Reports a window narrower than breakpoint, where the open sidebar lies over the grid.

There Escape, or a tap outside the elements marked with the class area, sets open to False, as for a drawer. Escape then moves the focus to the toggle that reopens it, a tap leaves it where the tap put it. :meth:focus_toggle moves the focus to the sidebar's toggle.

area = param.String(default='', doc="The CSS class of the sidebar's elements.") class-attribute instance-attribute
open = param.Boolean(default=False, doc='Whether the sidebar is open.') class-attribute instance-attribute
focus_toggle()

Focus the sidebar's toggle once it shows, as the one pressed hides on its click.

compact_inputs(view)

Switch the Material UI widgets in view to their small size, where they have one.

Their labels also stay in the outline's notch, as a filled input shows it.

filter_chips(chips=(), hint='', detail='')

Return the chips noting a component's own Filter nodes, (instance_id, title), and hint.

The same notes as a tile's (see :meth:panel_flowdash.ui.tile.Tile.set_filters), for a component shown in the top bar or the sidebar.

dashboard_bar

The bar above a dashboard: view actions in view mode, editing controls in edit mode.

COMPACT_BREAKPOINT = 1024 module-attribute

DONE_COMPACT_BREAKPOINT = 900 module-attribute

EDIT_COMPACT_BREAKPOINT = _WIDE_BREAKPOINT module-attribute

ICON_ONLY_WHEN_COMPACT = icon_only_below(COMPACT_BREAKPOINT) module-attribute

LABEL_LINE_HEIGHT = 'calc(0.8125rem * 1.75)' module-attribute

PASSIVE_TOOLTIP_CSS = '.MuiTooltip-popper { pointer-events: none !important; }' module-attribute

PHONE_BREAKPOINT = 600 module-attribute

PHONE_TOUCH_CSS = f'@media (max-width: {PHONE_BREAKPOINT - 0.05}px) {{ .MuiButtonBase-root, .MuiTabs-root {{ min-width: 44px !important; min-height: 44px !important; }} }}' module-attribute

SAVE_STATE_TEXT_BREAKPOINT = 800 module-attribute

SETTINGS_MENU_BREAKPOINT = 900 module-attribute

SHOW_ON_PHONE = f'@media (min-width: {PHONE_BREAKPOINT}px) {{ :host {{ display: none !important; }} }}' module-attribute

TOOLTIP_KEYFRAMES = '@keyframes fd-tooltip-in { from { opacity: 0; } to { opacity: 1; } }' module-attribute

DashboardBar

Bases: Viewer

One row of dashboard controls, with a view and an edit section.

In view mode it shows the dashboard title, an info button opening the description, the health chip (whose popover holds the pipeline and any issues) and the view actions: the Dashboard/Report switch, Ask, Edit, Refresh (its tooltip says when the dashboard was last refreshed) with the auto-refresh period, the editor's toolbar_extra items, Full screen and an overflow menu (Download, Settings). In edit mode it shows the title with the save state, the same Dashboard/Report switch, the Dataflow/Layout/Split tabs (Dataflow/Layout for the report), Ask when the host has an assistant, and the edit actions: Settings, an overflow menu (Download, Import file, Clear canvas), Discard, Save and Done.

layout arranges these parts. With "compact" they form one line: the description sits behind an info button, and Refresh's tooltip says when the dashboard was last refreshed. When a host offers its header (placement="header", FlowDashApp's top bar), the bar then renders nothing itself: the host places :attr:lead after its breadcrumb, which stands in for the title, and :attr:actions at its end (see :attr:in_header). With "full" the bar is always its own row, with a large title over a line holding the description, the health chip and when the dashboard was last refreshed.

Each part of a section comes from one method returning a list of viewables, so a feature adds an item by extending that method: :meth:_view_meta, :meth:_view_actions, :meth:_edit_status, :meth:_edit_actions, and :meth:_menu_items for the menu entries (dispatched by :meth:_on_overflow). Call :meth:sync after changing anything they read. On phones the menu also stands in for the actions the top bar hides (:meth:_phone_items).

actions property

The actions of the current mode.

ask_button = pmui.Toggle(label='Ask', icon='forum', icon_size='18px', value=editor.ask, margin=(0, 4), description='Ask about this dashboard', css_classes=['fd-ask-toggle'], sx=_ASK_SX, stylesheets=[PASSIVE_TOOLTIP_CSS, _ICON_ONLY_WHEN_NARROW, _HIDE_ON_PHONE]) instance-attribute
description = pmui.Typography(variant='body2', margin=0, sx={'color': 'text.secondary'}, styles={'flex-basis': '100%'}) instance-attribute
discard_button = pmui.Button(label='Discard', icon='undo', variant='text', color='default', size='small', margin=(0, 2), description='Discard', sx={'color': 'text.secondary'}, stylesheets=[PASSIVE_TOOLTIP_CSS, _icon_only('Discard'), _HIDE_ON_PHONE]) instance-attribute
done_button = pmui.Button(label='Done', icon='check', variant='text', size='small', margin=(0, 4, 0, 2), description='Done', sx={'fontWeight': 600}, stylesheets=[PASSIVE_TOOLTIP_CSS, _DONE_ICON_ONLY, _HIDE_ON_PHONE]) instance-attribute
download_button = pmui.FileDownload(callback=editor._download_callback, filename='dashboard.json', auto=True, visible=False) instance-attribute
edit_button = pmui.Button(label='Edit', icon='edit', variant='outlined', size='small', margin=(0, 4), description='Edit', css_classes=['fd-edit-button'], stylesheets=[PASSIVE_TOOLTIP_CSS, ICON_ONLY_WHEN_COMPACT, _HIDE_ON_PHONE]) instance-attribute
editor = param.Parameter(doc='The FlowDash editor the bar controls.') class-attribute instance-attribute
fullscreen_button = pmui.IconButton(icon='fullscreen', description='Full screen', size='small', margin=(0, 4), align='center', css_classes=[pmui.Fullscreen.TOGGLE_CLASS], sx=_ICON_BUTTON_SX, stylesheets=[PASSIVE_TOOLTIP_CSS, _HIDE_ON_PHONE]) instance-attribute
health = DashboardHealth(editor) instance-attribute
health_chip = self.health_popover.chip instance-attribute
health_popover = HealthPopover(editor=editor, health=self.health) instance-attribute
in_header property

Whether a host header shows the lead and actions in place of the bar's own row.

info = pn.Row(self.info_button, self.info_popup, margin=0, align='center', styles={'width': 'fit-content', 'flex': '0 0 auto'}) instance-attribute
info_button = pmui.IconButton(icon='info_outline', size='small', margin=0, color='default', description='About this dashboard', css_classes=['fd-description'], sx={'color': 'text.secondary'}) instance-attribute
info_popup = pmui.Popup(self._about, anchor_origin={'horizontal': 'left', 'vertical': 'bottom'}, transform_origin={'horizontal': 'left', 'vertical': 'top'}, modal=False, label='About this dashboard', css_classes=['fd-description-popover'], sx={'& .MuiPopover-paper': {'p': 2, 'mt': 1, 'maxWidth': 'min(420px, calc(100vw - 32px))', 'borderRadius': '12px'}}) instance-attribute
layout = param.Selector(default='compact', objects=['compact', 'full'], doc='\n "compact" keeps the bar to one line and lets a host header take it,\n "full" shows it as its own row with the title over a meta line.') class-attribute instance-attribute
lead property

The title's companions: the info button and health chip, or the save state.

may_make_standalone_report = param.Callable(default=None, doc='\n Called with the open dashboard; "Make a standalone report" is offered\n only when it returns True. When unset, every dashboard may.') class-attribute instance-attribute
mode_tabs = pmui.RadioButtonGroup(options=self.output_switch.tabs(_EDIT_TABS), value=self.output_switch.tab(), size='small', margin=(0, 12, 0, 4), sx=_TOGGLE_SX, stylesheets=[_ICON_ONLY_WHEN_NARROW, _HIDE_ON_PHONE]) instance-attribute
on_mode = param.Callable(default=None, doc='\n Called with "edit" or "view" when the user asks to switch modes. When\n unset the bar switches the editor\'s `editable` itself, asking first\n when leaving edit mode with unsaved changes.') class-attribute instance-attribute
on_open_source = param.Callable(default=None, doc="\n Called with no arguments when the user follows a standalone report's\n link back to the dashboard it was made from.") class-attribute instance-attribute
on_standalone_report = param.Callable(default=None, doc="\n Called with no arguments when the user asks to make the dashboard's\n report a standalone report. The overflow menu offers it on a\n dashboard's report in view mode, and only when this is set.") class-attribute instance-attribute
output_switch = OutputSwitch(editor, margin=(0, 4), sx=_TOGGLE_SX, stylesheets=[_ICON_ONLY_WHEN_NARROW, _HIDE_ON_PHONE]) instance-attribute
output_toggle = self.output_switch.toggle instance-attribute
overflow = pmui.MenuButton(icon='more_vert', label='', variant='text', size='small', color='default', description='More actions', margin=(0, 4), sx=_OVERFLOW_SX, css_classes=['fd-more-actions'], stylesheets=[PASSIVE_TOOLTIP_CSS, PHONE_TOUCH_CSS]) instance-attribute
placement = param.Selector(default='row', objects=['row', 'header'], doc='\n Whether a host offers its header for the bar ("header"), which then\n takes :attr:`lead` and :attr:`actions` and shows the dashboard\'s title\n while the layout is "compact", or not ("row").') class-attribute instance-attribute
refresh_button = pmui.Button(label='Refresh', icon='refresh', variant='outlined', size='small', margin=(0, 0, 0, 4), description='Refresh now', sx={'borderTopRightRadius': 0, 'borderBottomRightRadius': 0}, stylesheets=[PASSIVE_TOOLTIP_CSS, ICON_ONLY_WHEN_COMPACT, _HIDE_ON_PHONE]) instance-attribute
refresh_label = pmui.Typography(variant='caption', sx={'color': 'text.secondary'}, margin=0) instance-attribute
refresh_period = pmui.MenuButton(label='Off', variant='outlined', size='small', description='Update automatically', margin=(0, 4, 0, 0), sx={'borderTopLeftRadius': 0, 'borderBottomLeftRadius': 0, 'ml': '-1px', 'minWidth': 0, 'whiteSpace': 'nowrap', 'color': 'text.secondary'}, stylesheets=[PASSIVE_TOOLTIP_CSS, _HIDE_ON_PHONE]) instance-attribute
refresh_text = '' instance-attribute
report_source = param.Callable(default=None, doc='\n Called with an opened standalone report; returns the title of the\n dashboard it was made from, or None to show no link, e.g. when that\n dashboard is gone or the viewer may not open it.') class-attribute instance-attribute
save_button = pmui.Button(label='Save', icon='save', variant='text', size='small', margin=(0, 2), description='Save', stylesheets=[PASSIVE_TOOLTIP_CSS, _icon_only('Save'), PHONE_TOUCH_CSS]) instance-attribute
save_state = pmui.Typography(variant='caption', sx={'color': 'text.secondary', 'whiteSpace': 'nowrap'}, margin=0, stylesheets=[_SAVE_STATE_DOT_ONLY]) instance-attribute
settings_button = pmui.IconButton(icon='tune', size='small', margin=(0, 4), color='primary', description='Settings', sx=_ICON_BUTTON_SX, stylesheets=[PASSIVE_TOOLTIP_CSS, _HIDE_ON_PHONE, _SETTINGS_IN_MENU]) instance-attribute
title = pmui.Typography(variant='subtitle1', margin=0, sx={'whiteSpace': 'nowrap', 'overflow': 'hidden', 'textOverflow': 'ellipsis', 'fontWeight': 500}) instance-attribute
visible = param.Boolean(default=True, doc='Whether the bar is shown.') class-attribute instance-attribute
discard()

Throw away unsaved changes, reloading the saved dashboard.

download(extension='json')

Send the canvas to the browser as a dashboard file, JSON or YAML.

open_import()

Ask for a dashboard file to replace the canvas with.

request_mode(mode)

Switch to mode ("edit" or "view") through on_mode, or directly.

stamp_refresh()

Record that the dashboard was refreshed now.

sync()

Reflect the editor's mode, dashboard and save state in the bar.

PhoneQuery

Bases: JSComponent

Reports whether the browser window is narrower than breakpoint, as a phone's is.

breakpoint = param.Integer(default=PHONE_BREAKPOINT, doc='Window width in pixels.') class-attribute instance-attribute
phone = param.Boolean(default=False, doc='Whether the window is narrower than the breakpoint.') class-attribute instance-attribute

format_period(seconds)

Return a refresh period as "15 min", "1 hour" or "30 s".

fullscreen_toolbar(health_chip)

Return the items shown over a dashboard in full screen: its health and an exit button.

The chip follows the text and style of the bar's health_chip. The dashboard's title is not shown; it names the toolbar for screen readers.

hide_on_phone(css_class)

Return a layout's stylesheet hiding its children with css_class on a phone.

For the editor's side panels, which the phone's bottom sheets replace. CSS, so a phone never shows them before the server knows the window's width. The rule belongs to the layout holding them, not to their own shadow roots: WebKit can leave a host hidden by an @media :host rule after the window widens again, once the styles in its shadow root change.

icon_only_below(width, disabled_tooltip=None)

Return a stylesheet showing only the icons of a button or toggle group below width.

The options of a toggle group show their names as tooltips; a button that is disabled, where its own tooltip cannot show, shows disabled_tooltip.

tooltip_css(selector, content, placement='right')

Return CSS showing content as a tooltip beside selector while it is hovered or focused.

selector is completed with the hover or focus state by the caller's {state} placeholder, e.g. ".pa-toggle{state}". placement is "right" or "left".

dock_handle

A bar dragged to resize the panel docked beside or under it.

DockHandle

Bases: JSComponent

A bar dragged to resize the layout holding it, which reports its new :attr:size.

A horizontal bar sits on top of a layout docked under the page and sets its height; a vertical one sits on the inner edge of a layout docked to the side and sets its width: on the left of one docked to the right, or on the right of one docked to the left (edge="end"). While dragging, the layout follows the pointer in the page; :attr:size is set once the pointer is released. Arrow keys resize it by 24 pixels when the bar has focus. A width it sets stays within max_ratio of the window as the window narrows, and comes back as the window widens again.

The bar is a separator reporting the layout's size, and with :attr:region it names the layout as a region it controls.

css_classes = [*self.css_classes, 'fd-dock-vertical'] instance-attribute
edge = param.Selector(default='start', objects=['start', 'end'], doc='\n Which edge of its layout a vertical bar sits on: the left ("start"),\n for a layout docked to the right, or the right ("end"), for one\n docked to the left, which grows as the bar is dragged right.') class-attribute instance-attribute
label = param.String(default='Resize the code panel', doc="The bar's accessible name.") class-attribute instance-attribute
max_ratio = param.Number(default=0.8, doc="The largest share of the parent's height or width it may take.") class-attribute instance-attribute
max_size = param.Integer(default=None, allow_None=True, doc='The largest size, if any.') class-attribute instance-attribute
min_size = param.Integer(default=160) class-attribute instance-attribute
orientation = param.Selector(default='horizontal', objects=['horizontal', 'vertical'], doc='A horizontal bar resizes the height, a vertical one the width.') class-attribute instance-attribute
region = param.String(default=None, allow_None=True, doc='The accessible name of the layout it resizes, which is then a region the bar controls.') class-attribute instance-attribute
size = param.Integer(default=None, allow_None=True, doc='The height or width the bar resized its layout to.') class-attribute instance-attribute

drag_guard

Keeps a drag in the editor from selecting text on the page.

The tile grid, the canvas, the palette and the report's blocks are each dragged by a library or script of their own, which at best keeps the dragged element from being selected, not the text of the tiles, nodes or blocks the pointer passes over. :class:DragGuard turns text selection off for the whole page from the press on a drag handle until the drop, and clears any selection the browser makes during the drag, keeping one made before it.

GRID_DRAG_CSS = '\n.tile-grid:has(.muuri-grid:not(.muuri-no-handles)),\n.muuri-grid:not(.muuri-no-handles) {\n -webkit-user-select: none;\n user-select: none;\n}\n.muuri-grid:not(.muuri-no-handles) .muuri-grid-item > div:not(.muuri-handle) > * {\n -webkit-user-select: text;\n user-select: text;\n}\n.muuri-handle, .muuri-resize-ghost,\n.muuri-item-dragging, .muuri-item-dragging *,\n.muuri-item-releasing, .muuri-item-releasing * {\n -webkit-user-select: none !important;\n user-select: none !important;\n}\n' module-attribute

HANDLES = ('.muuri-handle', '.fd-control-handle', '.react-flow', '.fd-report-handle', "[draggable='true']") module-attribute

DragGuard

Bases: JSComponent

Turns off text selection on the page while something in the editor is dragged.

From a press on one of :data:HANDLES, or a native dragstart of one, until the pointer is released or the native drag ends, the body's user-select is none; afterwards its own inline value is put back. A selection the browser makes during the drag all the same, as WebKit does, is cleared, while one made before the drag is kept through it (WebKit itself collapses it on the press); a click there, moving less than a drag, clears it as a click elsewhere does. Presses in text fields, and on parts of a node marked nodrag, are left alone. It takes no space on the page.

gallery

The component gallery at /components: searchable cards and a detail panel.

DESCRIPTION = 'Building blocks for dashboards. Outputs of one connect to inputs of another.' module-attribute

ROLE_FILTERS = {'all': 'All', 'source': 'Data', 'transform': 'Transforms', 'view': 'Views', 'widget': 'Widgets'} module-attribute

ROLE_NAMES = {'source': 'Data', 'transform': 'Transform', 'view': 'View', 'widget': 'Widget', 'other': 'Component'} module-attribute

ComponentGallery

Bases: Viewer

Cards for every component the user may place, with filters and a detail panel.

Restricted components are left out, as in the editor palette. Usage counts come from one listing of the dashboards the user can access, without importing anything; :meth:load imports the components that do not declare their ports, off the event loop, so their ports and roles can be shown.

accepts = param.String(default=None, allow_None=True, doc='Only components taking this type.') class-attribute instance-attribute
accepts_menu = pmui.MenuButton(label='Accepts', icon='input', variant='outlined', color='default', margin=0, sx={'textTransform': 'none', 'borderRadius': 4, 'color': 'text.primary'}) instance-attribute
add_menu = pmui.MenuButton(label='Add to…', icon='add', variant='contained', margin=0, sx={'textTransform': 'none', 'borderRadius': 5}) instance-attribute
close_button = pmui.IconButton(icon='close', description='Close details', size='small', margin=0) instance-attribute
detail = pmui.Paper(self._detail_body, elevation=0, margin=0, visible=False, sizing_mode='stretch_both', sx={'borderRadius': 0, 'borderLeft': 1, 'borderColor': 'divider'}, stylesheets=[_DETAIL_CSS], css_classes=['flowdash-gallery-detail']) instance-attribute
entries property

The listed components, in display order.

page_button = pmui.Button(label='Open as page', icon='open_in_new', variant='outlined', margin=0, sx={'textTransform': 'none', 'borderRadius': 5}) instance-attribute
query = param.String(default='', doc='Search text.') class-attribute instance-attribute
role = param.Selector(default='all', objects=list(ROLE_FILTERS), doc='Role filter.') class-attribute instance-attribute
role_chips = {role: pmui.Chip(label=label, size='medium', margin=0, sx=_CHIP_SX, css_classes=[f'role-{role}']) for role, label in ROLE_FILTERS.items()} instance-attribute
search = pmui.TextInput(placeholder='Search by name, description, tag or port', variant='outlined', size='small', sizing_mode='stretch_width', min_width=200, max_width=340, margin=0, stylesheets=[':host { flex: 1 1 240px; }'], sx={'& .MuiOutlinedInput-root': {'borderRadius': 2, 'bgcolor': 'action.hover'}}) instance-attribute
selected = param.String(default=None, allow_None=True, doc='Component shown in the details.') class-attribute instance-attribute
used_in = pmui.MenuList(items=[], dense=True, margin=0, on_click=self._on_used_in) instance-attribute
add_to_dashboard(component_id, asset_id=None, *, kind=DASHBOARD_KIND) async

Open a dashboard or report in the editor with component_id placed on it.

Without asset_id a new dashboard, or report with kind, named after the component is created first. On a report the component is shown as a block at its end. The placement is left unsaved, like any edit. Returns the new instance id, or None if nothing was placed.

input_types()

Map the input types of the listed components from canonical to display name.

load() async

Import the components whose ports are not declared, then show their ports.

Imports run off the event loop; components declaring provides or requires on @register are listed without being imported.

refresh()

Rebuild the entries and cards from the registry and one dashboard listing.

role_counts()

Count matches per role for the current search and type filter, as the chips do.

visible_entries()

Return the components passing the search, role and type filters.

DashboardRef dataclass

A dashboard or report a component is placed in.

asset_id instance-attribute
kind = DASHBOARD_KIND class-attribute instance-attribute
path property
title instance-attribute

GalleryEntry dataclass

What the gallery shows and searches for one component.

builtin = False class-attribute instance-attribute
component_id instance-attribute
description = None class-attribute instance-attribute
display_icon property
icon = None class-attribute instance-attribute
inputs = () class-attribute instance-attribute
module = None class-attribute instance-attribute
outputs = () class-attribute instance-attribute
page_path = None class-attribute instance-attribute
ports_known = True class-attribute instance-attribute
role instance-attribute
role_name property
tags = () class-attribute instance-attribute
title instance-attribute
usage property

The usage line of a card, e.g. "In 3 dashboards" or "Built in".

used_in = () class-attribute instance-attribute
accepts(port_type)

Whether one of the inputs takes port_type (any type when None).

input_types()
matches(query)

Whether every word of query occurs in the title, description, tags or ports.

GalleryPort dataclass

A component port as the gallery lists it.

label = None class-attribute instance-attribute
name instance-attribute
required = None class-attribute instance-attribute
type = None class-attribute instance-attribute

card_html(entry)

Render a component card: a static icon preview, title, role, ports and usage.

gallery_entry(entry, spec=None, *, page_path=None, used_in=())

Describe entry for the gallery.

Until the component is imported (spec is None) the ports come from the provides/requires declared on @register.

ports_html(entry)

Render the detail panel's ports table; the label column only when a port has one.

usage_index(dashboards, entries)

Map component ids to the dashboards placing them, from the stored models alone.

Items saved under a component's former id (its aliases) count for it.

global_filters

The editor's global filters: which views they reach, the filter bar and the notes on tiles.

:class:GlobalFilters keeps the dashboard's filters (see :mod:panel_flowdash.global_filters) and their current values, and hands every view the dashboard shows the predicates that reach it: a component implementing :class:~panel_flowdash.global_filters.FilterTarget gets them through __flowdash_apply_filters__, any other Viewer has the DataFrames at its inputs filtered. :class:FilterBar shows one widget per filter above the tiles and, in edit mode, adds and removes filters. Each tile shows the Filter nodes feeding it as chips, and the active filters that do not reach it as a "Not filtered by ..." hint.

The values are what the person viewing the dashboard chose; only a filter's starting value is saved with the dashboard.

logger = logging.getLogger(__name__) module-attribute

FilterBar

Bases: Viewer

A widget for each global filter of a :class:GlobalFilters, and in edit mode a way to add and remove them.

editable = param.Boolean(default=False, doc='Whether filters can be added and removed.') class-attribute instance-attribute
filters = param.ClassSelector(class_=GlobalFilters, doc='The filters the bar shows.') class-attribute instance-attribute
has_content = param.Boolean(default=False, doc='Whether the bar shows anything.') class-attribute instance-attribute
sync()

Build a widget for each filter, reusing those whose filter is unchanged.

GlobalFilters

Bases: Parameterized

The global filters of a :class:~panel_flowdash.editor.FlowDash editor and the views they reach.

editor property
filters = param.List(default=[], doc="The dashboard's filters, views they exclude by instance id.") class-attribute instance-attribute
revision = param.Integer(default=0, doc='Bumped when the data of a view changes, so filter choices are read again.') class-attribute instance-attribute
shared = param.List(default=[], doc='\n The Filter nodes feeding every view, as (instance id, title). The\n filter bar shows them once instead of a chip on each tile.') class-attribute instance-attribute
values = param.Dict(default={}, doc='The current value of each filter, by column.') class-attribute instance-attribute
active()

Return the predicates of the filters with a value, by column.

apply()

Hand every view the predicates that reach it now, and update the notes on its tile.

available_columns()

Return the columns of the views' data that have no filter yet, for adding one.

columns(instance_id)

Return the columns a view can be filtered on, None while it does not know them.

entry(column)
filter_inputs(instance_id, values)

Return the input values of a view with its global filters applied to its DataFrames.

A filter a column cannot be compared with, e.g. a range of numbers on text, is left out for that view, whose tile then says so.

forget(instance_id)

Drop what is kept about a node that went away.

frames()

Return the DataFrames arriving at the views, unfiltered, to offer filter choices from.

inputs_changed(instance_id, names)

Note that new values arrived at a view's inputs, which may change its columns and notes.

A view applying filters itself is asked for its columns again, since any input, e.g. a query, can change them.

load(filters)

Show filters, keeping the current value of each filter whose starting value is the same.

local_filters(instance_id, sources=None)

Return the instance ids of the Filter nodes upstream of a view, nearest first.

A Filter node is a transform tagged filter, such as the built-in filter by selection.

mismatched(instance_id)

Return why the filters a view's data cannot be compared with were not applied, by column.

notes(instance_id)

Return the chips of a view's own Filter nodes (id, title), its hint and the hint's detail.

Filter nodes every view shares are left out, see :attr:shared. Reuses what :meth:apply last worked out, so a tile costs no more than its own view.

options(column)

Return the values a select filter on column offers.

predicates_for(instance_id)

Return the predicates a view gets now: the active filters it has not opted out of.

refresh(instance_id)

Read a view's columns again and hand it the filters that reach it, even if unchanged.

request(component) classmethod

Read the columns of component again and hand it its filters anew, wherever it is shown.

See :func:panel_flowdash.global_filters.request_filters.

set_value(column, value)

Change the current value of the filter on column, e.g. as the viewer chose it.

Raises:

Type Description
KeyError

If the dashboard has no filter on column.

FilterError

If value is not one the filter's widget takes.

shown_notes(instance_id)

Return the notes a view shows now, as :meth:notes last worked them out; empty without any.

span(column)

Return the smallest and largest value a range filter on column spans.

Views whose column cannot be compared with the others', e.g. text where most hold numbers, are left out.

summarizes(instance_id)

Return whether a view shows numbers worked out upstream, e.g. a KPI, rather than rows.

Such a view has a number arriving along an edge at one of its inputs, and no DataFrame at any: a global filter cannot reach the rows the number came from. A number set on the view itself is not worked out from rows.

targets()

Return the instance ids of the views the dashboard shows, which global filters reach.

widget(entry)

Return the widget of entry: its own, or the one the type of its column gives.

health

Which tiles of a dashboard failed or wait for input, kept current as the dataflow runs.

DashboardHealth

Bases: Parameterized

The state of an editor's tiles, derived from the dataflow graph.

A tile failed while one of its inputs holds a failure carried from upstream (see FlowDash.propagate_failures), and waits while a required, blocking input is unset. One whose failure is a refusal of access (see is_restricted) does not count as failed. :meth:track follows the nodes on the canvas; call it whenever components are added or removed.

affected property

The tiles that failed or wait, failed ones first.

failed = param.List(default=[], doc='Instance ids of the tiles that failed.') class-attribute instance-attribute
origins = param.List(default=[], doc='Instance ids of the nodes whose outputs carry the failures downstream.') class-attribute instance-attribute
tiles = param.List(default=[], doc='Instance ids of the tiles on the dashboard.') class-attribute instance-attribute
waiting = param.List(default=[], doc='Instance ids of the tiles waiting for input.') class-attribute instance-attribute
release()

Stop following the graph.

sentence()

Return the issue banner's message as a bold lead and the rest, empty without issues.

status(instance_id)

Return "failed", "waiting" or "ok" for one node.

summary()

Return the chip label: "All 5 tiles up to date" or "1 failed, 1 waiting".

track()

Watch the failures and blocking inputs of the nodes on the canvas.

update(*_events)

Recompute the state of every tile.

worst(statuses)

Return the most severe of statuses, "ok" when there are none.

health_popover

The health chip in the dashboard header and its popover with the pipeline and the issues.

HealthPopover

Bases: Viewer

A chip saying whether the tiles are up to date, opening the pipeline and the issues.

The chip is coloured by the worst tile status and counts the failed and waiting tiles. Its popover shows the pipeline strip (source, transform and view stages, each with a status dot) and, while some tiles failed or wait, the issue banner with its Show issues action. :meth:sync re-reads the editor's graph; the health's own changes are followed automatically.

banner = IssueBanner(health=self.health, on_show=self._show_issues) instance-attribute
chip = pmui.Button(label='', variant='text', size='small', margin=0, visible=False, css_classes=['fd-health-chip'], sx=_chip_sx(OK), stylesheets=[_DOT_ONLY_WHEN_NARROW]) instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose tiles are reported.') class-attribute instance-attribute
health = param.ClassSelector(class_=DashboardHealth, doc="The tiles' health.") class-attribute instance-attribute
pipeline = PipelineStrip() instance-attribute
popup = pmui.Popup(self.pipeline, self._ok_note, self.banner._banner, anchor_origin={'horizontal': 'left', 'vertical': 'bottom'}, transform_origin={'horizontal': 'left', 'vertical': 'top'}, modal=False, label='Dashboard health', css_classes=['fd-health-popover'], sx={'& .MuiPopover-paper': {'p': 2, 'mt': 1, 'maxWidth': 'min(560px, calc(100vw - 32px))', 'display': 'flex', 'flexDirection': 'column', 'gap': 1.5, 'borderRadius': '12px'}}) instance-attribute
visible property

Whether the chip is shown, i.e. the dashboard has tiles.

sync(*_events)

Re-read the health and the dataflow graph.

chip_label(health)

Return the chip's text: "9/9 up to date", or the counts of failed and waiting tiles.

home

Home with FlowDashApp(home="explore"): an Ask | Browse switch over the Ask landing and the launcher.

Ask is a composer holding the project's data as chips and the Explore view's model picker, with suggested questions as cards, the person's recent chats and a "Your data" card from the host. Asking makes a chat and continues on its Explore view, see :meth:FlowDashApp._ask_from_home. Browse is the launcher. The person's last choice is remembered in the usage ledger, so it is the one they land on.

Without a model there are no chat features: Home opens on Browse, and Ask only lists the person's earlier chats to reread, with a way to set up a model for admins. Someone with neither sees no Ask at all.

RECENT_CHATS = 5 module-attribute

SUGGEST_THREADS = 4 module-attribute

SUGGEST_TIMEOUT = 15 module-attribute

logger = logging.getLogger(__name__) module-attribute

AskLanding

Bases: Viewer

The Ask landing: a composer with the data chips and model picker, suggestions, recent chats and the data.

chips property

The data chips offered, in order.

composer = pmui.ChatAreaInput(placeholder='Ask a question about your data…', enable_upload=False, footer_objects=footer, sizing_mode='stretch_width', stylesheets=[_FOOTER_CSS], margin=(8, 0, 0, 0), css_classes=['flowdash-home-composer']) instance-attribute
picked property

The data chips picked, in the order offered.

picker = None instance-attribute
selected = param.List(default=[], item_type=str, doc='The ids of the data chips picked.') class-attribute instance-attribute
suggestions = param.List(default=[], item_type=Suggestion, doc='The questions suggested now.') class-attribute instance-attribute
ask(question)

Start a chat with question on the chips picked, returning whether it started.

load_chips()

Ask the app's data_chips hook for the chips again.

load_overview()

Ask the app's data_overview hook for the "Your data" card again.

Like the suggested questions hook it never blocks the event loop: a coroutine function is awaited on the session's loop and a plain function runs on the landing's threads. The card shows what the newest call returns once it arrives; it is left out until the first call answers and when a call fails.

refresh_chats()

List the person's recent chats again.

reset()

Let the person ask again, once the landing is shown after a chat was started.

toggle(chip_id)

Pick the chip chip_id, or put it back if it is picked.

ChatsToReread

Bases: Viewer

Ask without a model: the person's earlier chats to reread and, for an admin, "Set up a model".

refresh()

List the person's chats again.

HomePage

Bases: Viewer

Home with home="explore": the Ask | Browse switch over the Ask landing or the launcher.

Without a model Home opens on Browse, and the switch is shown only when Ask has something for the person: earlier chats to reread, or for an admin, a way to set up a model.

ask = None instance-attribute
ask_offered property

Whether Ask is offered: with a model, or without one to an admin or someone with chats.

choice = param.Selector(default=HOME_ASK, objects=[HOME_ASK, HOME_BROWSE]) class-attribute instance-attribute
reread = None instance-attribute
switch = pmui.RadioButtonGroup(options=_SWITCH_OPTIONS, value=self.choice, variant='outlined', align='center', sx=_SWITCH_SX, margin=(20, 0, 4, 0), css_classes=['flowdash-home-switch']) instance-attribute
refresh()

Bring the page shown up to date with the store, and with whether there is a model.

chat_list_items(chats)

Return chats as items of a list: the title, then the data asked about and when.

open_chat(app, item)

Open the chat an item of chat_list_items lists.

input_editor

The inspector's editor of a literal value for an unconnected input.

VALUE_LABEL = 'Value' module-attribute

LiteralEditor

Bases: Viewer

A typed field editing the literal value of one input, and a button removing it.

The button is laid out by the caller, beside the input's name. The field follows the input's Parameter, or its port type, and offers the choices the component computes for the input, like a config field. Each edit calls on_change with the new value; on_change raises ValueError to refuse it, and the reason is shown under the field. Emptying the field keeps the value; the button removes it, calling on_change with None.

choices_key = () instance-attribute
clear_button = pmui.IconButton(icon='backspace', description='Remove the value set here', size='small', margin=0, visible=is_set, css_classes=['fd-literal-clear']) instance-attribute
port = port instance-attribute
set_choices(choices)

Offer choices in the field, rebuilding it only if its widget changes.

sync(value, is_set)

Show value, set elsewhere, e.g. by undo or the agent, without calling on_change.

inspect_sheet

The side sheet that shows what a tile's outputs currently hold.

MAX_COLUMNS = 8 module-attribute

MAX_COLUMN_CHIPS = 12 module-attribute

MAX_COPY_ROWS = 50 module-attribute

MAX_ROWS = 10 module-attribute

SHEET_WIDTH = 420 module-attribute

dataframe_preview(frame, filename)

Columns with their dtypes, the first rows and export actions; never the whole frame.

describe_value(value)

Return the type name and a short shape of value, without walking its contents.

facts(rows)

Lay out labelled facts in two columns, leaving out rows without a value.

heading(text)

Return a section heading for the sheet.

is_dataframe(value)

Whether value is a pandas DataFrame, without importing pandas for others.

make_inspect_sheet()

Create the persistent right sheet: beside the tiles on wide screens, full screen on phones.

output_section(*, status, rows, preview, extra=None)

Describe one output: its status, facts about it and a preview of the value.

python_literal(frame)

Python that rebuilds the first rows of frame, for pasting into a notebook.

reserve_space(layout, sheet_open)

Pad layout by the sheet's width on wide screens, so no tile sits under the sheet.

sheet_header(title, on_close, caption='Inspect data')

Title the sheet with what is inspected, and offer to close it.

short_dtype(series)

Return a reader-friendly dtype such as str, int, float, bool or datetime.

value_status(value, failed)

Return the status label of an output value.

inspector

The inspector, a persistent panel beside the wiring canvas bound to its selection.

With a component selected it shows a compact one-line header with status dot and overflow menu, its settings, live input summaries, current outputs and tile options. With a connection selected it describes the connection and edits its transform steps (see :meth:Inspector._edge_view). With nothing selected it summarizes the dashboard and lists its issues.

HANDLE_WIDTH = 7 module-attribute

INSPECTOR_WIDTH = SIDECAR_WIDTH module-attribute

PREVIEW_REVISION = '_preview_rev' module-attribute

Inspector

Bases: Viewer

The sidecar: a panel beside the canvas or the tile grid showing what is selected.

It is shown in the Dataflow, Split and Layout tabs, follows the editor's one selection, and for a component shows the tabs Settings, Spec (where it has a spec, or a definition to show), Data, Tile and, when the assistant made it, History. The Spec tab holds the editor's code panel wherever it is not under the canvas, see :meth:sync_spec_tab. Whether it is open or folded is decided by the editor's :class:~panel_flowdash.ui.sidecar.SidecarFold.

collapse_button = pmui.IconButton(icon='keyboard_double_arrow_right', description='Hide inspector', size='small', margin=(8, 4, 0, 0), align='end') instance-attribute
collapsed = param.Boolean(default=False, doc='Whether the panel is folded to a narrow strip.') class-attribute instance-attribute
current_width property

The width the panel takes beside the canvas: open, folded or 0 when hidden.

editing_spec = param.Boolean(default=False, doc="Whether a component's Spec tab is shown, which wants more room.") class-attribute instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose canvas selection is inspected.') class-attribute instance-attribute
expand_button = pmui.IconButton(icon='keyboard_double_arrow_left', description='Show inspector', size='small', margin=(8, 4)) instance-attribute
handle = DockHandle(orientation='vertical', min_size=SIDECAR_MIN_WIDTH + HANDLE_WIDTH, max_size=SIDECAR_MAX_WIDTH + HANDLE_WIDTH, max_ratio=0.5, label='Resize the side panel', sizing_mode='stretch_height', width=HANDLE_WIDTH, margin=0) instance-attribute
sheet = param.Boolean(default=False, doc='\n Whether the panel fills a bottom sheet, as on a phone, rather than a\n column beside the canvas. Folding it then closes the sheet.') class-attribute instance-attribute
tile_options = None instance-attribute
visible = param.Boolean(default=True, doc='Whether the panel is shown.') class-attribute instance-attribute
width = param.Integer(default=SIDECAR_WIDTH, bounds=(SIDECAR_MIN_WIDTH, SIDECAR_MAX_WIDTH), doc='The width of the open panel, set by dragging its left edge.') class-attribute instance-attribute
fold(folded)

Fold the panel to its strip or open it, as the person chose.

has_unsent_text()

Whether a code field shown holds typed text it has not applied yet.

open_tab(instance_id, tab, turn_id=None)

Show tab of the component instance_id, now if it is shown or else once selected.

turn_id names the later turn the History tab shows, None for the request that made it.

refresh(force=False)

Show the selected component or connection, or the dashboard summary.

refresh_node()

Rebuild a node's view if it is shown, e.g. once its spec moves to or from the code panel.

refresh_summary()

Rebuild the dashboard summary if it is shown, e.g. after the issues changed.

settle() async

Wait for the config check of an edit in the form shown, so a save includes it.

sync_spec_tab()

Fill the shown component's Spec tab: the code panel, or where it is.

The editor has one code panel, shown in one place at a time. Unless it is under the canvas, this tab holds it, opened on the component when the tab is shown.

hooked_preview(value, instance, port_name, caller='inspector')

Return the component's own preview of port_name, or value when it gives none.

summarize_input_html(value, port_type=None)

Return a one-line escaped HTML summary of an input value: its shape, columns or items.

It only reads what the value already holds (a frame's shape, the columns its port type lists, a source's table names) and never calls a node's preview hook, so showing a node's inputs does not run queries.

value_preview(editor, value, hooked=False)

Show a table's first rows, a short caption for an empty or failed value, or the value.

hooked says value is a component's own preview, whose text is shown as a caption, or as Markdown when it has Markdown structure. A chart preview is drawn as the thumbnail its node card shows.

wants_preview_hook(value, instance)

Whether instance is asked for its own preview of value: not of a table, a failure or nothing.

issue_banner

A page-level banner naming the tiles that failed or wait for input.

ISSUE_CLASS = 'fd-issue-target' module-attribute

IssueBanner

Bases: Viewer

Say how many tiles failed or wait for input, with a Show issues action.

Hidden while every tile is up to date. on_show is called with the ids of the affected tiles, failed ones first; it marks their views with :data:ISSUE_CLASS and the banner then scrolls to them.

health = param.ClassSelector(class_=DashboardHealth, doc='The health to report.') class-attribute instance-attribute
on_show = param.Callable(default=None, doc='Called with the affected tile ids to mark their views before scrolling.') class-attribute instance-attribute
show_button = pmui.Button(label='Show issues', variant='text', size='small', color='error', margin=0, styles={'margin-left': 'auto', 'flex-shrink': '0'}) instance-attribute
visible = param.Boolean(default=True, doc='Whether the banner may show at all.') class-attribute instance-attribute
show_issues()

Scroll to and highlight the affected tiles, returning their ids.

sync(*_events)

Reflect the health in the banner.

mark_issue_targets(views, targets)

Give exactly the targets among views the :data:ISSUE_CLASS.

launcher

Browse: the dashboards, reports and chats a person may open, and the project's code pages.

COMPONENTS_ROUTE = '/components' module-attribute

KIND_LABELS = {DASHBOARD_KIND: ('Dashboard', 'space_dashboard'), REPORT_KIND: ('Report', 'description'), CHAT_KIND: ('Chat', 'forum')} module-attribute

OPEN_ACTION = {'label': 'Open', 'icon': 'visibility'} module-attribute

Launcher

Bases: Viewer

Browse: the person's dashboards, reports and chats, with filters, sorting and New.

The kind chips pick which assets are listed, with how many there are of each. The owner menu keeps those of anyone, the person's own or those shared with them, and a search keeps those whose title has the text. Cards draw each kind as it looks: a dashboard's tiles, a report's page and a chat's question over its answer. New makes a dashboard, a report or a dashboard from a template, or imports a file.

Card actions are dispatched through :meth:FlowDashApp._on_dashboard_action, so actions a subclass adds to the app's action tuples appear here as well.

assets property

The assets listed now, in order.

filter = param.Selector(default='all', objects=['all', 'owned', 'shared'], doc="Whose assets are listed: anyone's, the person's own or those shared with them.") class-attribute instance-attribute
fixed_kind = param.Boolean(default=False, doc='Whether `kind` is fixed, as on the Reports page, so the kind chips are hidden.') class-attribute instance-attribute
kind = param.Selector(default='all', objects=['all', DASHBOARD_KIND, REPORT_KIND, CHAT_KIND], doc='Which kind of asset is listed, or all of them.') class-attribute instance-attribute
search = param.String(default='', doc='Only assets whose title contains this text are listed.') class-attribute instance-attribute
sort = param.Selector(default='edited', objects=['edited', 'name'], doc='Order of the asset cards.') class-attribute instance-attribute
view_mode = param.Selector(default='grid', objects=['grid', 'list'], doc='Show assets as cards or rows.') class-attribute instance-attribute
new(what, template=None)

Start a new asset: a "dashboard", a "report", one from a "template", or "import" a file.

refresh()

Reload the assets from the store and rebuild the page.

build_downloader()

Build a hidden file download that :func:send_download drives from the server.

chat_question(model)

Return the first question a chat asked, its title when none is stored.

chat_thumbnail_html(model)

Draw a chat as its first question over its last answer.

component_icon(entry)

Return a component's declared icon, else the icon of its role when that is known.

component_role(entry)

Return "Data source", "Transform" or "View", by the rules the palette and gallery use.

Widgets and components whose ports are unknown get no label: ports are only known once the component was imported or declared on @register, and the launcher never imports components just to label them.

control_ids(entries)

Return the ids of the component entries registered with sidebar=True.

copy_dashboard(store, source, user, title)

Save the contents of source as a new, unshared asset of user, of the same kind.

initials(name)

Return up to two initials of name, e.g. "SK" for "sam.kim" or "Sam Kim".

parse_dashboard_file(content, user)

Parse a downloaded dashboard file into a model owned by user.

The file is a JSON export or a dashboard in the YAML format.

Raises:

Type Description
ValueError

If content is neither a dashboard export nor a dashboard in the YAML format.

relative_time(when, now=None)

Describe when relative to now, e.g. "12 minutes ago" or "yesterday".

report_thumbnail_html(model)

Draw a report as the top of its page: its title, then its first blocks.

send_download(downloader, model, restricted=(), extension='json')

Make the browser save model as the same file the editor's Download writes.

The items in restricted are written as :func:export_model describes. extension is "json" or "yaml".

thumbnail_html(model, icons, controls=(), position='top')

Draw the dashboard's saved tile layout as blocks with component icons.

icons maps component ids to their icon; components without one are drawn with the icon of the role they play in this dashboard's wiring. The controls, the component ids of controls, and the components moved beside the grid are drawn in the sidebar or top row, see _thumbnail_boxes.

unique_title(store, user, title, kind=DASHBOARD_KIND)

Return title, numbered if user already owns an asset of kind with that title.

layout_panel

The dashboard sections of the sidecar, shown while nothing is selected.

They are the screen size the tiles are arranged for and the placed components that have no tile on the dashboard; "Arrange for" is shown in the Layout tab only. The options of one tile are in the sidecar's Tile tab, see :mod:panel_flowdash.ui.tile_options.

GRID_EDIT_CSS = '\n:host {\n --tile-padding: 0px;\n}\n.muuri-grid:not(.muuri-no-handles) .muuri-grid-item {\n outline: 1px dashed var(--mui-palette-divider, rgba(127, 127, 127, 0.5));\n outline-offset: 2px;\n}\n.muuri-grid:not(.muuri-no-handles) .muuri-grid-item:hover {\n outline: 2px solid var(--mui-palette-primary-main, #0072b5);\n}\n.muuri-handle { opacity: 0.7 !important; }\n.muuri-grid-item:hover .muuri-handle, .muuri-handle:focus { opacity: 1 !important; }\n.muuri-handle.drag {\n top: 4px;\n left: calc(50% - 18px);\n width: 36px;\n height: 16px;\n padding: 2px 9px;\n box-sizing: border-box;\n border-radius: 8px;\n -webkit-mask-image: none;\n mask-image: none;\n color: var(--mui-palette-text-secondary, rgba(0, 0, 0, 0.6));\n background: radial-gradient(circle, currentColor 1.2px, transparent 1.6px) center / 6px 6px\n repeat content-box,\n var(--mui-palette-action-selected, rgba(127, 127, 127, 0.16));\n}\n.muuri-handle.resize {\n width: 18px;\n height: 18px;\n bottom: 2px;\n right: 2px;\n background-color: var(--mui-palette-primary-main, #0072b5);\n}\n.muuri-grid:not(.muuri-no-handles) .muuri-grid-item.muuri-selected {\n outline: 2px solid var(--mui-palette-primary-main, #0072b5);\n outline-offset: 5px;\n}\n:host(.fd-unframed-band) .muuri-grid.muuri-constrained { box-shadow: none; }\n:host(.fd-split-preview) .muuri-handle { display: none !important; }\n:host(.fd-split-preview) .muuri-grid .muuri-grid-item:not(:hover):not(.muuri-selected) { outline: none; }\n' module-attribute

MAX_OFF_GRID = 20 module-attribute

LayoutPanel

Bases: Viewer

The bands the tiles are arranged for, and the components off the grid.

arrange_section property

The band picker, shown only when the grid has more than one band.

band = param.String(default=None, allow_None=True, doc='Label of the breakpoint band the tiles are arranged for, or None for the base band.') class-attribute instance-attribute
band_select = pmui.RadioButtonGroup(options={}, size='small', sizing_mode='stretch_width', margin=(0, 0, 8, 0)) instance-attribute
band_summary = _caption('', margin=0) instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose tile grid is arranged.') class-attribute instance-attribute
off_grid_section = pn.Column(_heading('Not on the dashboard'), _caption('Placed components without a tile: those shown beside the dashboard and hidden tiles, such as the data sources the assistant left off. Show a hidden one to put it back.', margin=(0, 0, 8, 0)), self._off_grid, margin=0, sizing_mode='stretch_width', css_classes=['fd-off-grid']) instance-attribute
reset_band_button = pmui.Button(label='Reset to automatic', icon='restart_alt', variant='text', size='small', margin=(4, 0, 0, 0), sx={'textTransform': 'none'}) instance-attribute
visible = param.Boolean(default=True, doc='Whether the Layout tab, which arranges the tiles, is shown.') class-attribute instance-attribute
band_hint()

Say which band's layout a tile's width and height apply to, if not the one shown.

refresh()

Re-read the components off the grid, listing the first :data:MAX_OFF_GRID.

show_tile(instance_id)

Put a hidden tile back on the dashboard.

sync_bands()

Show the bands of the grid's breakpoints, the one arranged for and how each is arranged.

node_card

Compact canvas nodes: a stacked-port card naming a component, its ports and its preview.

The live component is shown only in the tile grid, so the same view is never rendered twice and a table or map is never squeezed into a node. A card gives each port its own full-width row (inputs first, then outputs) with port names only; types are shown as handle colors and hover tooltips. Unconnected optional inputs fold into a single clickable row when there are two or more, outputs can be clicked to switch the previewed port on multi-output nodes, and cards can be collapsed to a 44 px header strip.

CARD_WIDTH = 260 module-attribute

SHRINK_DELAY = 1.5 module-attribute

STALE_TEXT = {'draft': ('Not run: the result shows the previous version of the spec', 'edit_note'), 'running': ('Running…', 'hourglass_top')} module-attribute

STATUS_TEXT = {'ok': 'Up to date', 'waiting': 'Waiting for input', 'pending': 'Updating', 'failed': 'Failed', 'unavailable': 'Unavailable'} module-attribute

logger = logging.getLogger(__name__) module-attribute

CardBridge

Bases: JSComponent

Relays clicks on the actions inside card HTML and styles each card's handles.

Handle positions are not set here: they are CSS variables in each node's style, so React Flow re-measures the handles when they move.

canvas_class = param.String(default='') class-attribute instance-attribute
handles = param.Dict(default={}) class-attribute instance-attribute

NodeCard

Bases: Viewer

The compact view of a placed component on the wiring canvas.

The card's parameters follow the component straight away, while its HTML is rebuilt at most once per burst of changes in a served session (see :class:~panel_flowdash.ui.node_preview.Coalescer) and only sent when it differs from what the page shows.

active_output = param.String(default=None, allow_None=True, doc='Effective output port currently previewed, used to mark the eye icon.') class-attribute instance-attribute
base_height property

The card's height without a preview, set by its collapsed state and visible ports.

collapsed = param.Boolean(default=False, doc='Whether the card is collapsed to a single 44 px header row.') class-attribute instance-attribute
edit = param.Selector(default=None, objects=[None, 'spec', 'definition'], doc='\n What the header\'s edit button opens in the code panel: the\n component\'s ``"spec"``, its read-only ``"definition"``, or None for\n no button.') class-attribute instance-attribute
height property

The card's current height, including the preview shown.

icon = param.String(default='widgets', doc='Material icon name.') class-attribute instance-attribute
inputs = param.List(default=[], doc='Input ports as dicts with ``name``, ``label``, ``type``, ``required``, ``connected``, ``missing``, ``source``.') class-attribute instance-attribute
outputs = param.List(default=[], doc='Output ports as dicts with ``name``, ``label``, ``type``.') class-attribute instance-attribute
preview property

The preview the card shows, if any.

preview_output = param.String(default=None, allow_None=True, doc='User-selected output port to preview, or None for automatic selection.') class-attribute instance-attribute
preview_source = param.Callable(default=None, doc="\n Returns the card's current preview, or None to show the summary. Only\n called while ``show_preview`` is on and the card is expanded.") class-attribute instance-attribute
show_optional = param.Boolean(default=False, doc='Whether folded unconnected optional inputs are temporarily expanded.') class-attribute instance-attribute
show_preview = param.Boolean(default=False, doc='Whether to preview the current value below the ports.') class-attribute instance-attribute
stale = param.Selector(default=None, objects=[None, *STALE_TEXT], doc='\n Whether the result does not match the spec in the code panel: a\n ``"draft"`` not run, or ``"running"``.') class-attribute instance-attribute
status = param.Selector(default='ok', objects=list(STATUS_TEXT)) class-attribute instance-attribute
status_detail = param.String(default='', doc='Why the component has its status.') class-attribute instance-attribute
subtitle = param.String(default='', doc='Secondary component type label under the title.') class-attribute instance-attribute
summary = param.String(default='', doc='One line describing the current value.') class-attribute instance-attribute
title = param.String(default='') class-attribute instance-attribute
handle_layout()

Return handle metadata (for JS sync) and CSS variable overrides (for node['style']).

refresh(*_events)

Rebuild the card, e.g. once the value it previews changed.

release()

Stop updating the card, e.g. once its component has been removed.

card_height(n_inputs, n_outputs, *, extra_rows=0)

Return the height of an expanded card without a preview.

component_icon(spec)

Return the component's own icon, or one for its role.

component_role(spec)

Classify a component as a data source, a transform or a view.

node_card(spec, state, failures, wiring, instance=None, show_preview=False, *, instance_id=None, preview_output=None, collapsed=False, on_layout=None, pending=None)

Build the card of a placed component, following its state until wiring is released.

pending says while the node's value is being computed.

node_preview(spec, state, instance=None, output=None)

Preview a placed component: its own preview, its selected output, or a view's input.

node_preview_value(spec, state, instance=None, output=None)

Return (port_name, raw_value) for the node's currently previewed output (for pop-out).

node_status(spec, state, failures, pending=None)

Return a placed component's status and a sentence explaining it.

A node whose async outputs, or those of a node upstream, are computing is "pending" (see :class:~panel_flowdash.pending.NodePending), unless it failed or is waiting for an input.

node_summary(spec, state, preferred_output=None)

Summarize the selected output holding a value, or for a view the first input holding one.

placeholder_card(placeholder)

Build the card of a saved item that could not be placed.

port_label(port)

Return the name a port is shown under.

port_offsets(count)

Return where count handles sit evenly spaced on a card, as percentages of its height.

port_tops(n_inputs, n_outputs, *, extra_rows=0)

Return the vertical centres of stacked input and output rows, in px from the card top.

select_preview_output(spec, state, preferred=None)

Choose which output port to preview, preferring a DataFrame over opaque values.

summarize_value(value, limit=60)

Describe a port value in a few words, e.g. "72,357 rows, 29 columns".

node_preview

Compact previews of a node's current value, shown inside its card on the wiring canvas.

A preview is a small, escaped HTML snippet with a fixed height per kind: a table for a DataFrame, a sparkline for numbers, chips for a list, a few key: value lines for a dict, a KPI tile, a chart thumbnail or a line of text for anything else. Each kind keeps its height while the value changes, so a card only resizes when the kind of its value does, and every preview is capped in rows, columns, characters and points, so a large value never reaches the page.

A component can supply its own preview by defining __flowdash_preview__; see :func:hook_preview.

CHART_COLOR = '#2a9d8f' module-attribute

CHART_CSS = '\n.fd-pv-chart {\n height: 112px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 3px;\n}\n.fd-pv-chart svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n.fd-ch-ax { stroke: var(--fd-divider); stroke-width: 1; }\n.fd-ch-ln {\n fill: none;\n stroke: var(--fd-viz-1, #2a9d8f);\n stroke-width: 1.8;\n stroke-linejoin: round;\n stroke-linecap: round;\n}\n.fd-ch-ar { fill: var(--fd-viz-1-soft, rgba(42, 157, 143, 0.18)); }\n.fd-ch-pt {\n fill: var(--fd-card-bg, #ffffff);\n stroke: var(--fd-viz-1, #2a9d8f);\n stroke-width: 1.4;\n}\n.fd-ch-br { fill: var(--fd-viz-1, #2a9d8f); }\n.fd-ch-txt {\n fill: var(--fd-muted);\n font-family: Roboto, system-ui, sans-serif;\n font-size: 9.5px;\n}\n.fd-pv-chart-empty {\n color: var(--fd-muted);\n font-size: 11px;\n}\n' module-attribute

DEFINITION_HOOK = '__flowdash_definition__' module-attribute

HEIGHTS = {'value': 22, 'table': _PV_CHROME + 22 + MAX_ROWS * 19 + 22, 'series': _PV_CHROME + 36, 'chips': _PV_CHROME + 36, 'entries': _PV_CHROME + 10 + MAX_ENTRIES * _LINE, 'text': _PV_CHROME + 10 + MAX_ENTRIES * _LINE, 'kpi': _PV_CHROME + 84, 'chart': _PV_CHROME + 112} module-attribute

MAX_CELL_CHARS = 24 module-attribute

MAX_CHART_POINTS = 120 module-attribute

MAX_CHIPS = 8 module-attribute

MAX_CHIP_CHARS = 24 module-attribute

MAX_COLUMNS = 3 module-attribute

MAX_ENTRIES = 3 module-attribute

MAX_LINE_CHARS = 48 module-attribute

MAX_POINTS = 48 module-attribute

MAX_ROWS = 4 module-attribute

MAX_TEXT_CHARS = 240 module-attribute

MIN_POINTS = 3 module-attribute

PREVIEW_CSS = '\n.fd-preview {\n box-sizing: border-box;\n padding: 6px 8px 8px;\n color: var(--fd-muted);\n font-size: 11px;\n line-height: 16px;\n overflow: hidden;\n}\n.fd-preview-value {\n margin: 4px 8px 6px;\n padding: 0 4px 0 8px;\n border-radius: 6px;\n background: var(--fd-surface);\n display: flex;\n align-items: center;\n gap: 6px;\n line-height: 22px;\n white-space: nowrap;\n}\n.fd-pvh {\n display: flex;\n align-items: center;\n gap: 4px;\n height: 22px;\n margin-bottom: 4px;\n}\n.fd-pv-meta {\n color: var(--fd-muted);\n font-size: 11px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: 0;\n}\n.fd-pv-meta-right {\n flex: none;\n color: var(--fd-muted);\n font-size: 10.5px;\n white-space: nowrap;\n margin-left: 4px;\n}\n.fd-pv-grow { flex: 1; min-width: 4px; }\n.fd-popout-btn {\n flex: none;\n width: 20px;\n height: 20px;\n padding: 0;\n border: 0;\n border-radius: 4px;\n background: transparent;\n color: var(--fd-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.fd-popout-btn:hover {\n background: var(--fd-hover);\n color: var(--fd-text);\n}\n.fd-popout-btn .fd-ms { font-size: 14px; }\n.fd-preview-value .fd-popout-btn {\n width: 18px;\n height: 18px;\n margin-left: auto;\n}\n.fd-preview-value .fd-popout-btn .fd-ms { font-size: 13px; }\n.fd-pvb {\n border-radius: 6px;\n background: var(--fd-surface);\n overflow: hidden;\n position: relative;\n}\n.fd-pv-key { flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }\n.fd-pv-val {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--fd-text);\n font-weight: 500;\n}\n.fd-pv-table-wrap {\n display: flex;\n flex-direction: column;\n height: 120px;\n}\n.fd-pv-table {\n width: 100%;\n table-layout: fixed;\n border-collapse: collapse;\n color: var(--fd-text);\n font-variant-numeric: tabular-nums;\n}\n.fd-pv-table th, .fd-pv-table td {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: left;\n}\n.fd-pv-table th {\n height: 22px;\n padding: 0 6px;\n color: var(--fd-muted);\n font-size: 10.5px;\n font-weight: 500;\n border-bottom: 1px solid var(--fd-divider);\n box-sizing: border-box;\n}\n.fd-pv-table td {\n height: 19px;\n padding: 0 6px;\n font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 10.5px;\n line-height: 19px;\n box-sizing: border-box;\n}\n.fd-pv-table .fd-num { text-align: right; }\n.fd-pv-foot {\n margin-top: auto;\n height: 22px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 6px;\n padding: 0 6px;\n font-size: 10.5px;\n color: var(--fd-muted);\n border-top: 1px solid var(--fd-divider);\n white-space: nowrap;\n}\n.fd-pv-foot span { overflow: hidden; text-overflow: ellipsis; }\n.fd-pv-spark-wrap { padding: 5px 8px; height: 36px; box-sizing: border-box; }\n.fd-pv-spark { display: block; width: 100%; height: 26px; overflow: visible; }\n.fd-pv-spark polyline {\n fill: none;\n stroke: var(--fd-viz-1, var(--fd-primary));\n stroke-width: 1.6;\n stroke-linejoin: round;\n stroke-linecap: round;\n}\n.fd-pv-chips {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px;\n height: 36px;\n box-sizing: border-box;\n overflow: hidden;\n}\n.fd-pv-chip {\n flex: none;\n max-width: 96px;\n height: 20px;\n box-sizing: border-box;\n padding: 0 7px;\n border-radius: 10px;\n border: 1px solid var(--fd-divider);\n background: var(--fd-chip-bg);\n line-height: 18px;\n color: var(--fd-text);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.fd-pv-entries { padding: 5px 8px; height: 58px; box-sizing: border-box; }\n.fd-pv-entry { display: flex; gap: 6px; height: 16px; white-space: nowrap; }\n.fd-pv-entry .fd-pv-val { font-weight: 400; }\n.fd-pv-text-wrap { padding: 5px 8px; height: 58px; box-sizing: border-box; }\n.fd-pv-text {\n color: var(--fd-text);\n white-space: pre-line;\n overflow-wrap: anywhere;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n max-height: 48px;\n}\n.fd-pv-kpi {\n padding: 8px 10px;\n height: 84px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 2px;\n}\n.fd-kpi-row {\n display: flex;\n align-items: baseline;\n gap: 5px;\n min-width: 0;\n}\n.fd-kpi-val {\n font-size: 24px;\n line-height: 28px;\n font-weight: 500;\n letter-spacing: -0.3px;\n color: var(--fd-text);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.fd-kpi-unit {\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: var(--fd-muted);\n padding: 0 5px;\n border-radius: 4px;\n background: var(--fd-chip-bg);\n white-space: nowrap;\n flex: none;\n}\n.fd-kpi-label {\n font-size: 11px;\n line-height: 15px;\n color: var(--fd-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.fd-kpi-delta {\n display: inline-flex;\n align-items: center;\n gap: 3px;\n font-size: 11px;\n line-height: 15px;\n color: var(--fd-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.fd-kpi-delta.fd-pos { color: var(--mui-palette-success-main, #2e7d32); }\n.fd-kpi-delta.fd-neg { color: var(--mui-palette-error-main, #d32f2f); }\n.fd-kpi-delta .fd-ms { font-size: 13px; }\n' module-attribute

PREVIEW_HOOK = '__flowdash_preview__' module-attribute

PREVIEW_KIND_KEY = '__flowdash_preview_kind__' module-attribute

PREVIEW_WORKERS = 4 module-attribute

PreviewCaller = t.Literal['card', 'popout', 'inspector', 'code_panel'] module-attribute

logger = logging.getLogger(__name__) module-attribute

Coalescer

Call callback once for each burst of calls, delay seconds after the first.

document returns the served document the callback updates, or None when there is none, in which case the callback runs straight away. In a session the calls of a burst, e.g. a slider being dragged, collapse into one call on the event loop, which then sees the latest values. Calls may come from any thread: the timer is set from the event loop.

delay = delay instance-attribute
cancel()

Drop a pending call and ignore every later one.

Preview dataclass

A rendered preview: its kind, its fixed height in px and its escaped html.

height property

The height the card reserves for this preview.

html instance-attribute
kind instance-attribute
size = None class-attribute instance-attribute
with_height(height)

Return this preview drawn in a block height px tall.

build_preview(value, label='', showing=False)

Build the preview of one value, or None when there is nothing to show.

Parameters:

Name Type Description Default
value Any

The value to preview.

required
label str

The name of the port holding it, shown beside a single value.

''
showing bool

Whether the value is one a view shows rather than one it publishes, which the caption above a table, sparkline, chips or entries says.

False

call_definition_hook(instance, caller=None)

Return (language, text) from instance.__flowdash_definition__, or None.

A component without code or a spec to edit may define the hook to show what defines it, e.g. a data source's spec as YAML, read only in the code panel. The language is an Ace mode such as "yaml", "json" or "sql". The hook returns None to show nothing, and one that fails or returns anything but two strings is logged and shows nothing. While it runs, preview_context returns caller.

call_preview_hook(instance, output=None, caller=None)

Invoke instance.__flowdash_preview__, passing output= if accepted.

While it runs, preview_context returns caller.

chart_preview(payload, caption='')

Preview a chart from a structured chart payload (Vega-Lite spec or inline SVG).

chart_svg(payload, *, width=240, height=104)

Return (html, caption) drawing a chart payload (Vega-Lite spec or inline SVG).

The caption is the payload's own, else one naming the mark and its points.

chips_preview(items, caption)

Preview the first few items of a list as chips.

describe_object(value)

Name a chart or other rich object, e.g. "HoloViews Curve of y over x".

Returns None for values that are not a recognized chart, so the caller falls back to the value's own text.

detached_holoviews(value)

Return a HoloViews object with each stream-driven DynamicMap frozen at its last frame.

Every plot of a DynamicMap subscribes to the same streams, so zooming one plot of a rasterized image would draw the other at its ranges too.

entries_preview(mapping, caption)

Preview the first few entries of a dict as key: value lines.

format_value(value, limit=MAX_CELL_CHARS)

Format one value for a cell or a line, e.g. 1,234 or 0.1235.

holoviews_pane(value, **params)

Return a new pane drawing a HoloViews object, or None for any other value.

A HoloViews element can be drawn again wherever it is shown, unlike a Panel or Bokeh object, which is shown in one place at a time. A stream-driven DynamicMap is drawn as a static copy of its last frame.

hook_preview(instance, label='', output=None, caller=None)

Ask a component for its own preview through __flowdash_preview__.

If the hook accepts an output keyword argument, output is passed so multi-output components can return a preview for the selected output port. Returns None (or a blank string) to keep the default preview, a str shown as plain text (up to three lines, never as HTML or Markdown), or any other value, which is previewed like an output value. While it runs, preview_context returns caller.

kpi_preview(value, *, unit='', label='', delta='', caption='')

Preview a single KPI metric with optional unit, label and delta.

preview_context()

Return who is asking for the preview or definition, from inside a component's hook.

"card", "popout", "inspector" or "code_panel" (see PreviewCaller) while FlowDash runs __flowdash_preview__ or __flowdash_definition__ for one of them, None anywhere else, e.g. when a host or a test calls the hook itself. The agent never calls these hooks. To decide whether slow work, such as a query, may run, ask preview_off_loop instead: the same caller may ask on or off the event loop.

preview_off_loop()

Whether the current code runs on FlowDash's preview worker, off the event loop.

True inside work FlowDash hands to its preview threads (run_off_loop), where a preview or definition hook may block for a short query without freezing the session; False on the event loop and anywhere else.

preview_priority(value)

Rank how informative a value's preview is (lower is better).

render_vega_lite_svg(spec, data=None, *, width=240, height=104)

Render a crisp, theme-aware inline SVG thumbnail from a Vega-Lite spec and rows.

Returns (svg_html, auto_caption). Falls back to a muted placeholder if the spec has no plottable rows.

run_off_loop(work, then, doc)

Call work on a worker thread, then pass its result to then on doc's event loop.

work should catch its own errors; one it raises is logged and then is not called. Nothing is delivered once the session has ended. While work runs, preview_off_loop returns True.

sanitize_svg(raw_svg)

Sanitize an SVG snippet to an allowlist of geometric SVG tags and attributes.

series_preview(values, caption)

Preview numbers as a sparkline, with their count and range; None if too few.

sparkline_svg(numbers_)

Draw numbers_ as a polyline in a 100 by 24 box, skipping non-finite values.

summarize_value(value, limit=60)

Describe a port value in a few words, e.g. "72,357 rows, 29 columns".

table_preview(value, caption)

Preview the first rows of the first columns of a DataFrame.

text_preview(text, *, caption='')

Preview a snippet of plain text, up to three lines; markup is shown as typed.

A short single line gets the one-line box of a single value.

value_preview(label, text, *, popout=True)

Preview a single value as label value on one line.

number_widgets

Config widgets for a number's format and its colored thresholds.

A text param holding a Python format spec asks for :class:FormatInput, and a list of [limit, color] pairs for :class:ThresholdsInput, through their FlowDash metadata::

format = param.String(metadata={"flowdash": {"widget": "format"}})
thresholds = param.List(metadata={"flowdash": {"widget": "thresholds"}})

Both store a format spec string and a list of pairs, as a text box and a list literal did, so existing dashboards load unchanged.

FORMAT_PRESETS = {'Automatic': '', 'Whole number': ',.0f', 'One decimal': ',.1f', 'Two decimals': ',.2f', 'Percent': ',.0%', 'Percent, one decimal': ',.1%', 'Scientific': '.2e'} module-attribute

FORMAT_WIDGET = 'format' module-attribute

THEME_COLORS = {'Primary': 'primary', 'Secondary': 'secondary', 'Success': 'success', 'Warning': 'warning', 'Error': 'error', 'Info': 'info'} module-attribute

THRESHOLDS_WIDGET = 'thresholds' module-attribute

FormatInput

Bases: CompositeWidget

A dropdown of number formats by name, with a field for a custom format spec.

description = param.String(default=None, allow_None=True, doc="\n The field's doc, shown as a tooltip beside its name.") class-attribute instance-attribute
value = param.String(default='', allow_None=True) class-attribute instance-attribute

ThresholdsInput

Bases: CompositeWidget

Rows of a limit and a color: a number takes the color of the lowest limit it reaches.

Pairs it cannot read, e.g. [2], and colors it does not offer, e.g. "rgb(0, 0, 0)", are kept as they are: the rows show what they can and an edit changes only its own pair.

description = param.String(default=None, allow_None=True, doc="\n The field's doc, shown as a tooltip beside its name.") class-attribute instance-attribute
value = param.List(default=[], allow_None=True) class-attribute instance-attribute

color_problem(color)

Return why color is no threshold color, or None if the KPI can show it.

format_example(spec)

Show how spec formats a sample number, the one the KPI shows a value like.

format_problem(spec)

Return why spec is no format for a number, in words, or None if it is one.

thresholds_problems(thresholds)

Return what is wrong with a list of [limit, color] pairs, empty if nothing is.

output_switch

The Dashboard/Report switch: whether the dashboard bar shows and edits the tile grid or the report.

It is interim, until a report becomes an artifact of its own, and kept in this one place so that it can go in one change: the dashboard bar only places :attr:OutputSwitch.toggle and asks the switch about the output.

REPORT_ITEM = {'label': 'Report', 'icon': 'description', 'action': 'output:report'} module-attribute

REPORT_MENU_BREAKPOINT = 1100 module-attribute

OutputSwitch

Shows the dashboard's tile grid or its report, in view and in edit mode alike.

In edit mode the report's Layout tab is its block editor, and the Dataflow tab, which both outputs share, keeps the output it was opened from, so Layout goes back to it. The report has no Split tab.

editor = editor instance-attribute
output property

The output on screen: the report or the dashboard, in the Dataflow tab the one it came from.

toggle = pmui.RadioButtonGroup(options=_OUTPUT_OPTIONS, value=self.output, size='small', css_classes=['fd-output-switch'], **{**params, 'stylesheets': [*params.get('stylesheets', []), _REPORT_IN_MENU]}) instance-attribute
choose_tab(tab)

Show the report's block editor for its Layout tab, returning whether tab was the report's.

edit()

Note the output that edit mode starts on, the one on screen.

menu_items(narrow)

Return the overflow menu's entries for the outputs the switch has no room for.

show(output)

Show output, e.g. picked in the overflow menu.

sync()

Show the editor's output in the switch, which is not a choice of the person's.

A standalone report has only the one output, so it has no switch.

tab()

Return the edit tab on screen: Layout for the report, else the editor's mode outside other surfaces.

tabs(tabs)

Return the edit tabs offered for the output on screen: the report has no Split.

palette

The editor's component palette: a search field over components grouped by role.

EMPTY_MESSAGE = 'No components match' module-attribute

HINT = 'Drag onto the canvas, or drop on a port to add and connect in one step. Click to add without connecting.' module-attribute

PRESET_RETRY = 5.0 module-attribute

ROLES = ('source', 'transform', 'view', 'other', 'widget') module-attribute

ROLE_LABELS = {'source': 'Data sources', 'transform': 'Transforms', 'view': 'Views', 'other': 'Components', 'widget': 'Widgets'} module-attribute

logger = logging.getLogger(__name__) module-attribute

ComponentPalette

Bases: Viewer

Search field, grouped component list and usage hint.

header_end is shown above the search field, except in the touch layout.

menu is the MenuList the canvas accepts drops from. Its items come from the items callable, which reads query and is called again whenever the query changes or :meth:refresh is called.

menu = pmui.MenuList(draggable=True, drag_type=drag_type, highlight=False, level_indent=0, sizing_mode='stretch_width', margin=0, styles={'max-height': 'none'}, sx=_PALETTE_SX) instance-attribute
query = param.String(default='', doc='Current search text.') class-attribute instance-attribute
search = pmui.TextInput(placeholder='Search components', size='small', sizing_mode='stretch_width', margin=0, sx=_SEARCH_SX) instance-attribute
touch = param.Boolean(default=False, doc="\n Whether the palette is laid out for a touch screen, as in the phone's\n bottom sheet: entries are 48 px touch targets and the hint about\n dragging is hidden, since an entry is added with a tap there.") class-attribute instance-attribute
refresh()

Rebuild the menu items from the items callable.

PaletteEntry dataclass

What the palette shows and searches for one component.

component_id instance-attribute
config = None class-attribute instance-attribute

The config a preset entry places the component with.

description = None class-attribute instance-attribute
draggable = True class-attribute instance-attribute
icon = None class-attribute instance-attribute
inputs = () class-attribute instance-attribute
outputs = () class-attribute instance-attribute
placed = False class-attribute instance-attribute
role instance-attribute
summary property

Port summary such as in: dataset, out: filtered (DataFrame).

Types are spelled out for the last group only: that is the side a component is usually wired from, and it keeps the line short.

tags = () class-attribute instance-attribute
title instance-attribute
tooltip = None class-attribute instance-attribute
item()

Return the MenuList item for this entry.

matches(query)

Whether every word of query occurs in the title, description, tags or ports.

PalettePort dataclass

A port as the palette summarizes and searches it.

name instance-attribute
type = None class-attribute instance-attribute

SearchShortcut

Bases: JSComponent

Shows search and focuses its input when / is pressed outside a text field.

Escape in the field clears it.

search = Child() class-attribute instance-attribute

component_presets(entry, context, failed=None)

Return the presets register(palette_presets=...) gives entry for context.

Each is a dict with a title, a JSON-serializable config dict and optionally an id, description, tooltip, tags and icon, plus the key that identifies it (a hash of its id, or else of its title and config). Malformed ones are skipped and a failing hook gives none.

editor_presets(editor, entry)

Return the presets of entry for editor, asking its hook again only when the context changes.

A hook that failed is asked again after PRESET_RETRY seconds.

palette_entry(entry, spec=None, *, placed=False)

Describe entry for the palette.

Components are imported lazily, so until spec exists the ports come from the provides/requires declared on @register.

palette_items(entries, query='')

MenuList items for the entries matching query, one group per role.

preset_entries(base, presets)

Return palette entries for presets of the component base describes, with its ports.

palette_drawer

The editor's component palette beside the canvas, which folds to a narrow strip like the sidecar.

The fold button sits beside the palette's search field; the folded strip shows a button opening it again. Pressing / while it is folded opens it and focuses the search field, as / focuses the field of the open palette. Whether it is open is remembered for the browser with the editor's other preferences, see :class:~panel_flowdash.ui.split_view.SplitPreferences.

FOLDED_CLASS = 'fd-palette-folded' module-attribute

FOLD_LABEL = 'Hide components' module-attribute

UNFOLD_LABEL = 'Show components' module-attribute

PaletteDrawer

Bases: Parameterized

The component palette in its column beside the canvas, open or folded to a strip.

:attr:panel is the column. fold_button, made by :func:fold_button, sits in the palette's header. On a phone the palette moves to a bottom sheet (see :meth:detach), where it does not fold.

bridge = PaletteFoldBridge(uid=uid, on_open=lambda: self.toggle(True, focus=True)) instance-attribute
fold_button = fold_button instance-attribute
open = param.Boolean(default=True, doc='Whether the palette is open rather than folded.') class-attribute instance-attribute
palette = palette instance-attribute
panel = pn.Column(region, self.unfold_button, self.bridge, width=width, sizing_mode='stretch_height', margin=0, styles={'border-right': '1px solid var(--mui-palette-divider, #e0e0e0)'}, stylesheets=[f':host(.{FOLDED_CLASS}) .fd-palette-region-{uid} {{ display: none !important; }}']) instance-attribute
unfold_button = pmui.IconButton(icon='keyboard_double_arrow_right', description=UNFOLD_LABEL, size='small', margin=(8, 4), visible=False, css_classes=[f'fd-palette-unfold-{uid}']) instance-attribute
width = width instance-attribute
attach()

Put the palette back in the column after the phone layout.

detach()

Take the palette out of the column, to show it in the phone's sheet.

toggle(open_, focus=False)

Open or fold the palette; with focus, move the focus to what is shown in its place.

PaletteFoldBridge

Bases: JSComponent

Gives the palette's fold buttons their ARIA state, moves the focus and opens it on /.

The buttons, the palette and its search field are found on the page by CSS classes ending in :attr:uid. An aria-controls id cannot reach across shadow roots, so the buttons reference the palette through ariaControlsElements where the browser supports it, which sets aria-controls to an empty value, and by its id elsewhere.

collapsed = param.Boolean(default=False, doc='Whether the palette is folded.') class-attribute instance-attribute
focus_count = param.Integer(default=0, doc='Bumped to move the focus to the focus target.') class-attribute instance-attribute
focus_target = param.Selector(default=None, objects=[None, 'search', 'unfold'], doc='What takes the focus on the next focus request.') class-attribute instance-attribute
label_count = param.Integer(default=0, doc='Bumped to label the buttons again, e.g. after they were rendered anew.') class-attribute instance-attribute
uid = param.String(default='', doc="The suffix of the CSS classes of the palette's parts.") class-attribute instance-attribute
request_focus(target)

Move the focus to target, "search" or "unfold", once it is on screen.

fold_button()

Return the button folding the palette, for the palette's header.

pipeline

A strip summarising the dataflow as source -> transform -> views, with a status dot per stage.

PipelineStrip

Bases: Viewer

The "Pipeline" strip in the health popover, hidden while nothing is wired.

stages = [] instance-attribute
visible property

Whether the strip has stages to show.

update(stages)

Show stages, or hide the strip when there are none.

Stage dataclass

One chip of the strip: a label and the worst status of its nodes.

label instance-attribute
nodes instance-attribute
status instance-attribute

pipeline_stages(edges, titles, status)

Order the wired nodes into stages from the sources to the views.

Nodes without outgoing edges are the views and are collapsed into one "N views" stage at the end. The others are grouped by their longest distance from a source, so a chain of transforms keeps its order. A group of more than two nodes is collapsed into a count too.

provenance

How a node was made: the agent request that created it, and the turns that changed it later.

NOT_RECORDED = 'The model and tool calls of this request are only kept while the session that made it is open.' module-attribute

WARNING_CHIP_SX = {'border': 'none', 'backgroundColor': 'transparent', 'color': 'text.secondary', 'cursor': 'default', '& .MuiChip-label': {'px': 0}, '& .MuiChip-icon': {'color': 'warning.main', 'ml': 0, 'mr': '4px'}} module-attribute

later_summary(later, more=False)

Say how many requests and manual edits changed a node after it was made, e.g. "Changed later by 2 requests".

provenance_chip(provenance, **params)

Return a quiet chip with a node's provenance label, e.g. "Metric: capacity", and its detail on hover.

provenance_line(provenance)

Return the provenance of a node's numbers as a chip with its detail, for "How was this made?".

provenance_objects(turn, state, *, redacted, later=(), on_open=None, more=False)

Show the agent request turn records and the turns that changed the node since.

The request is its span when state holds the run's steps, and what the turn says otherwise, e.g. after a reload, when a stored history holds the run's versions but none of its model or tool calls. redacted hides the request's content (the question, summary, arguments, results and messages) and keeps its shape. later lists the turns that changed the node after it was made, and more says more may have, since a summary names at most eight changes; on_open is offered for those whose steps state holds. Returns the objects and the span view among them, to release once closed.

recorded(state, run_id)

Whether state holds the steps of run run_id, not just its versions as a stored history does.

warning_chip(provenance, **params)

Return the chip of a provenance that warns about the numbers, e.g. a row limit, in the warning color.

report_editing

The pieces of the Report view that edit a report: dragging blocks, the insert bar and the text editor.

Every change they make goes through the editor (FlowDash.set_report and the helpers of :mod:panel_flowdash.report), so a gesture is one version of the edit history and Undo takes it back. :class:BlockDrag moves blocks by their drag handles; :class:BlockResize sets a block's height by the handle on its bottom edge; :class:InsertBar offers the kinds of block to insert between two blocks; and :class:TextBlockEditor edits a text block's Markdown in place, with a small toolbar limited to formatting that round-trips to Markdown and a picker for the live values a text may quote.

KIND_ICONS = {'chart': 'bar_chart', 'table': 'table_chart', 'kpi': 'speed', 'data': 'storage', 'control': 'tune', 'text': 'notes'} module-attribute

KIND_LABELS = {'chart': 'Chart', 'table': 'Table', 'kpi': 'KPI', 'data': 'Data', 'control': 'Control', 'text': 'Text'} module-attribute

MAX_PICKS = 50 module-attribute

MIN_BLOCK_HEIGHT = 120 module-attribute

RESIZE_STEP = 10 module-attribute

BlockDrag

Bases: JSComponent

Moves the blocks of a report being edited by their handles, with the pointer or the arrow keys.

The blocks are the children carrying block_class of the layout carrying list_class, in order; each has a handle carrying handle_class. Dragging a handle shows where the block would go, and dropping it, or pressing the up or down arrow while the handle has focus, calls on_move(index, to), to being the index the block ends up at.

block_class = param.String(default='fd-report-block') class-attribute instance-attribute
enabled = param.Boolean(default=False, doc='Whether blocks can be moved.') class-attribute instance-attribute
handle_class = param.String(default='fd-report-handle') class-attribute instance-attribute
list_class = param.String(default='fd-report-blocks') class-attribute instance-attribute
announce(text)

Tell screen readers about a move, e.g. "Moved Sales below Revenue".

BlockResize

Bases: JSComponent

Resizes the blocks of a report being edited by the handles on their bottom edge.

A block is a child carrying block_class of the layout carrying list_class; its resize handle carries handle_class and the part that takes the height carries sized_class. Dragging a handle previews the new height in place and, on release, calls on_resize(index, height, False). The up and down arrows, while the handle has focus, shrink or grow the block by step pixels and call on_resize(index, height, True), as a run of presses is one edit. Double-clicking the handle calls on_resize(index, None, False), to give the block its default height back.

block_class = param.String(default='fd-report-block') class-attribute instance-attribute
enabled = param.Boolean(default=False, doc='Whether blocks can be resized.') class-attribute instance-attribute
handle_class = param.String(default='fd-report-resize') class-attribute instance-attribute
list_class = param.String(default='fd-report-blocks') class-attribute instance-attribute
min_height = param.Integer(default=MIN_BLOCK_HEIGHT, bounds=(1, None)) class-attribute instance-attribute
sized_class = param.String(default='fd-report-sized') class-attribute instance-attribute
step = param.Integer(default=RESIZE_STEP, bounds=(1, None)) class-attribute instance-attribute

InsertBar

Bases: Viewer

The kinds of block that can be inserted at a place in a report, and the pickers for them.

on_insert(block) inserts a block; on_ask(question) adds a question not run yet; on_close() closes the bar. nodes lists the nodes the picker offers, each a dict with id, title, name, kind and on_dashboard; groups the groups, with id, label and size.

empty = pmui.Typography('', variant='body2', margin=(4, 0), sx={'color': 'text.secondary'}) instance-attribute
find = pmui.TextInput(placeholder='Find a node by title', label='Find a node', size='small', margin=0, sizing_mode='stretch_width') instance-attribute
group_list = pmui.MenuList(items=[], dense=True, margin=0, sizing_mode='stretch_width', on_click=self._on_group) instance-attribute
groups = param.List(default=[]) class-attribute instance-attribute
node_list = pmui.MenuList(items=[], dense=True, margin=0, sizing_mode='stretch_width', on_click=self._on_node) instance-attribute
nodes = param.List(default=[]) class-attribute instance-attribute
question = pmui.TextInput(label='Question', placeholder='What should the report answer?', size='small', margin=0, sizing_mode='stretch_width') instance-attribute
reset()

Show the kinds of block only, closing any picker.

MarkdownArea

Bases: JSComponent

A text block edited in place: its rendered prose, which a click turns into its Markdown source.

value is the Markdown, synced when the text area loses focus and after each :meth:apply; html is what the block shows while not active. :meth:apply formats the selection, or inserts text at it, and returns the focus to the text area, so a toolbar button does not end the editing.

active = param.Boolean(default=False, doc='Whether the Markdown source is being edited.') class-attribute instance-attribute
html = param.String(default='', doc='The rendered block, shown while not active.') class-attribute instance-attribute
placeholder = param.String(default='Write something…') class-attribute instance-attribute
value = param.String(default='', doc="The block's Markdown.") class-attribute instance-attribute
apply(action, text=None)

Format the selection (bold, italic, link, list) or insert text at it.

TextBlockEditor

Bases: Viewer

A text block in an edited report: its prose, edited in place with a small Markdown toolbar.

on_commit(text) is called with the block's new Markdown; on_open() when the block starts being edited. stylesheets style the rendered prose. values lists the live values the text can quote, each a dict with label and ref (node.port); picking one inserts {{ node.port }}.

area = MarkdownArea(value=text, html=html, margin=0, sizing_mode='stretch_width', css_classes=['fd-md'], stylesheets=list(stylesheets or [])) instance-attribute
done = pmui.Button(label='Done', size='small', variant='text', margin=0, css_classes=['fd-text-done']) instance-attribute
insert_value = pmui.MenuButton(label='Insert value', icon='data_object', items=[], size='small', variant='text', margin=0, sx={'textTransform': 'none'}, css_classes=['fd-insert-value']) instance-attribute
toolbar = pn.FlexBox(*buttons, pmui.Divider(orientation='vertical', height=20, margin=(0, 4), align='center'), self.insert_value, pn.Spacer(height=0, margin=0, styles={'flex': '1 1 auto'}), self.done, align_items='center', flex_wrap='wrap', gap='2px', margin=(0, 0, 6, 0), sizing_mode='stretch_width', visible=False, styles={'border-bottom': '1px solid var(--mui-palette-divider, rgba(0,0,0,0.12))', 'padding-bottom': '4px'}, css_classes=['fd-text-toolbar']) instance-attribute
values = param.List(default=[], doc='The values Insert value offers.') class-attribute instance-attribute
close()

Stop editing the block, showing its prose.

open()

Start editing the block.

update(text, html)

Show the block's committed text, rendered as html.

report_export

The Report view's Export button and dialog: pick a format, then the browser saves the file.

EXPORT_NOTE = "The file holds the report's values as they are now. Anyone you send it to can read them, and it cannot be taken back." module-attribute

PENDING_LABEL = 'Include questions not answered yet' module-attribute

logger = logging.getLogger(__name__) module-attribute

ReportExport

Bases: Parameterized

The Export button of the Report view, its dialog and the download it starts.

button = pmui.Button(label='Export', icon='download', variant='text', size='small', margin=0, align='center', css_classes=['fd-report-export']) instance-attribute
dialog = pmui.Dialog(objects=[self._format, self._pending, self._note], actions=[self._cancel, self._confirm], title='Export report', open=False, css_classes=['fd-report-export-dialog']) instance-attribute
downloader = build_downloader() instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose report is exported.') class-attribute instance-attribute
exporting = param.Boolean(default=False, doc='Whether an export is being built.') class-attribute instance-attribute
close()

Close the dialog.

open()

Open the dialog, offering pending questions only when the report has some.

send(file)

Make the browser save file.

report_view

The Report view: the dashboard read as a document, its blocks rendered live from the graph.

The view shows :func:~panel_flowdash.report.report_blocks: the dashboard's own report, or the one derived from its groups and tile layout. The dashboard's controls sit in a bar above a centred column of blocks, with a list of contents beside it on wide screens. A node block shows the view object the node's tile shows, so the Report view, the Explore view and the workspace are never on screen together (see FlowDash.surface). Text blocks fill their {{ node.port }} placeholders from the current outputs and follow them as they change.

In edit mode an editor authors the report: Customize makes the derived report the dashboard's own, after which every block has a drag handle and a menu, an insert bar between blocks adds headings, text, nodes, groups and questions, text is edited in place and the title can be changed (see :mod:panel_flowdash.ui.report_editing). Every change goes through FlowDash.set_report, so it is one version of the edit history. Viewers, and editors outside edit mode, read the report. A question not run yet has a Run button, which editors use to ask the assistant (FlowDash.run_pending); its answer fills the question's block.

BLOCK_HEIGHT = 320 module-attribute

BODY_PADDING = 32 module-attribute

COLUMN_WIDTH = 780 module-attribute

CONTENTS_WIDTH = 220 module-attribute

CUSTOMIZE_HINT = 'Customize it to reorder, write prose or ask questions.' module-attribute

DERIVED_NOTICE = "Built from this dashboard's groups and tile layout." module-attribute

EDIT_HINT = 'Edit the dashboard to customize it.' module-attribute

EMPTY_TEXT = 'This dashboard has nothing to show in a report yet.' module-attribute

PENDING_NOTE = 'Not answered yet. Running it asks the assistant to build the answer here.' module-attribute

PHONE_BREAKPOINT = 600 module-attribute

RAIL_WIDTH = 80 module-attribute

RESTRICTED_TEXT = 'This output uses a component you may not see.' module-attribute

RUN_UNAVAILABLE = 'Only editors can run a question, in an app with an assistant.' module-attribute

SIZED_CLASS = 'fd-report-sized' module-attribute

VALUE_CLASS = 'fd-report-value' module-attribute

WIDE_BREAKPOINT = 1280 module-attribute

logger = logging.getLogger(__name__) module-attribute

ReportContents

Bases: JSComponent

The report's contents: a list of its sections, or on phones a chip opening that list.

A click scrolls the section's heading into view; the list marks the section being read. Headings are found by their fd-report-anchor-<key> CSS class through the page's shadow roots.

items = param.List(default=[], doc='The sections, each a dict with label, key and badge.') class-attribute instance-attribute
variant = param.Selector(default='list', objects=['list', 'chip']) class-attribute instance-attribute

ReportView

Bases: Viewer

The Report view of a :class:~panel_flowdash.editor.FlowDash editor.

editor = param.Parameter(doc='The FlowDash editor whose dashboard the report shows.') class-attribute instance-attribute
shown = param.Boolean(default=False, doc='\n Whether the view is on screen. While hidden it neither follows the\n outputs its text shows nor rebuilds, and catches up when shown.') class-attribute instance-attribute
schedule(*_events)

Rebuild the report soon, once for a burst of changes, while it is on screen.

sync()

Build the report from the dashboard as it is now.

reports

The Reports rail section: the reports the signed-in person may open.

A standalone report is a :class:~panel_flowdash.asset_store.AssetModel of kind "report", its own graph and report document with no tile grid. It opens at its asset route on the report editor. /reports is Browse with only reports listed.

REPORTS_ORDER = 1 module-attribute

REPORTS_ROUTE = 'reports' module-attribute

REPORTS_SECTION_ID = 'reports' module-attribute

REPORT_ICON = 'description' module-attribute

accessible_reports(app)

Return the reports the session's identity may open, its own first, most recent first.

report_items(ctx)

List the session's reports as rail items, by title.

reports_section()

Build the built-in Reports section, listed with the built-in Dashboards section.

roles

The role a component plays in a dataflow: data source, transform, view or widget.

ROLES = ('source', 'transform', 'view', 'widget', 'other') module-attribute

ROLE_ICONS = {'source': 'storage', 'transform': 'filter_alt', 'view': 'insert_chart', 'widget': 'tune', 'other': 'widgets'} module-attribute

ROLE_TAGS = {'source': 'source', 'data source': 'source', 'transform': 'transform', 'view': 'view', 'widget': 'widget'} module-attribute

component_role(entry, inputs, outputs, *, ports_known=True)

Return the role of a component, one of :data:ROLES.

A source, transform, view or widget tag decides it. Otherwise built-in widgets are widgets, a component without outputs is a view, one with outputs but no inputs a data source, and the rest are transforms. A component whose ports are not known yet is other.

is_builtin(entry)

Whether entry is one of the widgets FlowDash ships with.

settings_dialog

The dashboard settings dialog: general settings, refresh schedule, sharing and delete.

CUSTOM = 'Custom' module-attribute

DEDICATED_SETTINGS = ('description', 'refresh_period', 'viewers_can_inspect') module-attribute

Kind = t.Literal['user', 'group'] module-attribute

REFRESH_PRESETS = {'Off': 0, '1 min': 60, '5 min': 300, '15 min': 900, '1 hour': 3600} module-attribute

REMOVE = 'remove' module-attribute

ROLE_LABELS = {'view': 'Can view', 'edit': 'Can edit', 'blocked': 'Blocked'} module-attribute

Role = t.Literal['view', 'edit', 'blocked'] module-attribute

SECTIONS = ('general', 'refresh', 'sharing') module-attribute

SECTION_ICONS = {'general': 'info', 'refresh': 'autorenew', 'sharing': 'group'} module-attribute

SECTION_LABELS = {'general': 'General', 'refresh': 'Refresh', 'sharing': 'Sharing'} module-attribute

TILE_SETTINGS = {'node_previews': 'Preview values on the canvas', 'tile_cards': 'Frame tiles', 'tile_titles': 'Show tile titles'} module-attribute

SettingsDialog

Bases: Parameterized

One dialog for a dashboard's settings, its refresh schedule and its sharing.

The editor owns it and mounts dialog. Settings are edited on a copy and applied to the editor's settings on Save settings. An application supplies the sharing, rename and delete callbacks; without them the dialog only offers the dashboard settings.

delete = param.Callable(default=None, doc='\n Called with the dashboard id and title to ask for deleting the\n dashboard. Without it the dialog offers no Delete.') class-attribute instance-attribute
dialog = pmui.Dialog(objects=[self._subtitle, body], actions=[self._footer_note, pn.layout.HSpacer(), self._cancel_button, self._save_button], title='Dashboard settings', open=False, show_close_button=True, width_option='md', sx={'& .MuiDialog-paper': {'minWidth': 'min(760px, 100%)'}}) instance-attribute
rename = param.Callable(default=None, doc='\n Called with the dashboard id and the new title. Returns None once\n renamed, or the reason it was not. Without it the title is read-only.') class-attribute instance-attribute
save_sharing = param.Callable(default=None, doc='\n Called with the dashboard id and the new Permission when the sharing\n changed. Returns whether it was stored.') class-attribute instance-attribute
section = param.Selector(default='general', objects=list(SECTIONS), doc='The section shown.') class-attribute instance-attribute
sharing = param.Callable(default=None, doc="\n Called with a dashboard id when the dialog opens. Returns the\n SharingAccess to show, or None when the current identity may not\n change the dashboard's sharing.") class-attribute instance-attribute
set_role(name, kind, role)

Give a listed person or group another role, or remove them.

show(section='general', asset_id=None, title='')

Open the dialog on section for a dashboard, by default the editor's.

ShareEntry dataclass

One person or group named in a dashboard's sharing rules, with its role.

kind instance-attribute
name instance-attribute
role instance-attribute

SharingAccess dataclass

What the sharing section shows for one dashboard.

The application builds it for identities that may administer the dashboard; the dialog has no sharing section without one.

default_allow = True class-attribute instance-attribute
group_sizes = field(default_factory=dict) class-attribute instance-attribute
groups = () class-attribute instance-attribute
owner instance-attribute
permission instance-attribute
shareable = True class-attribute instance-attribute
users = () class-attribute instance-attribute
you = frozenset() class-attribute instance-attribute

entries_from_permission(permission, owner)

Return the entries a permission names and whether everyone may view.

A name in several lists gets the strongest role: blocked over edit over view, matching how access is evaluated. The owner keeps their own row, so rules naming the owner are not listed; an owner-only allow rule is how "only the people listed" is stored when nobody else may view.

permission_from_entries(entries, *, everyone, owner)

Build the permission for entries, the inverse of entries_from_permission.

With everyone on there are no view rules, so the project default lets everyone view and "Can view" entries add nothing. With it off and nobody listed as a viewer, the owner is the only view rule, which still lets editors view but nobody else.

refresh_choice(period)

Return the preset label for a refresh period, or "Custom".

Return the absolute URL of dashboard_path on the current page's server.

settled_scroll

Scrolls an element into view once it stops moving, e.g. a tile the grid is still placing.

SettledScroll

Bases: JSComponent

Scrolls the first element carrying a CSS class into view once it has settled.

pmui's Reveal scrolls as soon as the element exists. A tile just added to the grid is still moving then: the grid animates it into place, and a drawer opening beside the grid narrows it and lays the tiles out again. This waits until the element has kept its place for a few checks, for at most timeout milliseconds, and then scrolls it into view. The page's shadow roots are searched until the element is found, and after that only its box is read. It renders nothing itself, but must be on the page. The element stops below a sticky bar over its column, such as the controls bar while tiles are arranged, rather than under it.

scroll_to(css_class, timeout=3000)

Scroll the first element carrying css_class into view once it has settled.

sheet

Bottom sheets: where the editor's side panels go on a phone, and the buttons opening them.

ABOVE_SHEET_CLASS = 'fd-above-sheet' module-attribute

BEHIND_SHEET_CLASS = 'fd-behind-sheet' module-attribute

INSPECTOR_SHEET_HEIGHT = '55dvh' module-attribute

INSPECTOR_SHEET_TALL_HEIGHT = '85dvh' module-attribute

SHEET_SX = {'borderTopLeftRadius': 12, 'borderTopRightRadius': 12, 'overflowY': 'auto'} module-attribute

TOUCH_TARGET_SX = {'width': '44px', 'height': '44px'} module-attribute

SheetLabel

Bases: JSComponent

Names the sheet it is placed in for assistive technology.

The Drawer's paper takes no attributes, and an aria-labelledby cannot reach the title in another shadow root, so the label is set on the paper (or its dialog) from inside. A temporary sheet renders a new paper each time it opens, which resizes this element, so the label is set again then.

label = param.String(doc="The sheet's accessible name, its visible title.") class-attribute instance-attribute

bottom_sheet(title, css_class, height)

Return a modal bottom sheet with title and a close button, and the column it holds.

inspector_sheet()

Return the inspector's sheet.

Persistent, without a backdrop, so the canvas above it still takes a tap on another node, which the sheet then shows.

sheet_button(icon, label, css_class)

Return a floating button opening a bottom sheet, shown on phones only.

shell

The app shell: top bar content (breadcrumb, search slot) and the navigation rail.

DASHBOARD_EDIT_HEADER_SX = _hide_brand_below(_EDIT_BRAND_BREAKPOINT) module-attribute

DASHBOARD_HEADER_SX = _hide_brand_below(_BRAND_BREAKPOINT) module-attribute

DOCS_URL = 'https://panel-extensions.github.io/panel-flowdash/' module-attribute

HEADER_SX = {'& .MuiToolbar-root': {'minHeight': '56px'}, '--fd-header-height': '61px', '& .header .MuiToolbar-root': {'gap': '4px'}, '& .header .title': {'fontSize': '1.25rem', 'fontWeight': 600}, '& .header .MuiToolbar-root > .MuiBox-root': {'minWidth': 0}, '& .header .MuiToolbar-root > .MuiBox-root:has(.title)': {'flexShrink': 0}, f'@media (max-width: {NARROW_BREAKPOINT - 0.05}px)': {'& .header .title': {'display': 'none'}}} module-attribute

NARROW_BREAKPOINT = 600 module-attribute

logger = logging.getLogger('panel_flowdash') module-attribute

AppShell

The chrome around a FlowDashApp page in the rail navigation variant.

It provides the top bar content placed in the page header (the breadcrumb with a dashboard switcher, and :attr:search_slot) and the navigation placed in the page's rail (:attr:rail_content): the rail buttons, and on narrow screens, where the page moves its rail into the sidebar drawer, a navigation list. The menu, theme and contextbar toggles are the page's own.

Call :meth:sync with the route after every navigation and :meth:refresh when the dashboards or pages the user can see change.

breadcrumb = pn.Row(margin=0, align='center', min_width=0, stylesheets=[_SHRINK]) instance-attribute
dashboard_actions = pn.Row(margin=0, align='center') instance-attribute
dashboard_lead = pn.Row(margin=(0, 0, 0, 4), align='center', min_width=0) instance-attribute
dashboard_switcher = pmui.MenuButton(label='', variant='text', size='small', margin=0, sx=_SWITCHER_SX, stylesheets=[_SHRINK_SWITCHER]) instance-attribute
header property

Items for the page header, left to right.

nav_list = pn.Column(pmui.Typography(app.title, variant='h6', margin=(8, 16, 8, 16)), self._nav_list, sizing_mode='stretch_width', margin=0, stylesheets=[_HIDE_WHEN_WIDE]) instance-attribute
rail = pmui.NavigationRail(items=[], stylesheets=[_HIDE_WHEN_NARROW, _RAIL_MENU_ALIGN_CSS], on_click=self._on_rail_click) instance-attribute
rail_content property

Items for the page rail: the rail buttons and, for narrow screens, the list.

search_slot = pn.Row(margin=0, align='center') instance-attribute
crumbs()

Return the breadcrumb trail for the current route, the current page last.

rail_items()

Return the rail destinations: a path to open, items for a menu or an href.

refresh(section_id=None)

Rebuild the rail and switcher after sections, dashboards or pages changed.

sync(path, search=None)

Point the breadcrumb and the active rail item at the route path (and optional search).

Crumb

Bases: NamedTuple

One breadcrumb: a label and the path it links to (None for the current page).

label instance-attribute
path = None class-attribute instance-attribute

ViewportObserver

Bases: JSComponent

Browser bridge for narrow-viewport tracking and external links.

breakpoint = param.Integer(default=NARROW_BREAKPOINT, doc='Viewport width threshold (px) below which the rail moves into the drawer.') class-attribute instance-attribute
narrow = param.Boolean(default=False, doc='True while the viewport matches the narrow-screen drawer breakpoint.') class-attribute instance-attribute
observer_id = param.String(default='', doc='Stable key used to deduplicate document listeners across re-renders.') class-attribute instance-attribute
open_url(url)

Ask the browser to open url in a new tab.

sidecar

Whether the editor's sidecar is open or folded to its strip, decided in one place.

The sidecar (:class:~panel_flowdash.ui.inspector.Inspector) shares the window's width with the palette, the canvas or the tile grid and the assistant's drawer. Three things decide whether it is open:

  • The person's choice, made with its fold and unfold buttons. It is kept across tabs, and a new selection never overrides it; the folded strip then shows a dot for the selection.
  • The assistant's drawer. In a window narrower than :data:SHARED_SLOT_BELOW the two share one slot: opening the drawer folds the sidecar, and opening the sidecar closes the drawer.
  • The space budget. Where the open sidecar would leave the content less than its minimum, it folds, until the person opens it or selects something there; that holds until the window is resized.

CONTENT_MIN_WIDTH = 240 module-attribute

FOLDED_WIDTH = 44 module-attribute

SHARED_SLOT_BELOW = 1600 module-attribute

SIDECAR_MAX_WIDTH = 560 module-attribute

SIDECAR_MIN_WIDTH = 300 module-attribute

SIDECAR_WIDTH = 360 module-attribute

SPLIT_MIN_WIDTH = 980 module-attribute

SidecarFold

Bases: Parameterized

The one owner of the sidecar's collapsed state, see the module docstring.

drawer_open = param.Boolean(default=False, doc="Whether the assistant's drawer is open.") class-attribute instance-attribute
drawer_width = param.Integer(default=0, doc='The width the open drawer takes from the page; 0 while it overlays the page.') class-attribute instance-attribute
editor = editor instance-attribute
on_close_drawer = param.Callable(default=None, allow_None=True, doc="Closes the assistant's drawer, to free the shared slot.") class-attribute instance-attribute
user_open = param.Boolean(default=True, doc='Whether the person last opened rather than folded it.') class-attribute instance-attribute
drawer_changed(open_, width=0)

Record the assistant's drawer opening or closing; width is what it takes from the page.

fits()
folded()

Whether the sidecar is folded, from the person's choice, the drawer and the budget.

On a phone it is a bottom sheet over the page, which the person or the drawer opening over it closes.

left_phone()

Open the column again after the phone layout, whose sheet the person may have closed.

Beside an open drawer in a window where they share a slot, the drawer keeps it.

on_collapsed(collapsed)

Follow the sidecar folded or opened by anyone but this owner, e.g. a test or a phone sheet.

room()

Return the width left to the canvas or the grid beside the open sidecar, or None if unknown.

selection_made()

Open the sidecar the budget folded, as the person selected something to see in it.

sync()

Fold or open the sidecar as :meth:folded decides.

user_toggle(open_)

Record the person opening or folding the sidecar, and apply it.

window_resized()

spec_field

A spec edited as a form over its curated settings and as JSON or YAML, kept in sync both ways.

The inspector uses :class:SpecEditor for a param.Dict that declares settings, see :mod:panel_flowdash.spec_settings. Changing a control writes its path into the spec, and the lines that changed are highlighted in the text. Editing the text (applied on blur or Ctrl+Enter, like a code field, or with :attr:SpecEditor.live once it parses and typing pauses) reads every path back into the form, and the text stays as typed. Keys no control covers are kept as written, marked in the editor's gutter and listed at the end of the form with a link to their lines, and while the text does not parse the form is disabled and the spec keeps its last valid value.

YAML is read as YAML 1.2, so keys like on stay strings, and its comments are kept through edits made in the form.

The parts are exposed separately (:attr:SpecEditor.form, :attr:SpecEditor.spec) for a host laying them out itself, e.g. beside a live preview.

APPLY_DELAY = 0.6 module-attribute

MODES = {'Form': 'form', 'Form + Spec': 'both', 'Spec': 'spec'} module-attribute

NOT_SET = 'Not set' module-attribute

SET_IN_SPEC = 'Set in the spec' module-attribute

SYNTAX_LABELS = {'json': 'JSON', 'yaml': 'YAML'} module-attribute

AceGoto

Bases: JSComponent

Puts the cursor on a line of the visible Ace editor beside it, scrolled into view and focused.

goto = param.Dict(default={}, doc='\n ``{"row": n, "count": k}``: puts the cursor on line *n* (from 0) of the\n editor, scrolled into view, and gives it focus; *count* tells requests\n for the same line apart.') class-attribute instance-attribute

SpecEditor

Bases: CompositeWidget

A spec dict edited through a form of its settings and as JSON or YAML text.

Parameters:

Name Type Description Default
value

The spec.

required
settings

The :class:~panel_flowdash.spec_settings.SpecSetting controls.

required
choices

Choices per setting key, e.g. the columns of an input for encoding.x.field, overriding the setting's own options.

required
mode

Whether the form, the text or both are shown.

required
syntax

Whether the text is JSON or YAML.

required
live

Whether typed text is applied once it parses and typing pauses for :data:APPLY_DELAY seconds, as well as on blur.

required
layout

"stacked" puts the JSON under the form, "columns" beside it.

required
choices = param.Dict(default={}) class-attribute instance-attribute
editor = CodeEditor(value='', language=self.syntax, height=_EDITOR_HEIGHT, on_keyup=False, indent=2, soft_tabs=True, keyboard_accessible=True, sizing_mode='stretch_width', margin=0, css_classes=['fd-spec-editor'], stylesheets=[ACE_THEME_CSS, _EDITOR_CSS], styles={'border': '1px solid var(--mui-palette-divider, #ccc)', 'border-radius': '4px'}) instance-attribute
error = param.String(default=None, allow_None=True, doc='\n Why the text in the editor is not a valid spec, while it is not.') class-attribute instance-attribute
form = pn.Column(margin=0, sizing_mode='stretch_width', css_classes=['fd-spec-form']) instance-attribute
header = pn.Row(self._label, pn.layout.HSpacer(), self.mode_toggle, margin=(0, 0, 6, 0), sizing_mode='stretch_width', align='center') instance-attribute
layout = param.Selector(default='stacked', objects=['stacked', 'columns']) class-attribute instance-attribute
live = param.Boolean(default=False) class-attribute instance-attribute
mode = param.Selector(default='both', objects=list(MODES.values())) class-attribute instance-attribute
mode_toggle = pmui.RadioButtonGroup(options=MODES, value=self.mode, size='small', margin=0, sx={'& .MuiToggleButton-root, & .MuiButton-root': {'textTransform': 'none', 'whiteSpace': 'nowrap', 'py': 0.25, 'px': 1}}, css_classes=['fd-spec-mode']) instance-attribute
settings = param.List(default=[], item_type=SpecSetting) class-attribute instance-attribute
spec = pn.Column(self.editor, self.status, self._goto, margin=0, sizing_mode='stretch_width', css_classes=['fd-spec-text']) instance-attribute
status = pmui.Typography(variant='caption', margin=(4, 0, 0, 0), css_classes=['fd-spec-status']) instance-attribute
syntax = param.Selector(default='json', objects=list(SYNTAX_LABELS)) class-attribute instance-attribute
syntax_label property

The name of the text's syntax, "JSON" or "YAML".

unknown = param.List(default=[], doc='\n The dotted paths of the spec the form cannot show, kept as written.') class-attribute instance-attribute
unsent = param.Boolean(default=False, doc='\n Whether text typed into the editor has not been applied yet.') class-attribute instance-attribute
unshown = pn.Column(margin=(10, 0, 0, 0), sizing_mode='stretch_width', visible=False, css_classes=['fd-spec-unshown']) instance-attribute
value = param.Dict(default={}) class-attribute instance-attribute
yaml_doc property

The YAML document of the text last shown or read, holding its comments, for :meth:load.

flush()

Apply text typed and not applied yet, returning whether the text is a valid spec.

load(value, comments=None)

Show value as a spec loaded afresh, e.g. another node's, rather than as an edit.

Unlike setting :attr:value, no line is marked as changed, and text typed but not applied, valid or not, is dropped. comments is a YAML document, :attr:yaml_doc of earlier text of the same spec, whose comments YAML text keeps.

reveal(path)

Show the text with the cursor on the first line of path.

split_view

The Split tab of the editor: the wiring canvas and the tile grid side by side.

The two panes sit in a panel-splitjs HSplit. Dragging the gutter resizes them, and the sizes are remembered for the browser in local storage, together with whether the editor was last in the Split tab and where the code panel was docked. Collapsing a pane, with the gutter's buttons or by dragging it to the edge, falls back to the tab of the pane that is left: collapsing the grid leaves the Dataflow tab, collapsing the canvas the Layout tab, and the split keeps its last sizes for next time.

:class:SplitEvents reports when the canvas pane changed size, so the canvas can fit its view to the new width.

ASK_MAX_RATIO = 0.5 module-attribute

ASK_MIN_WIDTH = 320 module-attribute

ASK_WIDTH = 480 module-attribute

ASSISTANT_WIDTH = 360 module-attribute

DEFAULT_SIZES = (55.0, 45.0) module-attribute

GUTTER_CSS = '\n.gutter > .divider { --color: var(--mui-palette-divider, var(--panel-border-color)); }\n.gutter::after { background-color: var(--mui-palette-text-disabled, var(--panel-border-color)); }\n' module-attribute

STORAGE_KEY = 'panel-flowdash.editor.split' module-attribute

LocalPreference

Bases: JSComponent

Keeps :attr:value in the browser's local storage under :attr:key.

When it renders it sends what is stored to on_load; afterwards every change of :attr:value from Python is written back. It also keeps :attr:window_width up to date. It takes no space on the page.

key = param.String(default=STORAGE_KEY, doc='The local storage key.') class-attribute instance-attribute
legacy_key = param.String(default=None, allow_None=True, doc='\n A key the value was stored under before. While nothing is stored under\n :attr:`key`, the value is read from it and copied to :attr:`key`. It\n is left in place, since other apps may read it too.') class-attribute instance-attribute
on_load = on_load instance-attribute
value = param.String(default=None, allow_None=True, doc='The JSON text to store.') class-attribute instance-attribute
window_width = param.Integer(default=None, allow_None=True, doc='Width of the browser window in pixels.') class-attribute instance-attribute

SplitEvents

Bases: JSComponent

Reports when the canvas pane is shown or the window resized.

Placed in the canvas pane, the component calls on_resize once the pane has its size and whenever the window changes width, but not when a panel beside the split opens or closes, so the canvas does not move under the pointer. :attr:pane_size follows every size change of the pane. It takes no space on the page.

active = param.Boolean(default=False, doc='Whether resizes are reported.') class-attribute instance-attribute
on_resize = on_resize instance-attribute
pane_size = param.List(default=[], item_type=(int, float), doc='Width and height of the canvas pane in pixels.') class-attribute instance-attribute

SplitPreferences

Bases: Parameterized

What the editor remembers about the Split tab for a browser.

ask_width = param.Integer(default=ASK_WIDTH, bounds=(ASK_MIN_WIDTH, None), doc='The width of the Ask panel docked left of a dashboard, set by dragging its right edge.') class-attribute instance-attribute
assistant_width = param.Integer(default=ASSISTANT_WIDTH, bounds=(ASK_MIN_WIDTH, None), doc="The width of the assistant's drawer, Ask in edit mode, set by dragging its left edge.") class-attribute instance-attribute
code_dock = param.Selector(default='bottom', objects=['bottom', 'sidecar'], doc="Where the code panel is docked: under the canvas or in the sidecar's Spec tab.") class-attribute instance-attribute
palette_open = param.Boolean(default=True, doc='Whether the component palette beside the canvas is open or folded.') class-attribute instance-attribute
sidecar_width = param.Integer(default=SIDECAR_WIDTH, bounds=(SIDECAR_MIN_WIDTH, SIDECAR_MAX_WIDTH), doc="The width of the editor's sidecar, set by dragging its left edge.") class-attribute instance-attribute
sizes = param.NumericTuple(default=DEFAULT_SIZES, length=2, doc='Widths of the canvas and the grid pane in percent of the split.') class-attribute instance-attribute
spec_text = param.Selector(default='yaml', objects=['yaml', 'json'], doc="The syntax of a spec's text in the code panel.") class-attribute instance-attribute
spec_view = param.Selector(default='form', objects=['form', 'yaml', 'json'], doc='The view of a spec in the code panel: its form, or its text as YAML or JSON.') class-attribute instance-attribute
split = param.Boolean(default=False, doc='Whether the editor was last in the Split tab.') class-attribute instance-attribute
load(stored)

Apply preferences read back from the browser, returning whether any applied.

Anything malformed, e.g. written by another version, is ignored rather than raising, so a bad entry can never keep the editor from loading.

to_json()

Return the preferences as stored in the browser.

SplitView

Bases: Viewer

The canvas and the tile grid in two resizable panes.

on_collapse is called with the pane that was collapsed (0 for the canvas, 1 for the grid), on_load once the preferences stored in the browser were read and any usable ones applied, and on_resize when the canvas pane was shown or changed width.

events = SplitEvents(on_resize=on_resize) instance-attribute
left = pn.Column(margin=0, sizing_mode='stretch_both') instance-attribute
loaded = False instance-attribute
on_collapse = on_collapse instance-attribute
on_load = on_load instance-attribute
on_resize = on_resize instance-attribute
preferences = param.ClassSelector(class_=SplitPreferences, doc='The remembered state.') class-attribute instance-attribute
right = pn.Column(margin=0, sizing_mode='stretch_both', scroll='both-auto') instance-attribute
split = HSplit(self.left, self.right, sizes=sizes, expanded_sizes=sizes, collapse_threshold=5, show_buttons=True, snap_size=80, gutter_size=8, sizing_mode='stretch_both', stylesheets=[GUTTER_CSS], margin=0) instance-attribute
storage = LocalPreference(on_load=self._on_stored, key=key, legacy_key=None if key == STORAGE_KEY else STORAGE_KEY) instance-attribute
restore()

Open both panes at the remembered sizes, e.g. after one was collapsed.

show(left, right)

Put left (the canvas) and right (the grid and its controls) in the panes.

is_collapsed(collapsed, sizes)

Return which pane (0 left, 1 right) the split shows collapsed, or None.

storage_key()

Return the local storage key for the app being served.

Apps served from one origin share local storage, so the key carries the app's path, except for an app at the root, which keeps the plain key.

valid_sizes(sizes)

Return sizes as two pane widths summing to 100, or None if they are unusable.

Sizes with a collapsed pane are unusable too: restoring them would open the Split tab with one side missing.

states

Empty, error and system states: not found, access denied, loading, empty canvas, unsaved changes.

CHANGES_LIMIT = 6 module-attribute

EmptyState

Bases: Viewer

A centred explanation of an empty or failed page: an icon, a title, text and actions.

body holds extra content shown between the text and the actions, such as a list of suggestions.

actions = param.List(default=[], doc='Buttons offering the next step, primary first.') class-attribute instance-attribute
body = param.List(default=[], doc='Extra content shown above the actions.') class-attribute instance-attribute
icon = param.String(default='info', doc='Material icon name shown in the tinted circle.') class-attribute instance-attribute
text = param.String(default='', doc='One or two sentences explaining what happened.') class-attribute instance-attribute
title = param.String(default='', doc='What happened, in a few words.') class-attribute instance-attribute
tone = param.Selector(default='primary', objects=list(_TONES), doc="Colour of the icon circle: 'primary', 'error' or 'neutral'.") class-attribute instance-attribute

LeavePageGuard

Bases: JSComponent

Has the browser ask before the page is reloaded, closed or left while active.

Navigation inside the app goes through :class:UnsavedChangesDialog; this covers leaving the page itself, where the browser shows its own prompt.

active = param.Boolean(default=False, doc='Whether leaving the page asks first.') class-attribute instance-attribute

LoadingSkeleton

Bases: Viewer

Placeholder of a dashboard while it loads: a header line and tile blocks.

tiles = param.Integer(default=4, bounds=(1, None), doc='Number of tile placeholders.') class-attribute instance-attribute

StartCard

Bases: Viewer

The empty canvas's guide: three steps to a first dashboard and one-click starts.

add_button = pmui.Button(icon='add', variant='contained', size='small', margin=0, visible=False) instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose canvas is empty.') class-attribute instance-attribute
import_button = pmui.Button(label='Import a .json file', icon='upload_file', variant='text', size='small', margin=0) instance-attribute
refresh(*_events)

Pick the data source to offer and reflect whether the canvas may be edited.

UnsavedChangesDialog

Bases: Viewer

Asks what to do with unsaved changes before leaving the editor, listing them.

The answers call on_leave (discard and go), on_save (save, then go) or on_stay; each closes the dialog first. Dismissing the dialog with Escape or a click outside it answers on_stay.

changes = [] instance-attribute
dialog = pmui.Dialog(objects=[self._changes], actions=[self.leave_button, pn.layout.HSpacer(), self.stay_button, self.save_button], title='Save changes before leaving?', open=False) instance-attribute
leave_button = pmui.Button(label='Leave without saving', color='error', variant='text', margin=0) instance-attribute
on_leave = param.Callable(doc='Called when the user leaves without saving.') class-attribute instance-attribute
on_save = param.Callable(doc='Called when the user saves and leaves.') class-attribute instance-attribute
on_stay = param.Callable(doc='Called when the user keeps editing.') class-attribute instance-attribute
save_button = pmui.Button(label='Save and leave', variant='contained', margin=0) instance-attribute
stay_button = pmui.Button(label='Keep editing', variant='text', margin=0) instance-attribute
show(changes)

Open the dialog listing changes, at most :data:CHANGES_LIMIT of them.

access_denied(*, user, subject=None, owner=None, on_home=None)

Build the page for a dashboard or page that exists but the user may not open.

subject names what was refused (a page title; dashboards pass None so their title is not revealed). owner is who to ask for access.

admin_needs_this_machine(*, on_home=None)

Build the page refusing Admin to a session without sign-in from another machine.

dashboard_not_found(asset_id, similar, *, on_open, on_all)

Build the page for a dashboard id that does not exist (or that the user may not see).

describe_changes(saved, current, titles=None)

List what changed from the saved dashboard to the current canvas.

Returns (icon, text) pairs: added and removed components, added and removed connections, changed transforms, changed component and dashboard settings, and one entry for moved or resized tiles. titles maps component ids to their titles.

first_data_source(editor)

Return the id of the first component the editor offers that is a data source.

Components are imported lazily, so for one whose ports are not known yet a "source" in its title or id stands in for the port check.

page_not_found(path, *, on_home)

Build the page for a URL that matches no dashboard, page or route.

signed_in_as(user)

Say who the user is signed in as, or that they are not signed in.

similar_dashboards(ref, dashboards, limit=_SIMILAR_LIMIT)

Return the dashboards whose id or title is closest to ref, best match first.

Matches ignore case. A title containing ref (or contained in it) counts as a match, so a partial name finds the dashboard, as does an id with a typo. Only pass dashboards the user may open, so no other title is shown.

status_bar

The status bar under the wiring canvas: issues, counts, key hints and zoom.

CanvasShortcuts

Bases: JSComponent

Listens for single-key canvas shortcuts (P for previews, C for collapse all).

active = param.Boolean(default=True) class-attribute instance-attribute

CanvasWatcher

Call callback when nodes or edges change, or a node card changes its status.

In a served session the calls of one burst, e.g. every card of a dashboard being loaded changing its status, are coalesced into one on the next tick.

Issue dataclass

Something on the canvas that keeps an output from being up to date.

detail instance-attribute
edge_id = None class-attribute instance-attribute
instance_id instance-attribute
status instance-attribute
title instance-attribute

StatusBar

Bases: Viewer

A one-line bar under the canvas summarizing the dashboard's state.

It says whether every output is up to date or how many issues there are (clicking the count selects the first component or connection with an issue), counts the components and connections, lists key hints and shows the zoom. In the Layout tab it describes the tile grid instead: its columns, the tiles on it and the components without a tile. The canvas follows the page's light or dark theme through it, since it is a Material component shown alongside the canvas in every edit session.

collapse_toggle = pmui.Toggle(label='Collapse all', icon='unfold_less', icon_size='18px', value=False, description='Collapse all nodes (C)', size='small', margin=0, align='center', styles={'flex': 'none'}, stylesheets=[_VIEW_TOGGLE_CSS, PHONE_TOUCH_CSS], sx=_VIEW_TOGGLE_SX) instance-attribute
counts = pmui.Typography(variant='caption', margin=(0, 12), styles={'flex': 'none'}, sx=_NOWRAP, stylesheets=[f'@container fd-status-bar (max-width: {_COUNTS_MIN_WIDTH - 2 * _BAR_PADDING}px) {{ :host {{ display: none !important; }} }}']) instance-attribute
editor = param.Parameter(doc='The FlowDash editor whose canvas the bar describes.') class-attribute instance-attribute
grid_label = pmui.Typography(f'{GRID_COLUMNS}-column grid', variant='caption', margin=(0, 12, 0, 0), styles={'flex': 'none'}, sx=_NOWRAP) instance-attribute
issues_button = pmui.Button(label='All outputs up to date', icon='check_circle', icon_size='16px', variant='text', size='small', color='success', margin=0, styles={'flex': 'none'}, sx={**_TEXT, 'textTransform': 'none', 'fontWeight': 400, 'whiteSpace': 'nowrap', 'py': '2px', 'minHeight': 0, '& .MuiButton-startIcon': {'ml': 0, 'mr': '4px'}}, stylesheets=[PHONE_TOUCH_CSS]) instance-attribute
keys = pn.pane.HTML('<div class="fd-keys"><span><kbd>Space</kbd>drag to pan</span><span><kbd>Del</kbd>remove</span></div>', margin=(0, 12), styles={'flex': 'none'}, stylesheets=[_KEYS_CSS, f'@container fd-status-bar (max-width: {_KEYS_MIN_WIDTH - 2 * _BAR_PADDING}px) {{ :host {{ display: none !important; }} }}']) instance-attribute
minimap_toggle = pmui.ToggleIcon(icon='map', active_icon='map', value=flow.show_minimap, description='Show minimap', color='default', icon_size='18px', sx={'color': 'text.secondary', '&.Mui-checked': {'color': 'primary.text'}, '& .MuiIcon-root': {'color': 'inherit'}}, size='small', margin=0, align='center', styles={'flex': 'none'}, stylesheets=[PHONE_TOUCH_CSS]) instance-attribute
preview_toggle = pmui.Toggle(label='Previews', icon='preview', icon_size='18px', value=settings.node_previews, size='small', margin=0, align='center', styles={'flex': 'none'}, stylesheets=[_VIEW_TOGGLE_CSS, PHONE_TOUCH_CSS], sx=_VIEW_TOGGLE_SX) instance-attribute
view_controls = pn.Row(self.preview_toggle, self.collapse_toggle, self.minimap_toggle, self.zoom, margin=(0, 0, 0, 4), styles={'flex': 'none', 'gap': '2px', 'padding-left': '8px', 'border-left': '1px solid var(--mui-palette-divider)'}) instance-attribute
visible = param.Boolean(default=True, doc='Whether the bar is shown.') class-attribute instance-attribute
zoom = pmui.Typography(variant='caption', margin=(0, 4, 0, 6), align='center', styles={'flex': 'none'}, sx=_NOWRAP) instance-attribute
sync()

Recount the components, connections and issues.

sync_collapse_toggle()

Reflect whether every card on the canvas is collapsed, without toggling them.

toggle_collapse_all()

Collapse every node on the canvas, or expand them all when they all are.

toggle_previews()

Show the values on the canvas's nodes if they are hidden, else hide them.

canvas_issues(editor)

List the components that failed, wait for input or are unavailable, then broken edges.

A component still computing is not an issue, see :func:updating_cards. An edge is broken when the transform being edited on it has a failing step or is refused by its target, or when it could not be restored.

component_title(editor, instance_id)

Return the title of a placed component, or its id if its spec is unknown.

connection_title(editor, mapping)

Name a connection by its ends, e.g. 'State Filter to Capacity by Year'.

select_on_canvas(flow, node_id=None, edge_id=None)

Select one node or edge on the canvas, or clear the selection.

updating_cards(editor)

Count the components whose outputs, or those upstream of them, are computing.

template_picker

The template step of the "Create dashboard" dialog: pick Blank or a template, then bind its slots.

BLANK = '' module-attribute

NOT_CHOSEN = 'Not chosen' module-attribute

logger = logging.getLogger(__name__) module-attribute

TemplateError

Bases: ValueError

A file that is not a valid template, or bindings that do not fit one.

The message starts with the offending key, e.g. x-template.slots.date.of: ....

path = path instance-attribute
reason = reason instance-attribute

TemplatePicker

Bases: Viewer

Choose what a new dashboard starts from and bind the chosen template's slots.

step is choose (the list of Blank and the templates, with a preview) or bind (one field per slot of the chosen template).

selected = param.String(default=BLANK, doc="The id of the chosen template, '' for Blank.") class-attribute instance-attribute
step = param.Selector(default='choose', objects=['choose', 'bind']) class-attribute instance-attribute
template property

The chosen template, None for Blank.

valid = param.Boolean(default=True, doc='Whether every required slot is bound.') class-attribute instance-attribute
visible = param.Boolean(default=True, doc='Whether the picker is shown.') class-attribute instance-attribute
back()

Return to the list of templates.

bindings()

Return the bindings for :func:~panel_flowdash.templates.fill_template, checked.

Raises:

Type Description
TemplateError

If a choice is no longer offered or a column is not the data's.

filled()

Return the dashboard document the chosen template gives with the choices made.

pick(template_id)

Choose the template template_id, as clicking it in the list does.

raw_bindings()

Return the choices made so far, by slot: choice keys, column names and text.

reset(templates=None)

Start over at Blank, with templates if given.

start_binding() async

Show the chosen template's slots, offering what the user may bind them to.

preview_html(template, icons, controls=(), position='top')

Draw template's tiles as the launcher draws a dashboard's, slots by their kind.

controls and position place the controls as thumbnail_html does.

text

Render user- and data-supplied strings as literal text.

pmui.Typography, pmui.Alert and the Markdown panes render their object as Markdown with raw HTML allowed, so a dashboard title, a column name or an error message must be escaped before it reaches them. pn.pane.HTML takes HTML, so text interpolated into its markup goes through html.escape instead.

Markdown panes also typeset TeX found between \(, \[, $$ or \begin{...} with MathJax, whose \style and \href commands can load remote resources or run script. FlowDash's own Markdown never contains math, so its panes come from :func:markdown_pane with math turned off, and escaped text cannot form a delimiter either.

alert_pane(object='', **params)

Return a Panel Alert pane with MathJax turned off in the browser, like :func:markdown_pane.

code_block(text)

Return text as a fenced Markdown code block that it cannot close early.

code_span(text)

Return text as inline Markdown code that it cannot close early.

Line breaks become spaces, since a blank line would end the paragraph and with it the span.

escape_html(text)

Escape text for raw HTML inside a Markdown pane, such as a <pre> block.

Line breaks become character references too: a blank line would end the HTML block and hand the rest of the text to Markdown.

escape_markdown(text)

Escape text so a Markdown pane shows it verbatim, without HTML, formatting or math.

field_label(parameter)

Return the label a config field is shown under, with acronyms in capitals.

Param derives Sql from sql, so a label the parameter does not set itself is derived again from its name.

markdown_pane(object='', **params)

Return a Markdown pane for FlowDash's own markup, with MathJax turned off in the browser.

Interpolate user or data text into object only through :func:escape_markdown.

markdown_renderer(preset='commonmark', new_tab=True)

Return a Markdown renderer that shows raw HTML as typed.

With new_tab its links open in a new tab, since a link followed in the app's own tab would leave the dashboard and any unsaved edits behind; a link to an anchor on the page stays in it. Exported documents keep plain links.

text_alert(text, **params)

Return a pmui.Alert whose message is text shown as literal text.

The message goes to the alert's own object: passed positionally a string becomes a child pane chosen by pn.panel, which renders a string ending in .png as a remote image and other strings as Markdown with math.

text_typography(text, **params)

Return a pmui.Typography showing text, a string or a reactive one, as literal text.

tile

The optional frame, title and actions of a dashboard tile in view mode.

TILE_KEY_PREFIX = 'flowdash-tile-key-' module-attribute

Tile

Bases: Column

A component's view in a frame with a title bar.

The title bar holds an optional title and subtitle (FlowDash's own tiles set no subtitle), a status chip and the tile actions: Inspect, Expand (a full-screen dialog of the tile) and a More menu with what has no button of its own (Show in editor, How was this made?), which is left out when it would be empty. :meth:set_style chooses whether the tile is a framed card and whether it shows its title. Only a titled card gives the title bar a row; otherwise the bar floats over the tile's top-right corner on hover or keyboard focus and takes no space. Callers choose which actions apply with :meth:set_actions and react to them through on_inspect, on_show_in_editor and on_how_made.

title may be a reactive expression; label is the plain name the actions' accessible names and the expand dialog use. view is the wrapped view; the tile only moves it into the expand dialog and back, so it is never re-created. An untitled tile keeps room above its view for the notes floating in its corner, unless it is compact, like a KPI, whose short centred view they do not cover.

body = pn.Column(view, margin=(0, 8, 8, 8), sizing_mode='stretch_both') instance-attribute
compact = compact instance-attribute
expand_button = pmui.IconButton(icon='open_in_full', description=f'Expand {label}', size='small', margin=0, align='center', sx=_ACTION_SX) instance-attribute
expand_dialog = pmui.Dialog(title=label, full_screen=True, show_close_button=True, close_on_click=True, open=False) instance-attribute
expanded property
filter_notes = pn.FlexBox(margin=0, gap=f'{_NOTE_GAP}px', flex_wrap='nowrap', align_items='center', align='center', visible=False, styles={'flex': 'none'}, stylesheets=[_NOTES_CSS], css_classes=['flowdash-tile-filters']) instance-attribute
framed property
header = pn.Row(self.titles, self.status, self.inspect_button, self.expand_button, self.more_menu, css_classes=['flowdash-tile-header'], margin=(10, 8, 6, 16), sizing_mode='stretch_width') instance-attribute
inspect_button = pmui.IconButton(icon='data_object', description=f'Inspect data for {label}', size='small', margin=0, align='center', visible=False, sx=_ACTION_SX) instance-attribute
more_menu = pmui.MenuButton(label='', icon='more_vert', description=f'More for {label}', items=[], size='small', variant='text', margin=0, align='center', visible=False, sx=_MORE_SX) instance-attribute
on_how_made = on_how_made instance-attribute
on_inspect = on_inspect instance-attribute
on_node_action = on_node_action instance-attribute
on_show_in_editor = on_show_in_editor instance-attribute
shown property

Whether the tile wraps its view rather than the stand-in of a hidden tile.

stale_mark = pmui.Typography('', variant='caption', margin=0, visible=False, sx={**status_chip_sx('warning'), 'bgcolor': 'color-mix(in srgb, var(--mui-palette-warning-main) 16%, var(--mui-palette-background-paper, #fff))'}, css_classes=['flowdash-tile-stale-mark']) instance-attribute
status = pmui.Typography('', variant='caption', margin=(0, 4), align='center', visible=False, css_classes=['flowdash-tile-status']) instance-attribute
subtitle = text_typography(subtitle or '', variant='caption', margin=0, visible=False, sx={'color': 'text.secondary', 'display': 'block', **_ELLIPSIS}) instance-attribute
title = text_typography(title, variant='subtitle1', margin=0, visible=False, sx={'fontWeight': 500, 'lineHeight': 1.4, **_ELLIPSIS}) instance-attribute
titles = pn.Column(self.title, self.subtitle, margin=0, sizing_mode='stretch_width') instance-attribute
view = view instance-attribute
expand(_event=None)

Show the tile's view in a full-screen dialog until the dialog closes.

set_actions(*, inspect, show_in_editor, how_made=False, node_actions=())

Offer Inspect, Show in editor and How was this made? only where they apply to the current viewer.

node_actions are the registered node actions offered, as (key, label, icon), which go to the More menu and call on_node_action with their key.

set_chrome(shown)

Show the frame and actions (view mode), or leave both to the grid (arranging).

set_filters(chips=(), hint='', detail='')

Note the Filter nodes feeding the view, (instance_id, title), and hint.

The filters share one filter icon, which names them on hover.

hint says which active global filters do not reach the view, e.g. "Not filtered by State", and detail why, as its tooltip.

set_provenance(provenance, warning=None)

Show where the view's numbers come from as a quiet chip, and a warning about them, before its filter notes.

provenance is the :class:~panel_flowdash.node_actions.Provenance label shown now (in edit mode, or as the editor's provenance_labels says) or None, and warning the warning about the numbers, which is always shown, as a :class:WarningNote, or None.

set_stale(stale)

Mark the tile while its result does not match its spec: a "draft" not run, or "running".

set_status(status)

Show the 'failed', 'waiting' or 'pending' chip, or none.

set_style(*, framed, titled)

Draw the tile as a framed card or unframed, with or without its title.

set_view(view)

Wrap view in place of the current view, e.g. a hidden tile's once it is shown.

UnshownView

Bases: Spacer

The stand-in for the view of a hidden tile until it is shown, see FlowDash._unshown_view.

resolve_framed(tile, component, dashboard)

Return whether a tile is framed: its own option, else its component's hint, else the dashboard's.

status_chip_sx(color)

Style a small tinted chip with a leading dot, readable in light and dark mode.

tile_bands

The breakpoint bands of the tile grid, named after the screens they stand for.

TileGrid splits widths at its breakpoints into bands labelled "xs", "sm", "md" and so on, narrowest first. The band holding the width the layout was arranged at (reference_width) is the base band, which shows layout itself; every other band shows a layout generated from it, or a custom one in responsive_layouts once tiles were arranged for that band.

DEFAULT_REFERENCE_WIDTH = 1200 module-attribute

band_for_width(breakpoints, width)

Return the label of the band width falls in, or None without breakpoints.

band_labels(breakpoints)

Return the labels TileGrid gives the bands of breakpoints, narrowest first.

band_names(breakpoints)

Return {band label: name}, e.g. {"md": "Desktop", "sm": "Tablet", "xs": "Phone"}.

The widest band comes first. Beyond four bands the ones between the narrowest and the widest are named by their range of widths.

band_sources(breakpoints, width, responsive_layouts)

Return how each band's layout is arranged: :data:BASE, :data:CUSTOM or :data:AUTOMATIC.

band_summary(names, sources)

Describe which bands follow the base band's layout and which were arranged separately.

base_band(breakpoints, width)

Return the band whose layout is layout itself, given the grid's reference_width.

reference_width(width, breakpoints)

Return the grid width a layout's percentage widths are relative to, as TileGrid does.

tile_drag

Dragging components between the tile grid and the areas beside it, the top bar and the sidebar.

The grid's tiles are dragged by TileGrid (Muuri), which knows nothing of other drop targets, so a page-level script watches those drags and the handles of the components beside the grid, highlights where a component can go while it is dragged, and reports the drop. The editor then moves the component with :func:panel_flowdash.ui.tile_layout.move_to_area, so a drag is one edit.

REFUSAL = 'Charts and tables stay on the grid' module-attribute

TileDrag

Bases: JSComponent

Watches drags of tiles and of the components beside the grid, and reports drops.

tiles and controls map the keys the dragged elements carry on the page to {"id": instance id, "fits": bool}, fits saying whether the component may leave the grid. A drop calls on_move(instance_id, area, before), before being the instance id the component goes in front of or None for last; a drop refused because the component does not fit calls on_refuse(instance_id, area). A tile dropped beside the grid calls on_release(instance_id) first, as the pointer is released and before the grid sends the layout the drag ended with.

areas = param.List(default=[], doc='The areas beside the grid a component can be dropped in.') class-attribute instance-attribute
controls = param.Dict(default={}, doc="The components beside the grid, by their handle's key.") class-attribute instance-attribute
enabled = param.Boolean(default=False, doc='Whether drags are watched.') class-attribute instance-attribute
grid = param.String(default='', doc="The CSS class of the editor's tile grid.") class-attribute instance-attribute
labels = param.Dict(default={'top': 'Top bar', 'sidebar': 'Sidebar', 'grid': 'Grid'}, doc='The names drop targets are labelled with.') class-attribute instance-attribute
refusal = param.String(default=REFUSAL, doc='The hint on targets a component may not go to.') class-attribute instance-attribute
tiles = param.Dict(default={}, doc='The tiles on the grid, by the key class they carry.') class-attribute instance-attribute
uid = param.String(default='', doc='The suffix of the CSS classes of the areas beside the grid.') class-attribute instance-attribute

tile_layout

Reading and changing the tile layout of a dashboard from its editor.

Shared by the inspector's Tile tab and the layout panel. Every helper works whether or not the tile grid is on screen, since the editor keeps the layout of a hidden grid until it is shown again.

AREAS = (GRID, TOP, SIDEBAR) module-attribute

AREA_ICONS = {GRID: 'dashboard', TOP: 'vertical_align_top', SIDEBAR: 'view_sidebar'} module-attribute

AREA_NAMES = {GRID: 'grid', TOP: 'top bar', SIDEBAR: 'sidebar'} module-attribute

COMPACT_KINDS = frozenset({'control', 'kpi', 'text'}) module-attribute

FRAME_DEFAULT = 'default' module-attribute

GRID_COLUMNS = 12 module-attribute

HIDDEN = 'hidden' module-attribute

OffGrid dataclass

A placed component without a tile on the dashboard, and why.

area = GRID class-attribute instance-attribute
hidden = False class-attribute instance-attribute
instance_id instance-attribute
reason instance-attribute
restorable property

Whether showing it again is a layout change, i.e. it was hidden.

title instance-attribute

area_items(editor, area, entries=None)

Return the placed items shown in area, in their order there; hidden tiles included.

area_of(editor, item, entries=None)

Return the area a placed component is shown in, one of :data:AREAS, or None if nowhere yet.

chart_title(spec)

Return the title a chart spec gives itself, e.g. a Vega-Lite spec's title, or None.

default_area(editor, item)

Return where a component goes unless it was moved: controls beside the grid, the rest on it.

Controls are the components registered with sidebar=True, and go where the dashboard's controls_position setting says. None while the component is not loaded yet, which is shown nowhere until it is.

fits_beside(editor, item)

Whether a component may move off the grid: a control, a KPI or text, not a chart or table.

frame_choices(editor, instance_id)

Return a tile's frame choices by label, naming what its default resolves to.

frame_value(entry)

Return the frame choice of a tile's layout entry.

grid_tiles(editor)

Return the placed items shown as tiles, in placement order.

layout_summary(editor)

Summarize the grid, e.g. "4 tiles, 2 components hidden".

move_buttons(editor, item, areas=None, then=None, **params)

Return a "Move to ..." button for each area the component can be moved to, of areas if given.

They do what dragging the component there does, for keyboards and screen readers. then is called after a move, e.g. to put the focus back on the rebuilt panel, since the button pressed goes away with the move.

move_targets(editor, item)

Return the areas a placed component can be moved to from where it is now.

move_tile(editor, instance_id, index, *, record=True)

Move a component's tile to position index among the tiles, 0 for the first.

Without record the move is not recorded as an edit, see :func:update_tile.

move_to_area(editor, instance_id, area, before=None, index=None, *, record=True)

Show a component in area, in front of the component before there or else last.

index, the position among the others in area with 0 for the first, may be given instead of before.

One edit, and so one version in the history, unless record is False (see :func:update_tile). Moving within an area reorders it. A tile keeps its size on the grid while it is beside it, and a hidden tile moved anywhere is shown. Returns whether anything moved.

Raises:

Type Description
ValueError

If the component is a chart, table or data preview and area is not the grid, or area is unknown.

off_grid(editor)

List the placed components that have no tile on the dashboard, with the reason.

refusal(editor, item, area)

Explain why a component that does not fit beside the grid cannot go to area.

row_layout(editor)

Return the entries of the tiles shown on the grid, by the rows the grid packs them in.

A tile stacked below a shorter tile of its row, beside a taller one, has the instance id of that tile under "under".

tile_entry(editor, instance_id)

Return the tile layout entry of a component, empty if it has none yet.

tile_heading(editor, item, config=None)

Return the title a tile shows above its view, with tile_titles on.

Its configured title, else the title of the chart its spec draws, else its node's name when a file gave the node one (busiest_routes reads "Busiest routes"), else its component's title. config holds the current config values, read from the item unless given.

tile_title(editor, item)

Return the name a placed component goes by on the dashboard.

to_columns(width)

Return how many of the grid's columns a tile width in percent of the row spans.

to_width(columns)

Return the width in percent of the row that spans columns of the grid.

update_tile(editor, instance_id, rebalance=None, *, hold_heights=None, record=True, **patch)

Change how a component's tile is laid out, e.g. visible, width or height.

Works whether or not the tile grid is on screen: the grid is rebuilt from the updated layout, which is what is saved. With rebalance, a new width or height also resizes the other tiles of the tile's row, except those of rebalance, as dragging the tile's edge does (see :func:~panel_flowdash.auto_layout.resize_in_row); with hold_heights too, the tiles of rebalance keep only their width and those of hold_heights their height. Without record the change is not recorded as an edit, for a caller that records the edit it is part of.

tile_options

The options of one component's tile, shown in the sidecar's Tile tab.

One vocabulary for every tab: widths are steps of the grid's twelve columns, heights are bounded by the component's size hints, and the frame, whether the tile is shown and where the component goes (the grid, the top bar or the sidebar) are set here too.

AUTO = 'auto' module-attribute

HEIGHTS = (200, 300, 400, 500, 600, 800) module-attribute

TileOptions

The tile options of the component instance_id, kept in step with the grid.

Changes made elsewhere, e.g. a tile resized or hidden on the grid or a frame set by the agent, are shown here, and :meth:release stops following them.

arrange_button = pmui.Button(label='Arrange tiles', icon='dashboard', variant='text', size='small', margin=(12, 0, 0, 0), sx={'textTransform': 'none'}) instance-attribute
band_hint = _caption('', margin=(0, 0, 4, 0), css_classes=['fd-tile-band-hint']) instance-attribute
editor = editor instance-attribute
filters = pn.Column(margin=(12, 0, 0, 0), sizing_mode='stretch_width', visible=False) instance-attribute
frame_select = pmui.Select(label='Frame', options={'Default': FRAME_DEFAULT}, value=FRAME_DEFAULT, description='Whether the tile is drawn as a card in view mode', sizing_mode='stretch_width', margin=(12, 0, 8, 0)) instance-attribute
height_select = pmui.Select(label='Height', options={'Automatic': AUTO}, value=AUTO, sizing_mode='stretch_width', margin=(8, 0, 8, 4)) instance-attribute
instance_id = instance_id instance-attribute
item = item instance-attribute
layout = pn.Column(margin=0, sizing_mode='stretch_width', css_classes=['fd-tile-options']) instance-attribute
show_switch = pmui.Switch(label='Show on dashboard', margin=(4, 0, 4, 0)) instance-attribute
size_hint = _caption('', margin=(0, 0, 4, 0)) instance-attribute
spec = spec instance-attribute
width_select = pmui.Select(label='Width', options=width_options(), sizing_mode='stretch_width', margin=(8, 4, 8, 0)) instance-attribute
release()
sync()

Show the tile's current options, and those its component's area allows.

size_hints(spec)

Return a sentence naming a component's starting, smallest and largest size.

width_label(columns)

Return the label of a width spanning columns of the grid, e.g. "Half (6/12)".

width_options()

Return the width choices by label: automatic, then each number of columns, widest first.

transform_offer

The dialog offering to connect a table to a number input through transform steps.

A DataFrame output cannot feed a Number input as it is, but a column of it reduced to one value can. Dropping such a connection opens this dialog instead of refusing it: the person picks the column and the aggregation, sees the value the input would get, and the edge is created with the two steps, editable later in the inspector like any edge transform.

AGGREGATIONS = {'Sum': 'sum', 'Mean': 'mean', 'Count': 'count', 'Minimum': 'min', 'Maximum': 'max', 'Last value': 'last'} module-attribute

TransformOffer

Bases: Viewer

A dialog connecting a table or series output to a number input through steps.

dialog = pmui.Dialog(objects=[self._message, self._column, self._column_text, self._how, self._result], actions=[self._cancel, self._confirm], title='Connect with a transform', open=False, css_classes=['fd-transform-offer']) instance-attribute
mapping property

The connection offered, while the dialog is open.

close()

Close the dialog without connecting.

confirm()

Create the connection with the chosen steps and close, or show why it failed.

offer(mapping, kind)

Open the dialog for connecting mapping through steps of kind, see :func:bridge_kind.

steps()

Return the transform steps the dialog's choices make.

as_number(value)

Return value if it is a finite real number a number input can show, else None.

bridge_kind(source_type, target_type)

Return how transform steps can turn an output of source_type into target_type.

"column" for a DataFrame, or a type registered as one of its subtypes, feeding a number (pick a column, then aggregate it), "aggregate" for a Series feeding a number, or None if no steps bridge the two.

bridge_steps(column, how)

Return the transform steps reducing column (or a Series, without one) with how.

likely_measure(columns)

Return the column a number is most likely wanted from: numeric, and not an id or a year.

show_number(value)

Show a number as the KPI shows it by default: thousands separators, two decimals.

waiting

The placeholder a tile shows while a required input has no value yet.

WaitingPlaceholder

Bases: Column

A centred icon, what the tile needs and how to provide it.

headline = pmui.Typography(variant='subtitle1', align='center', margin=(0, 12, 4, 12), sx={'fontWeight': 500, 'textAlign': 'center'}) instance-attribute
hint = pmui.Typography(variant='body2', align='center', margin=(0, 12), sx={'color': 'text.secondary', 'textAlign': 'center'}) instance-attribute
show(missing, message=None)

Say that the tile needs the missing inputs, led by a custom message if given.

join_labels(labels)

Join labels the way a sentence lists them: "A", "A and B", "A, B and C".

warning_note

The note a tile shows when a provenance warns about its numbers, e.g. that a row limit cut them.

LABEL_MAX_SHARE = 50 module-attribute

LABEL_MAX_WIDTH = 220 module-attribute

NARROW_TILE_WIDTH = 240 module-attribute

WarningNote

Bases: JSComponent

A warning icon and its short label, which a click or tap discloses the detail of.

It is a button named "Warning:

detail = param.String(default='', doc='The sentence the note discloses.') class-attribute instance-attribute
estimated_width property

A CSS length for the note's width, for laying out the tile's hover actions beside it.

icon = param.String(default='warning', doc='A Material icon name.') class-attribute instance-attribute
label = param.String(default='', doc="The short label, e.g. 'First 100,000 rows'.") class-attribute instance-attribute