@coherent.js/core 1.0.0-rc.2 → 1.0.0-rc.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.
- package/README.md +13 -20
- package/dist/index.cjs.map +2 -2
- package/dist/index.js.map +2 -2
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ Requirements:
|
|
|
27
27
|
|
|
28
28
|
JavaScript (ESM):
|
|
29
29
|
```js
|
|
30
|
-
import {
|
|
30
|
+
import { render } from '@coherent.js/core';
|
|
31
31
|
|
|
32
|
-
const html =
|
|
32
|
+
const html = render({
|
|
33
33
|
div: { class: 'greeting', text: 'Hello Coherent' }
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -38,28 +38,21 @@ console.log(html);
|
|
|
38
38
|
|
|
39
39
|
TypeScript:
|
|
40
40
|
```ts
|
|
41
|
-
import {
|
|
41
|
+
import { render } from '@coherent.js/core';
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
console.log(html);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
main();
|
|
43
|
+
const html = render({
|
|
44
|
+
div: { class: 'greeting', text: 'Hello Coherent (TS)' }
|
|
45
|
+
});
|
|
46
|
+
console.log(html);
|
|
51
47
|
```
|
|
52
48
|
|
|
53
49
|
## Exports overview
|
|
54
50
|
|
|
55
|
-
The package
|
|
51
|
+
The package ships built ESM and CJS bundles under `dist/` with types under `types/`.
|
|
56
52
|
|
|
57
53
|
Key APIs (selected):
|
|
58
54
|
- Rendering
|
|
59
|
-
- `
|
|
60
|
-
- `render(input)` (alias of `renderToString`)
|
|
61
|
-
- `renderScopedComponent(input)` – applies scoped attributes and style processing
|
|
62
|
-
- `renderUnsafe(input)` – render without encapsulation
|
|
55
|
+
- `render(input, options?)` – renders a component object to an HTML string
|
|
63
56
|
- Component system (re-exported from internal modules)
|
|
64
57
|
- `createComponent`, `defineComponent`, `registerComponent`, `getComponent`, `getRegisteredComponents`
|
|
65
58
|
- State helpers: `withState`, `withStateUtils`, `createStateManager`
|
|
@@ -73,7 +66,7 @@ Tip: When working in the monorepo website/dev flow, imports can resolve to `src`
|
|
|
73
66
|
## Minimal component example
|
|
74
67
|
|
|
75
68
|
```js
|
|
76
|
-
import { createComponent,
|
|
69
|
+
import { createComponent, render } from '@coherent.js/core';
|
|
77
70
|
|
|
78
71
|
const Counter = createComponent(({ count = 0 }) => ({
|
|
79
72
|
div: {
|
|
@@ -84,12 +77,12 @@ const Counter = createComponent(({ count = 0 }) => ({
|
|
|
84
77
|
}
|
|
85
78
|
}));
|
|
86
79
|
|
|
87
|
-
const html =
|
|
80
|
+
const html = render(Counter({ count: 2 }));
|
|
88
81
|
```
|
|
89
82
|
|
|
90
83
|
TypeScript:
|
|
91
84
|
```ts
|
|
92
|
-
import { createComponent,
|
|
85
|
+
import { createComponent, render } from '@coherent.js/core';
|
|
93
86
|
|
|
94
87
|
type Props = { count?: number };
|
|
95
88
|
|
|
@@ -100,7 +93,7 @@ const Counter = createComponent((props: Props) => ({
|
|
|
100
93
|
}
|
|
101
94
|
}));
|
|
102
95
|
|
|
103
|
-
const html =
|
|
96
|
+
const html = render(Counter({ count: 2 }));
|
|
104
97
|
```
|
|
105
98
|
|
|
106
99
|
## Development
|