@almadar/shell-web 0.1.0 → 1.1.0

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.
Files changed (131) hide show
  1. package/dist/{ArbitraryClassCompiler-Mzabq-UB.d.ts → ArbitraryClassCompiler-CO_iASBn.d.ts} +99 -4
  2. package/dist/AvlGlyph-PIXU6QH5.js +5 -0
  3. package/dist/AvlStateMachine-CKGMECMG.js +8 -0
  4. package/dist/AvlTransitionDetail-QZX6G5KJ.js +10 -0
  5. package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
  6. package/dist/BehaviorView-JLZ4PKWY.js +10 -0
  7. package/dist/{EventBusProvider-CVwjkV_2.d.ts → EventBusProvider-BFFHfN4O.d.ts} +12 -0
  8. package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
  9. package/dist/FlowCanvas-RPII4V24.js +23 -0
  10. package/dist/{BehaviorValueFrame-SSEMEBTG.css → FlowCanvas-VWUPMBKB.css} +189 -191
  11. package/dist/{GameAudioProvider-Cm9BnvmP.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +5 -8
  12. package/dist/KernelEngineContext-CPeWQMAz.d.ts +46 -0
  13. package/dist/LayersPanel-M2LHWUFF.js +6 -0
  14. package/dist/ModuleCard-NJD6JQGD.js +6 -0
  15. package/dist/OrbInspector-OWWKPOBF.js +23 -0
  16. package/dist/{TraitValueFrame-4G3KOUBR.css → OrbInspector-VMTMZHNQ.css} +189 -191
  17. package/dist/{Select-mDZIwNqN.d.ts → Select-C2Uq6t86.d.ts} +17 -31
  18. package/dist/ServerBridge-Bqsj-lOU.d.ts +124 -0
  19. package/dist/{FlowCanvas-3JRMNJLV.css → UISlotRenderer-BIS6KT7T.css} +189 -191
  20. package/dist/UISlotRenderer-PY7FIJXN.js +23 -0
  21. package/dist/auth/browser/index.js +1 -0
  22. package/dist/auth/react/index.d.ts +8 -1
  23. package/dist/auth/react/index.js +40 -2
  24. package/dist/avl/index.css +189 -191
  25. package/dist/avl/index.d.ts +107 -85
  26. package/dist/avl/index.js +170 -39
  27. package/dist/{chunk-P4LNHAFI.js → chunk-2WGR4TDJ.js} +465 -36
  28. package/dist/{chunk-GKIFONTE.js → chunk-3S54FWRC.js} +2 -2
  29. package/dist/{chunk-KVQS4GXU.js → chunk-4YJ53G7S.js} +18 -8
  30. package/dist/{chunk-MBQAMMSE.js → chunk-4YXBKHHM.js} +269 -658
  31. package/dist/{chunk-YDNJLLG6.js → chunk-57DC34LY.js} +19 -10
  32. package/dist/{chunk-FP3WIKTC.js → chunk-7N6ZPHQ5.js} +9 -1
  33. package/dist/{chunk-AILY3XPS.js → chunk-AE7VCQB6.js} +5 -6
  34. package/dist/{chunk-L677XGY3.js → chunk-AGVSO4WY.js} +4 -5
  35. package/dist/{chunk-FAJDTHWC.js → chunk-AGXD77SL.js} +2 -2
  36. package/dist/chunk-AU7O65OX.js +66 -0
  37. package/dist/{chunk-DFNZUYX4.js → chunk-FAKU5F62.js} +273 -29
  38. package/dist/{chunk-U6QRZASX.js → chunk-ILQXJ2AR.js} +1 -1
  39. package/dist/chunk-M74BCDBQ.js +490 -0
  40. package/dist/{chunk-GYTPOFVC.js → chunk-MS4K3K2R.js} +12095 -13329
  41. package/dist/{chunk-SGM3FASH.js → chunk-OWNG4JZI.js} +13 -12
  42. package/dist/{chunk-VFF5OO47.js → chunk-PCR37T3U.js} +15 -38
  43. package/dist/{chunk-SJGJJKBY.js → chunk-PRLHKBXG.js} +5 -3
  44. package/dist/{chunk-R5O5AUPI.js → chunk-PRXQGGCO.js} +93 -86
  45. package/dist/{chunk-42FY4RYA.js → chunk-REXYVBUO.js} +2 -2
  46. package/dist/{chunk-EQAMU2ZC.js → chunk-UTDC2NEA.js} +1 -1
  47. package/dist/{chunk-73SRAB4P.js → chunk-UU57VNS2.js} +2 -2
  48. package/dist/{chunk-TESBIVUA.js → chunk-VHC2M26B.js} +2 -2
  49. package/dist/{chunk-L2DEKY4J.js → chunk-VO2TTLS5.js} +3 -6
  50. package/dist/{chunk-2PY54Z44.js → chunk-VUIACGDU.js} +4 -5
  51. package/dist/{chunk-DLZF4PVE.js → chunk-YYIHRIDH.js} +3 -3
  52. package/dist/{chunk-DYEKAA4L.js → chunk-ZDRDJKYB.js} +243 -252
  53. package/dist/components/index.css +189 -191
  54. package/dist/components/index.d.ts +739 -289
  55. package/dist/components/index.js +25 -28
  56. package/dist/context/index.d.ts +2 -3
  57. package/dist/context/index.js +4 -3
  58. package/dist/core.d.ts +95 -19
  59. package/dist/core.js +2 -1
  60. package/dist/design-classes/index.cjs +3 -1
  61. package/dist/design-classes/index.js +3 -1
  62. package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
  63. package/dist/hooks/index.d.ts +40 -5
  64. package/dist/hooks/index.js +5 -4
  65. package/dist/index.d.ts +40 -114
  66. package/dist/index.js +174 -34
  67. package/dist/kernel-client-JW6OH5FX.js +537 -0
  68. package/dist/kernel-wire-DGAySGhX.d.ts +95 -0
  69. package/dist/lib/index.d.ts +3 -4
  70. package/dist/lib/index.js +4 -4
  71. package/dist/{prism-AIWGN2X5.js → prism-X5YWKXO5.js} +5 -3
  72. package/dist/providers/index.css +189 -191
  73. package/dist/providers/index.d.ts +41 -28
  74. package/dist/providers/index.js +19 -24
  75. package/dist/renderer/index.d.ts +0 -2
  76. package/dist/renderer/index.js +1 -0
  77. package/dist/runtime/index.css +189 -191
  78. package/dist/runtime/index.d.ts +57 -253
  79. package/dist/runtime/index.js +18 -24
  80. package/dist/ssr/index.cjs +2643 -535
  81. package/dist/ssr/index.d.cts +0 -23
  82. package/dist/ssr/index.d.ts +0 -23
  83. package/dist/ssr/index.js +2639 -535
  84. package/dist/storage/browser/index.js +1 -0
  85. package/dist/test-support.d.ts +15 -8
  86. package/dist/test-support.js +91 -24
  87. package/dist/{paintDispatch-ChW5mVuK.d.ts → verificationRegistry-oopV1J1n.d.ts} +132 -30
  88. package/package.json +14 -38
  89. package/src/core/lib/band-shapes.json +7 -0
  90. package/src/core/locales/ar.json +18 -5
  91. package/src/core/locales/en.json +18 -5
  92. package/src/core/locales/sl.json +18 -5
  93. package/tailwind-preset.cjs +30 -1
  94. package/dist/AvlGlyph-JKJOAH23.js +0 -6
  95. package/dist/AvlStateMachine-PI4YGREK.js +0 -8
  96. package/dist/AvlTransitionDetail-ZH7V24UG.js +0 -12
  97. package/dist/AvlTransitionExplainer-ZSRT7L6Y.js +0 -13
  98. package/dist/BehaviorValueFrame-6RUJXT4A.js +0 -29
  99. package/dist/BehaviorView-RFEE5J6E.js +0 -10
  100. package/dist/Canvas3DHost-_Y-5uLM_.d.ts +0 -552
  101. package/dist/FlowCanvas-STDC4OWK.js +0 -27
  102. package/dist/KernelEngineContext-BOCQoFwk.d.ts +0 -43
  103. package/dist/LayersPanel-BBQ54IVG.js +0 -7
  104. package/dist/ModuleCard-3TT2X7IW.js +0 -7
  105. package/dist/OrbInspector-K6T6O7GI.js +0 -27
  106. package/dist/OrbInspector-MHLJ6OEE.css +0 -1756
  107. package/dist/ServerBridge-Cm1On51b.d.ts +0 -233
  108. package/dist/TraitValueFrame-2PJGLLVI.js +0 -28
  109. package/dist/UISlotRenderer-JKFSX24W.js +0 -27
  110. package/dist/UISlotRenderer-KVFO6J7R.css +0 -1756
  111. package/dist/UserContext-DqWeZkUZ.d.ts +0 -100
  112. package/dist/avl-3d-context-BIRKWpaL.d.ts +0 -204
  113. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
  114. package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
  115. package/dist/chunk-2QOH2HWM.js +0 -95
  116. package/dist/chunk-6P3MWXYE.js +0 -440
  117. package/dist/chunk-B4BU77LT.js +0 -432
  118. package/dist/chunk-DJ433ET5.js +0 -1327
  119. package/dist/chunk-DZ42OJQC.js +0 -176
  120. package/dist/chunk-EOWMARUB.js +0 -16
  121. package/dist/chunk-FIW6WN23.js +0 -508
  122. package/dist/chunk-GAR5TQ5B.js +0 -199
  123. package/dist/chunk-PC7K4SK7.js +0 -1384
  124. package/dist/chunk-ZO6MXAS3.js +0 -69
  125. package/dist/kernel-client-ZH4PSMCN.js +0 -367
  126. package/dist/kernel-wire-B4S8pnP3.d.ts +0 -65
  127. package/dist/three/index.css +0 -503
  128. package/dist/three/index.d.ts +0 -1185
  129. package/dist/three/index.js +0 -3896
  130. package/dist/useKeyboardRouter-Dsq553Ur.d.ts +0 -42
  131. package/dist/verificationRegistry-CabxhfTv.d.ts +0 -122
@@ -1,100 +0,0 @@
1
- import React__default from 'react';
2
- import { UserContext as UserContext$1, FieldValue } from '@almadar/core';
3
-
4
- /**
5
- * UserContext
6
- *
7
- * React context for providing user data throughout the application.
8
- * Enables @user bindings in S-expressions for role-based UI and permissions.
9
- *
10
- * Usage:
11
- * ```tsx
12
- * // In App.tsx or layout
13
- * <UserProvider user={{ id: '123', role: 'admin', permissions: ['read', 'write'] }}>
14
- * <App />
15
- * </UserProvider>
16
- *
17
- * // In components - access via hook
18
- * const { user, hasRole, hasPermission } = useUser();
19
- * if (hasRole('admin')) { ... }
20
- * if (hasPermission('delete')) { ... }
21
- * ```
22
- *
23
- * @packageDocumentation
24
- */
25
-
26
- /**
27
- * User data for `@user` bindings — the canonical `UserContext` from
28
- * `@almadar/core`, kept under this name for existing consumers. Declaring the
29
- * shape locally let it drift from the type both execution paths resolve against.
30
- */
31
- type UserData = UserContext$1;
32
- /**
33
- * User context value.
34
- */
35
- interface UserContextValue {
36
- /** Current user data (null if not logged in) */
37
- user: UserData | null;
38
- /** Check if user is logged in */
39
- isLoggedIn: boolean;
40
- /** Check if user has a specific role */
41
- hasRole: (role: string) => boolean;
42
- /** Check if user has a specific permission */
43
- hasPermission: (permission: string) => boolean;
44
- /** Check if user has any of the specified roles */
45
- hasAnyRole: (roles: string[]) => boolean;
46
- /** Check if user has all of the specified permissions */
47
- hasAllPermissions: (permissions: string[]) => boolean;
48
- /** Get a user field by path (for @user.field bindings) */
49
- getUserField: (path: string) => FieldValue | undefined;
50
- }
51
- declare const UserContext: React__default.Context<UserContextValue | null>;
52
- interface UserProviderProps {
53
- /** User data (null if not logged in) */
54
- user?: UserData | null;
55
- /** Children to render */
56
- children: React__default.ReactNode;
57
- }
58
- /**
59
- * Provider component that provides user context to the application.
60
- *
61
- * Provides RBAC helpers and field access for @user bindings.
62
- */
63
- declare function UserProvider({ user, children, }: UserProviderProps): React__default.ReactElement;
64
- /**
65
- * Hook to access the user context.
66
- *
67
- * Returns default values if used outside of UserProvider (for resilience).
68
- *
69
- * @example
70
- * ```tsx
71
- * function AdminPanel() {
72
- * const { user, hasRole, hasPermission } = useUser();
73
- *
74
- * if (!hasRole('admin') && !hasPermission('admin:access')) {
75
- * return <AccessDenied />;
76
- * }
77
- *
78
- * return <div>Welcome, {user?.name}</div>;
79
- * }
80
- * ```
81
- */
82
- declare function useUser(): UserContextValue;
83
- /**
84
- * Hook to check if user has a specific role.
85
- * Convenience wrapper around useUser().hasRole().
86
- */
87
- declare function useHasRole(role: string): boolean;
88
- /**
89
- * Hook to check if user has a specific permission.
90
- * Convenience wrapper around useUser().hasPermission().
91
- */
92
- declare function useHasPermission(permission: string): boolean;
93
- /**
94
- * Hook to get user data for @user bindings in S-expressions.
95
- * Returns the user data object compatible with EvaluationContext.user
96
- */
97
- declare function useUserForEvaluation(): UserData | undefined;
98
-
99
- export { UserContext as U, UserProvider as c, useHasRole as e, useUser as f, useUserForEvaluation as g, useHasPermission as u };
100
- export type { UserContextValue as a, UserData as b, UserProviderProps as d };
@@ -1,204 +0,0 @@
1
- import * as React from 'react';
2
- import { QuadraticBezierCurve3 } from 'three';
3
-
4
- /**
5
- * avl-3d-layout.ts
6
- *
7
- * Pure math utilities for 3D positioning of AVL visualization nodes.
8
- * The 3D equivalent of avl-layout.ts (2D positioning helpers).
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- interface Position3D {
14
- x: number;
15
- y: number;
16
- z: number;
17
- }
18
- interface ExprTreeNode3D {
19
- label: string;
20
- type: 'operator' | 'literal' | 'binding';
21
- children?: ExprTreeNode3D[];
22
- }
23
- interface TreeLayoutResult {
24
- node: ExprTreeNode3D;
25
- position: Position3D;
26
- }
27
- /**
28
- * Theme roles for the 3D scenes. three.js cannot evaluate CSS, so scenes read
29
- * these through `useAvl3DPalette()` (resolved against the active theme).
30
- */
31
- declare const AVL_3D_COLORS: {
32
- readonly exprOperatorUnknown: "var(--color-muted-foreground)";
33
- readonly exprBinding: "var(--color-accent)";
34
- readonly exprLiteral: "var(--color-muted-foreground)";
35
- readonly effectUi: string;
36
- readonly effectData: string;
37
- readonly effectCommunication: string;
38
- readonly effectLifecycle: string;
39
- readonly effectControl: string;
40
- readonly effectAsync: string;
41
- readonly effectCompute: string;
42
- readonly effectSystem: string;
43
- readonly effectUnknown: "var(--color-muted-foreground)";
44
- readonly fieldParticle: "var(--color-foreground)";
45
- readonly lightAmbient: "var(--color-info)";
46
- readonly lightDirectional: string;
47
- readonly lightFill: string;
48
- readonly "op:arithmetic": string;
49
- readonly "op:comparison": string;
50
- readonly "op:logic": string;
51
- readonly "op:control": string;
52
- readonly "op:effect": string;
53
- readonly "op:collection": string;
54
- readonly "op:std-math": string;
55
- readonly "op:std-str": string;
56
- readonly "op:std-array": string;
57
- readonly "op:std-object": string;
58
- readonly "op:std-validate": string;
59
- readonly "op:std-json": string;
60
- readonly "op:std-csv": string;
61
- readonly "op:std-time": string;
62
- readonly "op:std-format": string;
63
- readonly "op:std-i18n": string;
64
- readonly "op:std-async": string;
65
- readonly "op:std-nn": string;
66
- readonly "op:std-tensor": string;
67
- readonly "op:std-train": string;
68
- readonly "op:std-prob": string;
69
- readonly "op:std-os": string;
70
- readonly "op:std-browser": string;
71
- readonly "op:std-composition": string;
72
- readonly "op:std-vec": string;
73
- readonly "op:std-geo": string;
74
- readonly "op:std-grid": string;
75
- readonly "op:std-anim": string;
76
- readonly "op:std-ease": string;
77
- readonly "op:std-noise": string;
78
- readonly "op:std-path": string;
79
- readonly "op:ml-arch": string;
80
- readonly "op:ml-effect": string;
81
- readonly "op:ml-tensor": string;
82
- readonly "op:ml-graph": string;
83
- readonly "op:ml-contract": string;
84
- readonly "op:ml-data": string;
85
- readonly "op:std-llm": string;
86
- readonly "op:std-workspace": string;
87
- readonly "op:std-session": string;
88
- readonly "op:std-memory": string;
89
- readonly "op:std-trace": string;
90
- readonly "op:std-behavior": string;
91
- readonly "op:std-behavior-value": string;
92
- readonly "op:std-program": string;
93
- readonly "op:std-integration": string;
94
- readonly orbitalSphere: "var(--color-card)";
95
- readonly orbitalRim: "var(--color-info)";
96
- readonly entityCore: "var(--color-warning)";
97
- readonly entityCoreGlow: string;
98
- readonly traitOrbit: "var(--color-info)";
99
- readonly traitOrbitHighlight: "var(--color-primary)";
100
- readonly stateIdle: "var(--color-muted)";
101
- readonly stateEdge: "var(--color-info)";
102
- readonly stateActive: "var(--color-primary)";
103
- readonly transitionArc: "var(--color-muted-foreground)";
104
- readonly transitionArcHover: "var(--color-primary)";
105
- readonly guardPass: "var(--color-success)";
106
- readonly guardFail: "var(--color-error)";
107
- readonly crossWire: "var(--color-accent)";
108
- readonly crossWireGlow: string;
109
- readonly pagePortal: "var(--color-success)";
110
- readonly background: "var(--color-background)";
111
- readonly backgroundSurface: "var(--color-card)";
112
- readonly fog: "var(--color-background)";
113
- readonly sparkle: "var(--color-info)";
114
- readonly sparkleWarm: "var(--color-warning)";
115
- readonly persistencePersistent: "var(--color-info)";
116
- readonly persistenceRuntime: "var(--color-success)";
117
- readonly persistenceUnknown: "var(--color-muted-foreground)";
118
- };
119
- /**
120
- * Positions N nodes on a golden-ratio spiral in the XZ plane (y=0).
121
- * Used as initial positions for the force-directed layout.
122
- */
123
- declare function goldenSpiralPositions(count: number, baseRadius: number): Position3D[];
124
- /**
125
- * Distributes N points on a sphere surface using Fibonacci lattice.
126
- * Produces near-uniform spacing regardless of count.
127
- */
128
- declare function fibonacciSpherePositions(count: number, radius: number): Position3D[];
129
- /**
130
- * Evenly spaces N points on a tilted ring (elliptical orbit).
131
- * `tilt` is the ring's inclination in radians relative to the XZ plane.
132
- */
133
- declare function orbitRingPositions(count: number, radius: number, tilt: number): Position3D[];
134
- /**
135
- * Creates a QuadraticBezierCurve3 between two 3D points with a control
136
- * point offset perpendicular to the from-to line. The offset direction
137
- * is computed in 3D using a cross product with the up vector.
138
- */
139
- declare function arcCurve3D(from: [number, number, number], to: [number, number, number], offset: number): QuadraticBezierCurve3;
140
- /**
141
- * Creates a loop curve above a point for self-transitions.
142
- */
143
- declare function selfLoopCurve3D(position: [number, number, number], loopRadius: number): QuadraticBezierCurve3;
144
- /**
145
- * Recursively positions an expression tree in 3D space.
146
- * Root at origin, children spread horizontally, depth goes downward (negative Y).
147
- */
148
- declare function treeLayout3D(node: ExprTreeNode3D, origin: Position3D, horizontalSpacing: number, verticalSpacing?: number): TreeLayoutResult[];
149
- declare const CAMERA_POSITIONS: {
150
- readonly application: {
151
- readonly position: [number, number, number];
152
- readonly target: [number, number, number];
153
- };
154
- readonly orbital: {
155
- readonly position: [number, number, number];
156
- readonly target: [number, number, number];
157
- };
158
- readonly trait: {
159
- readonly position: [number, number, number];
160
- readonly target: [number, number, number];
161
- };
162
- readonly transition: {
163
- readonly position: [number, number, number];
164
- readonly target: [number, number, number];
165
- };
166
- };
167
-
168
- interface Avl3DModelOverrides {
169
- /** GLB URL for orbital nodes (replaces sphere) */
170
- orbital?: string;
171
- /** GLB URL for entity core (replaces icosahedron) */
172
- entity?: string;
173
- /** GLB URL for state nodes (replaces sphere) */
174
- state?: string;
175
- /** GLB URL for guard gates (replaces octahedron) */
176
- guard?: string;
177
- /** GLB URL for page portals (replaces plane) */
178
- page?: string;
179
- }
180
- interface Avl3DConfig {
181
- /** Custom 3D model URLs to replace default primitive geometry */
182
- modelOverrides: Avl3DModelOverrides;
183
- /** Whether postprocessing effects are enabled */
184
- effectsEnabled: boolean;
185
- /**
186
- * AVL_3D_COLORS resolved against the active theme, for three.js materials
187
- * and lights (which cannot evaluate `var()`/`color-mix()` themselves).
188
- * Null until the viewer has resolved every token — descendants render only
189
- * once the Canvas that provides this context is mounted, so they can treat
190
- * a non-null palette as guaranteed.
191
- */
192
- palette: Readonly<Record<keyof typeof AVL_3D_COLORS, string>> | null;
193
- }
194
- declare const Avl3DContext: React.Context<Avl3DConfig>;
195
- /**
196
- * Access the current AVL 3D configuration.
197
- * Returns model overrides and effect settings.
198
- */
199
- declare function useAvl3DConfig(): Avl3DConfig;
200
- /** The theme-resolved AVL_3D_COLORS palette for three.js materials and lights. */
201
- declare function useAvl3DPalette(): Readonly<Record<keyof typeof AVL_3D_COLORS, string>> | null;
202
-
203
- export { CAMERA_POSITIONS as C, Avl3DContext as a, useAvl3DPalette as c, AVL_3D_COLORS as d, arcCurve3D as e, fibonacciSpherePositions as f, goldenSpiralPositions as g, orbitRingPositions as o, selfLoopCurve3D as s, treeLayout3D as t, useAvl3DConfig as u };
204
- export type { Avl3DConfig as A, Position3D as P, Avl3DModelOverrides as b };
@@ -1,132 +0,0 @@
1
- import { EntityPersistence, JsonObject, SExpr, OrbitalSchema, Trait } from '@almadar/core';
2
-
3
- /**
4
- * AVL Schema Parser
5
- *
6
- * Pure functions that transform an OrbitalSchema into structured data
7
- * for each zoom level of the Cosmic Zoom visualization.
8
- *
9
- * Imports all types from @almadar/core.
10
- *
11
- * @packageDocumentation
12
- */
13
-
14
- interface SerializedEffect extends JsonObject {
15
- type: string;
16
- args: SExpr[];
17
- }
18
- interface ApplicationOrbitalData {
19
- name: string;
20
- entityName: string;
21
- fieldCount: number;
22
- persistence: EntityPersistence;
23
- traitNames: string[];
24
- pageNames: string[];
25
- position: {
26
- x: number;
27
- y: number;
28
- };
29
- }
30
- interface CrossLink {
31
- emitterOrbital: string;
32
- listenerOrbital: string;
33
- eventName: string;
34
- emitterTrait: string;
35
- listenerTrait: string;
36
- }
37
- interface ApplicationLevelData {
38
- orbitals: ApplicationOrbitalData[];
39
- crossLinks: CrossLink[];
40
- }
41
- interface FieldInfo extends JsonObject {
42
- name: string;
43
- type: string;
44
- required: boolean;
45
- hasDefault: boolean;
46
- }
47
- interface OrbitalTraitInfo extends JsonObject {
48
- name: string;
49
- stateCount: number;
50
- eventCount: number;
51
- transitionCount: number;
52
- emits: string[];
53
- listens: string[];
54
- }
55
- interface OrbitalPageInfo extends JsonObject {
56
- name: string;
57
- route: string;
58
- }
59
- interface ExternalLink extends JsonObject {
60
- targetOrbital: string;
61
- eventName: string;
62
- direction: string;
63
- traitName: string;
64
- }
65
- interface OrbitalLevelData {
66
- name: string;
67
- entity: {
68
- name: string;
69
- fields: FieldInfo[];
70
- persistence: EntityPersistence;
71
- };
72
- traits: OrbitalTraitInfo[];
73
- pages: OrbitalPageInfo[];
74
- externalLinks: ExternalLink[];
75
- }
76
- interface TraitStateInfo extends JsonObject {
77
- name: string;
78
- isInitial: boolean | null;
79
- isTerminal: boolean | null;
80
- }
81
- interface TraitTransitionInfo extends JsonObject {
82
- from: string;
83
- to: string;
84
- event: string;
85
- /** `.orb` config data omits the key instead of carrying null. */
86
- guard: SExpr | null;
87
- effects: SerializedEffect[];
88
- index: number;
89
- }
90
- interface TraitLevelData extends JsonObject {
91
- name: string;
92
- linkedEntity: string;
93
- states: TraitStateInfo[];
94
- transitions: TraitTransitionInfo[];
95
- emittedEvents: string[];
96
- listenedEvents: string[];
97
- }
98
- interface ExprTreeNode {
99
- label: string;
100
- type: 'operator' | 'literal' | 'binding';
101
- children?: ExprTreeNode[];
102
- }
103
- interface SlotTarget {
104
- name: string;
105
- pattern: string;
106
- }
107
- interface TransitionLevelData {
108
- from: string;
109
- to: string;
110
- event: string;
111
- guard: ExprTreeNode | null;
112
- effects: ExprTreeNode[];
113
- slotTargets: SlotTarget[];
114
- }
115
- /**
116
- * Parse the application-level view: all orbitals with cross-orbital links.
117
- */
118
- declare function parseApplicationLevel(schema: OrbitalSchema): ApplicationLevelData;
119
- /**
120
- * Parse a single orbital's detail view.
121
- */
122
- declare function parseOrbitalLevel(schema: OrbitalSchema, orbitalName: string): OrbitalLevelData | null;
123
- declare function parseTraitLevel(schema: OrbitalSchema, orbitalName: string, traitName: string): TraitLevelData | null;
124
- /** One trait's state machine as AVL trait data; null when the trait has no state machine. */
125
- declare function traitLevelFromTrait(trait: Trait, linkedEntity: string): TraitLevelData | null;
126
- /**
127
- * Parse a single transition for the detail view.
128
- */
129
- declare function parseTransitionLevel(schema: OrbitalSchema, orbitalName: string, traitName: string, transitionIndex: number): TransitionLevelData | null;
130
-
131
- export { parseOrbitalLevel as e, parseTraitLevel as f, parseTransitionLevel as g, parseApplicationLevel as p, traitLevelFromTrait as t };
132
- export type { ApplicationLevelData as A, CrossLink as C, ExternalLink as E, FieldInfo as F, OrbitalTraitInfo as O, SerializedEffect as S, TraitLevelData as T, OrbitalPageInfo as a, OrbitalLevelData as b, TransitionLevelData as c, TraitTransitionInfo as d };
@@ -1,17 +0,0 @@
1
- /**
2
- * AVL Cosmic Zoom State Machine
3
- *
4
- * useReducer-based state machine managing which zoom level is displayed,
5
- * what is selected, and animation state.
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
- *
13
- * @packageDocumentation
14
- */
15
- type ZoomLevel = 'application' | 'orbital' | 'trait' | 'transition';
16
-
17
- export type { ZoomLevel as Z };
@@ -1,95 +0,0 @@
1
- import { TraitValueMountContext, OrbitalPluginHost, MountedInit } from './chunk-FIW6WN23.js';
2
- import { LoadingState, ErrorState, UISlotComponent, OrbPreview } from './chunk-GYTPOFVC.js';
3
- import { UISlotProvider } from './chunk-AILY3XPS.js';
4
- import { useContext, useMemo, useRef, useState, useEffect } from 'react';
5
- import { OrbitalSchemaSchema, defaultPage, isInlineTrait } from '@almadar/core';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
7
-
8
- function bridgeInbound(schema, listens, busEventOf = (event) => event) {
9
- const rows = [];
10
- for (const event of listens) {
11
- for (const orbital of schema.orbitals) {
12
- for (const trait of orbital.traits) {
13
- if (!isInlineTrait(trait)) continue;
14
- if (!trait.stateMachine?.transitions.some((t) => t.event === event)) continue;
15
- rows.push({ busEvent: busEventOf(event), orbital: orbital.name, trait: trait.name, trigger: event });
16
- }
17
- }
18
- }
19
- return rows;
20
- }
21
- function mountCarried(behavior, resolved) {
22
- let json;
23
- try {
24
- json = JSON.parse(resolved);
25
- } catch (error) {
26
- return { ok: false, error: `behavior ${behavior}: its resolved program is not JSON: ${String(error)}` };
27
- }
28
- const parsed = OrbitalSchemaSchema.safeParse(json);
29
- if (!parsed.success) return { ok: false, error: `behavior ${behavior}: its resolved program is not a program: ${parsed.error.message}` };
30
- const first = defaultPage(parsed.data)?.page.path;
31
- if (first === void 0) return { ok: false, error: `behavior ${behavior} has no page to open` };
32
- return { ok: true, mounted: { schema: parsed.data, firstPage: first } };
33
- }
34
- function BehaviorValueFrame({ value }) {
35
- const host = useContext(TraitValueMountContext);
36
- const key = useMemo(() => JSON.stringify(value), [value]);
37
- const latest = useRef(value);
38
- latest.current = value;
39
- const [state, setState] = useState({ status: "loading" });
40
- useEffect(() => {
41
- const current = latest.current;
42
- if (current.resolved !== void 0) {
43
- const carried = mountCarried(current.behavior, current.resolved);
44
- setState(carried.ok ? { status: "ready", mounted: carried.mounted } : { status: "error", message: carried.error });
45
- return;
46
- }
47
- const mountBehavior = host?.mountBehavior;
48
- if (mountBehavior === void 0) {
49
- setState({ status: "error", message: `This host cannot run behavior ${current.behavior}` });
50
- return;
51
- }
52
- let live = true;
53
- setState({ status: "loading" });
54
- void mountBehavior(current).then((result) => {
55
- if (!live) return;
56
- if (!result.ok) {
57
- const detail = (result.errors ?? []).map((e) => `${e.code}: ${e.message}`).join("\n");
58
- setState({ status: "error", message: detail.length > 0 ? `${result.error}
59
- ${detail}` : result.error });
60
- return;
61
- }
62
- setState({ status: "ready", mounted: result.mounted });
63
- });
64
- return () => {
65
- live = false;
66
- };
67
- }, [host, key]);
68
- if (state.status === "loading") return /* @__PURE__ */ jsx(LoadingState, {});
69
- if (state.status === "error") return /* @__PURE__ */ jsx(ErrorState, { message: state.message });
70
- if (value.bridge !== void 0) {
71
- const initEvent = `BEHAVIOR_VALUE_MOUNTED:${key}`;
72
- const plugin = {
73
- id: key,
74
- schema: state.mounted.schema,
75
- inbound: [...bridgeInbound(state.mounted.schema, value.bridge.listens), ...bridgeInbound(state.mounted.schema, ["INIT"], () => initEvent)],
76
- outbound: value.bridge.emits
77
- };
78
- return /* @__PURE__ */ jsx(UISlotProvider, { children: /* @__PURE__ */ jsxs(OrbitalPluginHost, { plugins: [plugin], mode: host?.mode ?? "mock", transport: host?.transport, children: [
79
- /* @__PURE__ */ jsx(MountedInit, { event: initEvent }),
80
- /* @__PURE__ */ jsx(UISlotComponent, { slot: "main" })
81
- ] }) });
82
- }
83
- return /* @__PURE__ */ jsx(
84
- OrbPreview,
85
- {
86
- schema: state.mounted.schema,
87
- initialPagePath: state.mounted.firstPage,
88
- isolated: true,
89
- ...host?.behaviorTransport !== void 0 ? { transport: host.behaviorTransport } : {}
90
- }
91
- );
92
- }
93
- var BehaviorValueFrame_default = BehaviorValueFrame;
94
-
95
- export { BehaviorValueFrame, BehaviorValueFrame_default };