anu-verzum 1.10.0 → 1.12.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.
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install anu-verzum
|
|
|
17
17
|
|
|
18
18
|
<h3>Babel setup</h3>
|
|
19
19
|
|
|
20
|
-
The package ships with a Babel preset that configures JSX for you.
|
|
20
|
+
The package ships with a Babel preset that configures both JSX and TypeScript for you.
|
|
21
21
|
Add it to your project's <code>babel.config.json</code>:
|
|
22
22
|
|
|
23
23
|
```json
|
|
@@ -26,8 +26,12 @@ Add it to your project's <code>babel.config.json</code>:
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
This preset
|
|
30
|
-
|
|
29
|
+
This preset does two things automatically:
|
|
30
|
+
|
|
31
|
+
- Transforms JSX to <code>Anu.createElement()</code> calls, including the <code><>...</></code> fragment shorthand (mapped to <code>Anu.Fragment</code>).
|
|
32
|
+
- Strips TypeScript types via <code>@babel/plugin-transform-typescript</code> with <code>jsxPragma: 'Anu'</code> pre-configured, so the <code>Anu</code> import is never incorrectly elided — even in files that use only host elements like <code><div></code> or <code><span></code>.
|
|
33
|
+
|
|
34
|
+
Because the preset handles TypeScript stripping itself, **do not** add <code>@babel/preset-typescript</code> separately — running both would transform TypeScript twice and cause errors.
|
|
31
35
|
|
|
32
36
|
<h3>Importing in your files</h3>
|
|
33
37
|
|
package/babel-preset.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnuElement, Props } from '../elements';
|
|
2
|
-
export declare abstract class Component<P extends
|
|
2
|
+
export declare abstract class Component<P extends Record<string, any> = Props, S extends Record<string, any> = Record<string, any>> {
|
|
3
3
|
props: P;
|
|
4
4
|
state: S;
|
|
5
5
|
context: Record<string, any>;
|
|
@@ -6,7 +6,7 @@ export type ContextValue<T> = {
|
|
|
6
6
|
value: T;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export type ConsumerProps<T> = Props & {
|
|
9
|
+
export type ConsumerProps<T> = Omit<Props, 'children'> & {
|
|
10
10
|
children: (ctx: ContextValue<T>) => AnuElement | null;
|
|
11
11
|
};
|
|
12
12
|
export type Context<T extends Record<string, any> = Record<string, any>> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anu-verzum",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A \"React-like\" UI library that supports JSX syntax, Redux-like state management, array-rendering, i18n, routing and many more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anu-verzum",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@babel/plugin-transform-react-jsx": "^7.21.0"
|
|
41
|
+
"@babel/plugin-transform-react-jsx": "^7.21.0",
|
|
42
|
+
"@babel/plugin-transform-typescript": "^7.28.6"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@babel/cli": "^7.21.0",
|