إنتقل إلى المحتوى الرئيسي

std-inventory-panel

Level: Atom | Entity: InventoryPanel | Persistence: singleton

1 states, 4 events, 4 transitions

Live Preview

schema.orb
{
"name": "InventoryPanelOrbital",
"orbitals": [
{
"name": "InventoryPanelOrbital",
"entity": {
"name": "InventoryPanel",
"persistence": "singleton",
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "status",
"type": "string",
"default": "active",
"values": [
"active",
"inactive",
"pending"
]
},
{
"name": "createdAt",
"type": "string"
},
{
"name": "items",
"type": "array"
}
],
"instances": [
{
"id": "inventory",
"items": [
{
"id": "item-0",
"name": "Iron Sword",
"quantity": 1,
"rarity": "common"
},
{
"id": "item-1",
"name": "Health Potion",
"quantity": 3,
"rarity": "common"
},
{
"id": "item-2",
"name": "Shield",
"quantity": 1,
"rarity": "uncommon"
},
{
"id": "item-3",
"name": "Magic Scroll",
"quantity": 2,
"rarity": "rare"
},
{
"id": "item-4",
"name": "Gold Ring",
"quantity": 1,
"rarity": "epic"
},
{
"id": "item-5",
"name": "Dragon Scale",
"quantity": 1,
"rarity": "epic"
}
]
}
]
},
"traits": [
{
"name": "InventoryPanelInventoryPanel",
"linkedEntity": "InventoryPanel",
"category": "interaction",
"stateMachine": {
"states": [
{
"name": "idle",
"isInitial": true
}
],
"events": [
{
"key": "INIT",
"name": "Initialize"
},
{
"key": "SELECT_SLOT",
"name": "Select Slot",
"payload": [
{
"name": "slotId",
"type": "string",
"required": true
}
]
},
{
"key": "USE_ITEM",
"name": "Use Item",
"payload": [
{
"name": "id",
"type": "string",
"required": true
}
]
},
{
"key": "DROP_ITEM",
"name": "Drop Item",
"payload": [
{
"name": "id",
"type": "string",
"required": true
}
]
}
],
"transitions": [
{
"from": "idle",
"to": "idle",
"event": "INIT",
"effects": [
[
"fetch",
"InventoryPanel"
],
[
"render-ui",
"main",
{
"type": "inventory-panel",
"items": "@entity.items",
"slots": 16,
"columns": 4,
"selectSlotEvent": "SELECT_SLOT",
"useItemEvent": "USE_ITEM",
"dropItemEvent": "DROP_ITEM",
"showTooltips": true
}
]
]
},
{
"from": "idle",
"to": "idle",
"event": "SELECT_SLOT",
"effects": [
[
"render-ui",
"main",
{
"type": "inventory-panel",
"items": "@entity.items",
"slots": 16,
"columns": 4,
"selectSlotEvent": "SELECT_SLOT",
"useItemEvent": "USE_ITEM",
"dropItemEvent": "DROP_ITEM",
"showTooltips": true
}
]
]
},
{
"from": "idle",
"to": "idle",
"event": "USE_ITEM",
"effects": [
[
"fetch",
"InventoryPanel"
],
[
"render-ui",
"main",
{
"type": "inventory-panel",
"items": "@entity.items",
"slots": 16,
"columns": 4,
"selectSlotEvent": "SELECT_SLOT",
"useItemEvent": "USE_ITEM",
"dropItemEvent": "DROP_ITEM",
"showTooltips": true
}
]
]
},
{
"from": "idle",
"to": "idle",
"event": "DROP_ITEM",
"effects": [
[
"persist",
"delete",
"InventoryPanel",
"@payload.id"
],
[
"fetch",
"InventoryPanel"
],
[
"render-ui",
"main",
{
"type": "inventory-panel",
"items": "@entity.items",
"slots": 16,
"columns": 4,
"selectSlotEvent": "SELECT_SLOT",
"useItemEvent": "USE_ITEM",
"dropItemEvent": "DROP_ITEM",
"showTooltips": true
}
],
[
"notify",
"InventoryPanel deleted successfully"
]
]
}
]
}
}
],
"pages": [
{
"name": "InventoryPanelInventoryPage",
"path": "/inventorypanels",
"traits": [
{
"ref": "InventoryPanelInventoryPanel"
}
]
}
]
}
],
"description": "Grid-based inventory atom using the `inventory-panel` pattern. Shows items in a grid with select, use, and drop actions."
}
Loading preview...

Orbital Visualization

Loading visualization...

Entity Fields

FieldTypeDefault
idstring-
namestring-
descriptionstring-
statusstring"active"
createdAtstring-
itemsarray-

States

StateType
idleInitial

Events

EventPayload
INIT-
SELECT_SLOTslotId: string
USE_ITEMid: string
DROP_ITEMid: string

Transitions

FromEventToEffects
idleINITidle2 effects
idleSELECT_SLOTidle1 effect
idleUSE_ITEMidle2 effects
idleDROP_ITEMidle4 effects