% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/action-class.R, R/action-utils.R
\name{new_action}
\alias{new_action}
\alias{is_action}
\alias{is_action_generator}
\alias{action_id}
\alias{board_actions}
\alias{action_triggers}
\alias{block_input_select}
\alias{block_registry_selectize}
\alias{board_select}
\title{Board actions}
\usage{
new_action(func, id)

is_action(x)

is_action_generator(x)

action_id(x)

board_actions(x, ...)

action_triggers(x)

block_input_select(
  block = NULL,
  block_id = NULL,
  links = NULL,
  mode = c("create", "update", "inputs"),
  ...
)

block_registry_selectize(id, blocks = list_blocks())

board_select(id, blocks, selected = NULL, ...)
}
\arguments{
\item{func}{A function which will be used to create a
\code{\link[shiny:moduleServer]{shiny::moduleServer()}}.}

\item{id}{Input ID}

\item{x}{Object}

\item{...}{Forwarded to other methods}

\item{block}{Block object}

\item{block_id}{Block ID}

\item{links}{Links object}

\item{mode}{Switch for determining the return object}

\item{blocks}{Character vector of block registry IDs}

\item{selected}{Character vector of pre-selected block (registry) IDs}
}
\value{
The constructor \code{new_action} returns a classed function that
inherits from \code{action}. Inheritance can be checked with functions
\code{is_action()}, \code{is_action_generator()} checks whether an objects is a
function that returns an \code{action} object. String-value action IDs can be
retrieved with \code{action_id()} and the set of actions associated with a board
can be enumerated via \code{board_actions()}. Finally, \code{action_triggers()} returns
a named list of objects suitable for use as action triggers.

For utilities \code{block_input_select()}, \code{block_registry_selectize()}
and \code{board_select}, see the respective sections.
}
\description{
Logic including a modal-based UI for board actions such as "append block"
or "edit stack" can be specified using \code{action} objects, which essentially
are classed shiny server functions.
}
\details{
An action is a function that can be called with arguments \code{input},
\code{output} and \code{session}, behaving as one would expect from a shiny server
module function. Actions are typically created by action generator
functions, they each have a unique ID and a \code{\link[shiny:reactiveVal]{shiny::reactiveVal()}}-based
trigger object (inheriting from \code{action_trigger}). Action trigger objects
implement their own counter-based invalidation mechanism (on top of how
reactive values behave).
}
\section{\code{block_input_select()}}{

Determine input options for a block by removing inputs that are already used
and also takes into account some edge-cases, such as variadic blocks. If
\code{mode} is set as "inputs", this will return a character vector, for
"create", the return value of a \code{\link[shiny:selectInput]{shiny::selectizeInput()}} call and for
"update", the return value of a \code{\link[shiny:updateSelectInput]{shiny::updateSelectizeInput()}} call.
}

\section{\code{block_registry_selectize()}}{

This creates UI for a block registry selector via \code{\link[shiny:selectInput]{shiny::selectizeInput()}}
and returns an object that inherits from \code{shiny.tag}.
}

\section{\code{board_select()}}{

Block selection UI, enumerating all blocks in a board is available as
\code{board_select()}. An object that inherits from \code{shiny.tag} is returned, which
contains the result from a \code{\link[shiny:selectInput]{shiny::selectizeInput()}} call.
}

