@almadar/ui 4.54.5 → 4.54.6
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/avl/index.cjs +355 -256
- package/dist/avl/index.d.cts +48 -2
- package/dist/avl/index.js +355 -256
- package/dist/components/molecules/avl/TraitCardNode.d.ts +31 -0
- package/dist/components/molecules/avl/avl-preview-converter.d.ts +18 -0
- package/dist/components/molecules/avl/avl-preview-types.d.ts +41 -1
- package/dist/components/organisms/avl/FlowCanvas.d.ts +1 -1
- package/dist/components/organisms/avl/avl-zoom-state.d.ts +12 -0
- package/dist/components/organisms/game/three/index.cjs +18 -1
- package/dist/components/organisms/game/three/index.js +18 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TraitCardNode — React Flow node for the `trait-expanded` view level.
|
|
3
|
+
*
|
|
4
|
+
* Renders one card per trait of a single orbital. Header shows the trait
|
|
5
|
+
* name + linked entity badge; body lists the trait's transitions as
|
|
6
|
+
* clickable rows that drill into L4 transition detail; left edge has
|
|
7
|
+
* one target handle per `listens[]` event; right edge has one source
|
|
8
|
+
* handle per `emits[]` event. The edges produced by
|
|
9
|
+
* `orbitalToTraitGraph` connect emit handles to listen handles where
|
|
10
|
+
* the event names match.
|
|
11
|
+
*
|
|
12
|
+
* Transition-row clicks bubble through `TraitCardSelectionContext`
|
|
13
|
+
* (mirrors `PatternSelectionContext` in `OrbPreviewNode`). FlowCanvas
|
|
14
|
+
* wraps the canvas in a provider that translates the context callback
|
|
15
|
+
* into its `onNodeClick({ level: 'transition', ... })` prop.
|
|
16
|
+
*/
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { type NodeProps } from '@xyflow/react';
|
|
19
|
+
export interface TraitCardTransitionClick {
|
|
20
|
+
orbitalName: string;
|
|
21
|
+
traitName: string;
|
|
22
|
+
transitionEvent: string;
|
|
23
|
+
fromState: string;
|
|
24
|
+
toState: string;
|
|
25
|
+
index: number;
|
|
26
|
+
}
|
|
27
|
+
export interface TraitCardSelectionContextValue {
|
|
28
|
+
selectTransition: (sel: TraitCardTransitionClick) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const TraitCardSelectionContext: React.Context<TraitCardSelectionContextValue>;
|
|
31
|
+
export declare const TraitCardNode: React.NamedExoticComponent<NodeProps>;
|
|
@@ -51,3 +51,21 @@ export declare function orbitalAliasToExpandedGraph(schema: OrbitalSchema, orbit
|
|
|
51
51
|
nodes: Node<PreviewNodeData>[];
|
|
52
52
|
edges: Edge<EventEdgeData>[];
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Build a React Flow graph for the `trait-expanded` level: one node per
|
|
56
|
+
* trait of `orbitalName`, with intra-orbital `emits → listens` edges
|
|
57
|
+
* between trait cards (an emit on trait A connects to a listen for the
|
|
58
|
+
* same event on trait B in the same orbital).
|
|
59
|
+
*
|
|
60
|
+
* Used by the cosmic tab at L3 (after the user drills into an orbital
|
|
61
|
+
* from the L1 grid). The canvas tab does not call this today; the new
|
|
62
|
+
* level is opt-in via `initialLevel="trait-expanded"`.
|
|
63
|
+
*
|
|
64
|
+
* Layout: grid (`ceil(sqrt(N))` cols). Nodes are `type: 'traitCard'`
|
|
65
|
+
* with `data.kind === 'trait-card'` so `FlowCanvas`'s NODE_TYPES routes
|
|
66
|
+
* them to `TraitCardNode`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function orbitalToTraitGraph(schema: OrbitalSchema, orbitalName: string, _mockData?: Record<string, unknown[]>): {
|
|
69
|
+
nodes: Node<PreviewNodeData>[];
|
|
70
|
+
edges: Edge<EventEdgeData>[];
|
|
71
|
+
};
|
|
@@ -18,8 +18,12 @@ import type { Expression, UISlot } from '@almadar/core';
|
|
|
18
18
|
* - `behavior-expanded` (L3) — drilled into a single imported behavior at
|
|
19
19
|
* L2: one card per transition of THAT behavior. Used to inspect what an
|
|
20
20
|
* import contributes without leaving the canvas.
|
|
21
|
+
* - `trait-expanded` — one card per trait of a single orbital, connected
|
|
22
|
+
* by intra-orbital `emits → listens` edges. Used by the cosmic tab to
|
|
23
|
+
* render the trait-level circuit when the user drills into an orbital
|
|
24
|
+
* from the L1 grid. Not used by the canvas tab today.
|
|
21
25
|
*/
|
|
22
|
-
export type ViewLevel = 'overview' | 'expanded' | 'behavior-expanded';
|
|
26
|
+
export type ViewLevel = 'overview' | 'expanded' | 'behavior-expanded' | 'trait-expanded';
|
|
23
27
|
/**
|
|
24
28
|
* Screen size preset for OrbPreview rendering inside nodes.
|
|
25
29
|
*
|
|
@@ -162,6 +166,42 @@ export interface PreviewNodeData extends Record<string, unknown> {
|
|
|
162
166
|
* card. Renderer can surface it as a "+N screens" badge.
|
|
163
167
|
*/
|
|
164
168
|
transitionCount?: number;
|
|
169
|
+
/**
|
|
170
|
+
* Discriminator for the node variant. Absent on overview/expanded/
|
|
171
|
+
* behavior-expanded cards (those use field-presence-based discrimination
|
|
172
|
+
* via `behaviorAlias`/`transitionEvent`). Set to `'trait-card'` for nodes
|
|
173
|
+
* produced by `orbitalToTraitGraph` so renderers can branch cleanly.
|
|
174
|
+
*/
|
|
175
|
+
kind?: 'trait-card';
|
|
176
|
+
/**
|
|
177
|
+
* Trait-card transitions (`kind === 'trait-card'` only). One row per
|
|
178
|
+
* transition; each row is clickable and drills to L4 transition detail
|
|
179
|
+
* in cosmic. `event` is the trigger; `fromState` / `toState` mirror the
|
|
180
|
+
* underlying state-machine edge.
|
|
181
|
+
*/
|
|
182
|
+
transitions?: Array<{
|
|
183
|
+
event: string;
|
|
184
|
+
fromState: string;
|
|
185
|
+
toState: string;
|
|
186
|
+
}>;
|
|
187
|
+
/**
|
|
188
|
+
* Trait-card `emits` event names (`kind === 'trait-card'` only). One
|
|
189
|
+
* source handle per entry on the right edge of the card. Drives the
|
|
190
|
+
* outgoing wire endpoints in `orbitalToTraitGraph`.
|
|
191
|
+
*/
|
|
192
|
+
emits?: string[];
|
|
193
|
+
/**
|
|
194
|
+
* Trait-card `listens` event names (`kind === 'trait-card'` only). One
|
|
195
|
+
* target handle per entry on the left edge of the card. Drives the
|
|
196
|
+
* incoming wire endpoints in `orbitalToTraitGraph`.
|
|
197
|
+
*/
|
|
198
|
+
listens?: string[];
|
|
199
|
+
/**
|
|
200
|
+
* Trait-card `linkedEntity` (`kind === 'trait-card'` only). Surfaced as a
|
|
201
|
+
* subtitle/badge next to the trait name so users can see what entity the
|
|
202
|
+
* trait operates on. Mirrors `Trait.linkedEntity` from the resolved schema.
|
|
203
|
+
*/
|
|
204
|
+
linkedEntity?: string;
|
|
165
205
|
}
|
|
166
206
|
/** Data for event flow edges. */
|
|
167
207
|
export interface EventEdgeData extends Record<string, unknown> {
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
* useReducer-based state machine managing which zoom level is displayed,
|
|
5
5
|
* what is selected, and animation state.
|
|
6
6
|
*
|
|
7
|
+
* Shared by AvlOrbitalsCosmicZoom (2D) and Avl3DViewer (3D). The 3D
|
|
8
|
+
* viewer drills through every level (`application → orbital → trait →
|
|
9
|
+
* transition`); the 2D cosmic view skips the `'orbital'` level after
|
|
10
|
+
* COSMIC-1 (no Orbital-View screen) by dispatching `JUMP_TO_TRAIT_CIRCUIT`
|
|
11
|
+
* to land directly at `'trait'`.
|
|
12
|
+
*
|
|
7
13
|
* @packageDocumentation
|
|
8
14
|
*/
|
|
9
15
|
export type ZoomLevel = 'application' | 'orbital' | 'trait' | 'transition';
|
|
@@ -50,6 +56,12 @@ export type ZoomAction = {
|
|
|
50
56
|
} | {
|
|
51
57
|
type: 'SWITCH_TRAIT';
|
|
52
58
|
trait: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'JUMP_TO_TRAIT_CIRCUIT';
|
|
61
|
+
orbital: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'SELECT_TRAIT';
|
|
64
|
+
trait: string;
|
|
53
65
|
};
|
|
54
66
|
export declare const initialZoomState: ZoomState;
|
|
55
67
|
export declare function zoomReducer(state: ZoomState, action: ZoomAction): ZoomState;
|
|
@@ -3707,6 +3707,22 @@ function zoomReducer(state, action) {
|
|
|
3707
3707
|
selectedTransition: action.transitionIndex
|
|
3708
3708
|
};
|
|
3709
3709
|
}
|
|
3710
|
+
case "JUMP_TO_TRAIT_CIRCUIT": {
|
|
3711
|
+
if (state.level !== "application" || state.animating) return state;
|
|
3712
|
+
return {
|
|
3713
|
+
...state,
|
|
3714
|
+
level: "trait",
|
|
3715
|
+
selectedOrbital: action.orbital,
|
|
3716
|
+
selectedTrait: null,
|
|
3717
|
+
selectedTransition: null,
|
|
3718
|
+
animating: false,
|
|
3719
|
+
animationDirection: "in",
|
|
3720
|
+
animationTarget: null
|
|
3721
|
+
};
|
|
3722
|
+
}
|
|
3723
|
+
case "SELECT_TRAIT": {
|
|
3724
|
+
return { ...state, selectedTrait: action.trait };
|
|
3725
|
+
}
|
|
3710
3726
|
case "ZOOM_OUT": {
|
|
3711
3727
|
if (state.level === "application" || state.animating) return state;
|
|
3712
3728
|
return {
|
|
@@ -3739,7 +3755,8 @@ function zoomReducer(state, action) {
|
|
|
3739
3755
|
if (state.level === "trait") {
|
|
3740
3756
|
return {
|
|
3741
3757
|
...state,
|
|
3742
|
-
level: "
|
|
3758
|
+
level: "application",
|
|
3759
|
+
selectedOrbital: null,
|
|
3743
3760
|
selectedTrait: null,
|
|
3744
3761
|
animating: false,
|
|
3745
3762
|
animationTarget: null
|
|
@@ -3683,6 +3683,22 @@ function zoomReducer(state, action) {
|
|
|
3683
3683
|
selectedTransition: action.transitionIndex
|
|
3684
3684
|
};
|
|
3685
3685
|
}
|
|
3686
|
+
case "JUMP_TO_TRAIT_CIRCUIT": {
|
|
3687
|
+
if (state.level !== "application" || state.animating) return state;
|
|
3688
|
+
return {
|
|
3689
|
+
...state,
|
|
3690
|
+
level: "trait",
|
|
3691
|
+
selectedOrbital: action.orbital,
|
|
3692
|
+
selectedTrait: null,
|
|
3693
|
+
selectedTransition: null,
|
|
3694
|
+
animating: false,
|
|
3695
|
+
animationDirection: "in",
|
|
3696
|
+
animationTarget: null
|
|
3697
|
+
};
|
|
3698
|
+
}
|
|
3699
|
+
case "SELECT_TRAIT": {
|
|
3700
|
+
return { ...state, selectedTrait: action.trait };
|
|
3701
|
+
}
|
|
3686
3702
|
case "ZOOM_OUT": {
|
|
3687
3703
|
if (state.level === "application" || state.animating) return state;
|
|
3688
3704
|
return {
|
|
@@ -3715,7 +3731,8 @@ function zoomReducer(state, action) {
|
|
|
3715
3731
|
if (state.level === "trait") {
|
|
3716
3732
|
return {
|
|
3717
3733
|
...state,
|
|
3718
|
-
level: "
|
|
3734
|
+
level: "application",
|
|
3735
|
+
selectedOrbital: null,
|
|
3719
3736
|
selectedTrait: null,
|
|
3720
3737
|
animating: false,
|
|
3721
3738
|
animationTarget: null
|