@jfdevelops/react-layout-adapter-zod 0.0.0-stage → 0.1.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 +20 -2
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -3
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @jfdevelops/react-layout-adapter-zod
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Opt-in native zod schemas for `React.ReactNode` and `React.ReactElement`.
|
|
4
|
+
Install this adapter alongside `zod` and React:
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
pnpm add @jfdevelops/react-layout-adapter-zod zod
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { reactNode, reactElement } from '@jfdevelops/react-layout-adapter-zod';
|
|
12
|
+
|
|
13
|
+
const content = reactNode();
|
|
14
|
+
const icon = reactElement();
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Both helpers return native zod schemas, so use the library's normal
|
|
18
|
+
object, array, union, and optional APIs. `reactElement()` accepts element values
|
|
19
|
+
such as `<Icon />`; component functions require their own schema.
|
|
20
|
+
|
|
21
|
+
See the [Standard Schema guide](../../docs/standard-schema.md) for usage with React Layout.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _jfdevelops_react_layout_adapters = require("@jfdevelops/react-layout-adapters");
|
|
3
|
+
let zod = require("zod");
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
const { reactNode, reactElement } = (0, _jfdevelops_react_layout_adapters.createAdapter)({
|
|
6
|
+
node: (check) => zod.z.custom(check, "Expected a React node").optional(),
|
|
7
|
+
element: (check) => zod.z.custom(check, "Expected a React element")
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.reactElement = reactElement;
|
|
11
|
+
exports.reactNode = reactNode;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["z"],"sources":["../src/index.ts"],"sourcesContent":["import { createAdapter } from '@jfdevelops/react-layout-adapters';\nimport { z } from 'zod';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport const { reactNode, reactElement } = createAdapter({\n node: (check) => z.custom<ReactNode>(check, 'Expected a React node').optional(),\n element: (check) => z.custom<ReactElement>(check, 'Expected a React element'),\n});\n"],"mappings":";;;;AAIA,MAAa,EAAE,WAAW,kBAAA,GAAA,kCAAA,eAA+B;CACvD,OAAO,UAAUA,IAAAA,EAAE,OAAkB,OAAO,uBAAuB,EAAE,SAAS;CAC9E,UAAU,UAAUA,IAAAA,EAAE,OAAqB,OAAO,0BAA0B;AAC9E,CAAC"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
declare const reactNode: () => z.ZodOptional<z.ZodCustom<ReactNode, ReactNode>>, reactElement: () => z.ZodCustom<ReactElement<any, string | import("react").JSXElementConstructor<any>>, ReactElement<any, string | import("react").JSXElementConstructor<any>>>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { reactElement, reactNode };
|
|
8
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
declare const reactNode: () => z.ZodOptional<z.ZodCustom<ReactNode, ReactNode>>, reactElement: () => z.ZodCustom<ReactElement<any, string | import("react").JSXElementConstructor<any>>, ReactElement<any, string | import("react").JSXElementConstructor<any>>>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { reactElement, reactNode };
|
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createAdapter } from "@jfdevelops/react-layout-adapters";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const { reactNode, reactElement } = createAdapter({
|
|
5
|
+
node: (check) => z.custom(check, "Expected a React node").optional(),
|
|
6
|
+
element: (check) => z.custom(check, "Expected a React element")
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { reactElement, reactNode };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { createAdapter } from '@jfdevelops/react-layout-adapters';\nimport { z } from 'zod';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport const { reactNode, reactElement } = createAdapter({\n node: (check) => z.custom<ReactNode>(check, 'Expected a React node').optional(),\n element: (check) => z.custom<ReactElement>(check, 'Expected a React element'),\n});\n"],"mappings":";;;AAIA,MAAa,EAAE,WAAW,iBAAiB,cAAc;CACvD,OAAO,UAAU,EAAE,OAAkB,OAAO,uBAAuB,EAAE,SAAS;CAC9E,UAAU,UAAU,EAAE,OAAqB,OAAO,0BAA0B;AAC9E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jfdevelops/react-layout-adapter-zod",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Native zod schemas for React nodes and elements in React Layout.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/jfdevelops/react-layout.git",
|
|
8
|
+
"directory": "packages/adapter-zod"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.mjs",
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"zod": "^4.0.0",
|
|
31
|
+
"react": ">=18"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"zod": "^4.6.7",
|
|
35
|
+
"react": "18.3.1",
|
|
36
|
+
"@types/react": "18.3.28",
|
|
37
|
+
"tsdown": "0.22.1",
|
|
38
|
+
"typescript": "6.0.3"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"provenance": true
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@jfdevelops/react-layout-adapters": "0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsdown",
|
|
49
|
+
"typecheck": "tsc --noEmit"
|
|
50
|
+
}
|
|
6
51
|
}
|