@almadar/ui 1.0.1 → 1.0.10

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.
@@ -317,4 +317,147 @@ declare function getNestedValue(obj: Record<string, unknown> | null | undefined,
317
317
  */
318
318
  declare function formatNestedFieldLabel(path: string): string;
319
319
 
320
- export { ApiError, type DebugEvent, type DebugEventType, type EntitySnapshot, type EntityState, type GuardContext, type GuardEvaluation, type PersistentEntityInfo, type RuntimeEntity, type TickExecution, type TraitDebugInfo, type TraitGuard, type TraitTransition, apiClient, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getAllTicks, getAllTraits, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getNestedValue, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, onDebugToggle, recordGuardEvaluation, registerTick, registerTrait, setDebugEnabled, setEntityProvider, setTickActive, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState };
320
+ /**
321
+ * Orbital State Machine Visualizer
322
+ *
323
+ * Renders SVG diagrams from Orbital schemas and Trait definitions.
324
+ * Can be used in documentation, IDE previews, and other tools.
325
+ */
326
+ interface VisualizerConfig {
327
+ nodeRadius: number;
328
+ nodeSpacing: number;
329
+ initialIndicatorOffset: number;
330
+ arrowSize: number;
331
+ colors: {
332
+ background: string;
333
+ node: string;
334
+ nodeBorder: string;
335
+ nodeText: string;
336
+ initialNode: string;
337
+ finalNode: string;
338
+ arrow: string;
339
+ arrowText: string;
340
+ effectText: string;
341
+ guardText: string;
342
+ initial: string;
343
+ };
344
+ fonts: {
345
+ node: string;
346
+ event: string;
347
+ effect: string;
348
+ };
349
+ }
350
+ interface StateDefinition {
351
+ name: string;
352
+ isInitial?: boolean;
353
+ isFinal?: boolean;
354
+ description?: string;
355
+ }
356
+ interface TransitionDefinition {
357
+ from: string;
358
+ to: string;
359
+ event: string;
360
+ guard?: unknown;
361
+ effects?: unknown[];
362
+ }
363
+ interface StateMachineDefinition {
364
+ states: StateDefinition[];
365
+ transitions: TransitionDefinition[];
366
+ }
367
+ interface EntityDefinition {
368
+ name: string;
369
+ fields?: (string | {
370
+ name: string;
371
+ })[];
372
+ }
373
+ interface RenderOptions {
374
+ title?: string;
375
+ entity?: EntityDefinition;
376
+ }
377
+ /** Position data for a state node in DOM layout */
378
+ interface DomStateNode {
379
+ id: string;
380
+ name: string;
381
+ x: number;
382
+ y: number;
383
+ radius: number;
384
+ isInitial: boolean;
385
+ isFinal: boolean;
386
+ description?: string;
387
+ }
388
+ /** Position data for a transition arrow */
389
+ interface DomTransitionPath {
390
+ id: string;
391
+ from: string;
392
+ to: string;
393
+ /** SVG path data for the curved arrow */
394
+ pathData: string;
395
+ /** Midpoint for label positioning */
396
+ labelX: number;
397
+ labelY: number;
398
+ }
399
+ /** Position data for a transition label with guard/effect details */
400
+ interface DomTransitionLabel {
401
+ id: string;
402
+ from: string;
403
+ to: string;
404
+ event: string;
405
+ x: number;
406
+ y: number;
407
+ /** Human-readable guard text (e.g., "if amount > 100") */
408
+ guardText?: string;
409
+ /** Human-readable effect texts */
410
+ effectTexts: string[];
411
+ /** Whether this transition has details to show in tooltip */
412
+ hasDetails: boolean;
413
+ }
414
+ /** Entity input box data */
415
+ interface DomEntityBox {
416
+ name: string;
417
+ fields: string[];
418
+ x: number;
419
+ y: number;
420
+ width: number;
421
+ height: number;
422
+ }
423
+ /** Output effects box data */
424
+ interface DomOutputsBox {
425
+ outputs: string[];
426
+ x: number;
427
+ y: number;
428
+ width: number;
429
+ height: number;
430
+ }
431
+ /** Complete DOM layout data for rendering */
432
+ interface DomLayoutData {
433
+ width: number;
434
+ height: number;
435
+ title?: string;
436
+ states: DomStateNode[];
437
+ paths: DomTransitionPath[];
438
+ labels: DomTransitionLabel[];
439
+ entity?: DomEntityBox;
440
+ outputs?: DomOutputsBox;
441
+ config: VisualizerConfig;
442
+ }
443
+ declare const DEFAULT_CONFIG: VisualizerConfig;
444
+ declare function formatGuard(guard: unknown): string;
445
+ declare function getEffectSummary(effects: unknown[]): string;
446
+ declare function extractOutputsFromTransitions(transitions: TransitionDefinition[]): string[];
447
+ /**
448
+ * Render a state machine to an SVG string.
449
+ * Works in both browser and Node.js environments.
450
+ */
451
+ declare function renderStateMachineToSvg(stateMachine: StateMachineDefinition, options?: RenderOptions, config?: VisualizerConfig): string;
452
+ /**
453
+ * Extract state machine from various data formats (Trait, Orbital, or raw)
454
+ */
455
+ declare function extractStateMachine(data: unknown): StateMachineDefinition | null;
456
+ /**
457
+ * Render a state machine to DOM layout data.
458
+ * This is used by the DOM-based visualizer component for hybrid SVG/DOM rendering.
459
+ * Unlike renderStateMachineToSvg, this returns structured data instead of an SVG string.
460
+ */
461
+ declare function renderStateMachineToDomData(stateMachine: StateMachineDefinition, options?: RenderOptions, config?: VisualizerConfig): DomLayoutData;
462
+
463
+ export { ApiError, DEFAULT_CONFIG, type DebugEvent, type DebugEventType, type DomEntityBox, type DomLayoutData, type DomOutputsBox, type DomStateNode, type DomTransitionLabel, type DomTransitionPath, type EntityDefinition, type EntitySnapshot, type EntityState, type GuardContext, type GuardEvaluation, type PersistentEntityInfo, type RenderOptions, type RuntimeEntity, type StateDefinition, type StateMachineDefinition, type TickExecution, type TraitDebugInfo, type TraitGuard, type TraitTransition, type TransitionDefinition, type VisualizerConfig, apiClient, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, extractOutputsFromTransitions, extractStateMachine, formatGuard, formatNestedFieldLabel, getAllTicks, getAllTraits, getDebugEvents, getEffectSummary, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getNestedValue, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, onDebugToggle, recordGuardEvaluation, registerTick, registerTrait, renderStateMachineToDomData, renderStateMachineToSvg, setDebugEnabled, setEntityProvider, setTickActive, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState };