@almadar/ui 1.0.30 → 1.0.32
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/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
- package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
- package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
- package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
- package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
- package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
- package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
- package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
- package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
- package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
- package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
- package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
- package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
- package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
- package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
- package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
- package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
- package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
- package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
- package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
- package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
- package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
- package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
- package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
- package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
- package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
- package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
- package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
- package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
- package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
- package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
- package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
- package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
- package/dist/{ThemeContext-lI5bo85E.d.ts → ThemeContext-D9xUORq5.d.ts} +2 -0
- package/dist/chunk-45CTDYBT.js +174 -0
- package/dist/{chunk-4UFNDD6B.js → chunk-BTXQJGFB.js} +41 -8
- package/dist/chunk-N6DJVKZ6.js +747 -0
- package/dist/chunk-PE2H3NAW.js +383 -0
- package/dist/{chunk-7IYF4RUG.js → chunk-RFD6G3ZR.js} +23 -68
- package/dist/chunk-UCXZS2YJ.js +9501 -0
- package/dist/chunk-YXZM3WCF.js +222 -0
- package/dist/cn-BoBXsxuX.d.ts +194 -0
- package/dist/components/index.css +1154 -0
- package/dist/components/index.d.ts +1082 -673
- package/dist/components/index.js +8935 -16486
- package/dist/components/organisms/game/three/index.css +315 -0
- package/dist/components/organisms/game/three/index.d.ts +1162 -0
- package/dist/components/organisms/game/three/index.js +2378 -0
- package/dist/context/index.d.ts +4 -4
- package/dist/context/index.js +2 -3
- package/dist/{event-bus-types-8-cjyMxw.d.ts → event-bus-types-CjJduURa.d.ts} +8 -0
- package/dist/hooks/index.d.ts +120 -106
- package/dist/hooks/index.js +4 -3
- package/dist/isometric-ynNHVPZx.d.ts +111 -0
- package/dist/lib/index.d.ts +117 -153
- package/dist/lib/index.js +4 -683
- package/dist/providers/index.css +1154 -0
- package/dist/providers/index.d.ts +84 -4
- package/dist/providers/index.js +165 -8
- package/dist/{useUISlots-mnggE9X9.d.ts → useUISlots-D0mttBSP.d.ts} +0 -20
- package/package.json +32 -11
- package/dist/chunk-HY5EFCOK.js +0 -419
- package/dist/chunk-W5YTXLXL.js +0 -29
- package/dist/cn-mqkxz8Sd.d.ts +0 -9
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { createContext, useContext, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// providers/EventBusProvider.tsx
|
|
5
|
+
function setGlobalEventBus(bus) {
|
|
6
|
+
if (typeof window !== "undefined") {
|
|
7
|
+
window.__kflowEventBus = bus;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function getGlobalEventBus() {
|
|
11
|
+
if (typeof window !== "undefined") {
|
|
12
|
+
return window.__kflowEventBus ?? null;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
var fallbackListeners = /* @__PURE__ */ new Map();
|
|
17
|
+
var fallbackAnyListeners = /* @__PURE__ */ new Set();
|
|
18
|
+
var fallbackEventBus = {
|
|
19
|
+
emit: (type, payload) => {
|
|
20
|
+
const event = {
|
|
21
|
+
type,
|
|
22
|
+
payload,
|
|
23
|
+
timestamp: Date.now()
|
|
24
|
+
};
|
|
25
|
+
const handlers = fallbackListeners.get(type);
|
|
26
|
+
if (handlers) {
|
|
27
|
+
handlers.forEach((handler) => {
|
|
28
|
+
try {
|
|
29
|
+
handler(event);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(`[EventBus] Error in listener for '${type}':`, error);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
fallbackAnyListeners.forEach((handler) => {
|
|
36
|
+
try {
|
|
37
|
+
handler(event);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
on: (type, listener) => {
|
|
44
|
+
if (!fallbackListeners.has(type)) {
|
|
45
|
+
fallbackListeners.set(type, /* @__PURE__ */ new Set());
|
|
46
|
+
}
|
|
47
|
+
fallbackListeners.get(type).add(listener);
|
|
48
|
+
return () => {
|
|
49
|
+
const handlers = fallbackListeners.get(type);
|
|
50
|
+
if (handlers) {
|
|
51
|
+
handlers.delete(listener);
|
|
52
|
+
if (handlers.size === 0) {
|
|
53
|
+
fallbackListeners.delete(type);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
once: (type, listener) => {
|
|
59
|
+
const wrappedListener = (event) => {
|
|
60
|
+
fallbackListeners.get(type)?.delete(wrappedListener);
|
|
61
|
+
listener(event);
|
|
62
|
+
};
|
|
63
|
+
return fallbackEventBus.on(type, wrappedListener);
|
|
64
|
+
},
|
|
65
|
+
hasListeners: (type) => {
|
|
66
|
+
const handlers = fallbackListeners.get(type);
|
|
67
|
+
return handlers !== void 0 && handlers.size > 0;
|
|
68
|
+
},
|
|
69
|
+
onAny: (listener) => {
|
|
70
|
+
fallbackAnyListeners.add(listener);
|
|
71
|
+
return () => {
|
|
72
|
+
fallbackAnyListeners.delete(listener);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
function useEventBus() {
|
|
77
|
+
const context = useContext(EventBusContext);
|
|
78
|
+
return context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
79
|
+
}
|
|
80
|
+
function useEventListener(event, handler) {
|
|
81
|
+
const eventBus = useEventBus();
|
|
82
|
+
const handlerRef = useRef(handler);
|
|
83
|
+
handlerRef.current = handler;
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const wrappedHandler = (evt) => {
|
|
86
|
+
handlerRef.current(evt);
|
|
87
|
+
};
|
|
88
|
+
const unsub = eventBus.on(event, wrappedHandler);
|
|
89
|
+
return () => {
|
|
90
|
+
if (typeof unsub === "function") unsub();
|
|
91
|
+
};
|
|
92
|
+
}, [event, eventBus]);
|
|
93
|
+
}
|
|
94
|
+
function useEmitEvent() {
|
|
95
|
+
const eventBus = useEventBus();
|
|
96
|
+
return useCallback(
|
|
97
|
+
(type, payload) => {
|
|
98
|
+
eventBus.emit(type, payload);
|
|
99
|
+
},
|
|
100
|
+
[eventBus]
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
var EventBusContext = createContext(null);
|
|
104
|
+
function EventBusProvider({ children, debug = false }) {
|
|
105
|
+
const listenersRef = useRef(/* @__PURE__ */ new Map());
|
|
106
|
+
const anyListenersRef = useRef(/* @__PURE__ */ new Set());
|
|
107
|
+
const deprecationWarningShown = useRef(false);
|
|
108
|
+
const getSelectedEntity = useCallback(() => {
|
|
109
|
+
if (!deprecationWarningShown.current) {
|
|
110
|
+
console.warn(
|
|
111
|
+
"[EventBus] getSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
|
|
112
|
+
);
|
|
113
|
+
deprecationWarningShown.current = true;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}, []);
|
|
117
|
+
const clearSelectedEntity = useCallback(() => {
|
|
118
|
+
if (!deprecationWarningShown.current) {
|
|
119
|
+
console.warn(
|
|
120
|
+
"[EventBus] clearSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
|
|
121
|
+
);
|
|
122
|
+
deprecationWarningShown.current = true;
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
const emit = useCallback((type, payload) => {
|
|
126
|
+
const event = {
|
|
127
|
+
type,
|
|
128
|
+
payload,
|
|
129
|
+
timestamp: Date.now()
|
|
130
|
+
};
|
|
131
|
+
const listeners = listenersRef.current.get(type);
|
|
132
|
+
const listenerCount = listeners?.size ?? 0;
|
|
133
|
+
if (debug) {
|
|
134
|
+
if (listenerCount > 0) {
|
|
135
|
+
console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
|
|
136
|
+
} else {
|
|
137
|
+
console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (listeners) {
|
|
141
|
+
const listenersCopy = Array.from(listeners);
|
|
142
|
+
for (const listener of listenersCopy) {
|
|
143
|
+
try {
|
|
144
|
+
listener(event);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error(`[EventBus] Error in listener for '${type}':`, error);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const anyListeners = Array.from(anyListenersRef.current);
|
|
151
|
+
for (const listener of anyListeners) {
|
|
152
|
+
try {
|
|
153
|
+
listener(event);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, [debug]);
|
|
159
|
+
const on = useCallback((type, listener) => {
|
|
160
|
+
if (!listenersRef.current.has(type)) {
|
|
161
|
+
listenersRef.current.set(type, /* @__PURE__ */ new Set());
|
|
162
|
+
}
|
|
163
|
+
const listeners = listenersRef.current.get(type);
|
|
164
|
+
listeners.add(listener);
|
|
165
|
+
if (debug) {
|
|
166
|
+
console.log(`[EventBus] Subscribed to '${type}', total: ${listeners.size}`);
|
|
167
|
+
}
|
|
168
|
+
return () => {
|
|
169
|
+
listeners.delete(listener);
|
|
170
|
+
if (debug) {
|
|
171
|
+
console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners.size}`);
|
|
172
|
+
}
|
|
173
|
+
if (listeners.size === 0) {
|
|
174
|
+
listenersRef.current.delete(type);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}, [debug]);
|
|
178
|
+
const once = useCallback((type, listener) => {
|
|
179
|
+
const wrappedListener = (event) => {
|
|
180
|
+
listenersRef.current.get(type)?.delete(wrappedListener);
|
|
181
|
+
listener(event);
|
|
182
|
+
};
|
|
183
|
+
return on(type, wrappedListener);
|
|
184
|
+
}, [on]);
|
|
185
|
+
const hasListeners = useCallback((type) => {
|
|
186
|
+
const listeners = listenersRef.current.get(type);
|
|
187
|
+
return listeners !== void 0 && listeners.size > 0;
|
|
188
|
+
}, []);
|
|
189
|
+
const onAny = useCallback((listener) => {
|
|
190
|
+
anyListenersRef.current.add(listener);
|
|
191
|
+
if (debug) {
|
|
192
|
+
console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
|
|
193
|
+
}
|
|
194
|
+
return () => {
|
|
195
|
+
anyListenersRef.current.delete(listener);
|
|
196
|
+
if (debug) {
|
|
197
|
+
console.log(`[EventBus] onAny unsubscribed, remaining: ${anyListenersRef.current.size}`);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}, [debug]);
|
|
201
|
+
const contextValue = useMemo(
|
|
202
|
+
() => ({
|
|
203
|
+
emit,
|
|
204
|
+
on,
|
|
205
|
+
once,
|
|
206
|
+
hasListeners,
|
|
207
|
+
onAny,
|
|
208
|
+
getSelectedEntity,
|
|
209
|
+
clearSelectedEntity
|
|
210
|
+
}),
|
|
211
|
+
[emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
|
|
212
|
+
);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
setGlobalEventBus(contextValue);
|
|
215
|
+
return () => {
|
|
216
|
+
setGlobalEventBus(null);
|
|
217
|
+
};
|
|
218
|
+
}, [contextValue]);
|
|
219
|
+
return /* @__PURE__ */ jsx(EventBusContext.Provider, { value: contextValue, children });
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export { EventBusContext, EventBusProvider, useEmitEvent, useEventBus, useEventListener };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Orbital State Machine Visualizer
|
|
5
|
+
*
|
|
6
|
+
* Renders SVG diagrams from Orbital schemas and Trait definitions.
|
|
7
|
+
* Can be used in documentation, IDE previews, and other tools.
|
|
8
|
+
*/
|
|
9
|
+
interface VisualizerConfig {
|
|
10
|
+
nodeRadius: number;
|
|
11
|
+
nodeSpacing: number;
|
|
12
|
+
initialIndicatorOffset: number;
|
|
13
|
+
arrowSize: number;
|
|
14
|
+
colors: {
|
|
15
|
+
background: string;
|
|
16
|
+
node: string;
|
|
17
|
+
nodeBorder: string;
|
|
18
|
+
nodeText: string;
|
|
19
|
+
initialNode: string;
|
|
20
|
+
finalNode: string;
|
|
21
|
+
arrow: string;
|
|
22
|
+
arrowText: string;
|
|
23
|
+
effectText: string;
|
|
24
|
+
guardText: string;
|
|
25
|
+
initial: string;
|
|
26
|
+
};
|
|
27
|
+
fonts: {
|
|
28
|
+
node: string;
|
|
29
|
+
event: string;
|
|
30
|
+
effect: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
interface StateDefinition {
|
|
34
|
+
name: string;
|
|
35
|
+
isInitial?: boolean;
|
|
36
|
+
isFinal?: boolean;
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
39
|
+
interface TransitionDefinition {
|
|
40
|
+
from: string;
|
|
41
|
+
to: string;
|
|
42
|
+
event: string;
|
|
43
|
+
guard?: unknown;
|
|
44
|
+
effects?: unknown[];
|
|
45
|
+
}
|
|
46
|
+
interface StateMachineDefinition {
|
|
47
|
+
states: StateDefinition[];
|
|
48
|
+
transitions: TransitionDefinition[];
|
|
49
|
+
}
|
|
50
|
+
interface EntityDefinition {
|
|
51
|
+
name: string;
|
|
52
|
+
fields?: (string | {
|
|
53
|
+
name: string;
|
|
54
|
+
})[];
|
|
55
|
+
}
|
|
56
|
+
interface RenderOptions {
|
|
57
|
+
title?: string;
|
|
58
|
+
entity?: EntityDefinition;
|
|
59
|
+
}
|
|
60
|
+
/** Position data for a state node in DOM layout */
|
|
61
|
+
interface DomStateNode {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
radius: number;
|
|
67
|
+
isInitial: boolean;
|
|
68
|
+
isFinal: boolean;
|
|
69
|
+
description?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Position data for a transition arrow */
|
|
72
|
+
interface DomTransitionPath {
|
|
73
|
+
id: string;
|
|
74
|
+
from: string;
|
|
75
|
+
to: string;
|
|
76
|
+
/** SVG path data for the curved arrow */
|
|
77
|
+
pathData: string;
|
|
78
|
+
/** Midpoint for label positioning */
|
|
79
|
+
labelX: number;
|
|
80
|
+
labelY: number;
|
|
81
|
+
}
|
|
82
|
+
/** Position data for a transition label with guard/effect details */
|
|
83
|
+
interface DomTransitionLabel {
|
|
84
|
+
id: string;
|
|
85
|
+
from: string;
|
|
86
|
+
to: string;
|
|
87
|
+
event: string;
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
/** Human-readable guard text (e.g., "if amount > 100") */
|
|
91
|
+
guardText?: string;
|
|
92
|
+
/** Human-readable effect texts */
|
|
93
|
+
effectTexts: string[];
|
|
94
|
+
/** Whether this transition has details to show in tooltip */
|
|
95
|
+
hasDetails: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** Entity input box data */
|
|
98
|
+
interface DomEntityBox {
|
|
99
|
+
name: string;
|
|
100
|
+
fields: string[];
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
}
|
|
106
|
+
/** Output effects box data */
|
|
107
|
+
interface DomOutputsBox {
|
|
108
|
+
outputs: string[];
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
}
|
|
114
|
+
/** Complete DOM layout data for rendering */
|
|
115
|
+
interface DomLayoutData {
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
title?: string;
|
|
119
|
+
states: DomStateNode[];
|
|
120
|
+
paths: DomTransitionPath[];
|
|
121
|
+
labels: DomTransitionLabel[];
|
|
122
|
+
entity?: DomEntityBox;
|
|
123
|
+
outputs?: DomOutputsBox;
|
|
124
|
+
config: VisualizerConfig;
|
|
125
|
+
}
|
|
126
|
+
declare const DEFAULT_CONFIG: VisualizerConfig;
|
|
127
|
+
declare function formatGuard(guard: unknown): string;
|
|
128
|
+
declare function getEffectSummary(effects: unknown[]): string;
|
|
129
|
+
declare function extractOutputsFromTransitions(transitions: TransitionDefinition[]): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Render a state machine to an SVG string.
|
|
132
|
+
* Works in both browser and Node.js environments.
|
|
133
|
+
*/
|
|
134
|
+
declare function renderStateMachineToSvg(stateMachine: StateMachineDefinition, options?: RenderOptions, config?: VisualizerConfig): string;
|
|
135
|
+
/**
|
|
136
|
+
* Extract state machine from various data formats (Trait, Orbital, or raw)
|
|
137
|
+
*/
|
|
138
|
+
declare function extractStateMachine(data: unknown): StateMachineDefinition | null;
|
|
139
|
+
/**
|
|
140
|
+
* Render a state machine to DOM layout data.
|
|
141
|
+
* This is used by the DOM-based visualizer component for hybrid SVG/DOM rendering.
|
|
142
|
+
* Unlike renderStateMachineToSvg, this returns structured data instead of an SVG string.
|
|
143
|
+
*/
|
|
144
|
+
declare function renderStateMachineToDomData(stateMachine: StateMachineDefinition, options?: RenderOptions, config?: VisualizerConfig): DomLayoutData;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Content Segment Parsing Utilities
|
|
148
|
+
*
|
|
149
|
+
* Parses rich content with code blocks and quiz tags into structured
|
|
150
|
+
* segments for rendering. Detects orbital schemas in JSON code blocks
|
|
151
|
+
* and marks them for JazariStateMachine rendering.
|
|
152
|
+
*/
|
|
153
|
+
/** Segment types for content rendering */
|
|
154
|
+
type ContentSegment = {
|
|
155
|
+
type: 'markdown';
|
|
156
|
+
content: string;
|
|
157
|
+
} | {
|
|
158
|
+
type: 'code';
|
|
159
|
+
language: string;
|
|
160
|
+
content: string;
|
|
161
|
+
} | {
|
|
162
|
+
type: 'orbital';
|
|
163
|
+
language: string;
|
|
164
|
+
content: string;
|
|
165
|
+
schema: unknown;
|
|
166
|
+
} | {
|
|
167
|
+
type: 'quiz';
|
|
168
|
+
question: string;
|
|
169
|
+
answer: string;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Parse markdown content to extract code blocks.
|
|
173
|
+
*
|
|
174
|
+
* Splits markdown into segments of plain markdown and fenced code blocks.
|
|
175
|
+
* JSON/orb code blocks containing orbital schemas are tagged as 'orbital'.
|
|
176
|
+
*/
|
|
177
|
+
declare function parseMarkdownWithCodeBlocks(content: string | undefined | null): ContentSegment[];
|
|
178
|
+
/**
|
|
179
|
+
* Parse content to extract all segments including quiz tags and code blocks.
|
|
180
|
+
*
|
|
181
|
+
* Supported tags:
|
|
182
|
+
* - <question>q</question><answer>a</answer> — Quiz Q&A
|
|
183
|
+
*
|
|
184
|
+
* Also handles fenced code blocks (```language...```) with orbital detection.
|
|
185
|
+
*/
|
|
186
|
+
declare function parseContentSegments(content: string | undefined | null): ContentSegment[];
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Utility function to merge Tailwind CSS classes
|
|
190
|
+
* Combines clsx for conditional classes with tailwind-merge to handle conflicts
|
|
191
|
+
*/
|
|
192
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
193
|
+
|
|
194
|
+
export { type ContentSegment as C, DEFAULT_CONFIG as D, type EntityDefinition as E, type RenderOptions as R, type StateDefinition as S, type TransitionDefinition as T, type VisualizerConfig as V, type DomEntityBox as a, type DomLayoutData as b, type DomOutputsBox as c, type DomStateNode as d, type DomTransitionLabel as e, type DomTransitionPath as f, type StateMachineDefinition as g, cn as h, extractOutputsFromTransitions as i, extractStateMachine as j, formatGuard as k, getEffectSummary as l, parseMarkdownWithCodeBlocks as m, renderStateMachineToSvg as n, parseContentSegments as p, renderStateMachineToDomData as r };
|