@conform-to/valibot 1.15.1 → 1.16.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
@@ -7,7 +7,7 @@
7
7
  ╚══════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
8
8
  ```
9
9
 
10
- Version 1.15.1 / License MIT / Copyright (c) 2025 Edmund Hung
10
+ Version 1.16.0 / License MIT / Copyright (c) 2025 Edmund Hung
11
11
 
12
12
  Progressively enhance HTML forms with React. Build resilient, type-safe forms with no hassle using web standards.
13
13
 
package/dist/future.d.ts CHANGED
@@ -1,4 +1,8 @@
1
+ /**
2
+ * @deprecated Use `getConstraints` instead.
3
+ */
1
4
  export { getValibotConstraint } from './constraint';
2
5
  export { coerceFormValue } from './coercion';
3
6
  export { formatResult } from './format';
7
+ export { isSchema, getConstraints } from './schema';
4
8
  //# sourceMappingURL=future.d.ts.map
package/dist/future.js CHANGED
@@ -5,9 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var constraint = require('./constraint.js');
6
6
  var coercion = require('./coercion.js');
7
7
  var format = require('./format.js');
8
+ var schema = require('./schema.js');
8
9
 
9
10
 
10
11
 
11
12
  exports.getValibotConstraint = constraint.getValibotConstraint;
12
13
  exports.coerceFormValue = coercion.coerceFormValue;
13
14
  exports.formatResult = format.formatResult;
15
+ exports.getConstraints = schema.getConstraints;
16
+ exports.isSchema = schema.isSchema;
package/dist/future.mjs CHANGED
@@ -1,3 +1,4 @@
1
1
  export { getValibotConstraint } from './constraint.mjs';
2
2
  export { coerceFormValue } from './coercion.mjs';
3
3
  export { formatResult } from './format.mjs';
4
+ export { getConstraints, isSchema } from './schema.mjs';
@@ -0,0 +1,17 @@
1
+ import type { GenericSchema, GenericSchemaAsync } from 'valibot';
2
+ import type { ValidationAttributes } from '@conform-to/dom/future';
3
+ import { getValibotConstraint } from './constraint';
4
+ type ValibotSchema = GenericSchema | GenericSchemaAsync;
5
+ /**
6
+ * Type guard to check if a value is a Valibot schema.
7
+ */
8
+ export declare function isSchema(schema: unknown): schema is ValibotSchema;
9
+ /**
10
+ * Extracts HTML validation attributes from a Valibot schema.
11
+ */
12
+ export declare function getConstraints(schema: unknown): Record<string, ValidationAttributes> | undefined;
13
+ /**
14
+ * @deprecated Use `getConstraints` instead.
15
+ */
16
+ export { getValibotConstraint };
17
+ //# sourceMappingURL=schema.d.ts.map
package/dist/schema.js ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var constraint = require('./constraint.js');
6
+
7
+ /**
8
+ * Type guard to check if a value is a Valibot schema.
9
+ */
10
+ function isSchema(schema) {
11
+ return typeof schema === 'object' && schema !== null && '~standard' in schema && typeof schema['~standard'] === 'object' && schema['~standard'] !== null && 'vendor' in schema['~standard'] && schema['~standard'].vendor === 'valibot';
12
+ }
13
+
14
+ /**
15
+ * Extracts HTML validation attributes from a Valibot schema.
16
+ */
17
+ function getConstraints(schema) {
18
+ if (!isSchema(schema)) {
19
+ return undefined;
20
+ }
21
+ return constraint.getValibotConstraint(schema);
22
+ }
23
+
24
+ exports.getValibotConstraint = constraint.getValibotConstraint;
25
+ exports.getConstraints = getConstraints;
26
+ exports.isSchema = isSchema;
@@ -0,0 +1,21 @@
1
+ import { getValibotConstraint } from './constraint.mjs';
2
+ export { getValibotConstraint } from './constraint.mjs';
3
+
4
+ /**
5
+ * Type guard to check if a value is a Valibot schema.
6
+ */
7
+ function isSchema(schema) {
8
+ return typeof schema === 'object' && schema !== null && '~standard' in schema && typeof schema['~standard'] === 'object' && schema['~standard'] !== null && 'vendor' in schema['~standard'] && schema['~standard'].vendor === 'valibot';
9
+ }
10
+
11
+ /**
12
+ * Extracts HTML validation attributes from a Valibot schema.
13
+ */
14
+ function getConstraints(schema) {
15
+ if (!isSchema(schema)) {
16
+ return undefined;
17
+ }
18
+ return getValibotConstraint(schema);
19
+ }
20
+
21
+ export { getConstraints, isSchema };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Conform helpers for integrating with Valibot",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.15.1",
6
+ "version": "1.16.0",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.mjs",
9
9
  "types": "./dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "url": "https://github.com/edmundhung/conform/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@conform-to/dom": "1.15.1"
39
+ "@conform-to/dom": "1.16.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "valibot": ">= 0.32.0"