TileRenderingScope

data class TileRenderingScope(val tileId: String, val events: ImmutableList<EventSchema>?, val onEvent: (UIEvent) -> Unit)

Receiver passed to every dev.catbit.mosaic.client.ui.sdui.foundation.tiles.renderer.TileRenderer.Render call — one fresh instance per tile, built by TileRendererManager right before rendering it.

It carries the tile's own identity (tileId) and its own declared events, and exposes every way a renderer can react to a user interaction: mutate this tile's own local state synchronously (dispatchEvent), notify every tile in the tree that shares a group concern (dispatchGroupEvent), run this tile's server-declared event chains (triggerEvent), or render child TileSchemas (RenderChild/RenderChildren). None of these calls block — they all funnel through onEvent, which the owning MosaicScreenStateHolder observes to mutate the live tile tree and trigger recomposition.

Constructors

Link copied to clipboard
constructor(tileId: String, events: ImmutableList<EventSchema>?, onEvent: (UIEvent) -> Unit)

Properties

Link copied to clipboard
val events: ImmutableList<EventSchema>?

the events this tile schema declares (TileSchema.events), used by triggerEvent to decide which of them actually fire for a given EventTrigger. null when the tile declares none.

Link copied to clipboard
val onEvent: (UIEvent) -> Unit

the sink every method on this scope funnels into — a callback owned by the screen's state holder that turns a UIEvent into a mutation of the live tile tree.

Link copied to clipboard

id of the tile currently being rendered — the same value that reaches TilesEditor/TilesEventDispatcher when this tile is later addressed by id.

Functions

Link copied to clipboard

Returns a callback firing trigger, or null when events declares no event wired to it — so a tile is only made interactive when something is actually listening.

Link copied to clipboard
fun dispatchEvent(tileEvent: TileEvent)

Applies tileEvent to this tile's own TileHolder synchronously, by emitting a UIEvent.TileEventHolderUIEvent addressed to tileId.

Link copied to clipboard
fun dispatchGroupEvent(tileGroupEvent: TileGroupEvent)

Broadcasts tileGroupEvent to every TileHolder in the whole screen's tile tree whose handlesGroupEvent(event) returns true for it, by emitting a UIEvent.TileGroupEventHolderUIEvent.

Link copied to clipboard

callbackFor specialized for EventTriggers.onClick() — the standard way a tile renderer wires up Modifier.styledWith's onClick/a composable's own onClick parameter, only when the tile actually declares an OnClick event.

Link copied to clipboard

Fires EventTriggers.onDisplay() once, the first time this composable enters composition — the standard way every built-in container/interactive tile implements its own OnDisplay trigger. Keyed on tileId, so it re-fires only if the tile identity itself changes (a new instance with a different id), not on every recomposition.

Link copied to clipboard

callbackFor specialized for EventTriggers.onLongPress() — same pattern as onClick, for Modifier.styledWith's onLongClick.

Link copied to clipboard
open override fun TileRenderingScope.Render(tileSchema: BadgeTileSchema)
open override fun TileRenderingScope.Render(tileSchema: ButtonTileSchema)
open override fun TileRenderingScope.Render(tileSchema: BoxTileSchema)
open override fun TileRenderingScope.Render(tileSchema: CardTileSchema)
open override fun TileRenderingScope.Render(tileSchema: ColumnTileSchema)
open override fun TileRenderingScope.Render(tileSchema: FlexBoxTileSchema)
open override fun TileRenderingScope.Render(tileSchema: FlowRowTileSchema)
open override fun TileRenderingScope.Render(tileSchema: GridTileSchema)
open override fun TileRenderingScope.Render(tileSchema: LazyRowTileSchema)
open override fun TileRenderingScope.Render(tileSchema: PagerTileSchema)
open override fun TileRenderingScope.Render(tileSchema: RowTileSchema)
open override fun TileRenderingScope.Render(tileSchema: ShimmerTileSchema)
open override fun TileRenderingScope.Render(tileSchema: IconTileSchema)
open override fun TileRenderingScope.Render(tileSchema: ImageTileSchema)
open override fun TileRenderingScope.Render(tileSchema: SwitchTileSchema)
open override fun TileRenderingScope.Render(tileSchema: ScreenTileSchema)
open override fun TileRenderingScope.Render(tileSchema: MenuTileSchema)
open override fun TileRenderingScope.Render(tileSchema: TabsTileSchema)
open override fun TileRenderingScope.Render(tileSchema: PopupTileSchema)
open override fun TileRenderingScope.Render(tileSchema: TooltipTileSchema)

Renders tileSchema as Compose UI.

Link copied to clipboard

Renders one child tileSchema, delegating to the app-wide TileRendererManager reached via LocalTileRendererManager and forwarding this scope's own onEvent sink unchanged.

Link copied to clipboard
fun RenderChildren(tileSchemas: ImmutableList<TileSchema>)

Renders every schema in tileSchemas in order, by calling the same path as RenderChild for each one — the usual way a container TileRenderer renders its whole children list in one call.

Link copied to clipboard
fun triggerEvent(trigger: EventTrigger, data: Any? = null)

Runs whichever of this tile's own events declare a trigger structurally equal to trigger — the remote half of a tile's interaction, and the primary way a TileRenderer starts a server-declared event chain.