@jfdevelops/react-layout-adapter-zod 0.0.0-stub.0 → 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 CHANGED
@@ -1,4 +1,21 @@
1
- # @jfdevelops/react-layout-adapter-zod
2
-
3
- Temporary placeholder for an upcoming React Layout adapter package.
4
- This prerelease contains no implementation and is published under the `stub` tag.
1
+ # @jfdevelops/react-layout-adapter-zod
2
+
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"}
@@ -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
@@ -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,21 +1,51 @@
1
- {
2
- "name": "@jfdevelops/react-layout-adapter-zod",
3
- "version": "0.0.0-stub.0",
4
- "description": "Temporary placeholder for the upcoming @jfdevelops/react-layout-adapter-zod package.",
5
- "type": "module",
6
- "main": "./index.js",
7
- "files": [
8
- "index.js",
9
- "README.md"
10
- ],
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/jfdevelops/react-layout.git",
14
- "directory": "packages/adapter-zod"
15
- },
16
- "publishConfig": {
17
- "access": "public",
18
- "tag": "stub",
19
- "registry": "https://registry.npmjs.org"
20
- }
21
- }
1
+ {
2
+ "name": "@jfdevelops/react-layout-adapter-zod",
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
+ }
51
+ }
package/index.js DELETED
@@ -1 +0,0 @@
1
- throw new Error("@jfdevelops/react-layout-adapter-zod is a placeholder package. The implementation has not been released yet.");