@creact-labs/creact 0.1.8 → 0.2.1

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 (146) hide show
  1. package/README.md +85 -22
  2. package/dist/cli.d.ts +11 -0
  3. package/dist/cli.js +88 -0
  4. package/dist/index.d.ts +19 -44
  5. package/dist/index.js +20 -68
  6. package/dist/jsx/index.d.ts +2 -0
  7. package/dist/jsx/index.js +1 -0
  8. package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
  9. package/dist/jsx/jsx-dev-runtime.js +4 -0
  10. package/dist/jsx/jsx-runtime.d.ts +38 -0
  11. package/dist/jsx/jsx-runtime.js +38 -0
  12. package/dist/jsx/types.d.ts +12 -0
  13. package/dist/jsx/types.js +4 -0
  14. package/dist/primitives/context.d.ts +34 -0
  15. package/dist/primitives/context.js +63 -0
  16. package/dist/primitives/index.d.ts +3 -0
  17. package/dist/primitives/index.js +3 -0
  18. package/dist/primitives/instance.d.ts +72 -0
  19. package/dist/primitives/instance.js +235 -0
  20. package/dist/primitives/store.d.ts +22 -0
  21. package/dist/primitives/store.js +97 -0
  22. package/dist/provider/backend.d.ts +110 -0
  23. package/dist/provider/backend.js +37 -0
  24. package/dist/provider/interface.d.ts +48 -0
  25. package/dist/provider/interface.js +39 -0
  26. package/dist/reactive/effect.d.ts +11 -0
  27. package/dist/reactive/effect.js +42 -0
  28. package/dist/reactive/index.d.ts +3 -0
  29. package/dist/reactive/index.js +3 -0
  30. package/dist/reactive/signal.d.ts +32 -0
  31. package/dist/reactive/signal.js +60 -0
  32. package/dist/reactive/tracking.d.ts +41 -0
  33. package/dist/reactive/tracking.js +161 -0
  34. package/dist/runtime/fiber.d.ts +21 -0
  35. package/dist/runtime/fiber.js +16 -0
  36. package/dist/runtime/index.d.ts +4 -0
  37. package/dist/runtime/index.js +4 -0
  38. package/dist/runtime/reconcile.d.ts +66 -0
  39. package/dist/runtime/reconcile.js +210 -0
  40. package/dist/runtime/render.d.ts +42 -0
  41. package/dist/runtime/render.js +231 -0
  42. package/dist/runtime/run.d.ts +119 -0
  43. package/dist/runtime/run.js +334 -0
  44. package/dist/runtime/state-machine.d.ts +95 -0
  45. package/dist/runtime/state-machine.js +209 -0
  46. package/dist/types.d.ts +13 -0
  47. package/dist/types.js +4 -0
  48. package/package.json +29 -24
  49. package/dist/cli/commands/BuildCommand.d.ts +0 -40
  50. package/dist/cli/commands/BuildCommand.js +0 -151
  51. package/dist/cli/commands/DeployCommand.d.ts +0 -38
  52. package/dist/cli/commands/DeployCommand.js +0 -194
  53. package/dist/cli/commands/DevCommand.d.ts +0 -52
  54. package/dist/cli/commands/DevCommand.js +0 -394
  55. package/dist/cli/commands/PlanCommand.d.ts +0 -39
  56. package/dist/cli/commands/PlanCommand.js +0 -164
  57. package/dist/cli/commands/index.d.ts +0 -36
  58. package/dist/cli/commands/index.js +0 -43
  59. package/dist/cli/core/ArgumentParser.d.ts +0 -46
  60. package/dist/cli/core/ArgumentParser.js +0 -127
  61. package/dist/cli/core/BaseCommand.d.ts +0 -75
  62. package/dist/cli/core/BaseCommand.js +0 -95
  63. package/dist/cli/core/CLIContext.d.ts +0 -68
  64. package/dist/cli/core/CLIContext.js +0 -183
  65. package/dist/cli/core/CommandRegistry.d.ts +0 -64
  66. package/dist/cli/core/CommandRegistry.js +0 -89
  67. package/dist/cli/core/index.d.ts +0 -36
  68. package/dist/cli/core/index.js +0 -43
  69. package/dist/cli/index.d.ts +0 -35
  70. package/dist/cli/index.js +0 -100
  71. package/dist/cli/output.d.ts +0 -204
  72. package/dist/cli/output.js +0 -437
  73. package/dist/cli/utils.d.ts +0 -59
  74. package/dist/cli/utils.js +0 -76
  75. package/dist/context/createContext.d.ts +0 -90
  76. package/dist/context/createContext.js +0 -113
  77. package/dist/context/index.d.ts +0 -30
  78. package/dist/context/index.js +0 -35
  79. package/dist/core/CReact.d.ts +0 -409
  80. package/dist/core/CReact.js +0 -1151
  81. package/dist/core/CloudDOMBuilder.d.ts +0 -447
  82. package/dist/core/CloudDOMBuilder.js +0 -1234
  83. package/dist/core/ContextDependencyTracker.d.ts +0 -165
  84. package/dist/core/ContextDependencyTracker.js +0 -448
  85. package/dist/core/ErrorRecoveryManager.d.ts +0 -145
  86. package/dist/core/ErrorRecoveryManager.js +0 -443
  87. package/dist/core/EventBus.d.ts +0 -91
  88. package/dist/core/EventBus.js +0 -185
  89. package/dist/core/ProviderOutputTracker.d.ts +0 -211
  90. package/dist/core/ProviderOutputTracker.js +0 -476
  91. package/dist/core/ReactiveUpdateQueue.d.ts +0 -76
  92. package/dist/core/ReactiveUpdateQueue.js +0 -121
  93. package/dist/core/Reconciler.d.ts +0 -415
  94. package/dist/core/Reconciler.js +0 -1044
  95. package/dist/core/RenderScheduler.d.ts +0 -153
  96. package/dist/core/RenderScheduler.js +0 -519
  97. package/dist/core/Renderer.d.ts +0 -336
  98. package/dist/core/Renderer.js +0 -944
  99. package/dist/core/Runtime.d.ts +0 -246
  100. package/dist/core/Runtime.js +0 -640
  101. package/dist/core/StateBindingManager.d.ts +0 -121
  102. package/dist/core/StateBindingManager.js +0 -309
  103. package/dist/core/StateMachine.d.ts +0 -441
  104. package/dist/core/StateMachine.js +0 -883
  105. package/dist/core/StructuralChangeDetector.d.ts +0 -140
  106. package/dist/core/StructuralChangeDetector.js +0 -363
  107. package/dist/core/Validator.d.ts +0 -127
  108. package/dist/core/Validator.js +0 -279
  109. package/dist/core/errors.d.ts +0 -153
  110. package/dist/core/errors.js +0 -202
  111. package/dist/core/index.d.ts +0 -38
  112. package/dist/core/index.js +0 -64
  113. package/dist/core/types.d.ts +0 -265
  114. package/dist/core/types.js +0 -48
  115. package/dist/hooks/context.d.ts +0 -147
  116. package/dist/hooks/context.js +0 -334
  117. package/dist/hooks/useContext.d.ts +0 -113
  118. package/dist/hooks/useContext.js +0 -169
  119. package/dist/hooks/useEffect.d.ts +0 -105
  120. package/dist/hooks/useEffect.js +0 -540
  121. package/dist/hooks/useInstance.d.ts +0 -139
  122. package/dist/hooks/useInstance.js +0 -455
  123. package/dist/hooks/useState.d.ts +0 -120
  124. package/dist/hooks/useState.js +0 -298
  125. package/dist/jsx.d.ts +0 -143
  126. package/dist/jsx.js +0 -76
  127. package/dist/providers/DummyBackendProvider.d.ts +0 -193
  128. package/dist/providers/DummyBackendProvider.js +0 -189
  129. package/dist/providers/DummyCloudProvider.d.ts +0 -128
  130. package/dist/providers/DummyCloudProvider.js +0 -157
  131. package/dist/providers/IBackendProvider.d.ts +0 -177
  132. package/dist/providers/IBackendProvider.js +0 -31
  133. package/dist/providers/ICloudProvider.d.ts +0 -230
  134. package/dist/providers/ICloudProvider.js +0 -31
  135. package/dist/providers/index.d.ts +0 -31
  136. package/dist/providers/index.js +0 -31
  137. package/dist/test-event-callbacks.d.ts +0 -0
  138. package/dist/test-event-callbacks.js +0 -1
  139. package/dist/utils/Logger.d.ts +0 -144
  140. package/dist/utils/Logger.js +0 -220
  141. package/dist/utils/Output.d.ts +0 -161
  142. package/dist/utils/Output.js +0 -401
  143. package/dist/utils/deepEqual.d.ts +0 -71
  144. package/dist/utils/deepEqual.js +0 -276
  145. package/dist/utils/naming.d.ts +0 -241
  146. package/dist/utils/naming.js +0 -376
