@almadar/ui 1.0.0 → 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.
- package/dist/chunk-4FRUCUO5.js +14 -0
- package/dist/chunk-7NEWMNNU.js +147 -0
- package/dist/chunk-AQREMI4N.js +426 -0
- package/dist/chunk-BCERHHKU.js +2834 -0
- package/dist/chunk-I5RSZIOE.js +190 -0
- package/dist/chunk-KKCVDUK7.js +104 -0
- package/dist/chunk-N7MVUW4R.js +194 -0
- package/dist/chunk-S7EYY36U.js +13 -0
- package/dist/chunk-TTXKOHDO.js +270 -0
- package/dist/chunk-XSEDIUM6.js +93 -0
- package/dist/cn-mqkxz8Sd.d.ts +9 -0
- package/dist/components/index.d.ts +175 -4
- package/dist/components/index.js +701 -7595
- package/dist/context/index.js +6 -342
- package/dist/hooks/index.d.ts +70 -1
- package/dist/hooks/index.js +6 -2262
- package/dist/lib/index.d.ts +180 -8
- package/dist/lib/index.js +685 -171
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +8 -905
- package/dist/renderer/index.d.ts +144 -1
- package/dist/renderer/index.js +209 -402
- package/dist/stores/index.js +2 -196
- package/package.json +11 -13
- package/themes/almadar.css +8 -0
- package/themes/index.css +1 -0
- package/themes/minimalist.css +8 -0
- package/themes/trait-wars.css +176 -0
- package/themes/wireframe.css +8 -0
- package/dist/components/index.js.map +0 -1
- package/dist/context/index.js.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/lib/index.js.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/renderer/index.js.map +0 -1
- package/dist/stores/index.js.map +0 -1
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Utility function to merge Tailwind CSS classes
|
|
5
|
-
* Combines clsx for conditional classes with tailwind-merge to handle conflicts
|
|
6
|
-
*/
|
|
7
|
-
declare function cn(...inputs: ClassValue[]): string;
|
|
1
|
+
export { c as cn } from '../cn-mqkxz8Sd.js';
|
|
2
|
+
import 'clsx';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* API Client - HTTP client for backend API calls
|
|
@@ -288,4 +283,181 @@ declare function getTrait(id: string): TraitDebugInfo | undefined;
|
|
|
288
283
|
declare function subscribeToTraitChanges(listener: ChangeListener): () => void;
|
|
289
284
|
declare function clearTraits(): void;
|
|
290
285
|
|
|
291
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Get Nested Value Utility
|
|
288
|
+
*
|
|
289
|
+
* Safely retrieves nested values from objects using dot-notation paths.
|
|
290
|
+
* Used by display components to support relation field access like "company.name".
|
|
291
|
+
*
|
|
292
|
+
* @packageDocumentation
|
|
293
|
+
*/
|
|
294
|
+
/**
|
|
295
|
+
* Get a nested value from an object using dot-notation path.
|
|
296
|
+
*
|
|
297
|
+
* @param obj - The object to traverse
|
|
298
|
+
* @param path - Dot-notation path (e.g., "company.name", "address.city")
|
|
299
|
+
* @returns The value at the path, or undefined if not found
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* const data = { company: { name: "Acme Corp", address: { city: "NYC" } } };
|
|
303
|
+
* getNestedValue(data, "company.name"); // => "Acme Corp"
|
|
304
|
+
* getNestedValue(data, "company.address.city"); // => "NYC"
|
|
305
|
+
* getNestedValue(data, "company.missing"); // => undefined
|
|
306
|
+
*/
|
|
307
|
+
declare function getNestedValue(obj: Record<string, unknown> | null | undefined, path: string): unknown;
|
|
308
|
+
/**
|
|
309
|
+
* Format a nested field path as a human-readable label.
|
|
310
|
+
*
|
|
311
|
+
* @param path - Dot-notation path (e.g., "company.name")
|
|
312
|
+
* @returns Formatted label (e.g., "Company Name")
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* formatFieldLabel("company.name"); // => "Company Name"
|
|
316
|
+
* formatFieldLabel("address.zipCode"); // => "Address Zip Code"
|
|
317
|
+
*/
|
|
318
|
+
declare function formatNestedFieldLabel(path: string): string;
|
|
319
|
+
|
|
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 };
|