@syntrologie/runtime-sdk 1.0.1 → 2.0.0
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/CAPABILITIES.md +630 -463
- package/README.md +285 -62
- package/dist/RuntimeProvider.d.ts +51 -0
- package/dist/RuntimeProvider.js +114 -0
- package/dist/RuntimeProvider.js.map +1 -0
- package/dist/SmartCanvasApp.d.ts +9 -3
- package/dist/SmartCanvasApp.js +36 -38
- package/dist/SmartCanvasApp.js.map +1 -1
- package/dist/actions/ActionEngine.d.ts +11 -0
- package/dist/actions/ActionEngine.js +274 -0
- package/dist/actions/ActionEngine.js.map +1 -0
- package/dist/actions/executors/index.d.ts +117 -0
- package/dist/actions/executors/index.js +242 -0
- package/dist/actions/executors/index.js.map +1 -0
- package/dist/actions/executors/tour.d.ts +18 -0
- package/dist/actions/executors/tour.js +332 -0
- package/dist/actions/executors/tour.js.map +1 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +12 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/types.d.ts +399 -0
- package/dist/actions/types.js +8 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/actions/validation.d.ts +14 -0
- package/dist/actions/validation.js +603 -0
- package/dist/actions/validation.js.map +1 -0
- package/dist/api.d.ts +32 -18
- package/dist/api.js +56 -39
- package/dist/api.js.map +1 -1
- package/dist/apps/AppContext.d.ts +31 -0
- package/dist/apps/AppContext.js +93 -0
- package/dist/apps/AppContext.js.map +1 -0
- package/dist/apps/AppLoader.d.ts +84 -0
- package/dist/apps/AppLoader.js +256 -0
- package/dist/apps/AppLoader.js.map +1 -0
- package/dist/apps/AppRegistry.d.ts +102 -0
- package/dist/apps/AppRegistry.js +317 -0
- package/dist/apps/AppRegistry.js.map +1 -0
- package/dist/apps/examples/gamification-app.example.d.ts +305 -0
- package/dist/apps/examples/gamification-app.example.js +329 -0
- package/dist/apps/examples/gamification-app.example.js.map +1 -0
- package/dist/apps/faq/index.js +11 -0
- package/dist/apps/faq/index.js.map +7 -0
- package/dist/apps/gamification/index.js +2 -0
- package/dist/apps/gamification/index.js.map +7 -0
- package/dist/apps/index.d.ts +15 -0
- package/dist/apps/index.js +17 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/nav/index.js +11 -0
- package/dist/apps/nav/index.js.map +7 -0
- package/dist/apps/types.d.ts +231 -0
- package/dist/apps/types.js +8 -0
- package/dist/apps/types.js.map +1 -0
- package/dist/bootstrap.d.ts +24 -0
- package/dist/bootstrap.js +133 -33
- package/dist/bootstrap.js.map +1 -1
- package/dist/components/ShadowCanvasOverlay.js +36 -9
- package/dist/components/ShadowCanvasOverlay.js.map +1 -1
- package/dist/components/TileCard.js +37 -18
- package/dist/components/TileCard.js.map +1 -1
- package/dist/context/schema.d.ts +16 -16
- package/dist/decisions/schema.d.ts +96 -96
- package/dist/earlyPatcher.d.ts +8 -20
- package/dist/earlyPatcher.js +13 -62
- package/dist/earlyPatcher.js.map +1 -1
- package/dist/editorLoader.d.ts +2 -0
- package/dist/editorLoader.js +52 -7
- package/dist/editorLoader.js.map +1 -1
- package/dist/events/normalizers/posthog.d.ts +24 -0
- package/dist/events/normalizers/posthog.js.map +1 -1
- package/dist/events/schema.d.ts +8 -8
- package/dist/events/types.d.ts +6 -0
- package/dist/events/types.js +8 -0
- package/dist/events/types.js.map +1 -1
- package/dist/hooks/useCanvasOverlays.d.ts +4 -1
- package/dist/hooks/useCanvasOverlays.js +53 -6
- package/dist/hooks/useCanvasOverlays.js.map +1 -1
- package/dist/hooks/useShadowCanvasConfig.d.ts +3 -7
- package/dist/hooks/useShadowCanvasConfig.js +2 -3
- package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/overlays/schema.d.ts +153 -153
- package/dist/runtime.d.ts +24 -0
- package/dist/runtime.js +75 -1
- package/dist/runtime.js.map +1 -1
- package/dist/smart-canvas.esm.js +155 -78
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +41155 -35362
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +155 -78
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/store/example.d.ts +1 -0
- package/dist/store/example.js +43 -0
- package/dist/store/example.js.map +1 -0
- package/dist/store/mini-effector.d.ts +46 -0
- package/dist/store/mini-effector.js +90 -0
- package/dist/store/mini-effector.js.map +1 -0
- package/dist/surfaces/Surfaces.d.ts +11 -0
- package/dist/surfaces/Surfaces.js +361 -0
- package/dist/surfaces/Surfaces.js.map +1 -0
- package/dist/surfaces/index.d.ts +9 -0
- package/dist/surfaces/index.js +12 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/positioning.d.ts +50 -0
- package/dist/surfaces/positioning.js +231 -0
- package/dist/surfaces/positioning.js.map +1 -0
- package/dist/surfaces/types.d.ts +167 -0
- package/dist/surfaces/types.js +23 -0
- package/dist/surfaces/types.js.map +1 -0
- package/dist/telemetry/adapters/posthog.d.ts +6 -0
- package/dist/telemetry/adapters/posthog.js +9 -0
- package/dist/telemetry/adapters/posthog.js.map +1 -1
- package/dist/types-only.d.ts +32 -0
- package/dist/types-only.js +11 -0
- package/dist/types-only.js.map +1 -0
- package/dist/types.d.ts +26 -14
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/widgets/WidgetRegistry.d.ts +139 -0
- package/dist/widgets/WidgetRegistry.js +182 -0
- package/dist/widgets/WidgetRegistry.js.map +1 -0
- package/dist/widgets/index.d.ts +7 -0
- package/dist/widgets/index.js +7 -0
- package/dist/widgets/index.js.map +1 -0
- package/package.json +14 -7
- package/schema/canvas-config.schema.json +444 -254
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActionEngine Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the types for the unified execution layer for interventions
|
|
5
|
+
* (highlight, tooltip, badge, DOM modifications, navigation).
|
|
6
|
+
*/
|
|
7
|
+
import type { Placement } from "@floating-ui/dom";
|
|
8
|
+
/** Static surface slots with fixed positioning */
|
|
9
|
+
export type StaticSurfaceSlot = "drawer_right" | "drawer_left" | "drawer_bottom" | "overlay_center" | "overlay_corner_br" | "overlay_corner_bl" | "toast_top" | "toast_bottom";
|
|
10
|
+
/** Dynamic inline slot (rendered inside anchor) */
|
|
11
|
+
export type InlineSurfaceSlot = `inline:${string}`;
|
|
12
|
+
/** Dynamic adjacent slot (positioned near anchor) */
|
|
13
|
+
export type AdjacentSurfaceSlot = `adjacent:${string}`;
|
|
14
|
+
/** All surface slot types */
|
|
15
|
+
export type SurfaceSlot = StaticSurfaceSlot | InlineSurfaceSlot | AdjacentSurfaceSlot;
|
|
16
|
+
/** Highlight style configuration */
|
|
17
|
+
export interface HighlightStyle {
|
|
18
|
+
/** Ring color (default: "#5b8cff") */
|
|
19
|
+
color?: string;
|
|
20
|
+
/** Backdrop scrim opacity 0-1 (default: 0.55, set to 0 to hide) */
|
|
21
|
+
scrimOpacity?: number;
|
|
22
|
+
/** Space between element and ring in pixels (default: 12) */
|
|
23
|
+
paddingPx?: number;
|
|
24
|
+
/** Ring corner radius in pixels (default: 12) */
|
|
25
|
+
radiusPx?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Badge position relative to anchor */
|
|
28
|
+
export type BadgePosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
29
|
+
/** CTA button configuration for tooltips/modals */
|
|
30
|
+
export interface CtaButton {
|
|
31
|
+
label: string;
|
|
32
|
+
actionId: string;
|
|
33
|
+
primary?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Modal content configuration */
|
|
36
|
+
export interface ModalContent {
|
|
37
|
+
title?: string;
|
|
38
|
+
body: string;
|
|
39
|
+
}
|
|
40
|
+
/** Tooltip content configuration */
|
|
41
|
+
export interface TooltipContent {
|
|
42
|
+
title?: string;
|
|
43
|
+
body: string;
|
|
44
|
+
cta?: {
|
|
45
|
+
label: string;
|
|
46
|
+
action: ActionStep;
|
|
47
|
+
};
|
|
48
|
+
ctaButtons?: CtaButton[];
|
|
49
|
+
}
|
|
50
|
+
/** Tooltip trigger mode */
|
|
51
|
+
export type TooltipTrigger = "immediate" | "hover" | "click";
|
|
52
|
+
/** Position where HTML/content should be inserted */
|
|
53
|
+
export type InsertPosition = "before" | "after" | "prepend" | "append" | "replace";
|
|
54
|
+
/** Widget configuration for surface mounting */
|
|
55
|
+
export interface WidgetConfig {
|
|
56
|
+
widgetId: string;
|
|
57
|
+
props?: Record<string, unknown>;
|
|
58
|
+
priority?: number;
|
|
59
|
+
}
|
|
60
|
+
/** Base action with common properties */
|
|
61
|
+
interface BaseAction {
|
|
62
|
+
/** Optional label for debugging/telemetry */
|
|
63
|
+
label?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Highlight an anchor element with spotlight effect */
|
|
66
|
+
export interface HighlightAction extends BaseAction {
|
|
67
|
+
kind: "overlays:highlight";
|
|
68
|
+
anchorId: string;
|
|
69
|
+
style?: HighlightStyle;
|
|
70
|
+
/** Duration in ms before auto-cleanup (for use in sequences) */
|
|
71
|
+
duration?: number;
|
|
72
|
+
}
|
|
73
|
+
/** Pulse animation on an anchor element */
|
|
74
|
+
export interface PulseAction extends BaseAction {
|
|
75
|
+
kind: "overlays:pulse";
|
|
76
|
+
anchorId: string;
|
|
77
|
+
duration?: number;
|
|
78
|
+
}
|
|
79
|
+
/** Add a badge near an anchor element */
|
|
80
|
+
export interface BadgeAction extends BaseAction {
|
|
81
|
+
kind: "overlays:badge";
|
|
82
|
+
anchorId: string;
|
|
83
|
+
content: string;
|
|
84
|
+
position?: BadgePosition;
|
|
85
|
+
}
|
|
86
|
+
/** Tooltip lifecycle - when the action completes (for sequences) */
|
|
87
|
+
export type TooltipWaitFor = "dismissed" | "cta-click" | `timeout:${number}`;
|
|
88
|
+
/** Show a tooltip near an anchor element */
|
|
89
|
+
export interface TooltipAction extends BaseAction {
|
|
90
|
+
kind: "overlays:tooltip";
|
|
91
|
+
anchorId: string;
|
|
92
|
+
content: TooltipContent;
|
|
93
|
+
trigger?: TooltipTrigger;
|
|
94
|
+
placement?: Placement;
|
|
95
|
+
/** When the action completes (for use in sequences). Publishes event to EventBus. */
|
|
96
|
+
waitFor?: TooltipWaitFor;
|
|
97
|
+
}
|
|
98
|
+
/** Modal lifecycle - when the action completes (for sequences) */
|
|
99
|
+
export type ModalWaitFor = "dismissed" | "cta-click" | `timeout:${number}`;
|
|
100
|
+
/** Show a centered modal dialog */
|
|
101
|
+
export interface ModalAction extends BaseAction {
|
|
102
|
+
kind: "overlays:modal";
|
|
103
|
+
content: ModalContent;
|
|
104
|
+
size?: "sm" | "md" | "lg";
|
|
105
|
+
blocking?: boolean;
|
|
106
|
+
scrim?: {
|
|
107
|
+
opacity?: number;
|
|
108
|
+
};
|
|
109
|
+
dismiss?: {
|
|
110
|
+
onEsc?: boolean;
|
|
111
|
+
closeButton?: boolean;
|
|
112
|
+
timeoutMs?: number;
|
|
113
|
+
};
|
|
114
|
+
ctaButtons?: CtaButton[];
|
|
115
|
+
/** When the action completes (for use in sequences). Publishes event to EventBus. */
|
|
116
|
+
waitFor?: ModalWaitFor;
|
|
117
|
+
}
|
|
118
|
+
/** Insert HTML content relative to anchor */
|
|
119
|
+
export interface InsertHtmlAction extends BaseAction {
|
|
120
|
+
kind: "content:insertHtml";
|
|
121
|
+
anchorId: string;
|
|
122
|
+
html: string;
|
|
123
|
+
position: InsertPosition;
|
|
124
|
+
}
|
|
125
|
+
/** Set text content of an anchor */
|
|
126
|
+
export interface SetTextAction extends BaseAction {
|
|
127
|
+
kind: "content:setText";
|
|
128
|
+
anchorId: string;
|
|
129
|
+
text: string;
|
|
130
|
+
}
|
|
131
|
+
/** Set an attribute on an anchor */
|
|
132
|
+
export interface SetAttrAction extends BaseAction {
|
|
133
|
+
kind: "content:setAttr";
|
|
134
|
+
anchorId: string;
|
|
135
|
+
attr: string;
|
|
136
|
+
value: string;
|
|
137
|
+
}
|
|
138
|
+
/** Add a CSS class to an anchor */
|
|
139
|
+
export interface AddClassAction extends BaseAction {
|
|
140
|
+
kind: "content:addClass";
|
|
141
|
+
anchorId: string;
|
|
142
|
+
className: string;
|
|
143
|
+
}
|
|
144
|
+
/** Remove a CSS class from an anchor */
|
|
145
|
+
export interface RemoveClassAction extends BaseAction {
|
|
146
|
+
kind: "content:removeClass";
|
|
147
|
+
anchorId: string;
|
|
148
|
+
className: string;
|
|
149
|
+
}
|
|
150
|
+
/** Set inline styles on an anchor */
|
|
151
|
+
export interface SetStyleAction extends BaseAction {
|
|
152
|
+
kind: "content:setStyle";
|
|
153
|
+
anchorId: string;
|
|
154
|
+
styles: Record<string, string>;
|
|
155
|
+
}
|
|
156
|
+
/** Mount a widget to a surface slot */
|
|
157
|
+
export interface MountWidgetAction extends BaseAction {
|
|
158
|
+
kind: "core:mountWidget";
|
|
159
|
+
slot: SurfaceSlot;
|
|
160
|
+
widget: WidgetConfig;
|
|
161
|
+
}
|
|
162
|
+
/** Scroll to an anchor element */
|
|
163
|
+
export interface ScrollToAction extends BaseAction {
|
|
164
|
+
kind: "navigation:scrollTo";
|
|
165
|
+
anchorId: string;
|
|
166
|
+
behavior?: ScrollBehavior;
|
|
167
|
+
block?: ScrollLogicalPosition;
|
|
168
|
+
inline?: ScrollLogicalPosition;
|
|
169
|
+
}
|
|
170
|
+
/** Navigate to a URL */
|
|
171
|
+
export interface NavigateAction extends BaseAction {
|
|
172
|
+
kind: "navigation:navigate";
|
|
173
|
+
url: string;
|
|
174
|
+
target?: "_self" | "_blank";
|
|
175
|
+
}
|
|
176
|
+
/** Wait for a duration or an event on the EventBus */
|
|
177
|
+
export interface WaitAction extends BaseAction {
|
|
178
|
+
kind: "core:wait";
|
|
179
|
+
/** Wait for a specific duration in milliseconds */
|
|
180
|
+
durationMs?: number;
|
|
181
|
+
/** Wait for an event on the EventBus */
|
|
182
|
+
event?: string;
|
|
183
|
+
}
|
|
184
|
+
/** Execute actions in sequence, awaiting each one's completion */
|
|
185
|
+
export interface SequenceAction extends BaseAction {
|
|
186
|
+
kind: "core:sequence";
|
|
187
|
+
actions: ActionStep[];
|
|
188
|
+
}
|
|
189
|
+
/** Execute actions in parallel */
|
|
190
|
+
export interface ParallelAction extends BaseAction {
|
|
191
|
+
kind: "core:parallel";
|
|
192
|
+
actions: ActionStep[];
|
|
193
|
+
/** How to determine completion: "all" waits for all, "any" completes when first finishes */
|
|
194
|
+
waitFor?: "all" | "any";
|
|
195
|
+
}
|
|
196
|
+
/** Tour step with route + action mapping */
|
|
197
|
+
export interface TourStep {
|
|
198
|
+
id: string;
|
|
199
|
+
action: ActionStep;
|
|
200
|
+
route?: string;
|
|
201
|
+
onAction?: Record<string, string | "end">;
|
|
202
|
+
}
|
|
203
|
+
/** Orchestrate sequential steps with cross-page state */
|
|
204
|
+
export interface TourAction extends BaseAction {
|
|
205
|
+
kind: "core:tour";
|
|
206
|
+
tourId: string;
|
|
207
|
+
steps: TourStep[];
|
|
208
|
+
startStep?: string;
|
|
209
|
+
autoStart?: boolean;
|
|
210
|
+
}
|
|
211
|
+
/** Union of all action step types */
|
|
212
|
+
export type ActionStep = HighlightAction | PulseAction | BadgeAction | TooltipAction | ModalAction | InsertHtmlAction | SetTextAction | SetAttrAction | AddClassAction | RemoveClassAction | SetStyleAction | MountWidgetAction | ScrollToAction | NavigateAction | WaitAction | SequenceAction | ParallelAction | TourAction;
|
|
213
|
+
/** Extract action kind literal types */
|
|
214
|
+
export type ActionKind = ActionStep["kind"];
|
|
215
|
+
/** State of an action */
|
|
216
|
+
export type ActionState = "pending" | "applied" | "reverted" | "failed";
|
|
217
|
+
/** Handle returned when an action is applied */
|
|
218
|
+
export interface ActionHandle {
|
|
219
|
+
/** Unique ID for this action instance */
|
|
220
|
+
id: string;
|
|
221
|
+
/** The action that was applied */
|
|
222
|
+
action: ActionStep;
|
|
223
|
+
/** Revert the action */
|
|
224
|
+
revert: () => Promise<void>;
|
|
225
|
+
/** Check if action is still applied */
|
|
226
|
+
isApplied: () => boolean;
|
|
227
|
+
/** Update action in place (if supported) */
|
|
228
|
+
update: (changes: Partial<ActionStep>) => Promise<void>;
|
|
229
|
+
/** Get current state */
|
|
230
|
+
getState: () => ActionState;
|
|
231
|
+
}
|
|
232
|
+
/** Handle for batch action operations */
|
|
233
|
+
export interface BatchActionHandle {
|
|
234
|
+
/** Unique ID for this batch */
|
|
235
|
+
id: string;
|
|
236
|
+
/** Individual action handles */
|
|
237
|
+
handles: ActionHandle[];
|
|
238
|
+
/** Revert all actions in the batch */
|
|
239
|
+
revertAll: () => Promise<void>;
|
|
240
|
+
/** Check if all actions are still applied */
|
|
241
|
+
isApplied: () => boolean;
|
|
242
|
+
}
|
|
243
|
+
/** Tracked active action */
|
|
244
|
+
export interface ActiveAction {
|
|
245
|
+
/** Action ID */
|
|
246
|
+
id: string;
|
|
247
|
+
/** The action definition */
|
|
248
|
+
action: ActionStep;
|
|
249
|
+
/** Adaptive that owns this action */
|
|
250
|
+
adaptiveId?: string;
|
|
251
|
+
/** When the action was applied */
|
|
252
|
+
appliedTs: number;
|
|
253
|
+
/** Current state */
|
|
254
|
+
state: ActionState;
|
|
255
|
+
}
|
|
256
|
+
/** Validation error */
|
|
257
|
+
export interface ValidationError {
|
|
258
|
+
code: string;
|
|
259
|
+
message: string;
|
|
260
|
+
field?: string;
|
|
261
|
+
}
|
|
262
|
+
/** Validation warning */
|
|
263
|
+
export interface ValidationWarning {
|
|
264
|
+
code: string;
|
|
265
|
+
message: string;
|
|
266
|
+
suggestion?: string;
|
|
267
|
+
}
|
|
268
|
+
/** Result of validating an action */
|
|
269
|
+
export interface ValidationResult {
|
|
270
|
+
valid: boolean;
|
|
271
|
+
errors: ValidationError[];
|
|
272
|
+
warnings: ValidationWarning[];
|
|
273
|
+
}
|
|
274
|
+
/** Cleanup function returned by executors */
|
|
275
|
+
export type ExecutorCleanup = () => void | Promise<void>;
|
|
276
|
+
/** Update function for actions that support in-place updates */
|
|
277
|
+
export type ExecutorUpdate = (changes: Partial<ActionStep>) => void | Promise<void>;
|
|
278
|
+
/** Result returned by action executors */
|
|
279
|
+
export interface ExecutorResult {
|
|
280
|
+
/** Function to clean up/revert the action */
|
|
281
|
+
cleanup: ExecutorCleanup;
|
|
282
|
+
/** Optional function to update the action in place */
|
|
283
|
+
updateFn?: ExecutorUpdate;
|
|
284
|
+
}
|
|
285
|
+
/** Executor function signature */
|
|
286
|
+
export type ActionExecutor<T extends ActionStep = ActionStep> = (action: T, context: ExecutorContext) => Promise<ExecutorResult>;
|
|
287
|
+
/** Context passed to executors */
|
|
288
|
+
export interface ExecutorContext {
|
|
289
|
+
/** Overlay root element for rendering */
|
|
290
|
+
overlayRoot: HTMLElement;
|
|
291
|
+
/** Resolve an anchor ID to an element */
|
|
292
|
+
resolveAnchor: (anchorId: string) => HTMLElement | null;
|
|
293
|
+
/** Generate unique IDs */
|
|
294
|
+
generateId: () => string;
|
|
295
|
+
/** Publish events to EventBus */
|
|
296
|
+
publishEvent: (name: string, props?: Record<string, unknown>) => void;
|
|
297
|
+
/** Get the current adaptive ID (if any) */
|
|
298
|
+
adaptiveId?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Execute a nested action (for composite executors like tours).
|
|
301
|
+
* Returns a handle that can be used to revert the action.
|
|
302
|
+
*/
|
|
303
|
+
applyAction?: (action: ActionStep) => Promise<ActionHandle>;
|
|
304
|
+
/**
|
|
305
|
+
* Subscribe to events (for composite executors).
|
|
306
|
+
* Returns an unsubscribe function.
|
|
307
|
+
*/
|
|
308
|
+
subscribeEvent?: (name: string, callback: (props?: Record<string, unknown>) => void) => () => void;
|
|
309
|
+
}
|
|
310
|
+
/** Executor registry interface (subset needed by ActionEngine) */
|
|
311
|
+
export interface ActionEngineExecutorRegistry {
|
|
312
|
+
get: (kind: string) => ActionExecutor<ActionStep> | undefined;
|
|
313
|
+
has: (kind: string) => boolean;
|
|
314
|
+
}
|
|
315
|
+
/** Options for creating an ActionEngine */
|
|
316
|
+
export interface ActionEngineOptions {
|
|
317
|
+
/** Overlay root element */
|
|
318
|
+
overlayRoot: HTMLElement;
|
|
319
|
+
/** Event bus for publishing and subscribing to action events */
|
|
320
|
+
eventBus?: {
|
|
321
|
+
publish: (name: string, props?: Record<string, unknown>) => void;
|
|
322
|
+
subscribe: (filter: {
|
|
323
|
+
names?: string[];
|
|
324
|
+
patterns?: string[];
|
|
325
|
+
}, callback: (event: {
|
|
326
|
+
name: string;
|
|
327
|
+
props?: Record<string, unknown>;
|
|
328
|
+
}) => void) => () => void;
|
|
329
|
+
};
|
|
330
|
+
/** Surfaces provider for mountWidget actions */
|
|
331
|
+
surfaces?: {
|
|
332
|
+
mount: (slot: SurfaceSlot, content: RenderableContent, opts?: MountOptions) => MountHandle;
|
|
333
|
+
};
|
|
334
|
+
/** Function to resolve anchor IDs to elements */
|
|
335
|
+
anchorResolver: (anchorId: string) => HTMLElement | null;
|
|
336
|
+
/** Current adaptive ID for attribution */
|
|
337
|
+
adaptiveId?: string;
|
|
338
|
+
/** Optional executor registry (uses default singleton if not provided) */
|
|
339
|
+
executorRegistry?: ActionEngineExecutorRegistry;
|
|
340
|
+
}
|
|
341
|
+
/** The ActionEngine interface */
|
|
342
|
+
export interface ActionEngine {
|
|
343
|
+
/** Apply a single action */
|
|
344
|
+
apply: (action: ActionStep) => Promise<ActionHandle>;
|
|
345
|
+
/** Apply multiple actions atomically */
|
|
346
|
+
applyBatch: (actions: ActionStep[]) => Promise<BatchActionHandle>;
|
|
347
|
+
/** Validate an action before applying */
|
|
348
|
+
validate: (action: ActionStep) => ValidationResult;
|
|
349
|
+
/** Get all currently active actions */
|
|
350
|
+
getActive: () => ActiveAction[];
|
|
351
|
+
/** Clean up all active actions and resources */
|
|
352
|
+
destroy: () => void;
|
|
353
|
+
}
|
|
354
|
+
/** Renderable content types for surfaces */
|
|
355
|
+
export type RenderableContent = {
|
|
356
|
+
type: "react";
|
|
357
|
+
component: unknown;
|
|
358
|
+
props?: Record<string, unknown>;
|
|
359
|
+
} | {
|
|
360
|
+
type: "html";
|
|
361
|
+
content: string;
|
|
362
|
+
} | {
|
|
363
|
+
type: "widget";
|
|
364
|
+
widgetId: string;
|
|
365
|
+
config?: Record<string, unknown>;
|
|
366
|
+
} | {
|
|
367
|
+
type: "custom";
|
|
368
|
+
mount: (container: HTMLElement) => () => void;
|
|
369
|
+
};
|
|
370
|
+
/** Mount options for surfaces */
|
|
371
|
+
export interface MountOptions {
|
|
372
|
+
priority?: number;
|
|
373
|
+
exclusive?: boolean;
|
|
374
|
+
animation?: "fade" | "slide" | "scale" | "none";
|
|
375
|
+
position?: {
|
|
376
|
+
placement: Placement | "auto";
|
|
377
|
+
offset?: {
|
|
378
|
+
x: number;
|
|
379
|
+
y: number;
|
|
380
|
+
};
|
|
381
|
+
flip?: boolean;
|
|
382
|
+
shift?: boolean;
|
|
383
|
+
};
|
|
384
|
+
constraints?: {
|
|
385
|
+
maxWidth?: string;
|
|
386
|
+
maxHeight?: string;
|
|
387
|
+
minWidth?: string;
|
|
388
|
+
minHeight?: string;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
/** Mount handle returned by Surfaces */
|
|
392
|
+
export interface MountHandle {
|
|
393
|
+
update: (content: RenderableContent) => void;
|
|
394
|
+
setOptions: (opts: Partial<MountOptions>) => void;
|
|
395
|
+
unmount: () => void;
|
|
396
|
+
isMounted: () => boolean;
|
|
397
|
+
getContainer: () => HTMLElement | null;
|
|
398
|
+
}
|
|
399
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actions/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Validation
|
|
3
|
+
*
|
|
4
|
+
* Validates action steps before execution.
|
|
5
|
+
*/
|
|
6
|
+
import type { ActionStep, ValidationResult } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* Validate an action step.
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateAction(action: ActionStep): ValidationResult;
|
|
11
|
+
/**
|
|
12
|
+
* Validate a batch of actions.
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateActions(actions: ActionStep[]): ValidationResult;
|