@syntrologie/runtime-sdk 1.0.1-canary.3 → 2.0.0-canary.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/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 +118 -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 +250 -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/index.d.ts +18 -0
- package/dist/apps/index.js +26 -0
- package/dist/apps/index.js.map +1 -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 +46 -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 +162 -55
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +21133 -17957
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +162 -55
- 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 +13 -3
- package/schema/canvas-config.schema.json +444 -254
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surfaces Positioning
|
|
3
|
+
*
|
|
4
|
+
* Handles positioning for different slot types using CSS for static slots
|
|
5
|
+
* and Floating UI for adjacent slots.
|
|
6
|
+
*/
|
|
7
|
+
import { computePosition, autoUpdate, offset, flip, shift, } from "@floating-ui/dom";
|
|
8
|
+
import { getSlotType } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* CSS styles for static surface slots.
|
|
11
|
+
*/
|
|
12
|
+
export const STATIC_SLOT_STYLES = {
|
|
13
|
+
drawer_right: {
|
|
14
|
+
position: "fixed",
|
|
15
|
+
top: "0",
|
|
16
|
+
right: "0",
|
|
17
|
+
bottom: "0",
|
|
18
|
+
width: "360px",
|
|
19
|
+
maxWidth: "90vw",
|
|
20
|
+
},
|
|
21
|
+
drawer_left: {
|
|
22
|
+
position: "fixed",
|
|
23
|
+
top: "0",
|
|
24
|
+
left: "0",
|
|
25
|
+
bottom: "0",
|
|
26
|
+
width: "360px",
|
|
27
|
+
maxWidth: "90vw",
|
|
28
|
+
},
|
|
29
|
+
drawer_bottom: {
|
|
30
|
+
position: "fixed",
|
|
31
|
+
left: "0",
|
|
32
|
+
right: "0",
|
|
33
|
+
bottom: "0",
|
|
34
|
+
maxHeight: "50vh",
|
|
35
|
+
},
|
|
36
|
+
overlay_center: {
|
|
37
|
+
position: "fixed",
|
|
38
|
+
top: "50%",
|
|
39
|
+
left: "50%",
|
|
40
|
+
transform: "translate(-50%, -50%)",
|
|
41
|
+
maxWidth: "90vw",
|
|
42
|
+
maxHeight: "90vh",
|
|
43
|
+
},
|
|
44
|
+
overlay_corner_br: {
|
|
45
|
+
position: "fixed",
|
|
46
|
+
bottom: "16px",
|
|
47
|
+
right: "16px",
|
|
48
|
+
maxWidth: "400px",
|
|
49
|
+
maxHeight: "80vh",
|
|
50
|
+
},
|
|
51
|
+
overlay_corner_bl: {
|
|
52
|
+
position: "fixed",
|
|
53
|
+
bottom: "16px",
|
|
54
|
+
left: "16px",
|
|
55
|
+
maxWidth: "400px",
|
|
56
|
+
maxHeight: "80vh",
|
|
57
|
+
},
|
|
58
|
+
toast_top: {
|
|
59
|
+
position: "fixed",
|
|
60
|
+
top: "16px",
|
|
61
|
+
left: "50%",
|
|
62
|
+
transform: "translateX(-50%)",
|
|
63
|
+
maxWidth: "90vw",
|
|
64
|
+
},
|
|
65
|
+
toast_bottom: {
|
|
66
|
+
position: "fixed",
|
|
67
|
+
bottom: "16px",
|
|
68
|
+
left: "50%",
|
|
69
|
+
transform: "translateX(-50%)",
|
|
70
|
+
maxWidth: "90vw",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Animation keyframes for different animation types.
|
|
75
|
+
*/
|
|
76
|
+
export const ANIMATION_KEYFRAMES = {
|
|
77
|
+
fade: [
|
|
78
|
+
{ opacity: 0 },
|
|
79
|
+
{ opacity: 1 },
|
|
80
|
+
],
|
|
81
|
+
slide: [
|
|
82
|
+
{ opacity: 0, transform: "translateY(10px)" },
|
|
83
|
+
{ opacity: 1, transform: "translateY(0)" },
|
|
84
|
+
],
|
|
85
|
+
scale: [
|
|
86
|
+
{ opacity: 0, transform: "scale(0.95)" },
|
|
87
|
+
{ opacity: 1, transform: "scale(1)" },
|
|
88
|
+
],
|
|
89
|
+
none: [],
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Animation options.
|
|
93
|
+
*/
|
|
94
|
+
export const ANIMATION_OPTIONS = {
|
|
95
|
+
duration: 200,
|
|
96
|
+
easing: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
97
|
+
fill: "forwards",
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Apply static slot positioning to an element.
|
|
101
|
+
*/
|
|
102
|
+
export function applyStaticSlotStyles(element, slot, constraints) {
|
|
103
|
+
const styles = STATIC_SLOT_STYLES[slot];
|
|
104
|
+
Object.assign(element.style, styles);
|
|
105
|
+
// Apply constraints
|
|
106
|
+
if (constraints) {
|
|
107
|
+
if (constraints.maxWidth)
|
|
108
|
+
element.style.maxWidth = constraints.maxWidth;
|
|
109
|
+
if (constraints.maxHeight)
|
|
110
|
+
element.style.maxHeight = constraints.maxHeight;
|
|
111
|
+
if (constraints.minWidth)
|
|
112
|
+
element.style.minWidth = constraints.minWidth;
|
|
113
|
+
if (constraints.minHeight)
|
|
114
|
+
element.style.minHeight = constraints.minHeight;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Set up adjacent slot positioning using Floating UI.
|
|
119
|
+
* Returns a cleanup function.
|
|
120
|
+
*/
|
|
121
|
+
export function setupAdjacentPositioning(container, anchorEl, config) {
|
|
122
|
+
const placement = config.placement === "auto" ? "bottom" : config.placement;
|
|
123
|
+
const middleware = [
|
|
124
|
+
offset(config.offset ? { mainAxis: config.offset.y, crossAxis: config.offset.x } : 8),
|
|
125
|
+
];
|
|
126
|
+
if (config.flip !== false) {
|
|
127
|
+
middleware.push(flip());
|
|
128
|
+
}
|
|
129
|
+
if (config.shift !== false) {
|
|
130
|
+
middleware.push(shift({ padding: 8 }));
|
|
131
|
+
}
|
|
132
|
+
// Set initial position style
|
|
133
|
+
container.style.position = "absolute";
|
|
134
|
+
container.style.zIndex = "2147483646";
|
|
135
|
+
const cleanup = autoUpdate(anchorEl, container, async () => {
|
|
136
|
+
const { x, y, strategy } = await computePosition(anchorEl, container, {
|
|
137
|
+
placement,
|
|
138
|
+
middleware,
|
|
139
|
+
});
|
|
140
|
+
Object.assign(container.style, {
|
|
141
|
+
position: strategy,
|
|
142
|
+
left: `${x}px`,
|
|
143
|
+
top: `${y}px`,
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
return cleanup;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Set up inline slot positioning.
|
|
150
|
+
* Inline slots render content inside the anchor element.
|
|
151
|
+
*/
|
|
152
|
+
export function setupInlinePositioning(container, anchorEl, position = "append") {
|
|
153
|
+
// Reset container positioning (inline is flow-based)
|
|
154
|
+
container.style.position = "relative";
|
|
155
|
+
container.style.display = "inline-block";
|
|
156
|
+
if (position === "prepend") {
|
|
157
|
+
anchorEl.insertBefore(container, anchorEl.firstChild);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
anchorEl.appendChild(container);
|
|
161
|
+
}
|
|
162
|
+
return () => {
|
|
163
|
+
container.remove();
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Play enter animation on an element.
|
|
168
|
+
*/
|
|
169
|
+
export function playEnterAnimation(element, animationType) {
|
|
170
|
+
if (animationType === "none" || ANIMATION_KEYFRAMES[animationType].length === 0) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return element.animate(ANIMATION_KEYFRAMES[animationType], ANIMATION_OPTIONS);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Play exit animation on an element.
|
|
177
|
+
* Returns a promise that resolves when the animation completes.
|
|
178
|
+
*/
|
|
179
|
+
export function playExitAnimation(element, animationType) {
|
|
180
|
+
if (animationType === "none" || ANIMATION_KEYFRAMES[animationType].length === 0) {
|
|
181
|
+
return Promise.resolve();
|
|
182
|
+
}
|
|
183
|
+
const keyframes = [...ANIMATION_KEYFRAMES[animationType]].reverse();
|
|
184
|
+
const animation = element.animate(keyframes, ANIMATION_OPTIONS);
|
|
185
|
+
return new Promise((resolve) => {
|
|
186
|
+
animation.onfinish = () => resolve();
|
|
187
|
+
animation.oncancel = () => resolve();
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Create and style a surface container element.
|
|
192
|
+
*/
|
|
193
|
+
export function createSurfaceContainer(slot, id) {
|
|
194
|
+
const container = document.createElement("div");
|
|
195
|
+
container.setAttribute("data-syntro-surface", slot);
|
|
196
|
+
container.setAttribute("data-syntro-mount-id", id);
|
|
197
|
+
container.className = "syntro-surface";
|
|
198
|
+
// Base styles for all surfaces
|
|
199
|
+
Object.assign(container.style, {
|
|
200
|
+
pointerEvents: "auto",
|
|
201
|
+
boxSizing: "border-box",
|
|
202
|
+
overflow: "auto",
|
|
203
|
+
});
|
|
204
|
+
return container;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get the z-index for a slot type.
|
|
208
|
+
*/
|
|
209
|
+
export function getSlotZIndex(slot) {
|
|
210
|
+
const type = getSlotType(slot);
|
|
211
|
+
switch (type) {
|
|
212
|
+
case "static":
|
|
213
|
+
// Drawers and overlays
|
|
214
|
+
if (slot.startsWith("drawer"))
|
|
215
|
+
return 2147483640;
|
|
216
|
+
if (slot.startsWith("overlay"))
|
|
217
|
+
return 2147483642;
|
|
218
|
+
if (slot.startsWith("toast"))
|
|
219
|
+
return 2147483644;
|
|
220
|
+
return 2147483640;
|
|
221
|
+
case "inline":
|
|
222
|
+
// Inline content doesn't need high z-index
|
|
223
|
+
return 1;
|
|
224
|
+
case "adjacent":
|
|
225
|
+
// Adjacent content needs to be above page content
|
|
226
|
+
return 2147483638;
|
|
227
|
+
default:
|
|
228
|
+
return 2147483640;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=positioning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positioning.js","sourceRoot":"","sources":["../../src/surfaces/positioning.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,eAAe,EACf,UAAU,EACV,MAAM,EACN,IAAI,EACJ,KAAK,GAEN,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsD;IACnF,YAAY,EAAE;QACZ,QAAQ,EAAE,OAAO;QACjB,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,MAAM;KACjB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,OAAO;QACjB,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,MAAM;KACjB;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EA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AAE,IAAI,CAAC,CAAC;IACpD,SAAS,CAAC,YAAY,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IACnD,SAAS,CAAC,SAAS,GAAG,gBAAgB,CAAC;IAEvC,+BAA+B;IAC/B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE;QAC7B,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,YAAY;QACvB,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO,UAAU,CAAC;YACjD,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;gBAAE,OAAO,UAAU,CAAC;YAClD,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBAAE,OAAO,UAAU,CAAC;YAChD,OAAO,UAAU,CAAC;QACpB,KAAK,QAAQ;YACX,2CAA2C;YAC3C,OAAO,CAAC,CAAC;QACX,KAAK,UAAU;YACb,kDAAkD;YAClD,OAAO,UAAU,CAAC;QACpB;YACE,OAAO,UAAU,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surfaces Types
|
|
3
|
+
*
|
|
4
|
+
* Defines types for the managed surface system that renders UI into named slots.
|
|
5
|
+
* Surfaces handles layout, stacking, animations, and priority-based arbitration.
|
|
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
|
+
/** React component content */
|
|
17
|
+
export interface ReactContent {
|
|
18
|
+
type: "react";
|
|
19
|
+
component: unknown;
|
|
20
|
+
props?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/** HTML string content */
|
|
23
|
+
export interface HtmlContent {
|
|
24
|
+
type: "html";
|
|
25
|
+
content: string;
|
|
26
|
+
}
|
|
27
|
+
/** Widget reference content */
|
|
28
|
+
export interface WidgetContent {
|
|
29
|
+
type: "widget";
|
|
30
|
+
widgetId: string;
|
|
31
|
+
config?: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/** Custom mount function content */
|
|
34
|
+
export interface CustomContent {
|
|
35
|
+
type: "custom";
|
|
36
|
+
mount: (container: HTMLElement) => () => void;
|
|
37
|
+
}
|
|
38
|
+
/** Union of all renderable content types */
|
|
39
|
+
export type RenderableContent = ReactContent | HtmlContent | WidgetContent | CustomContent;
|
|
40
|
+
/** Position configuration for adjacent slots */
|
|
41
|
+
export interface PositionConfig {
|
|
42
|
+
placement: Placement | "auto";
|
|
43
|
+
offset?: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
};
|
|
47
|
+
flip?: boolean;
|
|
48
|
+
shift?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Size constraints for mounted content */
|
|
51
|
+
export interface MountConstraints {
|
|
52
|
+
maxWidth?: string;
|
|
53
|
+
maxHeight?: string;
|
|
54
|
+
minWidth?: string;
|
|
55
|
+
minHeight?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Animation types for enter/exit */
|
|
58
|
+
export type AnimationType = "fade" | "slide" | "scale" | "none";
|
|
59
|
+
/** Options when mounting content to a surface */
|
|
60
|
+
export interface MountOptions {
|
|
61
|
+
/** Priority for conflict resolution (higher wins) */
|
|
62
|
+
priority?: number;
|
|
63
|
+
/** Whether to unmount other content in the same slot */
|
|
64
|
+
exclusive?: boolean;
|
|
65
|
+
/** Animation for enter/exit */
|
|
66
|
+
animation?: AnimationType;
|
|
67
|
+
/** Position configuration for adjacent slots */
|
|
68
|
+
position?: PositionConfig;
|
|
69
|
+
/** Size constraints */
|
|
70
|
+
constraints?: MountConstraints;
|
|
71
|
+
/** ID of the adaptive mounting this content */
|
|
72
|
+
adaptiveId?: string;
|
|
73
|
+
/** Whether to auto-unmount on route change */
|
|
74
|
+
autoUnmountOnRouteChange?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Handle returned when content is mounted */
|
|
77
|
+
export interface MountHandle {
|
|
78
|
+
/** Unique ID for this mount */
|
|
79
|
+
id: string;
|
|
80
|
+
/** Update the content */
|
|
81
|
+
update: (content: RenderableContent) => void;
|
|
82
|
+
/** Update mount options */
|
|
83
|
+
setOptions: (opts: Partial<MountOptions>) => void;
|
|
84
|
+
/** Unmount the content */
|
|
85
|
+
unmount: () => void;
|
|
86
|
+
/** Check if still mounted */
|
|
87
|
+
isMounted: () => boolean;
|
|
88
|
+
/** Get the DOM container element */
|
|
89
|
+
getContainer: () => HTMLElement | null;
|
|
90
|
+
}
|
|
91
|
+
/** State of a surface slot */
|
|
92
|
+
export interface SurfaceState {
|
|
93
|
+
/** The slot identifier */
|
|
94
|
+
slot: SurfaceSlot;
|
|
95
|
+
/** Whether the slot is currently occupied */
|
|
96
|
+
occupied: boolean;
|
|
97
|
+
/** Priority of the current content (if occupied) */
|
|
98
|
+
currentPriority?: number;
|
|
99
|
+
/** Adaptive ID that owns current content */
|
|
100
|
+
currentAdaptiveId?: string;
|
|
101
|
+
/** Total number of mounts to this slot this session */
|
|
102
|
+
mountCount: number;
|
|
103
|
+
/** ID of the current mount (if occupied) */
|
|
104
|
+
currentMountId?: string;
|
|
105
|
+
}
|
|
106
|
+
/** Callback for surface state changes */
|
|
107
|
+
export type SurfaceChangeCallback = (state: SurfaceState) => void;
|
|
108
|
+
/** Widget registry interface (subset needed by Surfaces) */
|
|
109
|
+
export interface SurfacesWidgetRegistry {
|
|
110
|
+
has: (id: string) => boolean;
|
|
111
|
+
mount: (id: string, container: HTMLElement, config?: Record<string, unknown>) => {
|
|
112
|
+
unmount: () => void;
|
|
113
|
+
update: (config?: Record<string, unknown>) => void;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/** Options for creating a Surfaces instance */
|
|
117
|
+
export interface SurfacesOptions {
|
|
118
|
+
/** Overlay root element for rendering */
|
|
119
|
+
overlayRoot: HTMLElement;
|
|
120
|
+
/** Event bus for publishing surface events */
|
|
121
|
+
eventBus?: {
|
|
122
|
+
publish: (name: string, props?: Record<string, unknown>) => void;
|
|
123
|
+
};
|
|
124
|
+
/** Function to resolve anchor IDs to elements (for inline/adjacent slots) */
|
|
125
|
+
anchorResolver?: (anchorId: string) => HTMLElement | null;
|
|
126
|
+
/** Default animation type */
|
|
127
|
+
defaultAnimation?: AnimationType;
|
|
128
|
+
/** Widget registry for resolving widget content */
|
|
129
|
+
widgetRegistry?: SurfacesWidgetRegistry;
|
|
130
|
+
}
|
|
131
|
+
/** The Surfaces interface */
|
|
132
|
+
export interface Surfaces {
|
|
133
|
+
/** Mount content to a surface slot */
|
|
134
|
+
mount: (slot: SurfaceSlot, content: RenderableContent, opts?: MountOptions) => MountHandle;
|
|
135
|
+
/** Get the current state of a slot */
|
|
136
|
+
getState: (slot: SurfaceSlot) => SurfaceState;
|
|
137
|
+
/** Subscribe to state changes for a slot */
|
|
138
|
+
onStateChange: (slot: SurfaceSlot, fn: SurfaceChangeCallback) => () => void;
|
|
139
|
+
/** Check if content can be mounted to a slot */
|
|
140
|
+
canMount: (slot: SurfaceSlot, priority?: number) => boolean;
|
|
141
|
+
/** Clean up all mounted surfaces */
|
|
142
|
+
destroy: () => void;
|
|
143
|
+
}
|
|
144
|
+
/** Resolved internal options (with defaults applied) */
|
|
145
|
+
export interface InternalMountOptions {
|
|
146
|
+
priority: number;
|
|
147
|
+
exclusive: boolean;
|
|
148
|
+
animation: AnimationType;
|
|
149
|
+
position: PositionConfig;
|
|
150
|
+
constraints: MountConstraints;
|
|
151
|
+
adaptiveId?: string;
|
|
152
|
+
autoUnmountOnRouteChange: boolean;
|
|
153
|
+
}
|
|
154
|
+
/** Internal mount entry */
|
|
155
|
+
export interface InternalMountEntry {
|
|
156
|
+
id: string;
|
|
157
|
+
slot: SurfaceSlot;
|
|
158
|
+
content: RenderableContent;
|
|
159
|
+
options: InternalMountOptions;
|
|
160
|
+
container: HTMLElement;
|
|
161
|
+
cleanup?: () => void;
|
|
162
|
+
mountedAt: number;
|
|
163
|
+
}
|
|
164
|
+
/** Slot type classifier */
|
|
165
|
+
export declare function getSlotType(slot: SurfaceSlot): "static" | "inline" | "adjacent";
|
|
166
|
+
/** Extract anchor ID from inline/adjacent slots */
|
|
167
|
+
export declare function getSlotAnchorId(slot: SurfaceSlot): string | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surfaces Types
|
|
3
|
+
*
|
|
4
|
+
* Defines types for the managed surface system that renders UI into named slots.
|
|
5
|
+
* Surfaces handles layout, stacking, animations, and priority-based arbitration.
|
|
6
|
+
*/
|
|
7
|
+
/** Slot type classifier */
|
|
8
|
+
export function getSlotType(slot) {
|
|
9
|
+
if (slot.startsWith("inline:"))
|
|
10
|
+
return "inline";
|
|
11
|
+
if (slot.startsWith("adjacent:"))
|
|
12
|
+
return "adjacent";
|
|
13
|
+
return "static";
|
|
14
|
+
}
|
|
15
|
+
/** Extract anchor ID from inline/adjacent slots */
|
|
16
|
+
export function getSlotAnchorId(slot) {
|
|
17
|
+
if (slot.startsWith("inline:"))
|
|
18
|
+
return slot.slice(7);
|
|
19
|
+
if (slot.startsWith("adjacent:"))
|
|
20
|
+
return slot.slice(9);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/surfaces/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuPH,2BAA2B;AAC3B,MAAM,UAAU,WAAW,CACzB,IAAiB;IAEjB,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChD,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,UAAU,CAAC;IACpD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,IAAiB;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -53,6 +53,11 @@ export interface PostHogAdapterOptions {
|
|
|
53
53
|
* Used to update GrowthBook attributes with segment membership.
|
|
54
54
|
*/
|
|
55
55
|
onFeatureFlagsLoaded?: (flags: Record<string, boolean | string>) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Callback when any event is captured by PostHog.
|
|
58
|
+
* Used to feed events into the EventBus for runtime decisions.
|
|
59
|
+
*/
|
|
60
|
+
onCapture?: (eventName: string, properties?: Record<string, unknown>) => void;
|
|
56
61
|
}
|
|
57
62
|
interface CanvasAnalyticsPayload extends Properties {
|
|
58
63
|
rectangleId?: string;
|
|
@@ -65,6 +70,7 @@ export declare class PostHogAdapter implements TelemetryClient {
|
|
|
65
70
|
private readonly options;
|
|
66
71
|
private client?;
|
|
67
72
|
private featureFlagsCallback?;
|
|
73
|
+
private captureCallback?;
|
|
68
74
|
constructor(options?: PostHogAdapterOptions);
|
|
69
75
|
/**
|
|
70
76
|
* Get all feature flags from PostHog.
|
|
@@ -8,6 +8,7 @@ export class PostHogAdapter {
|
|
|
8
8
|
this.options = options;
|
|
9
9
|
this.client = options.client;
|
|
10
10
|
this.featureFlagsCallback = options.onFeatureFlagsLoaded;
|
|
11
|
+
this.captureCallback = options.onCapture;
|
|
11
12
|
if (!this.client && typeof window !== "undefined" && options.apiKey) {
|
|
12
13
|
this.client = posthog;
|
|
13
14
|
// Determine if we should enable feature flags (for segment membership)
|
|
@@ -49,6 +50,14 @@ export class PostHogAdapter {
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
}
|
|
53
|
+
// Wire up capture callback to feed events into EventBus
|
|
54
|
+
if (this.captureCallback) {
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
ph.on('eventCaptured', (eventName, properties) => {
|
|
57
|
+
var _a;
|
|
58
|
+
(_a = this.captureCallback) === null || _a === void 0 ? void 0 : _a.call(this, eventName, properties);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
52
61
|
},
|
|
53
62
|
});
|
|
54
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog.js","sourceRoot":"","sources":["../../../src/telemetry/adapters/posthog.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"posthog.js","sourceRoot":"","sources":["../../../src/telemetry/adapters/posthog.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,YAAY,CAAC;AAuEjC;;GAEG;AACH,MAAM,OAAO,cAAc;IAKzB,YAA6B,UAAiC,EAAE;;QAAnC,YAAO,GAAP,OAAO,CAA4B;QAC9D,IAAI,CAAC,MAAM,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
2
|
+
* Types-only export for app packages.
|
|
3
|
+
*
|
|
4
|
+
* This file re-exports action types without importing any runtime code,
|
|
5
|
+
* allowing app packages to import types without circular dependency issues.
|
|
6
|
+
*
|
|
7
|
+
* Apps should import from "@syntrologie/runtime-sdk/types" instead of
|
|
8
|
+
* the main entry point when they only need type definitions.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Props passed to editor panel components.
|
|
12
|
+
*/
|
|
13
|
+
export interface EditorPanelProps {
|
|
14
|
+
/** The current config for this app's portion */
|
|
15
|
+
config: Record<string, unknown>;
|
|
16
|
+
/** Callback when config changes */
|
|
17
|
+
onChange: (config: Record<string, unknown>) => void;
|
|
18
|
+
/** Editor utilities */
|
|
19
|
+
editor: {
|
|
20
|
+
/** Mark the editor as dirty (has unsaved changes) */
|
|
21
|
+
setDirty: (dirty: boolean) => void;
|
|
22
|
+
/** Navigate back to home */
|
|
23
|
+
navigateHome: () => Promise<boolean>;
|
|
24
|
+
/** Save the current config */
|
|
25
|
+
save: () => Promise<void>;
|
|
26
|
+
/** Publish the current config */
|
|
27
|
+
publish: (captureScreenshot?: boolean) => Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
/** Platform client for API calls (optional) */
|
|
30
|
+
platformClient?: unknown;
|
|
31
|
+
}
|
|
32
|
+
export type { StaticSurfaceSlot, InlineSurfaceSlot, AdjacentSurfaceSlot, SurfaceSlot, HighlightStyle, BadgePosition, TooltipContent, TooltipTrigger, InsertPosition, WidgetConfig, HighlightAction, PulseAction, BadgeAction, TooltipAction, InsertHtmlAction, SetTextAction, SetAttrAction, AddClassAction, RemoveClassAction, SetStyleAction, MountWidgetAction, ScrollToAction, NavigateAction, ActionStep, ActionKind, ActionState, ActionHandle, BatchActionHandle, ActiveAction, ValidationError, ValidationWarning, ValidationResult, ExecutorCleanup, ExecutorUpdate, ExecutorResult, ActionExecutor, ExecutorContext, } from "./actions/types";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types-only export for app packages.
|
|
3
|
+
*
|
|
4
|
+
* This file re-exports action types without importing any runtime code,
|
|
5
|
+
* allowing app packages to import types without circular dependency issues.
|
|
6
|
+
*
|
|
7
|
+
* Apps should import from "@syntrologie/runtime-sdk/types" instead of
|
|
8
|
+
* the main entry point when they only need type definitions.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types-only.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-only.js","sourceRoot":"","sources":["../src/types-only.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { ActionStep } from './actions/types';
|
|
1
2
|
/**
|
|
2
3
|
* Props passed to every tile component when mounted
|
|
3
4
|
*/
|
|
@@ -294,10 +295,9 @@ export interface TileConfig {
|
|
|
294
295
|
*/
|
|
295
296
|
activation?: import("./decisions/types").ActivationConfig;
|
|
296
297
|
}
|
|
297
|
-
import type {
|
|
298
|
+
import type { ActionStep } from "./actions/types";
|
|
298
299
|
/**
|
|
299
300
|
* Theme configuration for the SmartCanvas overlay.
|
|
300
|
-
* These values are typically set from workspace settings after style selection.
|
|
301
301
|
*/
|
|
302
302
|
export interface CanvasThemeConfig {
|
|
303
303
|
name?: string;
|
|
@@ -310,35 +310,47 @@ export interface CanvasThemeConfig {
|
|
|
310
310
|
borderRadius?: string;
|
|
311
311
|
position?: 'left' | 'right';
|
|
312
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Launcher button configuration.
|
|
315
|
+
*/
|
|
313
316
|
export interface LauncherConfig {
|
|
314
|
-
/** Label shown on the launcher button (default: "Adaptives") */
|
|
315
317
|
label?: string;
|
|
316
|
-
/** Whether to animate the launcher to draw attention */
|
|
317
318
|
animate?: boolean;
|
|
318
|
-
/** Animation style: "pulse" (default), "bounce", "glow" */
|
|
319
319
|
animationStyle?: "pulse" | "bounce" | "glow";
|
|
320
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Route filtering - control where canvas appears.
|
|
323
|
+
*/
|
|
321
324
|
export interface RoutesConfig {
|
|
322
|
-
/** Routes where the canvas should NOT appear (e.g., ["/login", "/signup"]) */
|
|
323
325
|
exclude?: string[];
|
|
324
|
-
/** If specified, canvas ONLY appears on these routes */
|
|
325
326
|
include?: string[];
|
|
326
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Canvas configuration response.
|
|
330
|
+
*
|
|
331
|
+
* This is the complete config format. Actions are the single mechanism
|
|
332
|
+
* for all interventions: DOM modifications, tooltips, highlights, modals.
|
|
333
|
+
*/
|
|
327
334
|
export interface CanvasConfigResponse {
|
|
335
|
+
/** Tiles to display in the canvas drawer */
|
|
328
336
|
tiles: TileConfig[];
|
|
337
|
+
/**
|
|
338
|
+
* Actions to execute.
|
|
339
|
+
* This is the unified intervention format. Every DOM change, tooltip,
|
|
340
|
+
* highlight, or modal is an ActionStep.
|
|
341
|
+
*/
|
|
342
|
+
actions: ActionStep[];
|
|
343
|
+
/** When the config was fetched */
|
|
329
344
|
fetchedAt: string;
|
|
345
|
+
/** Optional version string for cache invalidation */
|
|
330
346
|
configVersion?: string;
|
|
347
|
+
/** Display title for the canvas */
|
|
331
348
|
canvasTitle?: string;
|
|
332
|
-
|
|
333
|
-
/** @deprecated Use overlayRecipes instead */
|
|
334
|
-
overlayRecipe?: import('./overlays/types').CanvasRecipe;
|
|
335
|
-
/** Multiple overlay recipes (tours) */
|
|
336
|
-
overlayRecipes?: import('./overlays/types').CanvasRecipe[];
|
|
337
|
-
/** SmartCanvas theme configuration from workspace settings */
|
|
349
|
+
/** Theme configuration */
|
|
338
350
|
theme?: CanvasThemeConfig;
|
|
339
351
|
/** Launcher button configuration */
|
|
340
352
|
launcher?: LauncherConfig;
|
|
341
|
-
/** Route filtering
|
|
353
|
+
/** Route filtering */
|
|
342
354
|
routes?: RoutesConfig;
|
|
343
355
|
}
|
|
344
356
|
export type CanvasConfigFetcher = () => Promise<CanvasConfigResponse>;
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF"}
|