Package-level declarations

Types

Link copied to clipboard

What the scaffold tells its contextual-toolbar slot each frame: where the bar actually docks (post fit-correction), the drag listener the bar must use so the scaffold's drop-zone chrome tracks the handle, and whether a vertical side dock is currently available as a drag target (the View canComposeContextualToolbarFitVertically gate).

Link copied to clipboard

The window edge a NutrientFloatingToolbar is docked against.

Link copied to clipboard
class FloatingToolbarState(initialEdge: FloatingToolbarEdge = FloatingToolbarEdge.Bottom, val allowedEdges: Set<FloatingToolbarEdge> = FloatingToolbarEdge.entries.toSet())

Observable UI state of a NutrientFloatingToolbar: which edge it is docked against and whether a drag is in flight. Create it with rememberFloatingToolbarState so the docked edge survives configuration changes and process death.

Link copied to clipboard

The captured backdrop shared between the content that draws it and the chrome that samples it.

Link copied to clipboard

Defaults for NutrientContextualToolbar, one per parameter, so a host overrides one value and inherits the rest — the TopAppBarDefaults shape — plus the sizing constants the bar shares with NutrientToolbarScaffold (the Compose home of the View ToolbarCoordinatorLayout styleable defaults).

Link copied to clipboard

Receives drag gestures from the contextual toolbar's drag handle. The host owns the drop-zone math and actually repositions the bar (via ToolbarCoordinator.setContextualToolbarPosition) — during Phase 2 that host is the ToolbarCoordinatorLayout bridge, from Phase 4 the NutrientToolbarScaffold. Passing no listener hides the drag handle even when the state says the bar is draggable.

Link copied to clipboard

