@almadar/ui 1.0.31 → 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/chunk-45CTDYBT.js +174 -0
- package/dist/{chunk-LRI6C6UI.js → chunk-BTXQJGFB.js} +25 -2
- package/dist/chunk-N6DJVKZ6.js +747 -0
- package/dist/chunk-PE2H3NAW.js +383 -0
- package/dist/{chunk-WRL6TBOL.js → chunk-RFD6G3ZR.js} +22 -90
- package/dist/chunk-UCXZS2YJ.js +9501 -0
- package/dist/{chunk-RUGU4MSK.js → chunk-YXZM3WCF.js} +37 -1
- package/dist/cn-BoBXsxuX.d.ts +194 -0
- package/dist/components/index.css +1154 -0
- package/dist/components/index.d.ts +804 -329
- package/dist/components/index.js +8095 -15387
- package/dist/components/organisms/game/three/index.d.ts +0 -107
- package/dist/components/organisms/game/three/index.js +1 -1
- package/dist/context/index.d.ts +2 -2
- 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 +83 -120
- package/dist/hooks/index.js +4 -4
- 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 +79 -3
- package/dist/providers/index.js +158 -10
- package/dist/{useUISlots-mnggE9X9.d.ts → useUISlots-D0mttBSP.d.ts} +0 -20
- package/package.json +20 -11
- package/dist/chunk-VLWZZA6A.js +0 -239
- package/dist/chunk-W5YTXLXL.js +0 -29
- package/dist/cn-mqkxz8Sd.d.ts +0 -9
|
@@ -14,6 +14,7 @@ function getGlobalEventBus() {
|
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
var fallbackListeners = /* @__PURE__ */ new Map();
|
|
17
|
+
var fallbackAnyListeners = /* @__PURE__ */ new Set();
|
|
17
18
|
var fallbackEventBus = {
|
|
18
19
|
emit: (type, payload) => {
|
|
19
20
|
const event = {
|
|
@@ -31,6 +32,13 @@ var fallbackEventBus = {
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
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
|
+
});
|
|
34
42
|
},
|
|
35
43
|
on: (type, listener) => {
|
|
36
44
|
if (!fallbackListeners.has(type)) {
|
|
@@ -57,6 +65,12 @@ var fallbackEventBus = {
|
|
|
57
65
|
hasListeners: (type) => {
|
|
58
66
|
const handlers = fallbackListeners.get(type);
|
|
59
67
|
return handlers !== void 0 && handlers.size > 0;
|
|
68
|
+
},
|
|
69
|
+
onAny: (listener) => {
|
|
70
|
+
fallbackAnyListeners.add(listener);
|
|
71
|
+
return () => {
|
|
72
|
+
fallbackAnyListeners.delete(listener);
|
|
73
|
+
};
|
|
60
74
|
}
|
|
61
75
|
};
|
|
62
76
|
function useEventBus() {
|
|
@@ -89,6 +103,7 @@ function useEmitEvent() {
|
|
|
89
103
|
var EventBusContext = createContext(null);
|
|
90
104
|
function EventBusProvider({ children, debug = false }) {
|
|
91
105
|
const listenersRef = useRef(/* @__PURE__ */ new Map());
|
|
106
|
+
const anyListenersRef = useRef(/* @__PURE__ */ new Set());
|
|
92
107
|
const deprecationWarningShown = useRef(false);
|
|
93
108
|
const getSelectedEntity = useCallback(() => {
|
|
94
109
|
if (!deprecationWarningShown.current) {
|
|
@@ -132,6 +147,14 @@ function EventBusProvider({ children, debug = false }) {
|
|
|
132
147
|
}
|
|
133
148
|
}
|
|
134
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
|
+
}
|
|
135
158
|
}, [debug]);
|
|
136
159
|
const on = useCallback((type, listener) => {
|
|
137
160
|
if (!listenersRef.current.has(type)) {
|
|
@@ -163,16 +186,29 @@ function EventBusProvider({ children, debug = false }) {
|
|
|
163
186
|
const listeners = listenersRef.current.get(type);
|
|
164
187
|
return listeners !== void 0 && listeners.size > 0;
|
|
165
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]);
|
|
166
201
|
const contextValue = useMemo(
|
|
167
202
|
() => ({
|
|
168
203
|
emit,
|
|
169
204
|
on,
|
|
170
205
|
once,
|
|
171
206
|
hasListeners,
|
|
207
|
+
onAny,
|
|
172
208
|
getSelectedEntity,
|
|
173
209
|
clearSelectedEntity
|
|
174
210
|
}),
|
|
175
|
-
[emit, on, once, hasListeners, getSelectedEntity, clearSelectedEntity]
|
|
211
|
+
[emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
|
|
176
212
|
);
|
|
177
213
|
useEffect(() => {
|
|
178
214
|
setGlobalEventBus(contextValue);
|
|
@@ -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 };
|