@@ -1,447 +0,0 @@
1
- /**
2
-
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
-
5
- * you may not use this file except in compliance with the License.
6
-
7
- * You may obtain a copy of the License at
8
-
9
- *
10
-
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- *
14
-
15
- * Unless required by applicable law or agreed to in writing, software
16
-
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
-
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
-
21
- * See the License for the specific language governing permissions and
22
-
23
- * limitations under the License.
24
-
25
- *
26
-
27
- * Copyright 2025 Daniel Coutinho Ribeiro
28
-
29
- */
30
- import { FiberNode, CloudDOMNode, OutputChange } from './types';
31
- import { ICloudProvider } from '../providers/ICloudProvider';
32
- import { StateBindingManager } from './StateBindingManager';
33
- import { ProviderOutputTracker } from './ProviderOutputTracker';
34
- import { ContextDependencyTracker } from './ContextDependencyTracker';
35
- /**
36
- * CloudDOMBuilder transforms a Fiber tree into a CloudDOM tree
37
- *
38
- * The CloudDOM tree represents actual cloud resources to be deployed:
39
- * - Only includes components that called useInstance (have cloudDOMNode attached)
40
- * - Filters out container components (no useInstance)
41
- * - Builds parent-child relationships for deployment order
42
- * - Generates resource IDs from hierarchical paths
43
- *
44
- * REQ-01: JSX → CloudDOM rendering
45
- * REQ-04: Receives ICloudProvider via dependency injection (not used in build, but available for future extensions)
46
- */
47
- export declare class CloudDOMBuilder {
48
- private cloudProvider;
49
- /**
50
- * Optional lifecycle hooks for integration with other components
51
- * Supports async hooks for validation, telemetry, and provider preparation
52
- */
53
- private beforeBuildHook?;
54
- private afterBuildHook?;
55
- /**
56
- * State binding manager for reactive output synchronization
57
- */
58
- private stateBindingManager?;
59
- /**
60
- * Provider output tracker for instance-output binding
61
- */
62
- private providerOutputTracker?;
63
- /**
64
- * Context dependency tracker for context reactivity
65
- */
66
- private contextDependencyTracker?;
67
- /**
68
- * Track existing nodes to handle re-render scenarios
69
- * Maps node ID to fiber path for duplicate detection during re-renders
70
- */
71
- private existingNodeMap;
72
- /**
73
- * Constructor receives ICloudProvider via dependency injection
74
- *
75
- * REQ-04: Dependency injection pattern - provider is injected, not inherited
76
- *
77
- * @param cloudProvider - Cloud provider implementation (injected)
78
- */
79
- constructor(cloudProvider: ICloudProvider);
80
- /**
81
- * Set lifecycle hooks for integration with other components
82
- *
83
- * Supports async hooks for:
84
- * - beforeBuild: Validation, pre-processing, telemetry
85
- * - afterBuild: Provider preparation, post-processing, logging
86
- *
87
- * Example:
88
- * ```typescript
89
- * builder.setHooks({
90
- * beforeBuild: async fiber => validator.validate(fiber),
91
- * afterBuild: async tree => cloudProvider.prepare(tree),
92
- * });
93
- * ```
94
- *
95
- * @param hooks - Optional lifecycle hooks (sync or async)
96
- */
97
- setHooks(hooks: {
98
- beforeBuild?: (fiber: FiberNode) => void | Promise<void>;
99
- afterBuild?: (rootNodes: CloudDOMNode[]) => void | Promise<void>;
100
- }): void;
101
- /**
102
- * Set reactive components for output synchronization
103
- *
104
- * @param stateBindingManager - State binding manager instance
105
- * @param providerOutputTracker - Provider output tracker instance
106
- * @param contextDependencyTracker - Context dependency tracker instance (optional)
107
- */
108
- setReactiveComponents(stateBindingManager: StateBindingManager, providerOutputTracker: ProviderOutputTracker, contextDependencyTracker?: ContextDependencyTracker): void;
109
- /**
110
- * Build CloudDOM tree from Fiber tree
111
- *
112
- * Traverses the Fiber tree and collects nodes that have cloudDOMNode attached
113
- * (i.e., components that called useInstance). Container components without
114
- * useInstance are filtered out, but their children are preserved.
115
- *
116
- * Supports async lifecycle hooks for validation and provider preparation.
117
- *
118
- * CRITICAL FIX: Preserves nodes from previousCloudDOM that weren't re-rendered.
119
- * This prevents node loss during selective re-renders (e.g., multi-environment apps).
120
- *
121
- * REQ-01: Transform Fiber → CloudDOM
122
- *
123
- * @param fiber - Root Fiber node
124
- * @param previousCloudDOM - Optional previous CloudDOM for incremental builds
125
- * @returns Promise resolving to array of CloudDOM nodes (top-level resources)
126
- */
127
- build(fiber: FiberNode, previousCloudDOM?: CloudDOMNode[]): Promise<CloudDOMNode[]>;
128
- /**
129
- * Flatten CloudDOM tree into a flat array of all nodes
130
- *
131
- * @param nodes - Root CloudDOM nodes
132
- * @returns Flattened array of all nodes
133
- */
134
- private flattenCloudDOM;
135
- /**
136
- * Build CloudDOM tree with error handling for CLI/CI environments
137
- *
138
- * Provides a safer entrypoint that handles errors gracefully without
139
- * crashing the entire process. Useful for CI/CD pipelines.
140
- *
141
- * @param fiber - Root Fiber node
142
- * @param previousCloudDOM - Optional previous CloudDOM for incremental builds
143
- * @returns Promise resolving to array of CloudDOM nodes, or empty array on error
144
- */
145
- buildSafe(fiber: FiberNode, previousCloudDOM?: CloudDOMNode[]): Promise<CloudDOMNode[]>;
146
- /**
147
- * Recursively collect CloudDOM nodes from Fiber tree
148
- *
149
- * Traverses the Fiber tree depth-first and collects all nodes that have
150
- * cloudDOMNode or cloudDOMNodes attached (i.e., components that called useInstance).
151
- *
152
- * Normalizes paths and IDs during collection for consistency.
153
- *
154
- * @param fiber - Current Fiber node
155
- * @param collected - Array to collect CloudDOM nodes into
156
- */
157
- private collectCloudDOMNodes;
158
- /**
159
- * Extract state from useState hooks in a Fiber node
160
- *
161
- * REQ-02: Extract outputs from useState calls
162
- * REQ-06: Universal output access
163
- * REQ-2.1: Store useState values without 'state.' prefix
164
- *
165
- * @param fiber - Fiber node to extract state from
166
- * @returns Object mapping state keys to values (state1, state2, etc.)
167
- */
168
- private extractOutputsFromFiber;
169
- /**
170
- * Execute post-deployment effects for all Fiber nodes
171
- * Called after successful deployment to run useEffect callbacks
172
- *
173
- * @param fiber - Root Fiber node
174
- */
175
- executePostDeploymentEffects(fiber: FiberNode): Promise<void>;
176
- /**
177
- * Sync Fiber hook state back to CloudDOM outputs after effects run
178
- * This ensures useState changes in useEffect are reflected in the CloudDOM
179
- *
180
- * @param fiber - Root Fiber node
181
- * @param cloudDOM - CloudDOM nodes to update
182
- */
183
- syncFiberStateToCloudDOM(fiber: FiberNode, cloudDOM: CloudDOMNode[]): void;
184
- /**
185
- * Sync a single Fiber node's state to its corresponding CloudDOM node
186
- */
187
- private syncFiberNodeToCloudDOM;
188
- /**
189
- * Update a CloudDOM node's state with the latest Fiber hook state
190
- *
191
- * REQ-1.2, 1.3: Separate useState values from provider outputs
192
- * State is stored in separate `state` field, not in `outputs`
193
- */
194
- private updateCloudDOMNodeOutputs;
195
- /**
196
- * Sync state back to the original CloudDOM nodes that components reference
197
- * This ensures that enhanced node proxies see the updated state
198
- */
199
- private syncOutputsToOriginalNodes;
200
- /**
201
- * Type guard to validate CloudDOM node structure
202
- *
203
- * @param node - Potential CloudDOM node
204
- * @returns True if node is a valid CloudDOM node
205
- */
206
- private isValidCloudNode;
207
- /**
208
- * Validate CloudDOM nodes for common issues
209
- *
210
- * Checks for:
211
- * - Duplicate IDs (would cause silent overwrites in hierarchy building)
212
- * - Invalid paths (empty or non-array)
213
- * - Circular references in paths
214
- *
215
- * Enhanced for re-render scenarios:
216
- * - Allows re-validation of existing nodes from the same fiber path
217
- * - Prevents false positives during reactive re-renders
218
- *
219
- * @param nodes - CloudDOM nodes to validate
220
- * @throws Error if duplicate IDs or circular references are found
221
- */
222
- private validateCloudDOMNodes;
223
- /**
224
- * Create deep defensive copy of CloudDOM nodes to avoid mutation
225
- *
226
- * Recursively copies:
227
- * - Node properties
228
- * - Props object
229
- * - Outputs object
230
- * - Children array (deep copy)
231
- *
232
- * This prevents mutations from later phases (e.g., provider injection,
233
- * dependency graph tagging) from affecting the original nodes.
234
- *
235
- * @param nodes - Original CloudDOM nodes
236
- * @returns Deep copy of nodes
237
- */
238
- private createDeepDefensiveCopy;
239
- /**
240
- * Build parent-child hierarchy from flat list of CloudDOM nodes
241
- *
242
- * Uses the path property to determine parent-child relationships:
243
- * - A node is a child of another if its path starts with the parent's path
244
- * - Returns only root nodes (nodes with no parent)
245
- *
246
- * Example:
247
- * - ['registry'] is root
248
- * - ['registry', 'service'] is child of ['registry']
249
- * - ['registry', 'service', 'task'] is child of ['registry', 'service']
250
- *
251
- * Optimization: Groups nodes by depth for O(n) parent lookup instead of O(n²)
252
- *
253
- * @param nodes - Flat array of CloudDOM nodes
254
- * @returns Array of root CloudDOM nodes with children attached
255
- */
256
- private buildHierarchy;
257
- /**
258
- * Find the parent node for a given node (optimized version)
259
- *
260
- * A node is the parent if:
261
- * 1. Its path is a prefix of the child's path
262
- * 2. Its path length is exactly one less than the child's path length (immediate parent)
263
- *
264
- * Example:
265
- * - Child path: ['registry', 'service', 'task']
266
- * - Parent path: ['registry', 'service'] ✓ (immediate parent)
267
- * - Not parent: ['registry'] ✗ (grandparent, not immediate)
268
- *
269
- * Optimization: Uses nodesByDepth map to only search nodes at parent depth (O(n) instead of O(n²))
270
- *
271
- * @param node - Node to find parent for
272
- * @param nodesByDepth - Map of nodes grouped by path depth
273
- * @returns Parent node or undefined if no parent
274
- */
275
- private findParentOptimized;
276
- /**
277
- * Get the cloud provider (for testing/debugging)
278
- *
279
- * @returns The injected cloud provider
280
- */
281
- getCloudProvider(): ICloudProvider;
282
- /**
283
- * Convert CloudDOM tree to flat map for debugging and backend storage
284
- *
285
- * Useful for:
286
- * - Backend state providers that need flat ID → node mapping
287
- * - Debugging and inspection
288
- * - Quick lookups by ID
289
- *
290
- * Type-safe: Preserves node subtype information for provider-specific extensions
291
- *
292
- * @param rootNodes - Root CloudDOM nodes
293
- * @returns Flat map of ID → CloudDOM node
294
- */
295
- toFlatMap<T extends CloudDOMNode = CloudDOMNode>(rootNodes: T[]): Record<string, T>;
296
- /**
297
- * Normalize path segments for consistent resource addressing
298
- *
299
- * Ensures consistent casing and formatting across environments:
300
- * - Trims whitespace
301
- * - Converts to lowercase
302
- * - Replaces slashes and spaces with hyphens
303
- *
304
- * REQ-NF: Future safety for cross-OS consistency
305
- *
306
- * @param path - Path segments to normalize
307
- * @returns Normalized path segments
308
- */
309
- private normalizePath;
310
- /**
311
- * Format path for human-readable error messages
312
- *
313
- * @param node - CloudDOM node
314
- * @returns Formatted path string (e.g., "registry > service > task")
315
- */
316
- private formatPath;
317
- /**
318
- * Detect circular references in CloudDOM hierarchy
319
- *
320
- * Uses depth-first search to detect cycles in parent-child relationships.
321
- * This is a graph-level safety check beyond simple path validation.
322
- *
323
- * @param nodes - Root CloudDOM nodes
324
- * @throws Error if circular hierarchy is detected
325
- */
326
- private detectCircularRefs;
327
- /**
328
- * Build efficient node map for CloudDOM comparison
329
- * Creates a flat map of node ID to node for fast lookup during comparison
330
- * Handles nested node structures properly
331
- *
332
- * REQ-1.4, 9.1: Efficient map building for CloudDOM comparison
333
- *
334
- * @param nodes - CloudDOM nodes to map
335
- * @returns Map of node ID to CloudDOM node
336
- */
337
- private buildNodeMap;
338
- /**
339
- * Detect output changes after deployment by comparing previous and current CloudDOM
340
- * This is called after deployment to identify which provider outputs have changed
341
- *
342
- * Enhanced to:
343
- * - Compare previous and current CloudDOM states properly
344
- * - Identify specific output keys that changed
345
- * - Track affected fibers for each change
346
- *
347
- * REQ-1.4, 1.5, 9.1, 9.2, 9.3: Enhanced output change detection
348
- *
349
- * @param previous - Previous CloudDOM state
350
- * @param current - Current CloudDOM state after deployment
351
- * @returns Array of output changes detected
352
- */
353
- detectOutputChanges(previous: CloudDOMNode[], current: CloudDOMNode[]): OutputChange[];
354
- /**
355
- * Synchronize provider outputs to bound state and trigger re-renders
356
- * This is the main method called after deployment to update reactive state
357
- *
358
- * @param fiber - Root fiber node
359
- * @param cloudDOM - Current CloudDOM after deployment
360
- * @param previousCloudDOM - Previous CloudDOM state (optional)
361
- * @returns Promise resolving to affected fibers that need re-rendering
362
- */
363
- syncOutputsAndReRender(fiber: FiberNode, cloudDOM: CloudDOMNode[], previousCloudDOM?: CloudDOMNode[]): Promise<FiberNode[]>;
364
- /**
365
- * Sync CloudDOM outputs to the original nodes that components reference
366
- * This is critical for reactivity to work - components need to see updated outputs
367
- */
368
- private syncCloudDOMOutputsToOriginalNodes;
369
- /**
370
- * Recursively sync outputs to original nodes in the fiber tree
371
- */
372
- private syncOutputsToOriginalNodesRecursive;
373
- /**
374
- * Update context provider values when outputs change
375
- * This enables context reactivity by finding components that create context values from outputs
376
- *
377
- * Strategy:
378
- * 1. Find all fibers that have both cloudDOMNodes (use outputs) AND render a Context.Provider child
379
- * 2. These are the components that create context values from outputs
380
- * 3. Mark them for re-render so they re-evaluate their context values
381
- *
382
- * @param fiber - Root fiber to search
383
- * @returns Array of fibers that need re-rendering (components creating context values from outputs)
384
- */
385
- private updateContextProviderValues;
386
- /**
387
- * Recursively find components that create context values from outputs
388
- * These are components that:
389
- * 1. Have cloudDOMNodes (use useInstance - depend on outputs)
390
- * 2. Have children that are Context.Provider components
391
- */
392
- private findContextValueCreators;
393
- /**
394
- * Apply output changes to bound state using StateBindingManager
395
- * This updates useState values that are bound to provider outputs
396
- *
397
- * Enhanced to:
398
- * - Apply detected changes to bound state via StateBindingManager
399
- * - Handle binding updates without creating loops
400
- * - Return affected fibers for re-rendering
401
- *
402
- * REQ-9.4, 9.5: Apply output changes to state and return affected fibers
403
- *
404
- * @param changes - Array of output changes to apply
405
- * @returns Array of fibers affected by the changes
406
- */
407
- applyOutputChangesToState(changes: OutputChange[]): FiberNode[];
408
- /**
409
- * Execute reactive effects for fibers affected by output changes
410
- * This triggers useEffect callbacks that depend on changed provider outputs
411
- *
412
- * @param affectedFibers - Fibers that were affected by output changes
413
- * @param changes - Output changes that occurred
414
- */
415
- private executeReactiveEffects;
416
- /**
417
- * Integrate with post-deployment effects to trigger output synchronization
418
- * This method should be called after deployment completes
419
- *
420
- * Phase ordering (REQ-1.1, 1.2, 1.5):
421
- * 1. Sync outputs to original nodes BEFORE executing effects
422
- * 2. Execute effects (they can now see updated outputs)
423
- * 3. Sync outputs and trigger re-renders for reactive changes
424
- * 4. Sync state changes back to CloudDOM
425
- *
426
- * @param fiber - Root fiber node
427
- * @param cloudDOM - Current CloudDOM after deployment
428
- * @param previousCloudDOM - Previous CloudDOM state (optional)
429
- * @returns Promise resolving to affected fibers that need re-rendering
430
- */
431
- integrateWithPostDeploymentEffects(fiber: FiberNode, cloudDOM: CloudDOMNode[], previousCloudDOM?: CloudDOMNode[]): Promise<FiberNode[]>;
432
- /**
433
- * Clear the existing node map (for testing or fresh builds)
434
- * This allows starting with a clean slate for node validation
435
- */
436
- clearExistingNodes(): void;
437
- /**
438
- * Get the existing node map (for debugging/inspection)
439
- * Returns a copy to prevent external mutation
440
- */
441
- getExistingNodes(): Map<string, string>;
442
- /**
443
- * Create a JSON replacer function that handles Symbols safely
444
- * Converts Symbols to their string representation for debugging
445
- */
446
- private createSymbolReplacer;
447
- }