@coherent.js/core 1.0.0-beta.2 → 1.0.0-beta.3

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 (104) hide show
  1. package/dist/coherent.d.ts +10 -150
  2. package/dist/coherent.d.ts.map +1 -1
  3. package/dist/coherent.js +33 -166
  4. package/dist/coherent.js.map +1 -1
  5. package/dist/components/component-system.js +109 -109
  6. package/dist/core/html-utils.js +5 -5
  7. package/dist/core/object-factory.js +21 -21
  8. package/dist/core/object-utils.js +2 -2
  9. package/dist/database/adapters/mongodb.d.ts +15 -0
  10. package/dist/database/adapters/mongodb.d.ts.map +1 -0
  11. package/dist/database/adapters/mongodb.js +216 -0
  12. package/dist/database/adapters/mongodb.js.map +1 -0
  13. package/dist/database/adapters/mysql.d.ts +12 -0
  14. package/dist/database/adapters/mysql.d.ts.map +1 -0
  15. package/dist/database/adapters/mysql.js +171 -0
  16. package/dist/database/adapters/mysql.js.map +1 -0
  17. package/dist/database/adapters/postgresql.d.ts +12 -0
  18. package/dist/database/adapters/postgresql.d.ts.map +1 -0
  19. package/dist/database/adapters/postgresql.js +177 -0
  20. package/dist/database/adapters/postgresql.js.map +1 -0
  21. package/dist/database/adapters/sqlite.d.ts +15 -0
  22. package/dist/database/adapters/sqlite.d.ts.map +1 -0
  23. package/dist/database/adapters/sqlite.js +241 -0
  24. package/dist/database/adapters/sqlite.js.map +1 -0
  25. package/dist/database/connection-manager.d.ts +135 -0
  26. package/dist/database/connection-manager.d.ts.map +1 -0
  27. package/dist/database/connection-manager.js +362 -0
  28. package/dist/database/connection-manager.js.map +1 -0
  29. package/dist/database/index.d.ts +38 -0
  30. package/dist/database/index.d.ts.map +1 -0
  31. package/dist/database/index.js +60 -0
  32. package/dist/database/index.js.map +1 -0
  33. package/dist/database/middleware.d.ts +122 -0
  34. package/dist/database/middleware.d.ts.map +1 -0
  35. package/dist/database/middleware.js +390 -0
  36. package/dist/database/middleware.js.map +1 -0
  37. package/dist/database/migration.d.ts +62 -0
  38. package/dist/database/migration.d.ts.map +1 -0
  39. package/dist/database/migration.js +423 -0
  40. package/dist/database/migration.js.map +1 -0
  41. package/dist/database/model.d.ts +8 -0
  42. package/dist/database/model.d.ts.map +1 -0
  43. package/dist/database/model.js +167 -0
  44. package/dist/database/model.js.map +1 -0
  45. package/dist/database/query-builder.d.ts +111 -0
  46. package/dist/database/query-builder.d.ts.map +1 -0
  47. package/dist/database/query-builder.js +187 -0
  48. package/dist/database/query-builder.js.map +1 -0
  49. package/dist/database/utils.d.ts +196 -0
  50. package/dist/database/utils.d.ts.map +1 -0
  51. package/dist/database/utils.js +372 -0
  52. package/dist/database/utils.js.map +1 -0
  53. package/dist/dev/dev-tools.d.ts +1 -1
  54. package/dist/dev/dev-tools.js +28 -28
  55. package/dist/performance/bundle-optimizer.js +11 -11
  56. package/dist/performance/cache-manager.js +6 -6
  57. package/dist/performance/monitor.js +10 -10
  58. package/dist/performance/monitor.js.map +1 -1
  59. package/dist/rendering/base-renderer.js +13 -13
  60. package/dist/rendering/dom-renderer.d.ts +0 -23
  61. package/dist/rendering/dom-renderer.d.ts.map +1 -1
  62. package/dist/rendering/dom-renderer.js +9 -77
  63. package/dist/rendering/dom-renderer.js.map +1 -1
  64. package/dist/rendering/html-renderer.d.ts +0 -15
  65. package/dist/rendering/html-renderer.d.ts.map +1 -1
  66. package/dist/rendering/html-renderer.js +4 -85
  67. package/dist/rendering/html-renderer.js.map +1 -1
  68. package/dist/rendering/streaming-renderer.js +12 -12
  69. package/dist/utils/dependency-utils.js +2 -2
  70. package/dist/utils/normalization.js +1 -1
  71. package/dist/utils/validation.js +1 -1
  72. package/package.json +1 -1
  73. package/dist/components/lifecycle.d.ts +0 -212
  74. package/dist/components/lifecycle.d.ts.map +0 -1
  75. package/dist/components/lifecycle.js +0 -525
  76. package/dist/components/lifecycle.js.map +0 -1
  77. package/dist/forms/validation.d.ts +0 -271
  78. package/dist/forms/validation.d.ts.map +0 -1
  79. package/dist/forms/validation.js +0 -573
  80. package/dist/forms/validation.js.map +0 -1
  81. package/dist/performance/component-cache.d.ts +0 -120
  82. package/dist/performance/component-cache.d.ts.map +0 -1
  83. package/dist/performance/component-cache.js +0 -364
  84. package/dist/performance/component-cache.js.map +0 -1
  85. package/dist/rendering/css-manager.d.ts +0 -73
  86. package/dist/rendering/css-manager.d.ts.map +0 -1
  87. package/dist/rendering/css-manager.js +0 -176
  88. package/dist/rendering/css-manager.js.map +0 -1
  89. package/dist/rendering/vdom-diff.d.ts +0 -47
  90. package/dist/rendering/vdom-diff.d.ts.map +0 -1
  91. package/dist/rendering/vdom-diff.js +0 -416
  92. package/dist/rendering/vdom-diff.js.map +0 -1
  93. package/dist/routing/router.d.ts +0 -241
  94. package/dist/routing/router.d.ts.map +0 -1
  95. package/dist/routing/router.js +0 -648
  96. package/dist/routing/router.js.map +0 -1
  97. package/dist/state/reactive-state.d.ts +0 -166
  98. package/dist/state/reactive-state.d.ts.map +0 -1
  99. package/dist/state/reactive-state.js +0 -546
  100. package/dist/state/reactive-state.js.map +0 -1
  101. package/dist/utils/error-handler.d.ts +0 -148
  102. package/dist/utils/error-handler.d.ts.map +0 -1
  103. package/dist/utils/error-handler.js +0 -468
  104. package/dist/utils/error-handler.js.map +0 -1
