Skip to Content
defold-typescript libraries
Pause-Gamesflow

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
    1. Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as flow from "flow.flow"

Functions

init(self: FlowSelf, config?: Flow_InitConfig): LuaTable

Mounts Flow and configures navigation on a GUI script instance.

Parameters

  • self: FlowSelf
  • config?: 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: FlowSelf
  • tree: 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: FlowSelf
  • dt: number

Returns

  • boolean

on_input(self: FlowSelf, action_id: Hash, action: FlowInputAction): boolean

Routes a Defold input action through Flow.

Parameters

  • self: FlowSelf
  • action_id: Hash
  • action: 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: FlowSelf
  • message_id: Hash | string
  • message?: FlowParams
  • sender?: 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: FlowSelf
  • id: string
  • params?: FlowParams
  • options?: 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: FlowSelf
  • result_or_transition?: FlowParams | string
  • options?: 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: FlowSelf
  • id: string
  • params?: FlowParams
  • options?: Flow_PushOptions | string

reset(self: FlowSelf, id: string, params?: FlowParams, options?: Flow_PushOptions | string)

Resets navigation to a root screen.

Parameters

  • self: FlowSelf
  • id: string
  • params?: FlowParams
  • options?: Flow_PushOptions | string

get_scroll_offset(self: FlowSelf, key: string): number

Returns the current screen's saved vertical scroll offset.

Parameters

  • self: FlowSelf
  • key: string

Returns

  • number

Variables

ui: typeof import('flow.ui') & FlowUiNamespaces

The low-level UI module plus Flow's component and helper namespaces.

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: string
  • key_prefix?: string
  • options?: 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: string
  • key?: string
  • style_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: string
  • params?: FlowParams
  • options?: 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: string
  • params?: FlowParams
  • options?: 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: object
  • config?: 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: object
  • message_id: Hash | string
  • message?: FlowParams
  • sender?: Url

Returns

  • boolean

On this page

Functionsinit(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): numberVariablesui: typeof import('flow.ui') & FlowUiNamespacesnav: Flow_Navigation & FlowNavigationMessageTransport & FlowNavigationNamespacesbottom_sheet: typeof import('flow.bottom_sheet')log: Flow_Loggercolor: typeof import('flow.color')Typestype FlowSelf = objecttype FlowParams = LuaMap<string, unknown> | Record<string, unknown>type FlowNavigationMessageModule = typeof import('flow.navigation.messages')type FlowNavigationMessageTransport = FlowNavigationMessageModule & FlowNavigationMessagesFlowInputActionFlowInputAction.x?: numberFlowInputAction.y?: numberFlowInputAction.pressed?: booleanFlowInputAction.released?: booleanFlowUiNamespacesFlowUiNamespaces.Flex: typeof import('flow.flex')FlowUiNamespaces.flex: typeof import('flow.flex')FlowUiNamespaces.color: typeof import('flow.color')FlowUiNamespaces.layout: typeof import('flow.layout')FlowUiNamespaces.cp: FlowComponentsFlowUiNamespaces.components: FlowComponentsFlowComponentsFlowComponents.Box(props: Flow_BoxProps): Flow_ElementFlowComponents.Button(props: Flow_ButtonProps): Flow_ElementFlowComponents.ButtonImage(props: Flow_ButtonImageProps): Flow_ElementFlowComponents.Icon(props: Flow_IconProps): Flow_ElementFlowComponents.Popup(props: Flow_PopupProps): Flow_ElementFlowComponents.Scroll(props: Flow_ScrollProps): Flow_ElementFlowComponents.Text(props: Flow_TextProps): Flow_ElementFlowComponents.Markdown: FlowMarkdownComponentFlowMarkdownComponentFlowMarkdownComponent.__call(options: Flow_MarkdownOptions): Flow_ElementFlowMarkdownComponent.parse(markdown_text: string, key_prefix?: string, options?: Flow_MarkdownOptions): Flow_Element[]FlowMarkdownComponent.viewer(markdown_text: string, key?: string, style_override?: Flow_Style): Flow_ElementFlowNavigationMessagesFlowNavigationMessages.ids: FlowNavigationMessageIdsFlowNavigationMessages.PUSH: Hash | stringFlowNavigationMessages.POP: Hash | stringFlowNavigationMessages.REPLACE: Hash | stringFlowNavigationMessages.RESET: Hash | stringFlowNavigationMessages.BACK: Hash | stringFlowNavigationMessages.INVALIDATE: Hash | stringFlowNavigationMessages.handle_message: FlowNavigationMessageModule['on_message']FlowNavigationMessageIdsFlowNavigationMessageIds.push: Hash | stringFlowNavigationMessageIds.pop: Hash | stringFlowNavigationMessageIds.replace: Hash | stringFlowNavigationMessageIds.reset: Hash | stringFlowNavigationMessageIds.back: Hash | stringFlowNavigationMessageIds.invalidate: Hash | stringFlowNavigationNamespacesFlowNavigationNamespaces.push(id: string, params?: FlowParams, options?: Flow_PushOptions | string): ReturnType<Flow_Navigation["push"]>FlowNavigationNamespaces.replace(id: string, params?: FlowParams, options?: Flow_PushOptions | string): ReturnType<Flow_Navigation["replace"]>FlowNavigationNamespaces.messages: FlowNavigationMessageTransportFlowNavigationNamespaces.runtime: typeof import('flow.navigation.runtime') & FlowRuntimeFacadeFlowNavigationNamespaces.proxy: typeof import('flow.navigation.proxy')FlowNavigationNamespaces.gui: typeof import('flow.navigation.gui')FlowRuntimeFacadeFlowRuntimeFacade.init(self: object, config?: Flow_RuntimeConfig): LuaTableFlowRuntimeFacade.final(self: object)FlowRuntimeFacade.on_message(self: object, message_id: Hash | string, message?: FlowParams, sender?: Url): boolean