@almadar/std 2.1.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/behaviors/async.d.ts +12 -7
- package/dist/behaviors/async.js +1085 -312
- package/dist/behaviors/async.js.map +1 -1
- package/dist/behaviors/data-management.d.ts +27 -13
- package/dist/behaviors/data-management.js +600 -244
- package/dist/behaviors/data-management.js.map +1 -1
- package/dist/behaviors/domain/commerce.d.ts +51 -0
- package/dist/behaviors/domain/commerce.js +1093 -0
- package/dist/behaviors/domain/commerce.js.map +1 -0
- package/dist/behaviors/domain/content.d.ts +51 -0
- package/dist/behaviors/domain/content.js +1294 -0
- package/dist/behaviors/domain/content.js.map +1 -0
- package/dist/behaviors/domain/dashboard.d.ts +45 -0
- package/dist/behaviors/domain/dashboard.js +783 -0
- package/dist/behaviors/domain/dashboard.js.map +1 -0
- package/dist/behaviors/domain/education.d.ts +41 -0
- package/dist/behaviors/domain/education.js +738 -0
- package/dist/behaviors/domain/education.js.map +1 -0
- package/dist/behaviors/domain/finance.d.ts +49 -0
- package/dist/behaviors/domain/finance.js +660 -0
- package/dist/behaviors/domain/finance.js.map +1 -0
- package/dist/behaviors/domain/game-2d-platformer.d.ts +50 -0
- package/dist/behaviors/domain/game-2d-platformer.js +810 -0
- package/dist/behaviors/domain/game-2d-platformer.js.map +1 -0
- package/dist/behaviors/domain/game-2d-puzzle.d.ts +42 -0
- package/dist/behaviors/domain/game-2d-puzzle.js +622 -0
- package/dist/behaviors/domain/game-2d-puzzle.js.map +1 -0
- package/dist/behaviors/domain/game-2d-rpg.d.ts +48 -0
- package/dist/behaviors/domain/game-2d-rpg.js +860 -0
- package/dist/behaviors/domain/game-2d-rpg.js.map +1 -0
- package/dist/behaviors/domain/game-2d-strategy.d.ts +48 -0
- package/dist/behaviors/domain/game-2d-strategy.js +692 -0
- package/dist/behaviors/domain/game-2d-strategy.js.map +1 -0
- package/dist/behaviors/domain/geospatial.d.ts +35 -0
- package/dist/behaviors/domain/geospatial.js +634 -0
- package/dist/behaviors/domain/geospatial.js.map +1 -0
- package/dist/behaviors/domain/healthcare.d.ts +36 -0
- package/dist/behaviors/domain/healthcare.js +1068 -0
- package/dist/behaviors/domain/healthcare.js.map +1 -0
- package/dist/behaviors/domain/iot.d.ts +45 -0
- package/dist/behaviors/domain/iot.js +589 -0
- package/dist/behaviors/domain/iot.js.map +1 -0
- package/dist/behaviors/domain/media.d.ts +41 -0
- package/dist/behaviors/domain/media.js +771 -0
- package/dist/behaviors/domain/media.js.map +1 -0
- package/dist/behaviors/domain/scheduling.d.ts +41 -0
- package/dist/behaviors/domain/scheduling.js +930 -0
- package/dist/behaviors/domain/scheduling.js.map +1 -0
- package/dist/behaviors/domain/simulation.d.ts +36 -0
- package/dist/behaviors/domain/simulation.js +706 -0
- package/dist/behaviors/domain/simulation.js.map +1 -0
- package/dist/behaviors/domain/social.d.ts +41 -0
- package/dist/behaviors/domain/social.js +840 -0
- package/dist/behaviors/domain/social.js.map +1 -0
- package/dist/behaviors/domain/workflow.d.ts +41 -0
- package/dist/behaviors/domain/workflow.js +879 -0
- package/dist/behaviors/domain/workflow.js.map +1 -0
- package/dist/behaviors/feedback.d.ts +10 -5
- package/dist/behaviors/feedback.js +279 -194
- package/dist/behaviors/feedback.js.map +1 -1
- package/dist/behaviors/game-core.d.ts +15 -8
- package/dist/behaviors/game-core.js +412 -80
- package/dist/behaviors/game-core.js.map +1 -1
- package/dist/behaviors/game-entity.d.ts +17 -10
- package/dist/behaviors/game-entity.js +544 -237
- package/dist/behaviors/game-entity.js.map +1 -1
- package/dist/behaviors/game-ui.d.ts +16 -8
- package/dist/behaviors/game-ui.js +451 -316
- package/dist/behaviors/game-ui.js.map +1 -1
- package/dist/behaviors/index.d.ts +18 -1
- package/dist/behaviors/index.js +18905 -2140
- package/dist/behaviors/index.js.map +1 -1
- package/dist/behaviors/infrastructure.d.ts +9 -8
- package/dist/behaviors/infrastructure.js +597 -169
- package/dist/behaviors/infrastructure.js.map +1 -1
- package/dist/behaviors/registry.d.ts +11 -11
- package/dist/behaviors/registry.js +18904 -2139
- package/dist/behaviors/registry.js.map +1 -1
- package/dist/behaviors/types.d.ts +19 -2
- package/dist/behaviors/types.js.map +1 -1
- package/dist/behaviors/ui-interaction.d.ts +20 -14
- package/dist/behaviors/ui-interaction.js +928 -518
- package/dist/behaviors/ui-interaction.js.map +1 -1
- package/dist/index.js +18906 -2141
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
// behaviors/domain/iot.ts
|
|
2
|
+
var IOT_THEME = {
|
|
3
|
+
name: "iot-teal",
|
|
4
|
+
tokens: {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: "#0d9488",
|
|
7
|
+
"primary-hover": "#0f766e",
|
|
8
|
+
"primary-foreground": "#ffffff",
|
|
9
|
+
accent: "#06b6d4",
|
|
10
|
+
"accent-foreground": "#ffffff",
|
|
11
|
+
success: "#22c55e",
|
|
12
|
+
warning: "#f59e0b",
|
|
13
|
+
error: "#ef4444"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var sensorMainEffects = [
|
|
18
|
+
["fetch", "SensorReading"],
|
|
19
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
20
|
+
// Header zone: icon + title + refresh
|
|
21
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
22
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
23
|
+
{ type: "icon", name: "thermometer", size: "lg" },
|
|
24
|
+
{ type: "typography", variant: "h2", content: "Sensor Dashboard" }
|
|
25
|
+
] }
|
|
26
|
+
] },
|
|
27
|
+
{ type: "divider" },
|
|
28
|
+
// Stats zone: key metrics side by side
|
|
29
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
30
|
+
{ type: "stats", label: "Total Sensors", icon: "cpu", entity: "SensorReading" },
|
|
31
|
+
{ type: "meter", value: "@entity.value", label: "Avg Reading", icon: "activity" }
|
|
32
|
+
] },
|
|
33
|
+
// Chart zone: trend line
|
|
34
|
+
{ type: "line-chart", entity: "SensorReading" },
|
|
35
|
+
{ type: "divider" },
|
|
36
|
+
// Data zone: sensor cards via data-grid
|
|
37
|
+
{
|
|
38
|
+
type: "data-grid",
|
|
39
|
+
entity: "SensorReading",
|
|
40
|
+
cols: 3,
|
|
41
|
+
gap: "md",
|
|
42
|
+
fields: [
|
|
43
|
+
{ name: "sensorId", label: "Sensor ID", icon: "cpu", variant: "h4" },
|
|
44
|
+
{ name: "value", label: "Reading", icon: "thermometer", variant: "body" },
|
|
45
|
+
{ name: "unit", label: "Unit", variant: "caption" },
|
|
46
|
+
{ name: "status", label: "Status", icon: "activity", variant: "badge" },
|
|
47
|
+
{ name: "timestamp", label: "Last Update", icon: "clock", variant: "caption", format: "date" }
|
|
48
|
+
],
|
|
49
|
+
itemActions: [
|
|
50
|
+
{ label: "View", event: "VIEW", icon: "eye" }
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
] }]
|
|
54
|
+
];
|
|
55
|
+
var alertMainEffects = [
|
|
56
|
+
["fetch", "AlertRule"],
|
|
57
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
58
|
+
// Header: icon + title + create button
|
|
59
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
60
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
61
|
+
{ type: "icon", name: "bell", size: "lg" },
|
|
62
|
+
{ type: "typography", variant: "h2", content: "Alert Rules" }
|
|
63
|
+
] },
|
|
64
|
+
{ type: "button", label: "New Rule", icon: "plus", variant: "primary", action: "CREATE" }
|
|
65
|
+
] },
|
|
66
|
+
{ type: "divider" },
|
|
67
|
+
// Stats + threshold meter
|
|
68
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
69
|
+
{ type: "stats", label: "Total Rules", icon: "shield", entity: "AlertRule" },
|
|
70
|
+
{ type: "meter", value: 0, label: "Threshold Level", icon: "gauge" }
|
|
71
|
+
] },
|
|
72
|
+
{ type: "divider" },
|
|
73
|
+
// Search
|
|
74
|
+
{ type: "search-input", placeholder: "Filter alert rules...", entity: "AlertRule" },
|
|
75
|
+
// Data zone: alert rules as list
|
|
76
|
+
{
|
|
77
|
+
type: "data-list",
|
|
78
|
+
entity: "AlertRule",
|
|
79
|
+
variant: "card",
|
|
80
|
+
fields: [
|
|
81
|
+
{ name: "metric", label: "Metric", icon: "bar-chart-2", variant: "h4" },
|
|
82
|
+
{ name: "sensorId", label: "Sensor", icon: "cpu", variant: "body" },
|
|
83
|
+
{ name: "threshold", label: "Threshold", icon: "gauge", variant: "body", format: "number" },
|
|
84
|
+
{ name: "operator", label: "Operator", variant: "caption" },
|
|
85
|
+
{ name: "isActive", label: "Active", icon: "power", variant: "badge" }
|
|
86
|
+
],
|
|
87
|
+
itemActions: [
|
|
88
|
+
{ label: "Edit", event: "EDIT", icon: "pencil" }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
] }]
|
|
92
|
+
];
|
|
93
|
+
var deviceMainEffects = [
|
|
94
|
+
["fetch", "Device"],
|
|
95
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
96
|
+
// Header
|
|
97
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
98
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
99
|
+
{ type: "icon", name: "router", size: "lg" },
|
|
100
|
+
{ type: "typography", variant: "h2", content: "Devices" }
|
|
101
|
+
] }
|
|
102
|
+
] },
|
|
103
|
+
{ type: "divider" },
|
|
104
|
+
// Stats row: device count + online meter
|
|
105
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
106
|
+
{ type: "stats", label: "Total Devices", icon: "server", entity: "Device" },
|
|
107
|
+
{ type: "meter", value: 0, label: "Online Devices", icon: "wifi" }
|
|
108
|
+
] },
|
|
109
|
+
{ type: "divider" },
|
|
110
|
+
// Search
|
|
111
|
+
{ type: "search-input", placeholder: "Search devices...", entity: "Device" },
|
|
112
|
+
// Data zone: device cards with status badges
|
|
113
|
+
{
|
|
114
|
+
type: "data-grid",
|
|
115
|
+
entity: "Device",
|
|
116
|
+
cols: 3,
|
|
117
|
+
gap: "md",
|
|
118
|
+
fields: [
|
|
119
|
+
{ name: "name", label: "Device Name", icon: "router", variant: "h4" },
|
|
120
|
+
{ name: "type", label: "Type", icon: "tag", variant: "caption" },
|
|
121
|
+
{ name: "status", label: "Status", icon: "wifi", variant: "badge" },
|
|
122
|
+
{ name: "firmware", label: "Firmware", icon: "hard-drive", variant: "caption" },
|
|
123
|
+
{ name: "lastSeen", label: "Last Seen", icon: "clock", variant: "caption", format: "date" }
|
|
124
|
+
],
|
|
125
|
+
itemActions: [
|
|
126
|
+
{ label: "View", event: "VIEW", icon: "eye" }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
] }]
|
|
130
|
+
];
|
|
131
|
+
var SENSOR_FEED_BEHAVIOR = {
|
|
132
|
+
name: "std-sensor-feed",
|
|
133
|
+
version: "1.0.0",
|
|
134
|
+
description: "Sensor data monitoring and visualization",
|
|
135
|
+
orbitals: [
|
|
136
|
+
{
|
|
137
|
+
name: "SensorFeedOrbital",
|
|
138
|
+
theme: IOT_THEME,
|
|
139
|
+
entity: {
|
|
140
|
+
name: "SensorReading",
|
|
141
|
+
persistence: "persistent",
|
|
142
|
+
collection: "sensor_readings",
|
|
143
|
+
fields: [
|
|
144
|
+
{ name: "id", type: "string", required: true },
|
|
145
|
+
{ name: "sensorId", type: "string", default: "" },
|
|
146
|
+
{ name: "value", type: "number", default: 0 },
|
|
147
|
+
{ name: "unit", type: "string", default: "" },
|
|
148
|
+
{ name: "timestamp", type: "string", default: "" },
|
|
149
|
+
{ name: "status", type: "string", default: "normal" }
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
traits: [
|
|
153
|
+
{
|
|
154
|
+
name: "SensorFeedControl",
|
|
155
|
+
linkedEntity: "SensorReading",
|
|
156
|
+
category: "interaction",
|
|
157
|
+
stateMachine: {
|
|
158
|
+
states: [
|
|
159
|
+
{ name: "browsing", isInitial: true },
|
|
160
|
+
{ name: "viewing" },
|
|
161
|
+
{ name: "configuring" }
|
|
162
|
+
],
|
|
163
|
+
events: [
|
|
164
|
+
{ key: "INIT", name: "Initialize" },
|
|
165
|
+
{ key: "VIEW", name: "View Sensor", payloadSchema: [{ name: "id", type: "string", required: true }] },
|
|
166
|
+
{ key: "CONFIGURE", name: "Configure Sensor" },
|
|
167
|
+
{ key: "SAVE_CONFIG", name: "Save Config", payloadSchema: [{ name: "unit", type: "string", required: true }] },
|
|
168
|
+
{ key: "CLOSE", name: "Close" },
|
|
169
|
+
{ key: "CANCEL", name: "Cancel" }
|
|
170
|
+
],
|
|
171
|
+
transitions: [
|
|
172
|
+
{
|
|
173
|
+
from: "browsing",
|
|
174
|
+
to: "browsing",
|
|
175
|
+
event: "INIT",
|
|
176
|
+
effects: sensorMainEffects
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
from: "browsing",
|
|
180
|
+
to: "viewing",
|
|
181
|
+
event: "VIEW",
|
|
182
|
+
effects: [
|
|
183
|
+
["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
|
|
184
|
+
// Modal header: sensor ID + close
|
|
185
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
186
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
187
|
+
{ type: "icon", name: "cpu", size: "md" },
|
|
188
|
+
{ type: "typography", variant: "h3", content: "@entity.sensorId" }
|
|
189
|
+
] },
|
|
190
|
+
{ type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
|
|
191
|
+
] },
|
|
192
|
+
{ type: "divider" },
|
|
193
|
+
// Meter gauge for current reading
|
|
194
|
+
{ type: "meter", value: "@entity.value", label: "Current Value", icon: "thermometer" },
|
|
195
|
+
// Detail fields
|
|
196
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
197
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
198
|
+
{ type: "typography", variant: "caption", content: "Unit" },
|
|
199
|
+
{ type: "typography", variant: "body", content: "@entity.unit" }
|
|
200
|
+
] },
|
|
201
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
202
|
+
{ type: "typography", variant: "caption", content: "Status" },
|
|
203
|
+
{ type: "badge", content: "@entity.status" }
|
|
204
|
+
] },
|
|
205
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
206
|
+
{ type: "typography", variant: "caption", content: "Last Update" },
|
|
207
|
+
{ type: "typography", variant: "body", content: "@entity.timestamp" }
|
|
208
|
+
] }
|
|
209
|
+
] },
|
|
210
|
+
{ type: "divider" },
|
|
211
|
+
// Actions
|
|
212
|
+
{ type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
|
|
213
|
+
{ type: "button", label: "Configure", icon: "settings", variant: "primary", action: "CONFIGURE" }
|
|
214
|
+
] }
|
|
215
|
+
] }]
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
from: "viewing",
|
|
220
|
+
to: "configuring",
|
|
221
|
+
event: "CONFIGURE",
|
|
222
|
+
effects: [
|
|
223
|
+
["fetch", "SensorReading"],
|
|
224
|
+
["render-ui", "modal", {
|
|
225
|
+
type: "form-section",
|
|
226
|
+
entity: "SensorReading",
|
|
227
|
+
submitEvent: "SAVE_CONFIG",
|
|
228
|
+
cancelEvent: "CANCEL"
|
|
229
|
+
}]
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
from: "configuring",
|
|
234
|
+
to: "browsing",
|
|
235
|
+
event: "SAVE_CONFIG",
|
|
236
|
+
effects: [
|
|
237
|
+
["set", "@entity.unit", "@payload.unit"],
|
|
238
|
+
["render-ui", "modal", null],
|
|
239
|
+
...sensorMainEffects
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
from: "viewing",
|
|
244
|
+
to: "browsing",
|
|
245
|
+
event: "CLOSE",
|
|
246
|
+
effects: [["render-ui", "modal", null]]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
from: "viewing",
|
|
250
|
+
to: "browsing",
|
|
251
|
+
event: "CANCEL",
|
|
252
|
+
effects: [["render-ui", "modal", null]]
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
from: "configuring",
|
|
256
|
+
to: "browsing",
|
|
257
|
+
event: "CLOSE",
|
|
258
|
+
effects: [["render-ui", "modal", null]]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
from: "configuring",
|
|
262
|
+
to: "browsing",
|
|
263
|
+
event: "CANCEL",
|
|
264
|
+
effects: [["render-ui", "modal", null]]
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
pages: [
|
|
271
|
+
{
|
|
272
|
+
name: "SensorPage",
|
|
273
|
+
path: "/sensors",
|
|
274
|
+
isInitial: true,
|
|
275
|
+
traits: [{ ref: "SensorFeedControl" }]
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
};
|
|
281
|
+
var ALERT_THRESHOLD_BEHAVIOR = {
|
|
282
|
+
name: "std-alert-threshold",
|
|
283
|
+
version: "1.0.0",
|
|
284
|
+
description: "Alert threshold configuration for sensors",
|
|
285
|
+
orbitals: [
|
|
286
|
+
{
|
|
287
|
+
name: "AlertThresholdOrbital",
|
|
288
|
+
theme: IOT_THEME,
|
|
289
|
+
entity: {
|
|
290
|
+
name: "AlertRule",
|
|
291
|
+
persistence: "persistent",
|
|
292
|
+
collection: "alert_rules",
|
|
293
|
+
fields: [
|
|
294
|
+
{ name: "id", type: "string", required: true },
|
|
295
|
+
{ name: "sensorId", type: "string", default: "" },
|
|
296
|
+
{ name: "metric", type: "string", default: "" },
|
|
297
|
+
{ name: "threshold", type: "number", default: 0 },
|
|
298
|
+
{ name: "operator", type: "string", default: "gt" },
|
|
299
|
+
{ name: "isActive", type: "boolean", default: true }
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
traits: [
|
|
303
|
+
{
|
|
304
|
+
name: "AlertThresholdControl",
|
|
305
|
+
linkedEntity: "AlertRule",
|
|
306
|
+
category: "interaction",
|
|
307
|
+
stateMachine: {
|
|
308
|
+
states: [
|
|
309
|
+
{ name: "browsing", isInitial: true },
|
|
310
|
+
{ name: "creating" },
|
|
311
|
+
{ name: "editing" }
|
|
312
|
+
],
|
|
313
|
+
events: [
|
|
314
|
+
{ key: "INIT", name: "Initialize" },
|
|
315
|
+
{ key: "CREATE", name: "New Alert Rule" },
|
|
316
|
+
{ key: "EDIT", name: "Edit Rule", payloadSchema: [{ name: "id", type: "string", required: true }] },
|
|
317
|
+
{ key: "SAVE", name: "Save Rule", payloadSchema: [{ name: "metric", type: "string", required: true }, { name: "threshold", type: "number", required: true }] },
|
|
318
|
+
{ key: "CLOSE", name: "Close" },
|
|
319
|
+
{ key: "CANCEL", name: "Cancel" }
|
|
320
|
+
],
|
|
321
|
+
transitions: [
|
|
322
|
+
{
|
|
323
|
+
from: "browsing",
|
|
324
|
+
to: "browsing",
|
|
325
|
+
event: "INIT",
|
|
326
|
+
effects: alertMainEffects
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
from: "browsing",
|
|
330
|
+
to: "creating",
|
|
331
|
+
event: "CREATE",
|
|
332
|
+
effects: [
|
|
333
|
+
["fetch", "AlertRule"],
|
|
334
|
+
["render-ui", "modal", {
|
|
335
|
+
type: "form-section",
|
|
336
|
+
entity: "AlertRule",
|
|
337
|
+
submitEvent: "SAVE",
|
|
338
|
+
cancelEvent: "CANCEL"
|
|
339
|
+
}]
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
from: "creating",
|
|
344
|
+
to: "browsing",
|
|
345
|
+
event: "SAVE",
|
|
346
|
+
effects: [
|
|
347
|
+
["set", "@entity.metric", "@payload.metric"],
|
|
348
|
+
["set", "@entity.threshold", "@payload.threshold"],
|
|
349
|
+
["render-ui", "modal", null],
|
|
350
|
+
...alertMainEffects
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
from: "creating",
|
|
355
|
+
to: "browsing",
|
|
356
|
+
event: "CLOSE",
|
|
357
|
+
effects: [["render-ui", "modal", null]]
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
from: "creating",
|
|
361
|
+
to: "browsing",
|
|
362
|
+
event: "CANCEL",
|
|
363
|
+
effects: [["render-ui", "modal", null]]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
from: "browsing",
|
|
367
|
+
to: "editing",
|
|
368
|
+
event: "EDIT",
|
|
369
|
+
effects: [
|
|
370
|
+
["fetch", "AlertRule"],
|
|
371
|
+
["render-ui", "modal", {
|
|
372
|
+
type: "form-section",
|
|
373
|
+
entity: "AlertRule",
|
|
374
|
+
submitEvent: "SAVE",
|
|
375
|
+
cancelEvent: "CANCEL"
|
|
376
|
+
}]
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
from: "editing",
|
|
381
|
+
to: "browsing",
|
|
382
|
+
event: "SAVE",
|
|
383
|
+
effects: [
|
|
384
|
+
["set", "@entity.metric", "@payload.metric"],
|
|
385
|
+
["set", "@entity.threshold", "@payload.threshold"],
|
|
386
|
+
["render-ui", "modal", null],
|
|
387
|
+
...alertMainEffects
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
from: "editing",
|
|
392
|
+
to: "browsing",
|
|
393
|
+
event: "CLOSE",
|
|
394
|
+
effects: [["render-ui", "modal", null]]
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
from: "editing",
|
|
398
|
+
to: "browsing",
|
|
399
|
+
event: "CANCEL",
|
|
400
|
+
effects: [["render-ui", "modal", null]]
|
|
401
|
+
}
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
pages: [
|
|
407
|
+
{
|
|
408
|
+
name: "AlertsPage",
|
|
409
|
+
path: "/alerts",
|
|
410
|
+
isInitial: true,
|
|
411
|
+
traits: [{ ref: "AlertThresholdControl" }]
|
|
412
|
+
}
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
]
|
|
416
|
+
};
|
|
417
|
+
var DEVICE_MGMT_BEHAVIOR = {
|
|
418
|
+
name: "std-device-mgmt",
|
|
419
|
+
version: "1.0.0",
|
|
420
|
+
description: "Device management with status and firmware tracking",
|
|
421
|
+
orbitals: [
|
|
422
|
+
{
|
|
423
|
+
name: "DeviceMgmtOrbital",
|
|
424
|
+
theme: IOT_THEME,
|
|
425
|
+
entity: {
|
|
426
|
+
name: "Device",
|
|
427
|
+
persistence: "persistent",
|
|
428
|
+
collection: "devices",
|
|
429
|
+
fields: [
|
|
430
|
+
{ name: "id", type: "string", required: true },
|
|
431
|
+
{ name: "name", type: "string", default: "" },
|
|
432
|
+
{ name: "type", type: "string", default: "" },
|
|
433
|
+
{ name: "status", type: "string", default: "offline" },
|
|
434
|
+
{ name: "lastSeen", type: "string", default: "" },
|
|
435
|
+
{ name: "firmware", type: "string", default: "" }
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
traits: [
|
|
439
|
+
{
|
|
440
|
+
name: "DeviceMgmtControl",
|
|
441
|
+
linkedEntity: "Device",
|
|
442
|
+
category: "interaction",
|
|
443
|
+
stateMachine: {
|
|
444
|
+
states: [
|
|
445
|
+
{ name: "browsing", isInitial: true },
|
|
446
|
+
{ name: "viewing" },
|
|
447
|
+
{ name: "configuring" }
|
|
448
|
+
],
|
|
449
|
+
events: [
|
|
450
|
+
{ key: "INIT", name: "Initialize" },
|
|
451
|
+
{ key: "VIEW", name: "View Device", payloadSchema: [{ name: "id", type: "string", required: true }] },
|
|
452
|
+
{ key: "CONFIGURE", name: "Configure Device" },
|
|
453
|
+
{ key: "SAVE_CONFIG", name: "Save Config", payloadSchema: [{ name: "name", type: "string", required: true }] },
|
|
454
|
+
{ key: "CLOSE", name: "Close" },
|
|
455
|
+
{ key: "CANCEL", name: "Cancel" }
|
|
456
|
+
],
|
|
457
|
+
transitions: [
|
|
458
|
+
{
|
|
459
|
+
from: "browsing",
|
|
460
|
+
to: "browsing",
|
|
461
|
+
event: "INIT",
|
|
462
|
+
effects: deviceMainEffects
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
from: "browsing",
|
|
466
|
+
to: "viewing",
|
|
467
|
+
event: "VIEW",
|
|
468
|
+
effects: [
|
|
469
|
+
["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
|
|
470
|
+
// Modal header
|
|
471
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
472
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
473
|
+
{ type: "icon", name: "router", size: "md" },
|
|
474
|
+
{ type: "typography", variant: "h3", content: "@entity.name" }
|
|
475
|
+
] },
|
|
476
|
+
{ type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
|
|
477
|
+
] },
|
|
478
|
+
{ type: "divider" },
|
|
479
|
+
// Device info grid
|
|
480
|
+
{ type: "stack", direction: "horizontal", gap: "lg", children: [
|
|
481
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
482
|
+
{ type: "stack", direction: "horizontal", gap: "xs", children: [
|
|
483
|
+
{ type: "icon", name: "tag", size: "xs" },
|
|
484
|
+
{ type: "typography", variant: "caption", content: "Type" }
|
|
485
|
+
] },
|
|
486
|
+
{ type: "typography", variant: "body", content: "@entity.type" }
|
|
487
|
+
] },
|
|
488
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
489
|
+
{ type: "stack", direction: "horizontal", gap: "xs", children: [
|
|
490
|
+
{ type: "icon", name: "wifi", size: "xs" },
|
|
491
|
+
{ type: "typography", variant: "caption", content: "Status" }
|
|
492
|
+
] },
|
|
493
|
+
{ type: "badge", content: "@entity.status" }
|
|
494
|
+
] },
|
|
495
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
496
|
+
{ type: "stack", direction: "horizontal", gap: "xs", children: [
|
|
497
|
+
{ type: "icon", name: "hard-drive", size: "xs" },
|
|
498
|
+
{ type: "typography", variant: "caption", content: "Firmware" }
|
|
499
|
+
] },
|
|
500
|
+
{ type: "typography", variant: "body", content: "@entity.firmware" }
|
|
501
|
+
] },
|
|
502
|
+
{ type: "stack", direction: "vertical", gap: "xs", children: [
|
|
503
|
+
{ type: "stack", direction: "horizontal", gap: "xs", children: [
|
|
504
|
+
{ type: "icon", name: "clock", size: "xs" },
|
|
505
|
+
{ type: "typography", variant: "caption", content: "Last Seen" }
|
|
506
|
+
] },
|
|
507
|
+
{ type: "typography", variant: "body", content: "@entity.lastSeen" }
|
|
508
|
+
] }
|
|
509
|
+
] },
|
|
510
|
+
{ type: "divider" },
|
|
511
|
+
// Actions
|
|
512
|
+
{ type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
|
|
513
|
+
{ type: "button", label: "Configure", icon: "settings", variant: "primary", action: "CONFIGURE" }
|
|
514
|
+
] }
|
|
515
|
+
] }]
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
from: "viewing",
|
|
520
|
+
to: "configuring",
|
|
521
|
+
event: "CONFIGURE",
|
|
522
|
+
effects: [
|
|
523
|
+
["fetch", "Device"],
|
|
524
|
+
["render-ui", "modal", {
|
|
525
|
+
type: "form-section",
|
|
526
|
+
entity: "Device",
|
|
527
|
+
submitEvent: "SAVE_CONFIG",
|
|
528
|
+
cancelEvent: "CANCEL"
|
|
529
|
+
}]
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
from: "configuring",
|
|
534
|
+
to: "browsing",
|
|
535
|
+
event: "SAVE_CONFIG",
|
|
536
|
+
effects: [
|
|
537
|
+
["set", "@entity.name", "@payload.name"],
|
|
538
|
+
["render-ui", "modal", null],
|
|
539
|
+
...deviceMainEffects
|
|
540
|
+
]
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
from: "viewing",
|
|
544
|
+
to: "browsing",
|
|
545
|
+
event: "CLOSE",
|
|
546
|
+
effects: [["render-ui", "modal", null]]
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
from: "viewing",
|
|
550
|
+
to: "browsing",
|
|
551
|
+
event: "CANCEL",
|
|
552
|
+
effects: [["render-ui", "modal", null]]
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
from: "configuring",
|
|
556
|
+
to: "browsing",
|
|
557
|
+
event: "CLOSE",
|
|
558
|
+
effects: [["render-ui", "modal", null]]
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
from: "configuring",
|
|
562
|
+
to: "browsing",
|
|
563
|
+
event: "CANCEL",
|
|
564
|
+
effects: [["render-ui", "modal", null]]
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
],
|
|
570
|
+
pages: [
|
|
571
|
+
{
|
|
572
|
+
name: "DevicesPage",
|
|
573
|
+
path: "/devices",
|
|
574
|
+
isInitial: true,
|
|
575
|
+
traits: [{ ref: "DeviceMgmtControl" }]
|
|
576
|
+
}
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
};
|
|
581
|
+
var IOT_BEHAVIORS = [
|
|
582
|
+
SENSOR_FEED_BEHAVIOR,
|
|
583
|
+
ALERT_THRESHOLD_BEHAVIOR,
|
|
584
|
+
DEVICE_MGMT_BEHAVIOR
|
|
585
|
+
];
|
|
586
|
+
|
|
587
|
+
export { ALERT_THRESHOLD_BEHAVIOR, DEVICE_MGMT_BEHAVIOR, IOT_BEHAVIORS, SENSOR_FEED_BEHAVIOR };
|
|
588
|
+
//# sourceMappingURL=iot.js.map
|
|
589
|
+
//# sourceMappingURL=iot.js.map
|