pub struct PanelTabProps {Show 16 fields
pub viewer: HtmlElement,
pub panel_id: String,
pub title: Option<String>,
pub theme: Option<String>,
pub active: bool,
pub visible: bool,
pub is_master: bool,
pub single: bool,
pub closable: bool,
pub is_settings_open: bool,
pub draggable: bool,
pub on_select: Callback<String>,
pub on_close: Callback<String>,
pub on_open_settings: Callback<String>,
pub on_context_menu: Callback<(String, f64, f64)>,
pub on_rename: Callback<(String, Option<String>)>,
}Expand description
A panel’s titlebar tab. The host is a <perspective-viewer-tab> custom
element mounted in the viewer’s light DOM and forwarded into its
<regular-layout-frame> titlebar via a <slot name="tab-{id}" slot="tab">
(rendered by MainPanel); the tab’s contents live in the host’s
ShadowRoot, whose adoptedStyleSheets carry the structure CSS.
Keeping the host in the light DOM — like the plugin — is what lets
document theme CSS (perspective-viewer [theme="X"]) reach it, so each
panel’s chrome is themed by the native cascade instead of a runtime-inlined
string; the --psp-* those rules set are inherited across the shadow
boundary into the contents. The host carries part="tab", which
<regular-layout-frame>’s pointer handler treats as a drag handle
(regular-layout@>=0.6.0’s custom-tab contract); the title is
pointer-events:none so clicks fall through to the host (like the built-in
<regular-layout-tab>).
Fields§
§viewer: HtmlElementThe <perspective-viewer> host element; the tab is attached here as a
light-DOM child (mirrors renderer::activate’s plugin mount).
panel_id: StringThe panel id. The tab is assigned to slot="tab-{panel_id}".
title: Option<String>The panel’s title; falls back to the id when None.
theme: Option<String>This panel’s effective theme. Reflected onto the host’s theme
attribute so the document theme rules (perspective-viewer [theme="X"])
theme the tab per-panel via the native cascade.
active: booltrue when this is the active panel (toolbar target / selected tab);
drives the active-tab styling.
visible: booltrue when this panel is visible — the front (selected) tab of its
stack, or a lone panel. Hidden panels are those at an unselected index
of a tab stack. Independent of active: every stack has a visible
panel, but only one panel in the whole layout is active.
is_master: booltrue when this panel is a master (filter-source) panel — shows the
broadcast badge to the left of the close button.
single: booltrue when this is the host viewer’s ONLY panel (one plugin child).
Reflected on the host as a single/multi class — the same
panel-count CSS hook Renderer::stamp_active stamps on the plugin —
e.g. the caret is hidden on a lone tab (see panel-tab.css).
closable: boolfalse for a lone panel (which can’t be closed to zero) — hides the
close button.
is_settings_open: booltrue when the settings sidebar is open. When closed, the tab renders
an open-settings button in place of the close button — the only
affordance for opening the settings panel (there is deliberately none
at zero panels).
draggable: boolfalse for a lone panel — suppresses the tab rearrange-drag.
<regular-layout-frame> arms a drag from any part="tab" pointerdown,
but a lone panel has nowhere to drop, so the host pointerdown handler
stops the event before it reaches the frame (see create).
on_select: Callback<String>Select this panel in the layout (brings its frame forward within a stack
and activates it). Wired by MainPanel to RegularLayout::select.
on_close: Callback<String>Remove this panel from the layout. Wired by MainPanel to the root
ClosePanel message (which mutates the Workspace model first, then
syncs the slave regular-layout — NOT RegularLayout::remove_panel
directly; see the app-initiated-layout-change invariant).
on_open_settings: Callback<String>Open the settings sidebar targeting this panel. Wired by MainPanel to
select this panel in the layout, activate it (so the sidebar binds its
engines), then toggle the sidebar open.
Open the panel context menu at (client_x, client_y). Wired here on the
tab host because the tab’s content is a create_portal subtree, so its
events don’t reach the frame’s main-tree oncontextmenu (unlike the
imperatively-mounted plugin body).
on_rename: Callback<(String, Option<String>)>Commit a new title for this panel. Wired by MainPanel to this panel’s
own Session::set_title.
(panel_id, new_title); None clears it back to the id fallback.
Trait Implementations§
Source§impl PartialEq for PanelTabProps
impl PartialEq for PanelTabProps
Source§impl Properties for PanelTabProps
impl Properties for PanelTabProps
impl StructuralPartialEq for PanelTabProps
Auto Trait Implementations§
impl !RefUnwindSafe for PanelTabProps
impl !Send for PanelTabProps
impl !Sync for PanelTabProps
impl !UnwindSafe for PanelTabProps
impl Freeze for PanelTabProps
impl Unpin for PanelTabProps
impl UnsafeUnpin for PanelTabProps
Blanket Implementations§
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> HasAllProps<(), T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self to a value of a Properties struct.