Pause-Games/flow/flow.flow
Flow's main facade for UI rendering, navigation, components, colors, logging, and hosted bottom sheets.
- GitHub: Pause-Games/flow — pinned to
1.0.0- Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as flow from "flow.flow"
- Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged
Functions
init(self:FlowSelf, config?: Flow_InitConfig): LuaTablefinal(self:FlowSelf)set_tree(self:FlowSelf, tree: Flow_Element): Flow_Elementinvalidate(self:FlowSelf)update(self:FlowSelf, dt: number): booleanon_input(self:FlowSelf, action_id:Hash, action:FlowInputAction): booleanon_message(self:FlowSelf, message_id:Hash| string, message?:FlowParams, sender?:Url): booleanpush(self:FlowSelf, id: string, params?:FlowParams, options?: Flow_PushOptions | string)pop(self:FlowSelf, result_or_transition?:FlowParams| string, options?: Flow_PushOptions | string)replace(self:FlowSelf, id: string, params?:FlowParams, options?: Flow_PushOptions | string)reset(self:FlowSelf, id: string, params?:FlowParams, options?: Flow_PushOptions | string)get_scroll_offset(self:FlowSelf, key: string): number
init(self: FlowSelf, config?: Flow_InitConfig): LuaTable
Mounts Flow and configures navigation on a GUI script instance.
Parameters
self:FlowSelfconfig?:Flow_InitConfig
Returns
LuaTable
final(self: FlowSelf)
Releases input focus and destroys the active adapter.
Parameters
self:FlowSelf
set_tree(self: FlowSelf, tree: Flow_Element): Flow_Element
Sets a static element tree and requests a redraw.
Parameters
self:FlowSelftree:Flow_Element
Returns
Flow_Element
invalidate(self: FlowSelf)
Requests a rebuild of the current static or navigation tree.
Parameters
self:FlowSelf
update(self: FlowSelf, dt: number): boolean
Advances animations and navigation, rebuilding and redrawing as needed.
Parameters
self:FlowSelfdt:number
Returns
boolean
on_input(self: FlowSelf, action_id: Hash, action: FlowInputAction): boolean
Routes a Defold input action through Flow.
Parameters
self:FlowSelfaction_id:Hashaction:FlowInputAction
Returns
boolean
on_message(self: FlowSelf, message_id: Hash | string, message?: FlowParams, sender?: Url): boolean
Handles navigation messages and forwards unhandled messages to the configured hook.
Parameters
self:FlowSelfmessage_id:Hash | stringmessage?:FlowParamssender?:Url
Returns
boolean
push(self: FlowSelf, id: string, params?: FlowParams, options?: Flow_PushOptions | string)
Pushes a screen through the facade's navigation singleton.
Parameters
self:FlowSelfid:stringparams?:FlowParamsoptions?:Flow_PushOptions | string
pop(self: FlowSelf, result_or_transition?: FlowParams | string, options?: Flow_PushOptions | string)
Pops the current screen through the facade's navigation singleton.
Parameters
self:FlowSelfresult_or_transition?:FlowParams | stringoptions?:Flow_PushOptions | string
replace(self: FlowSelf, id: string, params?: FlowParams, options?: Flow_PushOptions | string)
Replaces the current screen through the facade's navigation singleton.
Parameters
self:FlowSelfid:stringparams?:FlowParamsoptions?:Flow_PushOptions | string
reset(self: FlowSelf, id: string, params?: FlowParams, options?: Flow_PushOptions | string)
Resets navigation to a root screen.
Parameters
self:FlowSelfid:stringparams?:FlowParamsoptions?:Flow_PushOptions | string
get_scroll_offset(self: FlowSelf, key: string): number
Returns the current screen's saved vertical scroll offset.
Parameters
self:FlowSelfkey:string
Returns
number
Variables
ui: typeof import('flow.ui') & FlowUiNamespaces
The low-level UI module plus Flow's component and helper namespaces.
nav: Flow_Navigation & FlowNavigationMessageTransport & FlowNavigationNamespaces
The navigation API, message transport, and runtime adapters.
bottom_sheet: typeof import('flow.bottom_sheet')
Hosted bottom sheets.
log: Flow_Logger
Centralized logging.
color: typeof import('flow.color')
Color parsing and hexadecimal color helpers.
Types
type FlowSelf = object
type FlowParams = LuaMap<string, unknown> | Record<string, unknown>
type FlowNavigationMessageModule = typeof import('flow.navigation.messages')
type FlowNavigationMessageTransport = FlowNavigationMessageModule & FlowNavigationMessages
FlowInputAction
FlowInputAction.x?: number
FlowInputAction.y?: number
FlowInputAction.pressed?: boolean
FlowInputAction.released?: boolean
FlowUiNamespaces
FlowUiNamespaces.Flex: typeof import('flow.flex')
Flow's imperative flexbox module.
FlowUiNamespaces.flex: typeof import('flow.flex')
Alias of Flex.
FlowUiNamespaces.color: typeof import('flow.color')
Flow's color helpers.
FlowUiNamespaces.layout: typeof import('flow.layout')
Flow's layout pass.
FlowUiNamespaces.cp: FlowComponents
Primitive component constructors.
FlowUiNamespaces.components: FlowComponents
Alias of cp.
FlowComponents
FlowComponents.Box(props: Flow_BoxProps): Flow_Element
Creates a box element.
Parameters
props:Flow_BoxProps
Returns
Flow_Element
FlowComponents.Button(props: Flow_ButtonProps): Flow_Element
Creates a button element.
Parameters
props:Flow_ButtonProps
Returns
Flow_Element
FlowComponents.ButtonImage(props: Flow_ButtonImageProps): Flow_Element
Creates an image-backed button element.
Parameters
props:Flow_ButtonImageProps
Returns
Flow_Element
FlowComponents.Icon(props: Flow_IconProps): Flow_Element
Creates an icon element.
Parameters
props:Flow_IconProps
Returns
Flow_Element
FlowComponents.Popup(props: Flow_PopupProps): Flow_Element
Creates a popup element.
Parameters
props:Flow_PopupProps
Returns
Flow_Element
FlowComponents.Scroll(props: Flow_ScrollProps): Flow_Element
Creates a scroll element.
Parameters
props:Flow_ScrollProps
Returns
Flow_Element
FlowComponents.Text(props: Flow_TextProps): Flow_Element
Creates a text element.
Parameters
props:Flow_TextProps
Returns
Flow_Element
FlowComponents.Markdown: FlowMarkdownComponent
Creates a Markdown viewer and exposes Markdown parsing helpers.
FlowMarkdownComponent
FlowMarkdownComponent.__call(options: Flow_MarkdownOptions): Flow_Element
Creates a scrollable Markdown viewer.
Parameters
options:Flow_MarkdownOptions
Returns
Flow_Element
FlowMarkdownComponent.parse(markdown_text: string, key_prefix?: string, options?: Flow_MarkdownOptions): Flow_Element[]
Parses Markdown into Flow elements.
Parameters
markdown_text:stringkey_prefix?:stringoptions?:Flow_MarkdownOptions
Returns
Flow_Element[]
FlowMarkdownComponent.viewer(markdown_text: string, key?: string, style_override?: Flow_Style): Flow_Element
Creates a scrollable Markdown viewer from text and style overrides.
Parameters
markdown_text:stringkey?:stringstyle_override?:Flow_Style
Returns
Flow_Element
FlowNavigationMessages
FlowNavigationMessages.ids: FlowNavigationMessageIds
Map of all supported message ids keyed by operation name.
FlowNavigationMessages.PUSH: Hash | string
Message id for push; payload { id, params?, options? }.
FlowNavigationMessages.POP: Hash | string
Message id for pop; payload { result?, options? }.
FlowNavigationMessages.REPLACE: Hash | string
Message id for replace; payload { id, params?, options? }.
FlowNavigationMessages.RESET: Hash | string
Message id for reset; payload { id, params?, options? }.
FlowNavigationMessages.BACK: Hash | string
Message id for back; payload { result?, options? }.
FlowNavigationMessages.INVALIDATE: Hash | string
Message id for invalidate; no payload required.
FlowNavigationMessages.handle_message: FlowNavigationMessageModule['on_message']
Alias of on_message for older call sites.
FlowNavigationMessageIds
FlowNavigationMessageIds.push: Hash | string
Message id for push.
FlowNavigationMessageIds.pop: Hash | string
Message id for pop.
FlowNavigationMessageIds.replace: Hash | string
Message id for replace.
FlowNavigationMessageIds.reset: Hash | string
Message id for reset.
FlowNavigationMessageIds.back: Hash | string
Message id for back.
FlowNavigationMessageIds.invalidate: Hash | string
Message id for invalidate.
FlowNavigationNamespaces
FlowNavigationNamespaces.push(id: string, params?: FlowParams, options?: Flow_PushOptions | string): ReturnType<Flow_Navigation["push"]>
Pushes a screen, accepting the transition shorthand supported by the router.
Parameters
id:stringparams?:FlowParamsoptions?:Flow_PushOptions | string
Returns
ReturnType<Flow_Navigation["push"]>
FlowNavigationNamespaces.replace(id: string, params?: FlowParams, options?: Flow_PushOptions | string): ReturnType<Flow_Navigation["replace"]>
Replaces the current screen, accepting the transition shorthand supported by the router.
Parameters
id:stringparams?:FlowParamsoptions?:Flow_PushOptions | string
Returns
ReturnType<Flow_Navigation["replace"]>
FlowNavigationNamespaces.messages: FlowNavigationMessageTransport
Navigation message transport.
FlowNavigationNamespaces.runtime: typeof import('flow.navigation.runtime') & FlowRuntimeFacade
Navigation for plain script components.
FlowNavigationNamespaces.proxy: typeof import('flow.navigation.proxy')
Collection-proxy navigation support.
FlowNavigationNamespaces.gui: typeof import('flow.navigation.gui')
Navigation's GUI adapter.
FlowRuntimeFacade
FlowRuntimeFacade.init(self: object, config?: Flow_RuntimeConfig): LuaTable
Initializes navigation on a script component.
Parameters
self:objectconfig?:Flow_RuntimeConfig
Returns
LuaTable
FlowRuntimeFacade.final(self: object)
Detaches navigation from a script component.
Parameters
self:object
FlowRuntimeFacade.on_message(self: object, message_id: Hash | string, message?: FlowParams, sender?: Url): boolean
Routes a message through script navigation.
Parameters
self:objectmessage_id:Hash | stringmessage?:FlowParamssender?:Url
Returns
boolean