Receiver scope for NutrientContextualToolbar's slots: the bar's rendered state (its dock after the scaffold's fit-correction, its kind, its items) and a dispatch that stamps every action with that kind — the same routing the bar's own items use, so a host button in a slot is indistinguishable from an SDK one to ToolbarCoordinator.addActionListeners.

Link copied to clipboard

Defaults for NutrientMainToolbar, one per parameter, so a host overrides one value and inherits the rest — the TopAppBarDefaults shape. The Floating… values are the matching set for a toolbar composed as a pill over the document rather than docked to the window edge.

Link copied to clipboard

Receiver scope for NutrientMainToolbar's content, carrying the modifiers a piece of the toolbar uses to say how it wants to be sized and placed — the same two RowScope has, weight and align, and for the same reason: per-child layout control belongs on the child, not in the parent's parameter list. Everything else is a standard modifier: Modifier.fillMaxWidth() on a child grows a wrapping toolbar to the width it was offered, Modifier.width(…) fixes a child.

Link copied to clipboard
class ToolbarItemIndication(val shape: Shape, val rippleColor: Color = Color.Unspecified)

How a toolbar item shows that it is pressed, hovered, focused or selected: the shape its ripple, hover state layer and selection highlight are all clipped to, and the rippleColor of that ripple.

Properties

Link copied to clipboard

testTag on the document title overlay's text. Espresso/UIAutomator suites that targeted the legacy R.id.pspdf__activity_title_overlay TextView use onNodeWithTag(DOCUMENT_TITLE_OVERLAY_TEST_TAG).

Link copied to clipboard

The top inset the scaffold's content must consume so it is not hidden behind a top-docked toolbar — the Compose replacement for the View ToolbarCoordinatorLayout's getToolbarInset() / adjustContentViewTopPadding() sibling-padding machinery. Provided by NutrientToolbarScaffold to its content slot; 0.dp outside a scaffold.

Link copied to clipboard

The ToolbarItemIndication for items composed here — provided by NutrientMainToolbar and NutrientContextualToolbar from their itemIndication parameter, and what NutrientToolbarItemButton reads by default, so an item a host composes in a slot indicates like the SDK's own. Provide it yourself to restyle only part of a bar, say the item row in a slot. ToolbarItemIndication.Default outside a bar.

Functions

Link copied to clipboard
fun DocumentAnchoredPopup(visible: Boolean, anchor: () -> Offset, modifier: Modifier = Modifier, edgePadding: Dp = 8.dp, content: @Composable () -> Unit)

A popup anchored to a point in the document — the Compose replacement for the PopupWindow-based PopupToolbar (Phase 4 §4, P2-16). Renders content inside the host composition (no separate window), horizontally centered on the anchor with its bottom edge at the anchor, clamped to the host bounds inset by edgePadding (the View pspdf__popup_toolbar_edge_padding contract).

Link copied to clipboard

Records the drawing of the composable it is applied to into state, so chrome drawn later in the same composition can sample it — the "what's behind" half of a backdrop blur.

Link copied to clipboard
fun NutrientContextualToolbar(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, defaultGroupingProvider: ContextualToolbarGroupingProvider? = null, dragListener: NutrientContextualToolbarDragListener? = null, verticalDockAvailable: () -> Boolean = { true }, effectivePosition: ToolbarPosition? = null, closeButton: @Composable NutrientContextualToolbarScope.() -> Unit = { NutrientContextualToolbarCloseButton() }, shape: Shape = NutrientContextualToolbarDefaults.Shape, border: BorderStroke? = null, sideDockedShape: Shape = NutrientContextualToolbarDefaults.SideDockedShape, sideDockedBorder: BorderStroke? = NutrientContextualToolbarDefaults.sideDockedBorder(), shadowElevation: Dp = NutrientContextualToolbarDefaults.shadowElevation, windowInsets: WindowInsets = NutrientContextualToolbarDefaults.NoWindowInsets, colors: MainToolbarColors = NutrientContextualToolbarDefaults.colors(), itemIndication: ToolbarItemIndication = NutrientContextualToolbarDefaults.ItemIndication, enter: EnterTransition = NutrientContextualToolbarDefaults.enterTransition, exit: ExitTransition = NutrientContextualToolbarDefaults.exitTransition)

State-driven contextual (special-mode) toolbar — the one generic composable behind the annotation, document-editing, and content-editing bars. Renders coordinator's contextualToolbar state slice; nothing is painted while that flow is null.

Link copied to clipboard

The bar's close affordance — NutrientContextualToolbar's default closeButton: the View ContextualToolbar.updateCloseButton glyphs, a back arrow on a top-docked bar that ContextualToolbarState.usesBackButtonWhenHorizontal, the circled X otherwise, dispatching ToolbarAction.ItemClicked with R.id.pspdf__toolbar_close_button. Public so a host can keep it next to something of its own in the slot.

Link copied to clipboard
fun nutrientContextualToolbarComposeView(context: Context, coordinator: ToolbarCoordinator, defaultGroupingProvider: ContextualToolbarGroupingProvider? = null, dragListener: NutrientContextualToolbarDragListener? = null, verticalDockAvailable: () -> Boolean = { true }): ComposeView

Creates the ComposeView that hosts NutrientContextualToolbar for coordinator — the contextual counterpart of nutrientMainToolbarComposeView, mounted once by PdfUiImpl into the ToolbarCoordinatorLayout top slot (Phase 2). The composable paints nothing while the coordinator's contextual slice is null; the host additionally toggles the view's top-slot bookkeeping via ToolbarCoordinatorLayout.setComposeContextualToolbarVisible.

Link copied to clipboard
fun NutrientDocumentTitleOverlay(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier)

The document title overlay — a separate strip rendered below the main toolbar row that shows the current document's title centered. It is the Compose successor of the legacy pspdf__activity_title_overlay TextView.

Link copied to clipboard

Creates a ComposeView hosting NutrientDocumentTitleOverlay for coordinator, so View-based hosts can embed the title overlay on its own. (The SDK's PdfActivity does not use this — it composes the overlay inside NutrientMainToolbar; this is for custom hosts that want just the title overlay.)

Link copied to clipboard
fun NutrientFloatingContextualToolbar(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, state: FloatingToolbarState = rememberFloatingToolbarState(initialEdge = FloatingToolbarEdge.Top), vibrant: Boolean = true, draggable: Boolean = true, defaultGroupingProvider: ContextualToolbarGroupingProvider? = null, windowInsets: WindowInsets = WindowInsets.safeDrawing)

A Material 3 Expressive floating pill rendering of the contextual (special-mode) toolbars — the annotation creation, document editing and content editing bars — over a ToolbarCoordinator. The floating counterpart of NutrientContextualToolbar, and the companion of NutrientFloatingToolbar: both pills share one frame, so they dock against the same window edges, drag and fling identically, run on the same expressive spring motion, and paint the same Material 3 floating-toolbar color roles (vibrant picks primaryContainer, otherwise surfaceContainer).

Link copied to clipboard
fun NutrientFloatingToolbar(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, state: FloatingToolbarState = rememberFloatingToolbarState(), vibrant: Boolean = true, draggable: Boolean = true, collapsible: Boolean = false, windowInsets: WindowInsets = WindowInsets.safeDrawing)

A Material 3 Expressive floating toolbar rendering of a ToolbarCoordinator.

Link copied to clipboard
fun NutrientFloatingToolbarItemButton(item: ToolbarItem, vibrant: Boolean = true, edge: FloatingToolbarEdge = FloatingToolbarEdge.Bottom, onAction: (ToolbarAction) -> Unit)

One item: a vibrant/standard M3 icon button. A selected item (the SDK marks the item of an open outline, grid or reader view, and an active tool, as selected) renders with a filled container, so "on" reads as such and invites the tap that turns it off. Only a ToolbarItem.Toggle is a Material toggle button; a ToolbarItem.Button is a plain icon button painted with the same colors, so its merged semantics carry selected and never a checked state. A ToolbarItem.Submenu renders as the same button with a submenu corner mark; tapping it opens the children in a Material 3 dropdown, and a child tap dispatches ToolbarAction.SubmenuChildClicked.

Link copied to clipboard

One row of a floating toolbar's Material 3 dropdown menu, for a host that lays out its own pills: item's icon and label, disabled with the item, and a trailing check mark while the item is selected. onClick runs on tap; the host dispatches the action and closes the menu.

Link copied to clipboard

Applies the floating toolbar's Material 3 color mapping to SDK inline-search content.

Link copied to clipboard
fun NutrientMainToolbar(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, shape: Shape = NutrientMainToolbarDefaults.Shape, shadowElevation: Dp = NutrientMainToolbarDefaults.shadowElevation, windowInsets: WindowInsets = NutrientMainToolbarDefaults.windowInsets(coordinator), colors: MainToolbarColors = NutrientMainToolbarDefaults.colors(), itemIndication: ToolbarItemIndication = NutrientMainToolbarDefaults.ItemIndication, enter: EnterTransition = NutrientMainToolbarDefaults.enterTransition, exit: ExitTransition = NutrientMainToolbarDefaults.exitTransition, searchBar: @Composable NutrientToolbarScope.() -> Unit = { NutrientToolbarSearchBar(coordinator, Modifier.fillMaxWidth()) }, content: @Composable NutrientToolbarScope.() -> Unit)

NutrientMainToolbar with one content slot in place of the navigation-icon / title / actions three, for a bar that does not fit that shape: the pieces are laid out in a row exactly as composed, sized by what each asked for through NutrientToolbarScope (weight(), align()) or a standard modifier. The SDK's pieces are public, so "my own content" never means giving up the coordinator's items:

fun NutrientMainToolbar(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, navigationIcon: @Composable () -> Unit = { NutrientMainToolbarNavigationIcon(coordinator) }, title: @Composable NutrientToolbarScope.() -> Unit = { NutrientMainToolbarTitle(coordinator) }, actions: @Composable NutrientToolbarScope.() -> Unit = { NutrientToolbarItems(coordinator, Modifier.weight(1f)) }, searchBar: @Composable NutrientToolbarScope.() -> Unit = { NutrientToolbarSearchBar(coordinator, Modifier.fillMaxWidth()) }, shape: Shape = NutrientMainToolbarDefaults.Shape, shadowElevation: Dp = NutrientMainToolbarDefaults.shadowElevation, windowInsets: WindowInsets = NutrientMainToolbarDefaults.windowInsets(coordinator), colors: MainToolbarColors = NutrientMainToolbarDefaults.colors(), itemIndication: ToolbarItemIndication = NutrientMainToolbarDefaults.ItemIndication, enter: EnterTransition = NutrientMainToolbarDefaults.enterTransition, exit: ExitTransition = NutrientMainToolbarDefaults.exitTransition)

State-driven main toolbar. Renders coordinator's frame and items, emits ToolbarActions via coordinator.dispatch(…).

Link copied to clipboard

What NutrientMainToolbar's slots hold by default, as one piece of content: the coordinator's title, then its items taking the width that is left (NutrientToolbarScope.weight) — so trailing items pin to the far edge of a full-bleed bar while a floating one stays as wide as its icons.

Link copied to clipboard

The toolbar's own navigation (up / back) icon: com.pspdfkit.compose.toolbar.state.ToolbarFrame.navigationIcon, or nothing when the frame carries ToolbarIcon.None. NutrientMainToolbar's default navigationIcon, and the piece the SDK's own mount shows for PdfUi.setToolbarNavigationIcon.

Link copied to clipboard
fun NutrientMainToolbarTitle(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, style: TextStyle = NutrientMainToolbarDefaults.titleTextStyle)

The toolbar's own title: com.pspdfkit.compose.toolbar.state.ToolbarFrame.title, or nothing when the frame carries none. One line, ellipsized when the bar has no room for it. NutrientMainToolbar's default title.

Link copied to clipboard
fun Modifier.nutrientPointerInput(enabled: Boolean = true, onSecondaryClick: () -> Unit = {}, onTap: (PointerType) -> Unit): Modifier

Stylus-aware pointer input as a single primitive (STYLUS-1 / P1-8): one implementation, used everywhere a toolbar element handles taps.

Link copied to clipboard
fun NutrientPopup(onDismissRequest: () -> Unit, modifier: Modifier = Modifier, offset: IntOffset = IntOffset.Zero, content: @Composable () -> Unit)

Anchored popup primitive (POPUP-1 / P1-9) that toolbar submenus and the text-selection popup will build on in later phases. Owns anchoring with edge-overflow correction (clamp into the window, flip above the anchor when there isn't room below), themed chrome from UiTheme's popup colors, and dismissal (outside tap / back).

Link copied to clipboard
fun NutrientStatusBarScrim(state: NutrientBackdropState, modifier: Modifier = Modifier, color: Color = NutrientStatusBarScrimDefaults.tint(), blurRadius: Dp = NutrientStatusBarScrimDefaults.BlurRadius, visible: Boolean = true, windowInsets: WindowInsets = WindowInsets.statusBars)

A scrim over the status-bar strip, optionally blurring the content behind it.

Link copied to clipboard
fun NutrientToolbarItemButton(item: ToolbarItem, onAction: (ToolbarAction) -> Unit, modifier: Modifier = Modifier, onLongClick: () -> Unit? = null, invertedSelection: Boolean = false, toolbarPosition: ToolbarPosition = ToolbarPosition.Top, indication: ToolbarItemIndication = LocalToolbarItemIndication.current)

The render leaf for a single ToolbarItem — the smallest visual toolbar primitive.

Link copied to clipboard
fun NutrientToolbarItems(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier)

The coordinator's items as a toolbar row: the ordered item list, re-grouped into row items and ⋮ menu entries by measured width (see NutrientToolbarLayout), dispatching to coordinator. NutrientMainToolbar's default actions.

Link copied to clipboard
fun NutrientToolbarLayout(items: ImmutableList<ToolbarItem>, onAction: (ToolbarAction) -> Unit, modifier: Modifier = Modifier)

One-pass, feedback-loop-free toolbar layout (P0-5).

Link copied to clipboard
fun NutrientToolbars(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, showMainToolbar: Boolean = true, showContextualToolbar: Boolean = true, defaultGroupingProvider: ContextualToolbarGroupingProvider? = null, dragListener: NutrientContextualToolbarDragListener? = null, onEffectivePositionChanged: (ToolbarPosition?) -> Unit? = null, topWindowInset: Dp = 0.dp, bottomWindowInset: Dp = 0.dp, leftWindowInset: Dp = 0.dp, rightWindowInset: Dp = 0.dp, content: @Composable () -> Unit)

The SDK toolbar tree, assembled: NutrientToolbarScaffold with NutrientMainToolbar and NutrientContextualToolbar pre-wired in its slots — placement, fit-correction, drag chrome, and theming (ToolbarCoordinator.mainToolbarColors through NutrientTheme, like the ComposeView factories) all connected. The single-tree successor of PdfUiImpl mounting two ComposeViews into the View ToolbarCoordinatorLayout (Phase 4 §2); custom hosts that want the stock bars over their own content use this directly.

Link copied to clipboard
fun NutrientToolbarScaffold(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier, contextualToolbarSize: Dp = NutrientContextualToolbarDefaults.toolbarSize(LocalContext.current), verticalMargin: Dp = NutrientContextualToolbarDefaults.VerticalMargin, horizontalMargin: Dp = NutrientContextualToolbarDefaults.HorizontalMargin, topWindowInset: Dp = 0.dp, bottomWindowInset: Dp = 0.dp, leftWindowInset: Dp = 0.dp, rightWindowInset: Dp = 0.dp, dragTargetColor: Color = NutrientContextualToolbarDefaults.dragTargetColor(LocalContext.current), dragListener: NutrientContextualToolbarDragListener? = null, onEffectivePositionChanged: (ToolbarPosition?) -> Unit? = null, mainToolbar: @Composable () -> Unit? = null, contextualToolbar: @Composable ContextualToolbarSlotScope.() -> Unit? = null, content: @Composable () -> Unit)

Single-tree placement scaffold for the Nutrient toolbars — the Compose replacement for the View ToolbarCoordinatorLayout (Phase 4 §1, closes P0-4's overlay z-order bug class).

Link copied to clipboard
fun NutrientToolbarSearchBar(coordinator: ToolbarCoordinator, modifier: Modifier = Modifier)

The inline search bar for coordinator's current search session, or nothing when no session is registered — the same UI com.pspdfkit.compose.search.composables.NutrientInlineSearchBar renders standalone, without its own background, for embedding in a toolbar that already draws one.

Link copied to clipboard
fun rememberFloatingToolbarState(initialEdge: FloatingToolbarEdge = FloatingToolbarEdge.Bottom, allowedEdges: Set<FloatingToolbarEdge> = FloatingToolbarEdge.entries.toSet()): FloatingToolbarState

Creates and remembers a FloatingToolbarState. The docked edge, expansion state, and active item are persisted via rememberSaveable, so a drag to the bottom edge (or a collapse) survives rotation and process death.

Link copied to clipboard

Creates the NutrientBackdropState shared by a document view and the scrim over it. Call it in the composable that owns both, so the one instance can be passed to each.

Link copied to clipboard

The single accessibility contract for every toolbar item (A11Y-1 / P1-6).

Link copied to clipboard

Derives a Compose testTag from an R.id by resolving its resource entry name (e.g. R.id.pspdf__menu_option_search → "pspdf__menu_option_search").