@almadar/std 2.1.1 → 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 +1 -1
|
@@ -1,332 +1,417 @@
|
|
|
1
1
|
// behaviors/feedback.ts
|
|
2
|
+
var FEEDBACK_THEME = {
|
|
3
|
+
name: "feedback-amber",
|
|
4
|
+
tokens: {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: "#d97706",
|
|
7
|
+
"primary-hover": "#b45309",
|
|
8
|
+
"primary-foreground": "#ffffff",
|
|
9
|
+
accent: "#f59e0b",
|
|
10
|
+
"accent-foreground": "#000000",
|
|
11
|
+
success: "#22c55e",
|
|
12
|
+
warning: "#f59e0b",
|
|
13
|
+
error: "#ef4444"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var notificationEmptyEffects = [
|
|
18
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
19
|
+
// Header: icon + title
|
|
20
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
21
|
+
{ type: "icon", name: "bell-off", size: "lg" },
|
|
22
|
+
{ type: "typography", variant: "h2", content: "Notifications" }
|
|
23
|
+
] },
|
|
24
|
+
{ type: "divider" },
|
|
25
|
+
// Empty state
|
|
26
|
+
{ type: "stack", direction: "vertical", gap: "md", align: "center", children: [
|
|
27
|
+
{ type: "icon", name: "inbox", size: "xl" },
|
|
28
|
+
{ type: "typography", variant: "h3", content: "No Notifications" },
|
|
29
|
+
{ type: "typography", variant: "body", content: "Nothing to display" },
|
|
30
|
+
{ type: "button", label: "Send Test Notification", action: "SHOW", icon: "bell", variant: "primary" }
|
|
31
|
+
] }
|
|
32
|
+
] }]
|
|
33
|
+
];
|
|
34
|
+
var notificationVisibleEffects = [
|
|
35
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
36
|
+
// Header: icon + title
|
|
37
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
38
|
+
{ type: "icon", name: "bell", size: "lg" },
|
|
39
|
+
{ type: "typography", variant: "h2", content: "Notifications" }
|
|
40
|
+
] },
|
|
41
|
+
{ type: "divider" },
|
|
42
|
+
// Notification list
|
|
43
|
+
{
|
|
44
|
+
type: "data-list",
|
|
45
|
+
entity: "Notification",
|
|
46
|
+
fields: [
|
|
47
|
+
{ name: "title", label: "Title", icon: "tag", variant: "h4" },
|
|
48
|
+
{ name: "message", label: "Message", icon: "message-square", variant: "body" },
|
|
49
|
+
{ name: "type", label: "Type", icon: "info", variant: "badge" }
|
|
50
|
+
],
|
|
51
|
+
actions: [
|
|
52
|
+
{ label: "Dismiss", event: "HIDE", icon: "x", variant: "ghost" }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
] }]
|
|
56
|
+
];
|
|
2
57
|
var NOTIFICATION_BEHAVIOR = {
|
|
3
58
|
name: "std-notification",
|
|
4
59
|
version: "1.0.0",
|
|
5
60
|
description: "Toast notification with auto-dismiss",
|
|
61
|
+
theme: FEEDBACK_THEME,
|
|
6
62
|
orbitals: [
|
|
7
63
|
{
|
|
8
64
|
name: "NotificationOrbital",
|
|
9
65
|
entity: {
|
|
10
|
-
name: "
|
|
66
|
+
name: "Notification",
|
|
11
67
|
persistence: "runtime",
|
|
12
68
|
fields: [
|
|
13
69
|
{ name: "id", type: "string", required: true },
|
|
14
|
-
{ name: "
|
|
15
|
-
{ name: "
|
|
16
|
-
{ name: "
|
|
70
|
+
{ name: "message", type: "string", default: "" },
|
|
71
|
+
{ name: "type", type: "string", default: "info" },
|
|
72
|
+
{ name: "title", type: "string", default: "" }
|
|
17
73
|
]
|
|
18
74
|
},
|
|
19
75
|
traits: [
|
|
20
76
|
{
|
|
21
|
-
name: "
|
|
22
|
-
linkedEntity: "
|
|
77
|
+
name: "NotificationDisplay",
|
|
78
|
+
linkedEntity: "Notification",
|
|
23
79
|
category: "interaction",
|
|
24
80
|
stateMachine: {
|
|
25
81
|
states: [
|
|
26
|
-
{ name: "
|
|
27
|
-
{ name: "
|
|
28
|
-
{ name: "Dismissing" }
|
|
82
|
+
{ name: "hidden", isInitial: true },
|
|
83
|
+
{ name: "visible" }
|
|
29
84
|
],
|
|
30
85
|
events: [
|
|
31
|
-
{ key: "
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
86
|
+
{ key: "INIT", name: "Initialize" },
|
|
87
|
+
{
|
|
88
|
+
key: "SHOW",
|
|
89
|
+
name: "Show",
|
|
90
|
+
payloadSchema: [
|
|
91
|
+
{ name: "message", type: "string", required: true },
|
|
92
|
+
{ name: "type", type: "string", required: false },
|
|
93
|
+
{ name: "title", type: "string", required: false }
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{ key: "HIDE", name: "Hide" }
|
|
35
97
|
],
|
|
36
98
|
transitions: [
|
|
37
99
|
{
|
|
38
|
-
from: "
|
|
39
|
-
to: "
|
|
40
|
-
event: "
|
|
100
|
+
from: "hidden",
|
|
101
|
+
to: "hidden",
|
|
102
|
+
event: "INIT",
|
|
41
103
|
effects: [
|
|
42
|
-
|
|
43
|
-
"let",
|
|
44
|
-
[["id", ["+", "@entity.currentId", 1]]],
|
|
45
|
-
[
|
|
46
|
-
"do",
|
|
47
|
-
["set", "@entity.currentId", "@id"],
|
|
48
|
-
[
|
|
49
|
-
"set",
|
|
50
|
-
"@entity.notifications",
|
|
51
|
-
["array/append", "@entity.notifications", {
|
|
52
|
-
id: "@id",
|
|
53
|
-
type: "@payload.type",
|
|
54
|
-
message: "@payload.message",
|
|
55
|
-
title: "@payload.title"
|
|
56
|
-
}]
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
"when",
|
|
60
|
-
[">", "@entity.autoDismissMs", 0],
|
|
61
|
-
["async/delay", "@entity.autoDismissMs", ["emit", "AUTO_DISMISS", { id: "@id" }]]
|
|
62
|
-
]
|
|
63
|
-
]
|
|
64
|
-
]
|
|
104
|
+
...notificationEmptyEffects
|
|
65
105
|
]
|
|
66
106
|
},
|
|
67
107
|
{
|
|
68
|
-
from: "
|
|
69
|
-
to: "
|
|
108
|
+
from: "hidden",
|
|
109
|
+
to: "visible",
|
|
70
110
|
event: "SHOW",
|
|
71
111
|
effects: [
|
|
72
|
-
[
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
["set", "@entity.currentId", "@id"],
|
|
78
|
-
[
|
|
79
|
-
"set",
|
|
80
|
-
"@entity.notifications",
|
|
81
|
-
["array/append", "@entity.notifications", {
|
|
82
|
-
id: "@id",
|
|
83
|
-
type: "@payload.type",
|
|
84
|
-
message: "@payload.message",
|
|
85
|
-
title: "@payload.title"
|
|
86
|
-
}]
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
"when",
|
|
90
|
-
[">", "@entity.autoDismissMs", 0],
|
|
91
|
-
["async/delay", "@entity.autoDismissMs", ["emit", "AUTO_DISMISS", { id: "@id" }]]
|
|
92
|
-
]
|
|
93
|
-
]
|
|
94
|
-
]
|
|
112
|
+
["fetch", "Notification"],
|
|
113
|
+
["set", "@entity.message", "@payload.message"],
|
|
114
|
+
["set", "@entity.type", "@payload.type"],
|
|
115
|
+
["set", "@entity.title", "@payload.title"],
|
|
116
|
+
...notificationVisibleEffects
|
|
95
117
|
]
|
|
96
118
|
},
|
|
97
119
|
{
|
|
98
|
-
from: "
|
|
99
|
-
to: "
|
|
100
|
-
event: "
|
|
120
|
+
from: "visible",
|
|
121
|
+
to: "visible",
|
|
122
|
+
event: "SHOW",
|
|
101
123
|
effects: [
|
|
102
|
-
[
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
124
|
+
["fetch", "Notification"],
|
|
125
|
+
["set", "@entity.message", "@payload.message"],
|
|
126
|
+
["set", "@entity.type", "@payload.type"],
|
|
127
|
+
["set", "@entity.title", "@payload.title"],
|
|
128
|
+
...notificationVisibleEffects
|
|
107
129
|
]
|
|
108
130
|
},
|
|
109
131
|
{
|
|
110
|
-
from: "
|
|
111
|
-
to: "
|
|
112
|
-
event: "
|
|
132
|
+
from: "visible",
|
|
133
|
+
to: "hidden",
|
|
134
|
+
event: "HIDE",
|
|
113
135
|
effects: [
|
|
114
|
-
[
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
["array/filter", "@entity.notifications", ["fn", "n", ["!=", "@n.id", "@payload.id"]]]
|
|
118
|
-
]
|
|
136
|
+
["set", "@entity.message", ""],
|
|
137
|
+
["set", "@entity.title", ""],
|
|
138
|
+
...notificationEmptyEffects
|
|
119
139
|
]
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
from: "Visible",
|
|
123
|
-
to: "Hidden",
|
|
124
|
-
event: "HIDE",
|
|
125
|
-
effects: [["set", "@entity.notifications", []]]
|
|
126
140
|
}
|
|
127
141
|
]
|
|
128
142
|
}
|
|
129
143
|
}
|
|
130
144
|
],
|
|
131
|
-
pages: [
|
|
145
|
+
pages: [
|
|
146
|
+
{
|
|
147
|
+
name: "NotificationsPage",
|
|
148
|
+
path: "/notifications",
|
|
149
|
+
isInitial: true,
|
|
150
|
+
traits: [{ ref: "NotificationDisplay" }]
|
|
151
|
+
}
|
|
152
|
+
]
|
|
132
153
|
}
|
|
133
154
|
]
|
|
134
155
|
};
|
|
156
|
+
var confirmationClosedEffects = [
|
|
157
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
158
|
+
// Header: icon + title
|
|
159
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
160
|
+
{ type: "icon", name: "shield-check", size: "lg" },
|
|
161
|
+
{ type: "typography", variant: "h2", content: "Confirmation" }
|
|
162
|
+
] },
|
|
163
|
+
{ type: "divider" },
|
|
164
|
+
// Idle state
|
|
165
|
+
{ type: "stack", direction: "vertical", gap: "md", align: "center", children: [
|
|
166
|
+
{ type: "icon", name: "check-circle", size: "xl" },
|
|
167
|
+
{ type: "typography", variant: "body", content: "No pending confirmations" }
|
|
168
|
+
] }
|
|
169
|
+
] }]
|
|
170
|
+
];
|
|
135
171
|
var CONFIRMATION_BEHAVIOR = {
|
|
136
172
|
name: "std-confirmation",
|
|
137
173
|
version: "1.0.0",
|
|
138
174
|
description: "Confirmation dialog with confirm/cancel actions",
|
|
175
|
+
theme: FEEDBACK_THEME,
|
|
139
176
|
orbitals: [
|
|
140
177
|
{
|
|
141
178
|
name: "ConfirmationOrbital",
|
|
142
179
|
entity: {
|
|
143
|
-
name: "
|
|
180
|
+
name: "Confirmation",
|
|
144
181
|
persistence: "runtime",
|
|
145
182
|
fields: [
|
|
146
183
|
{ name: "id", type: "string", required: true },
|
|
147
184
|
{ name: "title", type: "string", default: "" },
|
|
148
|
-
{ name: "message", type: "string", default: "" }
|
|
149
|
-
{ name: "pendingAction", type: "object", default: null },
|
|
150
|
-
{ name: "confirmLabel", type: "string", default: "Confirm" },
|
|
151
|
-
{ name: "cancelLabel", type: "string", default: "Cancel" },
|
|
152
|
-
{ name: "confirmVariant", type: "string", default: "danger" }
|
|
185
|
+
{ name: "message", type: "string", default: "" }
|
|
153
186
|
]
|
|
154
187
|
},
|
|
155
188
|
traits: [
|
|
156
189
|
{
|
|
157
|
-
name: "
|
|
158
|
-
linkedEntity: "
|
|
190
|
+
name: "ConfirmationDialog",
|
|
191
|
+
linkedEntity: "Confirmation",
|
|
159
192
|
category: "interaction",
|
|
160
193
|
stateMachine: {
|
|
161
194
|
states: [
|
|
162
|
-
{ name: "
|
|
163
|
-
{ name: "
|
|
195
|
+
{ name: "closed", isInitial: true },
|
|
196
|
+
{ name: "open" }
|
|
164
197
|
],
|
|
165
198
|
events: [
|
|
166
|
-
{ key: "
|
|
199
|
+
{ key: "INIT", name: "Initialize" },
|
|
200
|
+
{
|
|
201
|
+
key: "REQUEST",
|
|
202
|
+
name: "Request",
|
|
203
|
+
payloadSchema: [
|
|
204
|
+
{ name: "title", type: "string", required: true },
|
|
205
|
+
{ name: "message", type: "string", required: true }
|
|
206
|
+
]
|
|
207
|
+
},
|
|
167
208
|
{ key: "CONFIRM", name: "Confirm" },
|
|
168
|
-
{ key: "CANCEL", name: "Cancel" }
|
|
209
|
+
{ key: "CANCEL", name: "Cancel" },
|
|
210
|
+
{ key: "CLOSE", name: "Close" }
|
|
169
211
|
],
|
|
170
212
|
transitions: [
|
|
171
213
|
{
|
|
172
|
-
from: "
|
|
173
|
-
to: "
|
|
214
|
+
from: "closed",
|
|
215
|
+
to: "closed",
|
|
216
|
+
event: "INIT",
|
|
217
|
+
effects: [
|
|
218
|
+
...confirmationClosedEffects
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
from: "closed",
|
|
223
|
+
to: "open",
|
|
174
224
|
event: "REQUEST",
|
|
175
225
|
effects: [
|
|
176
226
|
["set", "@entity.title", "@payload.title"],
|
|
177
227
|
["set", "@entity.message", "@payload.message"],
|
|
178
|
-
["
|
|
179
|
-
|
|
180
|
-
type: "
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
228
|
+
["render-ui", "modal", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
229
|
+
// Modal header: warning icon + title
|
|
230
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
231
|
+
{ type: "icon", name: "alert-triangle", size: "lg" },
|
|
232
|
+
{ type: "typography", variant: "h3", content: "@entity.title" }
|
|
233
|
+
] },
|
|
234
|
+
{ type: "divider" },
|
|
235
|
+
// Message body
|
|
236
|
+
{ type: "typography", variant: "body", content: "@entity.message" },
|
|
237
|
+
{ type: "divider" },
|
|
238
|
+
// Action buttons
|
|
239
|
+
{ type: "stack", direction: "horizontal", gap: "md", justify: "end", children: [
|
|
240
|
+
{ type: "button", label: "Cancel", icon: "x", variant: "secondary", action: "CANCEL" },
|
|
241
|
+
{ type: "button", label: "Confirm", icon: "check", variant: "primary", action: "CONFIRM" }
|
|
242
|
+
] }
|
|
243
|
+
] }]
|
|
190
244
|
]
|
|
191
245
|
},
|
|
192
246
|
{
|
|
193
|
-
from: "
|
|
194
|
-
to: "
|
|
247
|
+
from: "open",
|
|
248
|
+
to: "closed",
|
|
195
249
|
event: "CONFIRM",
|
|
196
250
|
effects: [
|
|
197
|
-
["
|
|
198
|
-
["set", "@entity.
|
|
251
|
+
["set", "@entity.title", ""],
|
|
252
|
+
["set", "@entity.message", ""],
|
|
253
|
+
["render-ui", "modal", null]
|
|
199
254
|
]
|
|
200
255
|
},
|
|
201
256
|
{
|
|
202
|
-
from: "
|
|
203
|
-
to: "
|
|
257
|
+
from: "open",
|
|
258
|
+
to: "closed",
|
|
204
259
|
event: "CANCEL",
|
|
205
|
-
effects: [
|
|
260
|
+
effects: [
|
|
261
|
+
["set", "@entity.title", ""],
|
|
262
|
+
["set", "@entity.message", ""],
|
|
263
|
+
["render-ui", "modal", null]
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
from: "open",
|
|
268
|
+
to: "closed",
|
|
269
|
+
event: "CLOSE",
|
|
270
|
+
effects: [
|
|
271
|
+
["set", "@entity.title", ""],
|
|
272
|
+
["set", "@entity.message", ""],
|
|
273
|
+
["render-ui", "modal", null]
|
|
274
|
+
]
|
|
206
275
|
}
|
|
207
276
|
]
|
|
208
277
|
}
|
|
209
278
|
}
|
|
210
279
|
],
|
|
211
|
-
pages: [
|
|
280
|
+
pages: [
|
|
281
|
+
{
|
|
282
|
+
name: "ConfirmationPage",
|
|
283
|
+
path: "/confirmation",
|
|
284
|
+
isInitial: true,
|
|
285
|
+
traits: [{ ref: "ConfirmationDialog" }]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
212
288
|
}
|
|
213
289
|
]
|
|
214
290
|
};
|
|
291
|
+
var undoReadyEffects = [
|
|
292
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
293
|
+
// Header: icon + title + clear button
|
|
294
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
295
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
296
|
+
{ type: "icon", name: "rotate-ccw", size: "lg" },
|
|
297
|
+
{ type: "typography", variant: "h2", content: "Undo History" }
|
|
298
|
+
] },
|
|
299
|
+
{ type: "button", label: "Clear All", icon: "trash-2", variant: "ghost", action: "CLEAR" }
|
|
300
|
+
] },
|
|
301
|
+
{ type: "divider" },
|
|
302
|
+
// Stats row
|
|
303
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
304
|
+
{ type: "stats", label: "Actions", icon: "layers", entity: "UndoEntry" },
|
|
305
|
+
{ type: "stats", label: "Status", icon: "activity", entity: "UndoEntry" }
|
|
306
|
+
] },
|
|
307
|
+
{ type: "divider" },
|
|
308
|
+
// Undo entries data grid
|
|
309
|
+
{
|
|
310
|
+
type: "data-grid",
|
|
311
|
+
entity: "UndoEntry",
|
|
312
|
+
cols: 1,
|
|
313
|
+
gap: "sm",
|
|
314
|
+
fields: [
|
|
315
|
+
{ name: "action", label: "Action", icon: "zap", variant: "h4" },
|
|
316
|
+
{ name: "description", label: "Description", icon: "file-text", variant: "body" },
|
|
317
|
+
{ name: "status", label: "Status", icon: "circle", variant: "badge" }
|
|
318
|
+
],
|
|
319
|
+
actions: [
|
|
320
|
+
{ label: "Undo", event: "UNDO", icon: "rotate-ccw", variant: "secondary" }
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
] }]
|
|
324
|
+
];
|
|
215
325
|
var UNDO_BEHAVIOR = {
|
|
216
326
|
name: "std-undo",
|
|
217
327
|
version: "1.0.0",
|
|
218
|
-
description: "Undo
|
|
328
|
+
description: "Undo stack for reversible actions",
|
|
329
|
+
theme: FEEDBACK_THEME,
|
|
219
330
|
orbitals: [
|
|
220
331
|
{
|
|
221
332
|
name: "UndoOrbital",
|
|
222
333
|
entity: {
|
|
223
|
-
name: "
|
|
334
|
+
name: "UndoEntry",
|
|
224
335
|
persistence: "runtime",
|
|
225
336
|
fields: [
|
|
226
337
|
{ name: "id", type: "string", required: true },
|
|
227
|
-
{ name: "
|
|
228
|
-
{ name: "
|
|
229
|
-
{ name: "
|
|
230
|
-
{ name: "showToast", type: "boolean", default: true }
|
|
338
|
+
{ name: "action", type: "string", default: "" },
|
|
339
|
+
{ name: "description", type: "string", default: "" },
|
|
340
|
+
{ name: "status", type: "string", default: "ready" }
|
|
231
341
|
]
|
|
232
342
|
},
|
|
233
343
|
traits: [
|
|
234
344
|
{
|
|
235
|
-
name: "
|
|
236
|
-
linkedEntity: "
|
|
345
|
+
name: "UndoManagement",
|
|
346
|
+
linkedEntity: "UndoEntry",
|
|
237
347
|
category: "interaction",
|
|
238
348
|
stateMachine: {
|
|
239
|
-
states: [
|
|
349
|
+
states: [
|
|
350
|
+
{ name: "ready", isInitial: true }
|
|
351
|
+
],
|
|
240
352
|
events: [
|
|
241
|
-
{ key: "
|
|
353
|
+
{ key: "INIT", name: "Initialize" },
|
|
354
|
+
{
|
|
355
|
+
key: "PUSH",
|
|
356
|
+
name: "Push",
|
|
357
|
+
payloadSchema: [
|
|
358
|
+
{ name: "action", type: "string", required: true },
|
|
359
|
+
{ name: "description", type: "string", required: true }
|
|
360
|
+
]
|
|
361
|
+
},
|
|
242
362
|
{ key: "UNDO", name: "Undo" },
|
|
243
|
-
{ key: "REDO", name: "Redo" },
|
|
244
363
|
{ key: "CLEAR", name: "Clear" }
|
|
245
364
|
],
|
|
246
365
|
transitions: [
|
|
247
366
|
{
|
|
248
|
-
from: "
|
|
249
|
-
to: "
|
|
250
|
-
event: "
|
|
367
|
+
from: "ready",
|
|
368
|
+
to: "ready",
|
|
369
|
+
event: "INIT",
|
|
251
370
|
effects: [
|
|
252
|
-
[
|
|
253
|
-
|
|
254
|
-
"@entity.undoStack",
|
|
255
|
-
[
|
|
256
|
-
"array/slice",
|
|
257
|
-
["array/prepend", "@entity.undoStack", {
|
|
258
|
-
action: "@payload.action",
|
|
259
|
-
data: "@payload.data",
|
|
260
|
-
reverseAction: "@payload.reverseAction",
|
|
261
|
-
reverseData: "@payload.reverseData",
|
|
262
|
-
description: "@payload.description"
|
|
263
|
-
}],
|
|
264
|
-
0,
|
|
265
|
-
"@entity.maxHistory"
|
|
266
|
-
]
|
|
267
|
-
],
|
|
268
|
-
["set", "@entity.redoStack", []],
|
|
269
|
-
[
|
|
270
|
-
"when",
|
|
271
|
-
"@entity.showToast",
|
|
272
|
-
["emit", "NOTIFY", {
|
|
273
|
-
type: "info",
|
|
274
|
-
message: ["str/concat", "@payload.description", " - Click to undo"],
|
|
275
|
-
action: { label: "Undo", event: "UNDO" }
|
|
276
|
-
}]
|
|
277
|
-
]
|
|
371
|
+
["fetch", "UndoEntry"],
|
|
372
|
+
...undoReadyEffects
|
|
278
373
|
]
|
|
279
374
|
},
|
|
280
375
|
{
|
|
281
|
-
from: "
|
|
282
|
-
to: "
|
|
283
|
-
event: "
|
|
284
|
-
guard: [">", ["array/len", "@entity.undoStack"], 0],
|
|
376
|
+
from: "ready",
|
|
377
|
+
to: "ready",
|
|
378
|
+
event: "PUSH",
|
|
285
379
|
effects: [
|
|
286
|
-
[
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
[
|
|
290
|
-
"do",
|
|
291
|
-
["set", "@entity.undoStack", ["array/slice", "@entity.undoStack", 1]],
|
|
292
|
-
["set", "@entity.redoStack", ["array/prepend", "@entity.redoStack", "@action"]],
|
|
293
|
-
["emit", "@action.reverseAction", "@action.reverseData"]
|
|
294
|
-
]
|
|
295
|
-
]
|
|
380
|
+
["set", "@entity.action", "@payload.action"],
|
|
381
|
+
["set", "@entity.description", "@payload.description"],
|
|
382
|
+
["set", "@entity.status", "recorded"]
|
|
296
383
|
]
|
|
297
384
|
},
|
|
298
385
|
{
|
|
299
|
-
from: "
|
|
300
|
-
to: "
|
|
301
|
-
event: "
|
|
302
|
-
guard: [">", ["array/len", "@entity.redoStack"], 0],
|
|
386
|
+
from: "ready",
|
|
387
|
+
to: "ready",
|
|
388
|
+
event: "UNDO",
|
|
303
389
|
effects: [
|
|
304
|
-
[
|
|
305
|
-
"let",
|
|
306
|
-
[["action", ["array/first", "@entity.redoStack"]]],
|
|
307
|
-
[
|
|
308
|
-
"do",
|
|
309
|
-
["set", "@entity.redoStack", ["array/slice", "@entity.redoStack", 1]],
|
|
310
|
-
["set", "@entity.undoStack", ["array/prepend", "@entity.undoStack", "@action"]],
|
|
311
|
-
["emit", "@action.action", "@action.data"]
|
|
312
|
-
]
|
|
313
|
-
]
|
|
390
|
+
["set", "@entity.status", "undone"]
|
|
314
391
|
]
|
|
315
392
|
},
|
|
316
393
|
{
|
|
317
|
-
from: "
|
|
318
|
-
to: "
|
|
394
|
+
from: "ready",
|
|
395
|
+
to: "ready",
|
|
319
396
|
event: "CLEAR",
|
|
320
397
|
effects: [
|
|
321
|
-
["set", "@entity.
|
|
322
|
-
["set", "@entity.
|
|
398
|
+
["set", "@entity.action", ""],
|
|
399
|
+
["set", "@entity.description", ""],
|
|
400
|
+
["set", "@entity.status", "ready"]
|
|
323
401
|
]
|
|
324
402
|
}
|
|
325
403
|
]
|
|
326
404
|
}
|
|
327
405
|
}
|
|
328
406
|
],
|
|
329
|
-
pages: [
|
|
407
|
+
pages: [
|
|
408
|
+
{
|
|
409
|
+
name: "UndoPage",
|
|
410
|
+
path: "/undo",
|
|
411
|
+
isInitial: true,
|
|
412
|
+
traits: [{ ref: "UndoManagement" }]
|
|
413
|
+
}
|
|
414
|
+
]
|
|
330
415
|
}
|
|
331
416
|
]
|
|
332
417
|
};
|