std-score
Level: Atom | Entity: ScoreEntry | Persistence: runtime
1 states, 5 events, 5 transitions
Live Preview
orbital ScoreEntryOrbital {
entity ScoreEntry [runtime] {
id : string
name : string
description : string
status : string
createdAt : string
total : number
combo : number
points : number
multiplier : number
}
trait ScoreEntryScore -> ScoreEntry [interaction] {
state idle {
INIT -> idle
(fetch ScoreEntry)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "score-board", score: ["object/get", ["array/first", "@entity"], "total"], highScore: 0, combo: ["object/get", ["array/first", "@entity"], "combo"], multiplier: 1, level: 1 }, { type: "animated-counter", value: ["object/get", ["array/first", "@entity"], "total"], prefix: "Score: ", duration: 300 }, { type: "trend-indicator", value: ["object/get", ["array/first", "@entity"], "points"], showValue: true }, { type: "spacer", size: "md" }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Add", event: "ADD", variant: "primary", icon: "plus" }, { type: "button", label: "Subtract", event: "SUBTRACT", variant: "secondary", icon: "minus" }, { type: "button", label: "Combo", event: "COMBO", variant: "secondary", icon: "zap" }, { type: "button", label: "Reset", event: "RESET", variant: "ghost", icon: "rotate-ccw" }] }] })
ADD -> idle
(set @entity.points @payload.points)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "score-board", score: ["object/get", ["array/first", "@entity"], "total"], highScore: 0, combo: ["object/get", ["array/first", "@entity"], "combo"], multiplier: 1, level: 1 }, { type: "animated-counter", value: ["object/get", ["array/first", "@entity"], "total"], prefix: "Score: ", duration: 300 }, { type: "trend-indicator", value: ["object/get", ["array/first", "@entity"], "points"], showValue: true }, { type: "spacer", size: "md" }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Add", event: "ADD", variant: "primary", icon: "plus" }, { type: "button", label: "Subtract", event: "SUBTRACT", variant: "secondary", icon: "minus" }, { type: "button", label: "Combo", event: "COMBO", variant: "secondary", icon: "zap" }, { type: "button", label: "Reset", event: "RESET", variant: "ghost", icon: "rotate-ccw" }] }] })
SUBTRACT -> idle
(set @entity.points @payload.points)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "score-board", score: ["object/get", ["array/first", "@entity"], "total"], highScore: 0, combo: ["object/get", ["array/first", "@entity"], "combo"], multiplier: 1, level: 1 }, { type: "animated-counter", value: ["object/get", ["array/first", "@entity"], "total"], prefix: "Score: ", duration: 300 }, { type: "trend-indicator", value: ["object/get", ["array/first", "@entity"], "points"], showValue: true }, { type: "spacer", size: "md" }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Add", event: "ADD", variant: "primary", icon: "plus" }, { type: "button", label: "Subtract", event: "SUBTRACT", variant: "secondary", icon: "minus" }, { type: "button", label: "Combo", event: "COMBO", variant: "secondary", icon: "zap" }, { type: "button", label: "Reset", event: "RESET", variant: "ghost", icon: "rotate-ccw" }] }] })
COMBO -> idle
(set @entity.multiplier @payload.multiplier)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "confetti-effect", trigger: true }, { type: "score-board", score: ["object/get", ["array/first", "@entity"], "total"], highScore: 0, combo: ["object/get", ["array/first", "@entity"], "combo"], multiplier: 1, level: 1 }, { type: "animated-counter", value: ["object/get", ["array/first", "@entity"], "total"], prefix: "Score: ", duration: 300 }, { type: "trend-indicator", value: ["object/get", ["array/first", "@entity"], "points"], showValue: true }, { type: "spacer", size: "md" }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Add", event: "ADD", variant: "primary", icon: "plus" }, { type: "button", label: "Subtract", event: "SUBTRACT", variant: "secondary", icon: "minus" }, { type: "button", label: "Combo", event: "COMBO", variant: "secondary", icon: "zap" }, { type: "button", label: "Reset", event: "RESET", variant: "ghost", icon: "rotate-ccw" }] }] })
RESET -> idle
(set @entity.total 0)
(set @entity.combo 1)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "score-board", score: ["object/get", ["array/first", "@entity"], "total"], highScore: 0, combo: ["object/get", ["array/first", "@entity"], "combo"], multiplier: 1, level: 1 }, { type: "animated-counter", value: ["object/get", ["array/first", "@entity"], "total"], prefix: "Score: ", duration: 300 }, { type: "trend-indicator", value: ["object/get", ["array/first", "@entity"], "points"], showValue: true }, { type: "spacer", size: "md" }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Add", event: "ADD", variant: "primary", icon: "plus" }, { type: "button", label: "Subtract", event: "SUBTRACT", variant: "secondary", icon: "minus" }, { type: "button", label: "Combo", event: "COMBO", variant: "secondary", icon: "zap" }, { type: "button", label: "Reset", event: "RESET", variant: "ghost", icon: "rotate-ccw" }] }] })
}
}
page "/scoreentrys/score" -> ScoreEntryScore
}
Loading preview...
Orbital Visualization
Loading visualization...
Entity Fields
| Field | Type | Default |
|---|---|---|
| id | string | - |
| name | string | - |
| description | string | - |
| status | string | "active" |
| createdAt | string | - |
| total | number | 0 |
| combo | number | 1 |
| points | number | 0 |
| multiplier | number | 1 |
States
| State | Type |
|---|---|
| idle | Initial |
Events
| Event | Payload |
|---|---|
| INIT | - |
| ADD | points: number |
| SUBTRACT | points: number |
| RESET | - |
| COMBO | multiplier: number |
Transitions
| From | Event | To | Effects |
|---|---|---|---|
| idle | INIT | idle | 2 effects |
| idle | ADD | idle | 2 effects |
| idle | SUBTRACT | idle | 2 effects |
| idle | COMBO | idle | 2 effects |
| idle | RESET | idle | 3 effects |