@creact-labs/creact 0.1.8 → 0.2.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 (146) hide show
  1. package/README.md +73 -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 +11 -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
package/dist/cli/utils.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
- /**
3
-
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
-
6
- * you may not use this file except in compliance with the License.
7
-
8
- * You may obtain a copy of the License at
9
-
10
- *
11
-
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
-
14
- *
15
-
16
- * Unless required by applicable law or agreed to in writing, software
17
-
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
-
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
-
22
- * See the License for the specific language governing permissions and
23
-
24
- * limitations under the License.
25
-
26
- *
27
-
28
- * Copyright 2025 Daniel Coutinho Ribeiro
29
-
30
- */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.logVerbose = logVerbose;
33
- exports.formatError = formatError;
34
- exports.outputJson = outputJson;
35
- const output_1 = require("./output");
36
- const Logger_1 = require("../utils/Logger");
37
- const logger = Logger_1.LoggerFactory.getLogger('cli');
38
- /**
39
- * Log message if verbose mode is enabled
40
- *
41
- * @param message - Message to log
42
- * @param verbose - Whether verbose mode is enabled
43
- */
44
- function logVerbose(message, verbose = false) {
45
- if (verbose || process.env.CREACT_VERBOSE === 'true') {
46
- logger.debug(output_1.colors.dim(`[verbose] ${message}`));
47
- }
48
- }
49
- /**
50
- * Format error for CLI output
51
- *
52
- * @param error - Error to format
53
- * @param verbose - Whether to include stack trace
54
- * @returns Formatted error message
55
- */
56
- function formatError(error, verbose = false) {
57
- let message = output_1.colors.error(`Error: ${error.message}`);
58
- if (verbose && error.stack) {
59
- message += `\n\n${output_1.colors.dim('Stack trace:')}\n${output_1.colors.dim(error.stack)}`;
60
- }
61
- return message;
62
- }
63
- /**
64
- * Output data in JSON format if --json flag is set
65
- *
66
- * @param data - Data to output
67
- * @param ctx - Command context
68
- * @returns true if JSON output was used, false otherwise
69
- */
70
- function outputJson(data, ctx) {
71
- if (ctx.flags.json) {
72
- logger.info(JSON.stringify(data, null, 2));
73
- return true;
74
- }
75
- return false;
76
- }
@@ -1,90 +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
- /**
31
- * Context object returned by createContext
32
- * Contains Provider and Consumer components for sharing values down the component tree
33
- */
34
- export interface Context<T> {
35
- /** Unique symbol to identify this context */
36
- _contextId: symbol;
37
- /** Default value when no Provider is found */
38
- defaultValue?: T;
39
- /** Provider component to supply context value */
40
- Provider: (props: {
41
- value: T;
42
- children?: any;
43
- }) => any;
44
- /** Consumer component to consume context value (alternative to useContext) */
45
- Consumer: (props: {
46
- children: (value: T) => any;
47
- }) => any;
48
- }
49
- /**
50
- * Create a typed context object (like React.createContext)
51
- *
52
- * Returns a context object with Provider and Consumer components.
53
- * Use with useContext hook to access values from the nearest Provider.
54
- *
55
- * REQ-02: Stack Context (declarative outputs)
56
- *
57
- * @param defaultValue - Optional default value when no Provider exists
58
- * @returns Context object with Provider and Consumer
59
- *
60
- * @example
61
- * ```tsx
62
- * // Create a typed context
63
- * interface RegistryOutputs {
64
- * repositoryUrl?: string;
65
- * repositoryArn?: string;
66
- * }
67
- *
68
- * const RegistryContext = createContext<RegistryOutputs>({});
69
- *
70
- * // Provider component
71
- * function RegistryStack({ children }) {
72
- * const repo = useInstance(EcrRepository, { key: 'repo', name: 'my-app' });
73
- * const [repositoryUrl, setRepositoryUrl] = useState();
74
- * const [repositoryArn, setRepositoryArn] = useState();
75
- *
76
- * const outputs = { repositoryUrl, repositoryArn };
77
- * return <RegistryContext.Provider value={outputs}>{children}</RegistryContext.Provider>;
78
- * }
79
- *
80
- * // Consumer component
81
- * function Service() {
82
- * const { repositoryUrl } = useContext(RegistryContext);
83
- * const service = useInstance(AppRunnerService, {
84
- * image: `${repositoryUrl}:latest`
85
- * });
86
- * return <></>;
87
- * }
88
- * ```
89
- */
90
- export declare function createContext<T>(defaultValue?: T): Context<T>;
@@ -1,113 +0,0 @@
1
- "use strict";
2
- /**
3
-
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
-
6
- * you may not use this file except in compliance with the License.
7
-
8
- * You may obtain a copy of the License at
9
-
10
- *
11
-
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
-
14
- *
15
-
16
- * Unless required by applicable law or agreed to in writing, software
17
-
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
-
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
-
22
- * See the License for the specific language governing permissions and
23
-
24
- * limitations under the License.
25
-
26
- *
27
-
28
- * Copyright 2025 Daniel Coutinho Ribeiro
29
-
30
- */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.createContext = createContext;
33
- /**
34
- * Create a typed context object (like React.createContext)
35
- *
36
- * Returns a context object with Provider and Consumer components.
37
- * Use with useContext hook to access values from the nearest Provider.
38
- *
39
- * REQ-02: Stack Context (declarative outputs)
40
- *
41
- * @param defaultValue - Optional default value when no Provider exists
42
- * @returns Context object with Provider and Consumer
43
- *
44
- * @example
45
- * ```tsx
46
- * // Create a typed context
47
- * interface RegistryOutputs {
48
- * repositoryUrl?: string;
49
- * repositoryArn?: string;
50
- * }
51
- *
52
- * const RegistryContext = createContext<RegistryOutputs>({});
53
- *
54
- * // Provider component
55
- * function RegistryStack({ children }) {
56
- * const repo = useInstance(EcrRepository, { key: 'repo', name: 'my-app' });
57
- * const [repositoryUrl, setRepositoryUrl] = useState();
58
- * const [repositoryArn, setRepositoryArn] = useState();
59
- *
60
- * const outputs = { repositoryUrl, repositoryArn };
61
- * return <RegistryContext.Provider value={outputs}>{children}</RegistryContext.Provider>;
62
- * }
63
- *
64
- * // Consumer component
65
- * function Service() {
66
- * const { repositoryUrl } = useContext(RegistryContext);
67
- * const service = useInstance(AppRunnerService, {
68
- * image: `${repositoryUrl}:latest`
69
- * });
70
- * return <></>;
71
- * }
72
- * ```
73
- */
74
- function createContext(defaultValue) {
75
- // Create unique symbol to identify this context
76
- const contextId = Symbol('Context');
77
- /**
78
- * Provider component - Supplies context value to descendants
79
- *
80
- * @param props.value - Value to provide to descendants
81
- * @param props.children - Child components
82
- */
83
- const Provider = (props) => {
84
- // Provider is a pass-through component that just returns its children
85
- // The Renderer will recognize it by the metadata on the function and store the context value in the Fiber
86
- // The props will be preserved in the Fiber node, including _contextId and _contextValue
87
- return props.children;
88
- };
89
- // Mark Provider with context metadata for Renderer to recognize
90
- Provider._isContextProvider = true;
91
- Provider._contextId = contextId;
92
- /**
93
- * Consumer component - Consumes context value (alternative to useContext)
94
- *
95
- * @param props.children - Render function that receives context value
96
- */
97
- const Consumer = (props) => {
98
- // Consumer is a placeholder - useContext hook will handle the actual lookup
99
- // The render function will be called by the Renderer with the context value
100
- return props.children;
101
- };
102
- // Mark Consumer with context metadata
103
- Consumer._isContextConsumer = true;
104
- Consumer._contextId = contextId;
105
- // Return context object
106
- const context = {
107
- _contextId: contextId,
108
- defaultValue,
109
- Provider,
110
- Consumer,
111
- };
112
- return context;
113
- }
@@ -1,30 +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
- export { createContext, Context } from './createContext';
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /**
3
-
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
-
6
- * you may not use this file except in compliance with the License.
7
-
8
- * You may obtain a copy of the License at
9
-
10
- *
11
-
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
-
14
- *
15
-
16
- * Unless required by applicable law or agreed to in writing, software
17
-
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
-
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
-
22
- * See the License for the specific language governing permissions and
23
-
24
- * limitations under the License.
25
-
26
- *
27
-
28
- * Copyright 2025 Daniel Coutinho Ribeiro
29
-
30
- */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.createContext = void 0;
33
- // REQ-02: Context API exports
34
- var createContext_1 = require("./createContext");
35
- Object.defineProperty(exports, "createContext", { enumerable: true, get: function () { return createContext_1.createContext; } });