@@ -33,7 +33,7 @@ export class StreamingRenderer extends BaseRenderer {
33
33
  * Main streaming render method
34
34
  */
35
35
  async *render(component, options = {}) {
36
- const _config = { ...this.config, ...options };
36
+ const config = { ...this.config, ...options };
37
37
  this.metrics.startTime = performance.now();
38
38
  try {
39
39
  // Validate input if requested
@@ -48,9 +48,9 @@ export class StreamingRenderer extends BaseRenderer {
48
48
  this.buffer = '';
49
49
  }
50
50
  }
51
- catch (error) {
52
- // Stream error information
53
- yield this.createErrorChunk(error);
51
+ catch (_error) {
52
+ // Stream _error information
53
+ yield this.createErrorChunk(_error);
54
54
  }
55
55
  finally {
56
56
  this.metrics.endTime = performance.now();
@@ -99,7 +99,7 @@ export class StreamingRenderer extends BaseRenderer {
99
99
  // Opening tag
100
100
  let openTag = `<${tagName}`;
101
101
  // Add attributes
102
- const attributes = this.utils.extractAttributes(_props);
102
+ const attributes = this.utils.extractAttributes(props);
103
103
  if (attributes) {
104
104
  openTag += ` ${attributes}`;
105
105
  }
@@ -113,7 +113,7 @@ export class StreamingRenderer extends BaseRenderer {
113
113
  yield* this.streamText(escapeHtml(String(text)));
114
114
  }
115
115
  // Handle children
116
- if (hasChildren(_props)) {
116
+ if (hasChildren(props)) {
117
117
  const children = normalizeChildren(props.children);
118
118
  for (const child of children) {
119
119
  yield* this.streamComponent(child, config, depth);
@@ -158,13 +158,13 @@ export class StreamingRenderer extends BaseRenderer {
158
158
  return chunk;
159
159
  }
160
160
  /**
161
- * Create an error chunk
161
+ * Create an _error chunk
162
162
  */
163
- createErrorChunk(error) {
164
- return this.createChunk(`<!-- Streaming Error: ${error.message} -->`, {
165
- error: true,
166
- errorMessage: error.message,
167
- errorStack: error.stack
163
+ createErrorChunk(_error) {
164
+ return this.createChunk(`<!-- Streaming Error: ${_error.message} -->`, {
165
+ _error: true,
166
+ errorMessage: _error.message,
167
+ errorStack: _error.stack
168
168
  });
169
169
  }
170
170
  /**
@@ -17,7 +17,7 @@ export function isPeerDependencyAvailable(packageName) {
17
17
  }
18
18
  }
19
19
  /**
20
- * Dynamically import a peer dependency with error handling
20
+ * Dynamically import a peer dependency with _error handling
21
21
  * @param {string} packageName - Name of the package to import
22
22
  * @param {string} integrationName - Human-readable name of the integration
23
23
  * @returns {Promise<any>} - The imported module
@@ -62,7 +62,7 @@ export function createLazyIntegration(packageName, integrationName, createIntegr
62
62
  };
63
63
  }
64
64
  /**
65
- * Check multiple peer dependencies and provide helpful error messages
65
+ * Check multiple peer dependencies and provide helpful _error messages
66
66
  * @param {Array<{package: string, integration: string}>} dependencies - List of dependencies to check
67
67
  * @returns {Object} - Object with availability status for each dependency
68
68
  */
@@ -1,5 +1,5 @@
1
1
  // src/utils/normalization.js
2
- export function normalizeProps(_props) {
2
+ export function normalizeProps(props) {
3
3
  if (!props || typeof props !== 'object') {
4
4
  return {};
5
5
  }
@@ -23,7 +23,7 @@ function validateComponent(componentFunction) {
23
23
  }
24
24
  return true;
25
25
  }
26
- function validateProps(_props) {
26
+ function validateProps(props) {
27
27
  if (props && typeof props !== 'object') {
28
28
  throw new Error('Props must be an object');
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coherent.js/core",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Core runtime for Coherent.js (SSR framework).",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -1,212 +0,0 @@
1
- /**
2
- * Lifecycle hooks factory
3
- */
4
- export function createLifecycleHooks(): {};
5
- export function getCurrentInstance(): any;
6
- export function setCurrentInstance(instance: any): void;
7
- /**
8
- * Component decorator for automatic lifecycle management
9
- */
10
- export function withLifecycle(component: any, options?: {}): (props?: {}) => any;
11
- export namespace LIFECYCLE_PHASES {
12
- let BEFORE_CREATE: string;
13
- let CREATED: string;
14
- let BEFORE_MOUNT: string;
15
- let MOUNTED: string;
16
- let BEFORE_UPDATE: string;
17
- let UPDATED: string;
18
- let BEFORE_UNMOUNT: string;
19
- let UNMOUNTED: string;
20
- let ERROR: string;
21
- }
22
- /**
23
- * Component lifecycle manager
24
- */
25
- export class ComponentLifecycle {
26
- constructor(component: any, options?: {});
27
- component: any;
28
- id: string;
29
- options: {};
30
- phase: any;
31
- hooks: Map<any, any>;
32
- state: ReactiveState;
33
- props: {};
34
- context: {};
35
- isMounted: boolean;
36
- isDestroyed: boolean;
37
- children: Set<any>;
38
- parent: any;
39
- eventHandlers: Map<any, any>;
40
- timers: Set<any>;
41
- subscriptions: Set<any>;
42
- /**
43
- * Generate unique component ID
44
- */
45
- generateId(): string;
46
- /**
47
- * Add lifecycle hook
48
- */
49
- hook(phase: any, callback: any): this;
50
- /**
51
- * Execute hooks for a specific phase
52
- */
53
- executeHook(phase: any, ...args: any[]): Promise<void>;
54
- /**
55
- * Handle component errors
56
- */
57
- handleError(error: any, phase: any): void;
58
- /**
59
- * Mount component
60
- */
61
- mount(container: any, props?: {}): Promise<void>;
62
- container: any;
63
- /**
64
- * Update component
65
- */
66
- update(newProps?: {}): Promise<void>;
67
- /**
68
- * Unmount component
69
- */
70
- unmount(): Promise<void>;
71
- /**
72
- * Add child component
73
- */
74
- addChild(child: any): void;
75
- /**
76
- * Remove child component
77
- */
78
- removeChild(child: any): void;
79
- /**
80
- * Add event listener with automatic cleanup
81
- */
82
- addEventListener(element: any, event: any, listener: any, options?: {}): () => void;
83
- /**
84
- * Add subscription with automatic cleanup
85
- */
86
- addSubscription(unsubscribe: any): any;
87
- /**
88
- * Set timer with automatic cleanup
89
- */
90
- setTimeout(callback: any, delay: any): NodeJS.Timeout;
91
- setInterval(callback: any, interval: any): NodeJS.Timeout;
92
- /**
93
- * Get component statistics
94
- */
95
- getStats(): {
96
- id: string;
97
- phase: any;
98
- isMounted: boolean;
99
- isDestroyed: boolean;
100
- childCount: number;
101
- eventHandlers: number;
102
- subscriptions: number;
103
- timers: number;
104
- state: {
105
- stateKeys: number;
106
- computedKeys: number;
107
- watcherKeys: number;
108
- historyLength: number;
109
- middlewareCount: number;
110
- };
111
- };
112
- }
113
- /**
114
- * Event system for components
115
- */
116
- export class ComponentEventSystem {
117
- events: Map<any, any>;
118
- globalHandlers: Map<any, any>;
119
- /**
120
- * Emit event to component or globally
121
- */
122
- emit(eventName: any, data?: {}, target?: null): {
123
- name: any;
124
- data: {};
125
- target: null;
126
- timestamp: number;
127
- stopped: boolean;
128
- preventDefault: boolean;
129
- };
130
- /**
131
- * Listen for events on component or globally
132
- */
133
- on(eventName: any, handler: any, componentId?: null): () => void;
134
- /**
135
- * Remove event handler
136
- */
137
- off(eventName: any, handler: any, componentId?: null): void;
138
- /**
139
- * Listen once
140
- */
141
- once(eventName: any, handler: any, componentId?: null): () => void;
142
- /**
143
- * Notify component handlers
144
- */
145
- _notifyHandlers(componentId: any, event: any): void;
146
- /**
147
- * Notify global handlers
148
- */
149
- _notifyGlobalHandlers(event: any): void;
150
- /**
151
- * Clean up events for a component
152
- */
153
- cleanup(componentId: any): void;
154
- /**
155
- * Get event statistics
156
- */
157
- getStats(): {
158
- componentEvents: number;
159
- globalEvents: number;
160
- totalHandlers: any;
161
- };
162
- }
163
- /**
164
- * Global event system instance
165
- */
166
- export const eventSystem: ComponentEventSystem;
167
- /**
168
- * Lifecycle hooks for direct use
169
- */
170
- export const useHooks: {};
171
- export namespace componentUtils {
172
- /**
173
- * Get component lifecycle instance
174
- */
175
- function getLifecycle(component: any): any;
176
- /**
177
- * Create component with lifecycle
178
- */
179
- function createWithLifecycle(component: any, options?: {}): {
180
- component: any;
181
- lifecycle: ComponentLifecycle;
182
- mount: (container: any, props?: {}) => Promise<void>;
183
- unmount: () => Promise<void>;
184
- update: (newProps?: {}) => Promise<void>;
185
- };
186
- /**
187
- * Get all component instances
188
- */
189
- function getAllInstances(): any[];
190
- /**
191
- * Find component by ID
192
- */
193
- function findById(id: any): any;
194
- /**
195
- * Emit event to component
196
- */
197
- function emit(component: any, eventName: any, data: any): {
198
- name: any;
199
- data: {};
200
- target: null;
201
- timestamp: number;
202
- stopped: boolean;
203
- preventDefault: boolean;
204
- };
205
- /**
206
- * Listen to component events
207
- */
208
- function listen(component: any, eventName: any, handler: any): () => void;
209
- }
210
- export default ComponentLifecycle;
211
- import { ReactiveState } from '../state/reactive-state.js';
212
- //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/components/lifecycle.js"],"names":[],"mappings":"AAoeA;;GAEG;AACH,2CAcC;AAOD,0CAEC;AAED,wDAEC;AA8DD;;GAEG;AACH,8DACuC,UAAU,SAchD;;;;;;;;;;;;AArjBD;;GAEG;AACH;IACI,0CAwBC;IAvBG,eAA0B;IAC1B,WAA2B;IAC3B,YAAsB;IACt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