@almadar/ui 2.10.0 → 2.11.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/{chunk-N6DJVKZ6.js → chunk-3E73CE7J.js} +260 -1
- package/dist/{chunk-KPOLHTPA.js → chunk-HQZV4PYL.js} +2 -2
- package/dist/{chunk-7M2KEJTF.js → chunk-QAFNBUDT.js} +1 -1
- package/dist/{chunk-6D5QMEUS.js → chunk-WCTZ7WZX.js} +2 -1
- package/dist/cn-C_ATNPvi.d.ts +332 -0
- package/dist/components/index.css +88 -0
- package/dist/components/index.d.ts +22 -3
- package/dist/components/index.js +1091 -20
- package/dist/lib/index.d.ts +175 -313
- package/dist/lib/index.js +2 -263
- package/dist/providers/index.js +3 -3
- package/dist/runtime/index.js +3 -3
- package/package.json +1 -1
- package/dist/cn-BoBXsxuX.d.ts +0 -194
|
@@ -744,4 +744,263 @@ function parseContentSegments(content) {
|
|
|
744
744
|
return segments;
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
-
|
|
747
|
+
// lib/traitRegistry.ts
|
|
748
|
+
var traits = /* @__PURE__ */ new Map();
|
|
749
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
750
|
+
function notifyListeners() {
|
|
751
|
+
listeners.forEach((listener) => listener());
|
|
752
|
+
}
|
|
753
|
+
function registerTrait(info) {
|
|
754
|
+
traits.set(info.id, info);
|
|
755
|
+
notifyListeners();
|
|
756
|
+
}
|
|
757
|
+
function updateTraitState(id, newState) {
|
|
758
|
+
const trait = traits.get(id);
|
|
759
|
+
if (trait) {
|
|
760
|
+
trait.currentState = newState;
|
|
761
|
+
trait.transitionCount++;
|
|
762
|
+
notifyListeners();
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function updateGuardResult(traitId, guardName, result) {
|
|
766
|
+
const trait = traits.get(traitId);
|
|
767
|
+
if (trait) {
|
|
768
|
+
const guard = trait.guards.find((g) => g.name === guardName);
|
|
769
|
+
if (guard) {
|
|
770
|
+
guard.lastResult = result;
|
|
771
|
+
notifyListeners();
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
function unregisterTrait(id) {
|
|
776
|
+
traits.delete(id);
|
|
777
|
+
notifyListeners();
|
|
778
|
+
}
|
|
779
|
+
function getAllTraits() {
|
|
780
|
+
return Array.from(traits.values());
|
|
781
|
+
}
|
|
782
|
+
function getTrait(id) {
|
|
783
|
+
return traits.get(id);
|
|
784
|
+
}
|
|
785
|
+
function subscribeToTraitChanges(listener) {
|
|
786
|
+
listeners.add(listener);
|
|
787
|
+
return () => listeners.delete(listener);
|
|
788
|
+
}
|
|
789
|
+
function clearTraits() {
|
|
790
|
+
traits.clear();
|
|
791
|
+
notifyListeners();
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// lib/tickRegistry.ts
|
|
795
|
+
var ticks = /* @__PURE__ */ new Map();
|
|
796
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
797
|
+
function notifyListeners2() {
|
|
798
|
+
listeners2.forEach((listener) => listener());
|
|
799
|
+
}
|
|
800
|
+
function registerTick(tick) {
|
|
801
|
+
ticks.set(tick.id, tick);
|
|
802
|
+
notifyListeners2();
|
|
803
|
+
}
|
|
804
|
+
function updateTickExecution(id, timestamp) {
|
|
805
|
+
const tick = ticks.get(id);
|
|
806
|
+
if (tick) {
|
|
807
|
+
tick.lastExecuted = timestamp;
|
|
808
|
+
tick.nextExecution = timestamp + tick.interval;
|
|
809
|
+
tick.executionCount++;
|
|
810
|
+
notifyListeners2();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
function setTickActive(id, isActive) {
|
|
814
|
+
const tick = ticks.get(id);
|
|
815
|
+
if (tick) {
|
|
816
|
+
tick.isActive = isActive;
|
|
817
|
+
notifyListeners2();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function unregisterTick(id) {
|
|
821
|
+
ticks.delete(id);
|
|
822
|
+
notifyListeners2();
|
|
823
|
+
}
|
|
824
|
+
function getAllTicks() {
|
|
825
|
+
return Array.from(ticks.values());
|
|
826
|
+
}
|
|
827
|
+
function getTick(id) {
|
|
828
|
+
return ticks.get(id);
|
|
829
|
+
}
|
|
830
|
+
function subscribeToTickChanges(listener) {
|
|
831
|
+
listeners2.add(listener);
|
|
832
|
+
return () => listeners2.delete(listener);
|
|
833
|
+
}
|
|
834
|
+
function clearTicks() {
|
|
835
|
+
ticks.clear();
|
|
836
|
+
notifyListeners2();
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// lib/guardRegistry.ts
|
|
840
|
+
var guardHistory = [];
|
|
841
|
+
var listeners3 = /* @__PURE__ */ new Set();
|
|
842
|
+
var MAX_HISTORY = 100;
|
|
843
|
+
function notifyListeners3() {
|
|
844
|
+
listeners3.forEach((listener) => listener());
|
|
845
|
+
}
|
|
846
|
+
function recordGuardEvaluation(evaluation) {
|
|
847
|
+
const entry = {
|
|
848
|
+
...evaluation,
|
|
849
|
+
id: `guard-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
850
|
+
timestamp: Date.now()
|
|
851
|
+
};
|
|
852
|
+
guardHistory.unshift(entry);
|
|
853
|
+
if (guardHistory.length > MAX_HISTORY) {
|
|
854
|
+
guardHistory.pop();
|
|
855
|
+
}
|
|
856
|
+
notifyListeners3();
|
|
857
|
+
}
|
|
858
|
+
function getGuardHistory() {
|
|
859
|
+
return [...guardHistory];
|
|
860
|
+
}
|
|
861
|
+
function getRecentGuardEvaluations(count) {
|
|
862
|
+
return guardHistory.slice(0, count);
|
|
863
|
+
}
|
|
864
|
+
function getGuardEvaluationsForTrait(traitName) {
|
|
865
|
+
return guardHistory.filter((g) => g.traitName === traitName);
|
|
866
|
+
}
|
|
867
|
+
function subscribeToGuardChanges(listener) {
|
|
868
|
+
listeners3.add(listener);
|
|
869
|
+
return () => listeners3.delete(listener);
|
|
870
|
+
}
|
|
871
|
+
function clearGuardHistory() {
|
|
872
|
+
guardHistory.length = 0;
|
|
873
|
+
notifyListeners3();
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// lib/entityDebug.ts
|
|
877
|
+
var entityProvider = null;
|
|
878
|
+
function setEntityProvider(provider) {
|
|
879
|
+
entityProvider = provider;
|
|
880
|
+
}
|
|
881
|
+
function clearEntityProvider() {
|
|
882
|
+
entityProvider = null;
|
|
883
|
+
}
|
|
884
|
+
function getEntitySnapshot() {
|
|
885
|
+
if (!entityProvider) {
|
|
886
|
+
return null;
|
|
887
|
+
}
|
|
888
|
+
const entities = entityProvider();
|
|
889
|
+
return {
|
|
890
|
+
entities,
|
|
891
|
+
timestamp: Date.now(),
|
|
892
|
+
totalCount: entities.length,
|
|
893
|
+
singletons: {},
|
|
894
|
+
runtime: entities.map((e) => ({ id: e.id, type: e.type, data: e.fields })),
|
|
895
|
+
persistent: {}
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function getEntityById(id) {
|
|
899
|
+
if (!entityProvider) {
|
|
900
|
+
return void 0;
|
|
901
|
+
}
|
|
902
|
+
return entityProvider().find((e) => e.id === id);
|
|
903
|
+
}
|
|
904
|
+
function getEntitiesByType(type) {
|
|
905
|
+
if (!entityProvider) {
|
|
906
|
+
return [];
|
|
907
|
+
}
|
|
908
|
+
return entityProvider().filter((e) => e.type === type);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// lib/debugRegistry.ts
|
|
912
|
+
var events = [];
|
|
913
|
+
var listeners4 = /* @__PURE__ */ new Set();
|
|
914
|
+
var MAX_EVENTS = 500;
|
|
915
|
+
function notifyListeners4() {
|
|
916
|
+
listeners4.forEach((listener) => listener());
|
|
917
|
+
}
|
|
918
|
+
function logDebugEvent(type, source, message, data) {
|
|
919
|
+
const event = {
|
|
920
|
+
id: `event-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
921
|
+
type,
|
|
922
|
+
source,
|
|
923
|
+
message,
|
|
924
|
+
data,
|
|
925
|
+
timestamp: Date.now()
|
|
926
|
+
};
|
|
927
|
+
events.unshift(event);
|
|
928
|
+
if (events.length > MAX_EVENTS) {
|
|
929
|
+
events.pop();
|
|
930
|
+
}
|
|
931
|
+
notifyListeners4();
|
|
932
|
+
}
|
|
933
|
+
function logStateChange(source, from, to, event) {
|
|
934
|
+
logDebugEvent("state-change", source, `${from} \u2192 ${to}`, { from, to, event });
|
|
935
|
+
}
|
|
936
|
+
function logEventFired(source, eventName, payload) {
|
|
937
|
+
logDebugEvent("event-fired", source, eventName, { eventName, payload });
|
|
938
|
+
}
|
|
939
|
+
function logEffectExecuted(source, effectType, details) {
|
|
940
|
+
logDebugEvent("effect-executed", source, effectType, { effectType, details });
|
|
941
|
+
}
|
|
942
|
+
function logError(source, message, error) {
|
|
943
|
+
logDebugEvent("error", source, message, { error });
|
|
944
|
+
}
|
|
945
|
+
function logWarning(source, message, data) {
|
|
946
|
+
logDebugEvent("warning", source, message, data);
|
|
947
|
+
}
|
|
948
|
+
function logInfo(source, message, data) {
|
|
949
|
+
logDebugEvent("info", source, message, data);
|
|
950
|
+
}
|
|
951
|
+
function getDebugEvents() {
|
|
952
|
+
return [...events];
|
|
953
|
+
}
|
|
954
|
+
function getRecentEvents(count) {
|
|
955
|
+
return events.slice(0, count);
|
|
956
|
+
}
|
|
957
|
+
function getEventsByType(type) {
|
|
958
|
+
return events.filter((e) => e.type === type);
|
|
959
|
+
}
|
|
960
|
+
function getEventsBySource(source) {
|
|
961
|
+
return events.filter((e) => e.source === source);
|
|
962
|
+
}
|
|
963
|
+
function subscribeToDebugEvents(listener) {
|
|
964
|
+
listeners4.add(listener);
|
|
965
|
+
return () => listeners4.delete(listener);
|
|
966
|
+
}
|
|
967
|
+
function clearDebugEvents() {
|
|
968
|
+
events.length = 0;
|
|
969
|
+
notifyListeners4();
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// lib/debugUtils.ts
|
|
973
|
+
var DEBUG_STORAGE_KEY = "orbital-debug";
|
|
974
|
+
var listeners5 = /* @__PURE__ */ new Set();
|
|
975
|
+
function isDebugEnabled() {
|
|
976
|
+
if (typeof window === "undefined") return false;
|
|
977
|
+
return localStorage.getItem(DEBUG_STORAGE_KEY) === "true";
|
|
978
|
+
}
|
|
979
|
+
function setDebugEnabled(enabled) {
|
|
980
|
+
if (typeof window === "undefined") return;
|
|
981
|
+
localStorage.setItem(DEBUG_STORAGE_KEY, String(enabled));
|
|
982
|
+
listeners5.forEach((listener) => listener(enabled));
|
|
983
|
+
}
|
|
984
|
+
function toggleDebug() {
|
|
985
|
+
const newValue = !isDebugEnabled();
|
|
986
|
+
setDebugEnabled(newValue);
|
|
987
|
+
return newValue;
|
|
988
|
+
}
|
|
989
|
+
function onDebugToggle(listener) {
|
|
990
|
+
listeners5.add(listener);
|
|
991
|
+
return () => listeners5.delete(listener);
|
|
992
|
+
}
|
|
993
|
+
function initDebugShortcut() {
|
|
994
|
+
if (typeof window === "undefined") return () => {
|
|
995
|
+
};
|
|
996
|
+
const handleKeyDown = (e) => {
|
|
997
|
+
if (e.ctrlKey && e.shiftKey && e.key === "D") {
|
|
998
|
+
e.preventDefault();
|
|
999
|
+
toggleDebug();
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1003
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export { DEFAULT_CONFIG, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, extractOutputsFromTransitions, extractStateMachine, formatGuard, getAllTicks, getAllTraits, getDebugEvents, getEffectSummary, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, onDebugToggle, parseContentSegments, parseMarkdownWithCodeBlocks, recordGuardEvaluation, registerTick, registerTrait, renderStateMachineToDomData, renderStateMachineToSvg, setDebugEnabled, setEntityProvider, setTickActive, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SuspenseConfigProvider } from './chunk-
|
|
1
|
+
import { SuspenseConfigProvider } from './chunk-QAFNBUDT.js';
|
|
2
2
|
import { ThemeProvider } from './chunk-DKQN5FVU.js';
|
|
3
3
|
import { SelectionProvider, EntityDataProvider } from './chunk-WGJIL4YR.js';
|
|
4
4
|
import { useEventBus, EventBusProvider } from './chunk-YXZM3WCF.js';
|
|
5
|
-
import { recordTransition, registerCheck, bindEventBus, bindTraitStateGetter } from './chunk-
|
|
5
|
+
import { recordTransition, registerCheck, bindEventBus, bindTraitStateGetter } from './chunk-WCTZ7WZX.js';
|
|
6
6
|
import { useOfflineExecutor } from './chunk-K2D5D3WK.js';
|
|
7
7
|
import { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
8
8
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTheme, useUISlots } from './chunk-DKQN5FVU.js';
|
|
2
2
|
import { useTranslate, useInfiniteScroll, useQuerySingleton, useLongPress, useSwipeGesture, useDragReorder, usePullToRefresh } from './chunk-WGJIL4YR.js';
|
|
3
3
|
import { useEventBus } from './chunk-YXZM3WCF.js';
|
|
4
|
-
import { cn, debugGroup, debug, debugGroupEnd, updateAssetStatus, bindCanvasCapture, getNestedValue, isDebugEnabled } from './chunk-
|
|
4
|
+
import { cn, debugGroup, debug, debugGroupEnd, updateAssetStatus, bindCanvasCapture, getNestedValue, isDebugEnabled } from './chunk-WCTZ7WZX.js';
|
|
5
5
|
import { isPortalSlot } from './chunk-K2D5D3WK.js';
|
|
6
6
|
import { __publicField } from './chunk-PKBMQBKP.js';
|
|
7
7
|
import * as LucideIcons from 'lucide-react';
|
|
@@ -229,7 +229,8 @@ function bindEventBus(eventBus) {
|
|
|
229
229
|
exposeOnWindow();
|
|
230
230
|
if (window.__orbitalVerification) {
|
|
231
231
|
window.__orbitalVerification.sendEvent = (event, payload) => {
|
|
232
|
-
|
|
232
|
+
const prefixed = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
233
|
+
eventBus.emit(prefixed, payload);
|
|
233
234
|
};
|
|
234
235
|
const eventLog = [];
|
|
235
236
|
window.__orbitalVerification.eventLog = eventLog;
|
|
@@ -0,0 +1,332 @@
|
|
|
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
|
+
* Verification Registry - Tracks runtime verification checks and transition traces
|
|
190
|
+
*
|
|
191
|
+
* Provides:
|
|
192
|
+
* 1. A checklist of pass/fail checks (INIT has fetch, bridge connected, etc.)
|
|
193
|
+
* 2. A full transition timeline with effect execution results
|
|
194
|
+
* 3. ServerBridge health snapshot
|
|
195
|
+
* 4. window.__orbitalVerification for Playwright/automation
|
|
196
|
+
*
|
|
197
|
+
* @packageDocumentation
|
|
198
|
+
*/
|
|
199
|
+
type CheckStatus = "pass" | "fail" | "pending" | "warn";
|
|
200
|
+
interface VerificationCheck {
|
|
201
|
+
id: string;
|
|
202
|
+
label: string;
|
|
203
|
+
status: CheckStatus;
|
|
204
|
+
details?: string;
|
|
205
|
+
/** Timestamp when status last changed */
|
|
206
|
+
updatedAt: number;
|
|
207
|
+
}
|
|
208
|
+
interface EffectTrace {
|
|
209
|
+
type: string;
|
|
210
|
+
args: unknown[];
|
|
211
|
+
status: "executed" | "failed" | "skipped";
|
|
212
|
+
error?: string;
|
|
213
|
+
durationMs?: number;
|
|
214
|
+
}
|
|
215
|
+
interface TransitionTrace {
|
|
216
|
+
id: string;
|
|
217
|
+
traitName: string;
|
|
218
|
+
from: string;
|
|
219
|
+
to: string;
|
|
220
|
+
event: string;
|
|
221
|
+
guardExpression?: string;
|
|
222
|
+
guardResult?: boolean;
|
|
223
|
+
effects: EffectTrace[];
|
|
224
|
+
timestamp: number;
|
|
225
|
+
}
|
|
226
|
+
interface BridgeHealth {
|
|
227
|
+
connected: boolean;
|
|
228
|
+
eventsForwarded: number;
|
|
229
|
+
eventsReceived: number;
|
|
230
|
+
lastError?: string;
|
|
231
|
+
lastHeartbeat: number;
|
|
232
|
+
}
|
|
233
|
+
interface VerificationSummary {
|
|
234
|
+
totalChecks: number;
|
|
235
|
+
passed: number;
|
|
236
|
+
failed: number;
|
|
237
|
+
warnings: number;
|
|
238
|
+
pending: number;
|
|
239
|
+
}
|
|
240
|
+
interface VerificationSnapshot {
|
|
241
|
+
checks: VerificationCheck[];
|
|
242
|
+
transitions: TransitionTrace[];
|
|
243
|
+
bridge: BridgeHealth | null;
|
|
244
|
+
summary: VerificationSummary;
|
|
245
|
+
}
|
|
246
|
+
type ChangeListener = () => void;
|
|
247
|
+
declare function registerCheck(id: string, label: string, status?: CheckStatus, details?: string): void;
|
|
248
|
+
declare function updateCheck(id: string, status: CheckStatus, details?: string): void;
|
|
249
|
+
declare function getAllChecks(): VerificationCheck[];
|
|
250
|
+
declare function recordTransition(trace: Omit<TransitionTrace, "id">): void;
|
|
251
|
+
declare function getTransitions(): TransitionTrace[];
|
|
252
|
+
declare function getTransitionsForTrait(traitName: string): TransitionTrace[];
|
|
253
|
+
declare function updateBridgeHealth(health: BridgeHealth): void;
|
|
254
|
+
declare function getBridgeHealth(): BridgeHealth | null;
|
|
255
|
+
declare function getSummary(): VerificationSummary;
|
|
256
|
+
declare function getSnapshot(): VerificationSnapshot;
|
|
257
|
+
declare function subscribeToVerification(listener: ChangeListener): () => void;
|
|
258
|
+
/** Asset load status for canvas verification */
|
|
259
|
+
type AssetLoadStatus = "loaded" | "failed" | "pending";
|
|
260
|
+
/** Event bus log entry for verification */
|
|
261
|
+
interface EventLogEntry {
|
|
262
|
+
type: string;
|
|
263
|
+
payload?: Record<string, unknown>;
|
|
264
|
+
timestamp: number;
|
|
265
|
+
}
|
|
266
|
+
/** Exposed on window for Playwright to query */
|
|
267
|
+
interface OrbitalVerificationAPI {
|
|
268
|
+
getSnapshot: () => VerificationSnapshot;
|
|
269
|
+
getChecks: () => VerificationCheck[];
|
|
270
|
+
getTransitions: () => TransitionTrace[];
|
|
271
|
+
getBridge: () => BridgeHealth | null;
|
|
272
|
+
getSummary: () => VerificationSummary;
|
|
273
|
+
/** Wait for a specific event to be processed */
|
|
274
|
+
waitForTransition: (event: string, timeoutMs?: number) => Promise<TransitionTrace | null>;
|
|
275
|
+
/** Send an event into the runtime (requires eventBus binding) */
|
|
276
|
+
sendEvent?: (event: string, payload?: Record<string, unknown>) => void;
|
|
277
|
+
/** Get current trait state */
|
|
278
|
+
getTraitState?: (traitName: string) => string | undefined;
|
|
279
|
+
/** Capture a canvas frame as PNG data URL. Registered by game organisms. */
|
|
280
|
+
captureFrame?: () => string | null;
|
|
281
|
+
/** Asset load status map. Registered by game organisms. */
|
|
282
|
+
assetStatus?: Record<string, AssetLoadStatus>;
|
|
283
|
+
/** Event bus log. Records all emit() calls for verification. */
|
|
284
|
+
eventLog?: EventLogEntry[];
|
|
285
|
+
/** Clear the event log. */
|
|
286
|
+
clearEventLog?: () => void;
|
|
287
|
+
}
|
|
288
|
+
declare global {
|
|
289
|
+
interface Window {
|
|
290
|
+
__orbitalVerification?: OrbitalVerificationAPI;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Wait for a transition matching the given event to appear.
|
|
295
|
+
* Returns the trace or null on timeout.
|
|
296
|
+
*/
|
|
297
|
+
declare function waitForTransition(event: string, timeoutMs?: number): Promise<TransitionTrace | null>;
|
|
298
|
+
/**
|
|
299
|
+
* Bind the EventBus so automation can send events and log emissions.
|
|
300
|
+
* Call this during app initialization.
|
|
301
|
+
*/
|
|
302
|
+
declare function bindEventBus(eventBus: {
|
|
303
|
+
emit: (type: string, payload?: Record<string, unknown>) => void;
|
|
304
|
+
onAny?: (listener: (event: {
|
|
305
|
+
type: string;
|
|
306
|
+
payload?: Record<string, unknown>;
|
|
307
|
+
}) => void) => () => void;
|
|
308
|
+
}): void;
|
|
309
|
+
/**
|
|
310
|
+
* Bind a trait state getter so automation can query current states.
|
|
311
|
+
*/
|
|
312
|
+
declare function bindTraitStateGetter(getter: (traitName: string) => string | undefined): void;
|
|
313
|
+
/**
|
|
314
|
+
* Register a canvas frame capture function.
|
|
315
|
+
* Called by game organisms (IsometricCanvas, PlatformerCanvas, SimulationCanvas)
|
|
316
|
+
* so the verifier can snapshot canvas content at checkpoints.
|
|
317
|
+
*/
|
|
318
|
+
declare function bindCanvasCapture(captureFn: () => string | null): void;
|
|
319
|
+
/**
|
|
320
|
+
* Update asset load status for canvas verification.
|
|
321
|
+
* Game organisms call this when images load or fail.
|
|
322
|
+
*/
|
|
323
|
+
declare function updateAssetStatus(url: string, status: AssetLoadStatus): void;
|
|
324
|
+
declare function clearVerification(): void;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Utility function to merge Tailwind CSS classes
|
|
328
|
+
* Combines clsx for conditional classes with tailwind-merge to handle conflicts
|
|
329
|
+
*/
|
|
330
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
331
|
+
|
|
332
|
+
export { type AssetLoadStatus as A, type BridgeHealth as B, type CheckStatus as C, DEFAULT_CONFIG as D, type EffectTrace as E, getSummary as F, getTransitions as G, getTransitionsForTrait as H, parseContentSegments as I, parseMarkdownWithCodeBlocks as J, recordTransition as K, registerCheck as L, renderStateMachineToDomData as M, renderStateMachineToSvg as N, subscribeToVerification as O, updateAssetStatus as P, updateBridgeHealth as Q, type RenderOptions as R, type StateDefinition as S, type TransitionDefinition as T, updateCheck as U, type VerificationCheck as V, waitForTransition as W, type ContentSegment as a, type DomEntityBox as b, type DomLayoutData as c, type DomOutputsBox as d, type DomStateNode as e, type DomTransitionLabel as f, type DomTransitionPath as g, type EntityDefinition as h, type EventLogEntry as i, type StateMachineDefinition as j, type TransitionTrace as k, type VerificationSnapshot as l, type VerificationSummary as m, type VisualizerConfig as n, bindCanvasCapture as o, bindEventBus as p, bindTraitStateGetter as q, clearVerification as r, cn as s, extractOutputsFromTransitions as t, extractStateMachine as u, formatGuard as v, getAllChecks as w, getBridgeHealth as x, getEffectSummary as y, getSnapshot as z };
|