@coherent.js/core 1.0.0-beta.2
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/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/coherent.d.ts +472 -0
- package/dist/coherent.d.ts.map +1 -0
- package/dist/coherent.js +590 -0
- package/dist/coherent.js.map +1 -0
- package/dist/components/component-system.d.ts +1138 -0
- package/dist/components/component-system.d.ts.map +1 -0
- package/dist/components/component-system.js +2220 -0
- package/dist/components/component-system.js.map +1 -0
- package/dist/components/lifecycle.d.ts +212 -0
- package/dist/components/lifecycle.d.ts.map +1 -0
- package/dist/components/lifecycle.js +525 -0
- package/dist/components/lifecycle.js.map +1 -0
- package/dist/core/html-utils.d.ts +14 -0
- package/dist/core/html-utils.d.ts.map +1 -0
- package/dist/core/html-utils.js +166 -0
- package/dist/core/html-utils.js.map +1 -0
- package/dist/core/object-factory.d.ts +38 -0
- package/dist/core/object-factory.d.ts.map +1 -0
- package/dist/core/object-factory.js +63 -0
- package/dist/core/object-factory.js.map +1 -0
- package/dist/core/object-utils.d.ts +77 -0
- package/dist/core/object-utils.d.ts.map +1 -0
- package/dist/core/object-utils.js +502 -0
- package/dist/core/object-utils.js.map +1 -0
- package/dist/dev/dev-tools.d.ts +194 -0
- package/dist/dev/dev-tools.d.ts.map +1 -0
- package/dist/dev/dev-tools.js +846 -0
- package/dist/dev/dev-tools.js.map +1 -0
- package/dist/forms/validation.d.ts +271 -0
- package/dist/forms/validation.d.ts.map +1 -0
- package/dist/forms/validation.js +573 -0
- package/dist/forms/validation.js.map +1 -0
- package/dist/index.cjs +5281 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +5204 -0
- package/dist/index.js.map +7 -0
- package/dist/performance/bundle-optimizer.d.ts +95 -0
- package/dist/performance/bundle-optimizer.d.ts.map +1 -0
- package/dist/performance/bundle-optimizer.js +192 -0
- package/dist/performance/bundle-optimizer.js.map +1 -0
- package/dist/performance/cache-manager.d.ts +107 -0
- package/dist/performance/cache-manager.d.ts.map +1 -0
- package/dist/performance/cache-manager.js +314 -0
- package/dist/performance/cache-manager.js.map +1 -0
- package/dist/performance/component-cache.d.ts +120 -0
- package/dist/performance/component-cache.d.ts.map +1 -0
- package/dist/performance/component-cache.js +364 -0
- package/dist/performance/component-cache.js.map +1 -0
- package/dist/performance/monitor.d.ts +189 -0
- package/dist/performance/monitor.d.ts.map +1 -0
- package/dist/performance/monitor.js +347 -0
- package/dist/performance/monitor.js.map +1 -0
- package/dist/rendering/base-renderer.d.ts +140 -0
- package/dist/rendering/base-renderer.d.ts.map +1 -0
- package/dist/rendering/base-renderer.js +409 -0
- package/dist/rendering/base-renderer.js.map +1 -0
- package/dist/rendering/css-manager.d.ts +73 -0
- package/dist/rendering/css-manager.d.ts.map +1 -0
- package/dist/rendering/css-manager.js +176 -0
- package/dist/rendering/css-manager.js.map +1 -0
- package/dist/rendering/dom-renderer.d.ts +62 -0
- package/dist/rendering/dom-renderer.d.ts.map +1 -0
- package/dist/rendering/dom-renderer.js +252 -0
- package/dist/rendering/dom-renderer.js.map +1 -0
- package/dist/rendering/html-renderer.d.ts +67 -0
- package/dist/rendering/html-renderer.d.ts.map +1 -0
- package/dist/rendering/html-renderer.js +444 -0
- package/dist/rendering/html-renderer.js.map +1 -0
- package/dist/rendering/renderer-config.d.ts +282 -0
- package/dist/rendering/renderer-config.d.ts.map +1 -0
- package/dist/rendering/renderer-config.js +144 -0
- package/dist/rendering/renderer-config.js.map +1 -0
- package/dist/rendering/streaming-renderer.d.ts +117 -0
- package/dist/rendering/streaming-renderer.d.ts.map +1 -0
- package/dist/rendering/streaming-renderer.js +326 -0
- package/dist/rendering/streaming-renderer.js.map +1 -0
- package/dist/rendering/vdom-diff.d.ts +47 -0
- package/dist/rendering/vdom-diff.d.ts.map +1 -0
- package/dist/rendering/vdom-diff.js +416 -0
- package/dist/rendering/vdom-diff.js.map +1 -0
- package/dist/routing/router.d.ts +241 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/routing/router.js +648 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/state/reactive-state.d.ts +166 -0
- package/dist/state/reactive-state.d.ts.map +1 -0
- package/dist/state/reactive-state.js +546 -0
- package/dist/state/reactive-state.js.map +1 -0
- package/dist/state/state-manager.d.ts +45 -0
- package/dist/state/state-manager.d.ts.map +1 -0
- package/dist/state/state-manager.js +151 -0
- package/dist/state/state-manager.js.map +1 -0
- package/dist/types/constants.d.ts +8 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/constants.js +36 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/utils/dependency-utils.d.ts +43 -0
- package/dist/utils/dependency-utils.d.ts.map +1 -0
- package/dist/utils/dependency-utils.js +105 -0
- package/dist/utils/dependency-utils.js.map +1 -0
- package/dist/utils/error-handler.d.ts +148 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +468 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/normalization.d.ts +3 -0
- package/dist/utils/normalization.d.ts.map +1 -0
- package/dist/utils/normalization.js +24 -0
- package/dist/utils/normalization.js.map +1 -0
- package/dist/utils/validation.d.ts +10 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +32 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +44 -0
- package/types/index.d.ts +734 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Thomas Drouvin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @coherent.js/core
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@coherent.js/core)
|
|
4
|
+
[](../../LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
|
|
7
|
+
Core runtime for Coherent.js — an object-based SSR framework focused on performance, streaming, and simplicity.
|
|
8
|
+
|
|
9
|
+
- ESM-only, Node 20+
|
|
10
|
+
- Pure object rendering to HTML
|
|
11
|
+
- Optional CSS-like scoping for component encapsulation
|
|
12
|
+
- Component system utilities, error boundaries, and performance hooks
|
|
13
|
+
|
|
14
|
+
For a high-level overview and repository-wide instructions, see the root README: ../../README.md
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add @coherent.js/core
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requirements:
|
|
23
|
+
- Node.js >= 20
|
|
24
|
+
- ESM module system
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
JavaScript (ESM):
|
|
29
|
+
```js
|
|
30
|
+
import { renderToString } from '@coherent.js/core';
|
|
31
|
+
|
|
32
|
+
const html = await renderToString({
|
|
33
|
+
div: { class: 'greeting', text: 'Hello Coherent' }
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
console.log(html);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
TypeScript:
|
|
40
|
+
```ts
|
|
41
|
+
import { renderToString } from '@coherent.js/core';
|
|
42
|
+
|
|
43
|
+
async function main() {
|
|
44
|
+
const html = await renderToString({
|
|
45
|
+
div: { class: 'greeting', text: 'Hello Coherent (TS)' }
|
|
46
|
+
});
|
|
47
|
+
console.log(html);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
main();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Exports overview
|
|
54
|
+
|
|
55
|
+
The package uses conditional exports; in development it may resolve to `src` while production resolves to `dist`.
|
|
56
|
+
|
|
57
|
+
Key APIs (selected):
|
|
58
|
+
- Rendering
|
|
59
|
+
- `renderToString(input, options?)`
|
|
60
|
+
- `render(input)` (alias of `renderToString`)
|
|
61
|
+
- `renderScopedComponent(input)` – applies scoped attributes and style processing
|
|
62
|
+
- `renderUnsafe(input)` – render without encapsulation
|
|
63
|
+
- Component system (re-exported from internal modules)
|
|
64
|
+
- `createComponent`, `defineComponent`, `registerComponent`, `getComponent`, `getRegisteredComponents`
|
|
65
|
+
- State helpers: `withState`, `withStateUtils`, `createStateManager`
|
|
66
|
+
- Lazy: `lazy`, `isLazy`, `evaluateLazy`
|
|
67
|
+
- Error boundaries (selected)
|
|
68
|
+
- `createErrorBoundary`, `withErrorBoundary`, `createAsyncErrorBoundary`
|
|
69
|
+
- `createGlobalErrorHandler`, `GlobalErrorHandler`
|
|
70
|
+
|
|
71
|
+
Tip: When working in the monorepo website/dev flow, imports can resolve to `src` via `exports.development`.
|
|
72
|
+
|
|
73
|
+
## Minimal component example
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
import { createComponent, renderToString } from '@coherent.js/core';
|
|
77
|
+
|
|
78
|
+
const Counter = createComponent(({ count = 0 }) => ({
|
|
79
|
+
div: {
|
|
80
|
+
class: 'counter',
|
|
81
|
+
children: [
|
|
82
|
+
{ span: { text: `Count: ${count}` } }
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
const html = await renderToString(Counter({ count: 2 }));
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
TypeScript:
|
|
91
|
+
```ts
|
|
92
|
+
import { createComponent, renderToString } from '@coherent.js/core';
|
|
93
|
+
|
|
94
|
+
type Props = { count?: number };
|
|
95
|
+
|
|
96
|
+
const Counter = createComponent((props: Props) => ({
|
|
97
|
+
div: {
|
|
98
|
+
class: 'counter',
|
|
99
|
+
children: [ { span: { text: `Count: ${props.count ?? 0}` } } ]
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
const html = await renderToString(Counter({ count: 2 }));
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
Run tests for this package:
|
|
109
|
+
```bash
|
|
110
|
+
pnpm --filter @coherent.js/core run test
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Watch mode:
|
|
114
|
+
```bash
|
|
115
|
+
pnpm --filter @coherent.js/core run test:watch
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Type check:
|
|
119
|
+
```bash
|
|
120
|
+
pnpm --filter @coherent.js/core run typecheck
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Build (from package dir or via workspace filter):
|
|
124
|
+
```bash
|
|
125
|
+
pnpm --filter @coherent.js/core run build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT © Coherent.js Team
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience function to create a Coherent instance
|
|
3
|
+
*/
|
|
4
|
+
export function createCoherent(options?: {}): Coherent;
|
|
5
|
+
/**
|
|
6
|
+
* Default instance for quick usage
|
|
7
|
+
*/
|
|
8
|
+
export const coherent: Coherent;
|
|
9
|
+
export namespace server {
|
|
10
|
+
export { renderToString as render };
|
|
11
|
+
export { renderBatch };
|
|
12
|
+
export { renderToChunks as chunk };
|
|
13
|
+
export { createStreamingRenderer as stream };
|
|
14
|
+
export { performanceMonitor };
|
|
15
|
+
}
|
|
16
|
+
export namespace components {
|
|
17
|
+
export { createComponent };
|
|
18
|
+
export { withState };
|
|
19
|
+
export { withProps };
|
|
20
|
+
export { memo };
|
|
21
|
+
export { lazy };
|
|
22
|
+
export { validateComponent };
|
|
23
|
+
export { isCoherentObject };
|
|
24
|
+
}
|
|
25
|
+
export namespace utils {
|
|
26
|
+
export { extractProps };
|
|
27
|
+
export { hasChildren };
|
|
28
|
+
export { normalizeChildren };
|
|
29
|
+
export { deepClone };
|
|
30
|
+
export { escapeHtml };
|
|
31
|
+
export { isVoidElement };
|
|
32
|
+
export { formatAttributes };
|
|
33
|
+
export { minifyHtml };
|
|
34
|
+
export { mergeProps };
|
|
35
|
+
export { getNestedValue };
|
|
36
|
+
export { setNestedValue };
|
|
37
|
+
export { cssUtils };
|
|
38
|
+
}
|
|
39
|
+
export namespace performance {
|
|
40
|
+
export { performanceMonitor };
|
|
41
|
+
export { createCacheManager };
|
|
42
|
+
export { getCache };
|
|
43
|
+
export { resetCache };
|
|
44
|
+
export { getRenderingStats };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Version and build information
|
|
48
|
+
*/
|
|
49
|
+
export const VERSION: "1.0.0";
|
|
50
|
+
export const BUILD_DATE: string;
|
|
51
|
+
export const FEATURES: string;
|
|
52
|
+
export default Coherent;
|
|
53
|
+
/**
|
|
54
|
+
* Main Coherent Framework Class
|
|
55
|
+
* Provides a unified interface to all framework capabilities
|
|
56
|
+
*/
|
|
57
|
+
export class Coherent {
|
|
58
|
+
constructor(options?: {});
|
|
59
|
+
options: {
|
|
60
|
+
enableCache: boolean;
|
|
61
|
+
enableMonitoring: boolean;
|
|
62
|
+
enableDevTools: boolean;
|
|
63
|
+
cacheSize: any;
|
|
64
|
+
cacheTTL: any;
|
|
65
|
+
maxDepth: any;
|
|
66
|
+
minify: any;
|
|
67
|
+
};
|
|
68
|
+
cache: Object | undefined;
|
|
69
|
+
componentCache: import("./performance/component-cache.js").ComponentCache | undefined;
|
|
70
|
+
state: import("./state/reactive-state.js").ReactiveState;
|
|
71
|
+
router: import("./routing/router.js").Router | undefined;
|
|
72
|
+
errorHandler: any;
|
|
73
|
+
devTools: DevTools | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Primary render method - converts components to HTML
|
|
76
|
+
*/
|
|
77
|
+
render(component: any, options?: {}): string;
|
|
78
|
+
/**
|
|
79
|
+
* Alias for render method (for clarity)
|
|
80
|
+
*/
|
|
81
|
+
renderToString(component: any, options?: {}): string;
|
|
82
|
+
/**
|
|
83
|
+
* Batch rendering for multiple components
|
|
84
|
+
*/
|
|
85
|
+
renderBatch(components: any, options?: {}): string[];
|
|
86
|
+
/**
|
|
87
|
+
* Streaming render for large components
|
|
88
|
+
*/
|
|
89
|
+
stream(component: any, options?: {}): AsyncGenerator<any, void, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Create a streaming renderer instance
|
|
92
|
+
*/
|
|
93
|
+
createStreamingRenderer(options?: {}): import("./rendering/streaming-renderer.js").StreamingRenderer;
|
|
94
|
+
/**
|
|
95
|
+
* Component creation helpers
|
|
96
|
+
*/
|
|
97
|
+
createComponent(definition: any): import("./components/component-system.js").Component;
|
|
98
|
+
withState(component: any, initialState: any): (WrappedComponent: any) => {
|
|
99
|
+
(props?: {}, globalState?: {}, context?: {}): any;
|
|
100
|
+
displayName: any;
|
|
101
|
+
__isHOC: boolean;
|
|
102
|
+
__hasState: boolean;
|
|
103
|
+
__stateContainer: {
|
|
104
|
+
initialized: boolean;
|
|
105
|
+
initialize(): void;
|
|
106
|
+
getState(): any;
|
|
107
|
+
setState(newState: any): boolean;
|
|
108
|
+
subscribe(listener: any): () => boolean;
|
|
109
|
+
unsubscribe(listener: any): boolean;
|
|
110
|
+
batch(batchFn: any): void;
|
|
111
|
+
destroy(): void;
|
|
112
|
+
};
|
|
113
|
+
__wrappedComponent: any;
|
|
114
|
+
cleanup(): void;
|
|
115
|
+
};
|
|
116
|
+
withProps(component: any, props: any): (WrappedComponent: any) => {
|
|
117
|
+
(originalProps?: {}, state?: {}, context?: {}): any;
|
|
118
|
+
displayName: any;
|
|
119
|
+
__isHOC: boolean;
|
|
120
|
+
__wrappedComponent: any;
|
|
121
|
+
__transform: any;
|
|
122
|
+
} | {
|
|
123
|
+
(...args: any[]): any;
|
|
124
|
+
cache: WeakMap<object, any> | {
|
|
125
|
+
maxSize: number;
|
|
126
|
+
cache: Map<any, any>;
|
|
127
|
+
onEvict: any;
|
|
128
|
+
get(key: any): any;
|
|
129
|
+
set(key: any, value: any): void;
|
|
130
|
+
has(key: any): boolean;
|
|
131
|
+
delete(key: any): boolean;
|
|
132
|
+
clear(): void;
|
|
133
|
+
get size(): number;
|
|
134
|
+
} | {
|
|
135
|
+
ttl: any;
|
|
136
|
+
cache: Map<any, any>;
|
|
137
|
+
timers: Map<any, any>;
|
|
138
|
+
onEvict: any;
|
|
139
|
+
get(key: any): any;
|
|
140
|
+
set(key: any, value: any): void;
|
|
141
|
+
has(key: any): boolean;
|
|
142
|
+
delete(key: any): boolean;
|
|
143
|
+
clear(): void;
|
|
144
|
+
get size(): number;
|
|
145
|
+
};
|
|
146
|
+
clear(): any;
|
|
147
|
+
delete(key: any): boolean;
|
|
148
|
+
has(key: any): boolean;
|
|
149
|
+
size(): any;
|
|
150
|
+
stats(): {
|
|
151
|
+
hits: number;
|
|
152
|
+
misses: number;
|
|
153
|
+
evictions: number;
|
|
154
|
+
};
|
|
155
|
+
resetStats(): void;
|
|
156
|
+
refresh(...args: any[]): any;
|
|
157
|
+
};
|
|
158
|
+
memo(component: any, areEqual: any): {
|
|
159
|
+
(...args: any[]): any;
|
|
160
|
+
cache: WeakMap<object, any> | {
|
|
161
|
+
maxSize: number;
|
|
162
|
+
cache: Map<any, any>;
|
|
163
|
+
onEvict: any;
|
|
164
|
+
get(key: any): any;
|
|
165
|
+
set(key: any, value: any): void;
|
|
166
|
+
has(key: any): boolean;
|
|
167
|
+
delete(key: any): boolean;
|
|
168
|
+
clear(): void;
|
|
169
|
+
get size(): number;
|
|
170
|
+
} | {
|
|
171
|
+
ttl: any;
|
|
172
|
+
cache: Map<any, any>;
|
|
173
|
+
timers: Map<any, any>;
|
|
174
|
+
onEvict: any;
|
|
175
|
+
get(key: any): any;
|
|
176
|
+
set(key: any, value: any): void;
|
|
177
|
+
has(key: any): boolean;
|
|
178
|
+
delete(key: any): boolean;
|
|
179
|
+
clear(): void;
|
|
180
|
+
get size(): number;
|
|
181
|
+
};
|
|
182
|
+
clear(): any;
|
|
183
|
+
delete(key: any): boolean;
|
|
184
|
+
has(key: any): boolean;
|
|
185
|
+
size(): any;
|
|
186
|
+
stats(): {
|
|
187
|
+
hits: number;
|
|
188
|
+
misses: number;
|
|
189
|
+
evictions: number;
|
|
190
|
+
};
|
|
191
|
+
resetStats(): void;
|
|
192
|
+
refresh(...args: any[]): any;
|
|
193
|
+
};
|
|
194
|
+
lazy(componentLoader: any): {
|
|
195
|
+
__isLazy: boolean;
|
|
196
|
+
__factory: any;
|
|
197
|
+
__options: {};
|
|
198
|
+
evaluate(...args: any[]): any;
|
|
199
|
+
invalidate(): /*elided*/ any;
|
|
200
|
+
isEvaluated(): boolean;
|
|
201
|
+
getCachedValue(): any;
|
|
202
|
+
map(transform: any): /*elided*/ any;
|
|
203
|
+
flatMap(transform: any): /*elided*/ any;
|
|
204
|
+
toString(): string;
|
|
205
|
+
toJSON(): any;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Component caching and memoization
|
|
209
|
+
*/
|
|
210
|
+
memoize(component: any, keyGenerator: any, options?: {}): (...args: any[]) => any;
|
|
211
|
+
/**
|
|
212
|
+
* Update DOM with virtual DOM diffing
|
|
213
|
+
*/
|
|
214
|
+
updateDOM(element: any, newComponent: any, componentId?: string, options?: {}): any;
|
|
215
|
+
/**
|
|
216
|
+
* Invalidate component cache by dependencies
|
|
217
|
+
*/
|
|
218
|
+
invalidateCache(dependencies: any): number;
|
|
219
|
+
/**
|
|
220
|
+
* Reactive state management
|
|
221
|
+
*/
|
|
222
|
+
setState(key: any, value: any): boolean;
|
|
223
|
+
getState(key: any): any;
|
|
224
|
+
watchState(key: any, callback: any, options: any): any;
|
|
225
|
+
createComputed(key: any, getter: any, options: any): {
|
|
226
|
+
_getter: any;
|
|
227
|
+
_cached: boolean;
|
|
228
|
+
_dirty: boolean;
|
|
229
|
+
get value(): any;
|
|
230
|
+
set value(newValue: any);
|
|
231
|
+
_compute(): void;
|
|
232
|
+
_value: any;
|
|
233
|
+
_invalidate(): void;
|
|
234
|
+
_observers: Set<any>;
|
|
235
|
+
_computedDependents: Set<any>;
|
|
236
|
+
_options: {
|
|
237
|
+
deep: boolean;
|
|
238
|
+
immediate: boolean;
|
|
239
|
+
};
|
|
240
|
+
watch(callback: any, options?: {}): () => void;
|
|
241
|
+
unwatch(observer: any): void;
|
|
242
|
+
unwatchAll(): void;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Event system
|
|
246
|
+
*/
|
|
247
|
+
emit(eventName: any, data: any, target: any): {
|
|
248
|
+
name: any;
|
|
249
|
+
data: {};
|
|
250
|
+
target: null;
|
|
251
|
+
timestamp: number;
|
|
252
|
+
stopped: boolean;
|
|
253
|
+
preventDefault: boolean;
|
|
254
|
+
};
|
|
255
|
+
on(eventName: any, handler: any, componentId: any): () => void;
|
|
256
|
+
off(eventName: any, handler: any, componentId: any): void;
|
|
257
|
+
/**
|
|
258
|
+
* Router methods
|
|
259
|
+
*/
|
|
260
|
+
navigate(location: any): Promise<any>;
|
|
261
|
+
getCurrentRoute(): any;
|
|
262
|
+
addRoutes(routes: any): void;
|
|
263
|
+
/**
|
|
264
|
+
* Form validation
|
|
265
|
+
*/
|
|
266
|
+
createForm(schema: any, options: any): import("./forms/validation.js").FormValidator;
|
|
267
|
+
/**
|
|
268
|
+
* Component lifecycle
|
|
269
|
+
*/
|
|
270
|
+
createComponentWithLifecycle(component: any, options: any): {
|
|
271
|
+
component: any;
|
|
272
|
+
lifecycle: import("./components/lifecycle.js").ComponentLifecycle;
|
|
273
|
+
mount: (container: any, props?: {}) => Promise<void>;
|
|
274
|
+
unmount: () => Promise<void>;
|
|
275
|
+
update: (newProps?: {}) => Promise<void>;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Error handling
|
|
279
|
+
*/
|
|
280
|
+
handleError(error: any, context: any): any;
|
|
281
|
+
/**
|
|
282
|
+
* Performance and monitoring
|
|
283
|
+
*/
|
|
284
|
+
getPerformanceStats(): {
|
|
285
|
+
cache: any;
|
|
286
|
+
componentCache: {
|
|
287
|
+
size: number;
|
|
288
|
+
maxSize: any;
|
|
289
|
+
hits: number;
|
|
290
|
+
misses: number;
|
|
291
|
+
hitRate: string | number;
|
|
292
|
+
evictions: number;
|
|
293
|
+
cleanups: number;
|
|
294
|
+
invalidations: number;
|
|
295
|
+
dependencies: number;
|
|
296
|
+
memoryUsage: number;
|
|
297
|
+
} | null;
|
|
298
|
+
monitor: any;
|
|
299
|
+
rendering: {
|
|
300
|
+
cache: any;
|
|
301
|
+
performance: any;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
getPerformanceRecommendations(): {
|
|
305
|
+
type: string;
|
|
306
|
+
priority: string;
|
|
307
|
+
suggestion: string;
|
|
308
|
+
impact: string;
|
|
309
|
+
details: string;
|
|
310
|
+
}[];
|
|
311
|
+
/**
|
|
312
|
+
* Development and debugging tools
|
|
313
|
+
*/
|
|
314
|
+
enableDevMode(): this;
|
|
315
|
+
disableDevMode(): this;
|
|
316
|
+
benchmark(component: any, iterations?: number): {
|
|
317
|
+
cache: any;
|
|
318
|
+
componentCache: {
|
|
319
|
+
size: number;
|
|
320
|
+
maxSize: any;
|
|
321
|
+
hits: number;
|
|
322
|
+
misses: number;
|
|
323
|
+
hitRate: string | number;
|
|
324
|
+
evictions: number;
|
|
325
|
+
cleanups: number;
|
|
326
|
+
invalidations: number;
|
|
327
|
+
dependencies: number;
|
|
328
|
+
memoryUsage: number;
|
|
329
|
+
} | null;
|
|
330
|
+
monitor: any;
|
|
331
|
+
rendering: {
|
|
332
|
+
cache: any;
|
|
333
|
+
performance: any;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Cache management
|
|
338
|
+
*/
|
|
339
|
+
clearCache(): boolean;
|
|
340
|
+
getCacheStats(): any;
|
|
341
|
+
optimizeCache(): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Precompilation for static components
|
|
344
|
+
*/
|
|
345
|
+
precompile(component: any, options?: {}): {
|
|
346
|
+
html: string;
|
|
347
|
+
isPrecompiled: boolean;
|
|
348
|
+
render: () => string;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Validation helpers
|
|
352
|
+
*/
|
|
353
|
+
validate(component: any): {
|
|
354
|
+
valid: boolean;
|
|
355
|
+
error?: undefined;
|
|
356
|
+
} | {
|
|
357
|
+
valid: boolean;
|
|
358
|
+
error: any;
|
|
359
|
+
};
|
|
360
|
+
isCoherent(obj: any): boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Utility methods
|
|
363
|
+
*/
|
|
364
|
+
clone(obj: any): any;
|
|
365
|
+
merge(obj1: any, obj2: any): {};
|
|
366
|
+
extract(element: any): {};
|
|
367
|
+
normalize(children: any): any[];
|
|
368
|
+
escape(text: any): any;
|
|
369
|
+
/**
|
|
370
|
+
* Framework information
|
|
371
|
+
*/
|
|
372
|
+
getVersion(): string;
|
|
373
|
+
getInfo(): {
|
|
374
|
+
name: string;
|
|
375
|
+
version: string;
|
|
376
|
+
description: string;
|
|
377
|
+
features: string[];
|
|
378
|
+
stats: {
|
|
379
|
+
cache: any;
|
|
380
|
+
componentCache: {
|
|
381
|
+
size: number;
|
|
382
|
+
maxSize: any;
|
|
383
|
+
hits: number;
|
|
384
|
+
misses: number;
|
|
385
|
+
hitRate: string | number;
|
|
386
|
+
evictions: number;
|
|
387
|
+
cleanups: number;
|
|
388
|
+
invalidations: number;
|
|
389
|
+
dependencies: number;
|
|
390
|
+
memoryUsage: number;
|
|
391
|
+
} | null;
|
|
392
|
+
monitor: any;
|
|
393
|
+
rendering: {
|
|
394
|
+
cache: any;
|
|
395
|
+
performance: any;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
import { renderToString } from './rendering/html-renderer.js';
|
|
401
|
+
import { renderHTML } from './rendering/html-renderer.js';
|
|
402
|
+
import { renderHTMLSync } from './rendering/html-renderer.js';
|
|
403
|
+
import { render } from './rendering/html-renderer.js';
|
|
404
|
+
import { renderBatch } from './rendering/html-renderer.js';
|
|
405
|
+
import { renderToChunks } from './rendering/html-renderer.js';
|
|
406
|
+
import { renderWithTiming } from './rendering/html-renderer.js';
|
|
407
|
+
import { createStreamingRenderer } from './rendering/streaming-renderer.js';
|
|
408
|
+
import { streamingUtils } from './rendering/streaming-renderer.js';
|
|
409
|
+
import { renderToDOM } from './rendering/dom-renderer.js';
|
|
410
|
+
import { updateDOM } from './rendering/dom-renderer.js';
|
|
411
|
+
import { hydrate } from './client/hydration.js';
|
|
412
|
+
import { makeHydratable } from './client/hydration.js';
|
|
413
|
+
import { hydrateAll } from './client/hydration.js';
|
|
414
|
+
import { hydrateBySelector } from './client/hydration.js';
|
|
415
|
+
import { enableClientEvents } from './client/hydration.js';
|
|
416
|
+
import { createComponent } from './components/component-system.js';
|
|
417
|
+
import { withState } from './components/component-system.js';
|
|
418
|
+
import { withProps } from './components/component-system.js';
|
|
419
|
+
import { memo } from './components/component-system.js';
|
|
420
|
+
import { lazy } from './components/component-system.js';
|
|
421
|
+
import { validateComponent } from './core/object-utils.js';
|
|
422
|
+
import { isCoherentObject } from './core/object-utils.js';
|
|
423
|
+
import { extractProps } from './core/object-utils.js';
|
|
424
|
+
import { hasChildren } from './core/object-utils.js';
|
|
425
|
+
import { normalizeChildren } from './core/object-utils.js';
|
|
426
|
+
import { deepClone } from './core/object-utils.js';
|
|
427
|
+
import { escapeHtml } from './core/html-utils.js';
|
|
428
|
+
import { isVoidElement } from './core/html-utils.js';
|
|
429
|
+
import { formatAttributes } from './core/html-utils.js';
|
|
430
|
+
import { minifyHtml } from './core/html-utils.js';
|
|
431
|
+
import { createHtmlConfig } from './rendering/renderer-config.js';
|
|
432
|
+
import { createStreamingConfig } from './rendering/renderer-config.js';
|
|
433
|
+
import { createDomConfig } from './rendering/renderer-config.js';
|
|
434
|
+
import { createDevConfig } from './rendering/renderer-config.js';
|
|
435
|
+
import { createProdConfig } from './rendering/renderer-config.js';
|
|
436
|
+
import { validateConfig } from './rendering/renderer-config.js';
|
|
437
|
+
import { mergeConfigs } from './rendering/renderer-config.js';
|
|
438
|
+
import { getConfigPreset } from './rendering/renderer-config.js';
|
|
439
|
+
import { CONFIG_PRESETS } from './rendering/renderer-config.js';
|
|
440
|
+
import { performanceMonitor } from './performance/monitor.js';
|
|
441
|
+
import { createComponentCache } from './performance/component-cache.js';
|
|
442
|
+
import { createCacheManager } from './performance/cache-manager.js';
|
|
443
|
+
import { memoize } from './performance/component-cache.js';
|
|
444
|
+
import { getCache } from './rendering/html-renderer.js';
|
|
445
|
+
import { resetCache } from './rendering/html-renderer.js';
|
|
446
|
+
import { getRenderingStats } from './rendering/html-renderer.js';
|
|
447
|
+
import { createErrorHandler } from './utils/error-handler.js';
|
|
448
|
+
import { globalErrorHandler } from './utils/error-handler.js';
|
|
449
|
+
import { createReactiveState } from './state/reactive-state.js';
|
|
450
|
+
import { observable } from './state/reactive-state.js';
|
|
451
|
+
import { computed } from './state/reactive-state.js';
|
|
452
|
+
import { stateUtils } from './state/reactive-state.js';
|
|
453
|
+
import { createLifecycleHooks } from './components/lifecycle.js';
|
|
454
|
+
import { eventSystem } from './components/lifecycle.js';
|
|
455
|
+
import { componentUtils } from './components/lifecycle.js';
|
|
456
|
+
import { withLifecycle } from './components/lifecycle.js';
|
|
457
|
+
import { createRouter } from './routing/router.js';
|
|
458
|
+
import { routeGuards } from './routing/router.js';
|
|
459
|
+
import { routeComponents } from './routing/router.js';
|
|
460
|
+
import { createForm } from './forms/validation.js';
|
|
461
|
+
import { validationRules } from './forms/validation.js';
|
|
462
|
+
import { binding } from './forms/validation.js';
|
|
463
|
+
import { formComponents } from './forms/validation.js';
|
|
464
|
+
import { createCSSManager } from './rendering/css-manager.js';
|
|
465
|
+
import { defaultCSSManager } from './rendering/css-manager.js';
|
|
466
|
+
import { cssUtils } from './rendering/css-manager.js';
|
|
467
|
+
import { DevTools } from './dev/dev-tools.js';
|
|
468
|
+
import { mergeProps } from './core/object-utils.js';
|
|
469
|
+
import { getNestedValue } from './core/object-utils.js';
|
|
470
|
+
import { setNestedValue } from './core/object-utils.js';
|
|
471
|
+
export { renderToString, renderHTML, renderHTMLSync, render, renderBatch, renderToChunks, renderWithTiming, createStreamingRenderer, streamingUtils, renderToDOM, updateDOM, hydrate, makeHydratable, autoHydrate, hydrateAll, hydrateBySelector, enableClientEvents, createComponent, withState, withProps, memo, lazy, validateComponent, isCoherentObject, extractProps, hasChildren, normalizeChildren, deepClone, escapeHtml, isVoidElement, formatAttributes, minifyHtml, createHtmlConfig, createStreamingConfig, createDomConfig, createDevConfig, createProdConfig, validateConfig, mergeConfigs, getConfigPreset, CONFIG_PRESETS, performanceMonitor, createComponentCache, createCacheManager, memoize, getCache, resetCache, getRenderingStats, createErrorHandler, globalErrorHandler, createReactiveState, observable, computed, stateUtils, createLifecycleHooks, eventSystem, componentUtils, withLifecycle, createRouter, routeGuards, routeComponents, createForm, validationRules, binding, formComponents, createCSSManager, defaultCSSManager, cssUtils, DevTools };
|
|
472
|
+
//# sourceMappingURL=coherent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coherent.d.ts","sourceRoot":"","sources":["../../../src/coherent.js"],"names":[],"mappings":"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"}
|