@reformer/core 10.2.0 → 11.0.0-beta.10

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.
Files changed (285) hide show
  1. package/README.md +90 -68
  2. package/dist/behaviors-value-D05z3my6.js +109 -0
  3. package/dist/behaviors.d.ts +1 -1
  4. package/dist/behaviors.js +376 -211
  5. package/dist/create-model-DPSG3I0O.js +30 -0
  6. package/dist/date-utils-90-qZbse.js +43 -0
  7. package/dist/en-HP8XEych.js +44 -0
  8. package/dist/form/aggregate-signals.d.ts +21 -63
  9. package/dist/form/behaviors/collections.d.ts +84 -0
  10. package/dist/form/behaviors/context.d.ts +56 -0
  11. package/dist/form/behaviors/index.d.ts +30 -0
  12. package/dist/form/behaviors/internals.d.ts +41 -0
  13. package/dist/form/{behaviors-node.d.ts → behaviors/node.d.ts} +28 -5
  14. package/dist/form/behaviors/operators.d.ts +59 -0
  15. package/dist/form/behaviors/schema-operators.d.ts +83 -0
  16. package/dist/form/behaviors/types.d.ts +37 -0
  17. package/dist/form/create-form.d.ts +59 -70
  18. package/dist/form/flow/flow.d.ts +87 -0
  19. package/dist/form/form-bundle.d.ts +153 -0
  20. package/dist/form/form-level.d.ts +121 -0
  21. package/dist/form/form-proxy-builder.d.ts +6 -22
  22. package/dist/form/index.d.ts +23 -27
  23. package/dist/form/nodes/form-array-node.d.ts +100 -0
  24. package/dist/form/nodes/form-control-node.d.ts +73 -0
  25. package/dist/form/nodes/form-group-node.d.ts +66 -0
  26. package/dist/form/nodes/node-kind.d.ts +29 -0
  27. package/dist/form/nodes/state/availability.d.ts +6 -0
  28. package/dist/form/nodes/state/component.d.ts +6 -0
  29. package/dist/form/nodes/state/index.d.ts +12 -0
  30. package/dist/form/nodes/state/interaction.d.ts +13 -0
  31. package/dist/form/nodes/state/issues.d.ts +9 -0
  32. package/dist/form/nodes/state/pending.d.ts +6 -0
  33. package/dist/form/schema/compile.d.ts +59 -0
  34. package/dist/form/schema/compiled.d.ts +143 -0
  35. package/dist/form/schema/row-key.d.ts +11 -0
  36. package/dist/form/schema-controller.d.ts +159 -0
  37. package/dist/form/schema-subtree.d.ts +28 -0
  38. package/dist/form/signal-node-registry.d.ts +27 -22
  39. package/dist/form/submission.d.ts +93 -0
  40. package/dist/form/type-guards.d.ts +14 -73
  41. package/dist/form/types/contracts.d.ts +21 -91
  42. package/dist/form/types/field-config.d.ts +27 -0
  43. package/dist/form/types/index.d.ts +5 -91
  44. package/dist/form/types/nodes.d.ts +159 -0
  45. package/dist/form/types/schema-node.d.ts +148 -50
  46. package/dist/form/types/validation-schema.d.ts +24 -41
  47. package/dist/form/validation/context.d.ts +67 -0
  48. package/dist/form/validation/index.d.ts +24 -28
  49. package/dist/form/validation/operators.d.ts +101 -0
  50. package/dist/form/validation/run.d.ts +120 -0
  51. package/dist/form/validation/strategy.d.ts +89 -0
  52. package/dist/form/validation/types.d.ts +83 -0
  53. package/dist/form/validators/date-utils.d.ts +42 -0
  54. package/dist/form/validators/email.d.ts +23 -0
  55. package/dist/form/{validation/validators → validators}/file-type.d.ts +10 -10
  56. package/dist/form/{validation/validators → validators}/file-utils.d.ts +3 -2
  57. package/dist/form/validators/future-date.d.ts +23 -0
  58. package/dist/form/{validation/validators → validators}/index.d.ts +7 -4
  59. package/dist/form/validators/integer.d.ts +22 -0
  60. package/dist/form/validators/is-date.d.ts +24 -0
  61. package/dist/form/validators/is-number.d.ts +25 -0
  62. package/dist/form/validators/max-age.d.ts +28 -0
  63. package/dist/form/validators/max-date.d.ts +25 -0
  64. package/dist/form/{validation/validators → validators}/max-file-size.d.ts +10 -10
  65. package/dist/form/validators/max-files.d.ts +26 -0
  66. package/dist/form/validators/max-length.d.ts +33 -0
  67. package/dist/form/validators/max-total-file-size.d.ts +26 -0
  68. package/dist/form/validators/max.d.ts +26 -0
  69. package/dist/form/validators/min-age.d.ts +27 -0
  70. package/dist/form/validators/min-date.d.ts +25 -0
  71. package/dist/form/{validation/validators → validators}/min-file-size.d.ts +10 -10
  72. package/dist/form/validators/min-files.d.ts +27 -0
  73. package/dist/form/validators/min-length.d.ts +33 -0
  74. package/dist/form/validators/min.d.ts +26 -0
  75. package/dist/form/validators/multiple-of.d.ts +25 -0
  76. package/dist/form/validators/non-negative.d.ts +22 -0
  77. package/dist/form/validators/non-zero.d.ts +22 -0
  78. package/dist/form/validators/past-date.d.ts +23 -0
  79. package/dist/form/validators/pattern.d.ts +26 -0
  80. package/dist/form/{validation/validators → validators}/phone.d.ts +11 -11
  81. package/dist/form/validators/required.d.ts +29 -0
  82. package/dist/form/validators/url.d.ts +45 -0
  83. package/dist/form/validators/validation-issue.d.ts +8 -0
  84. package/dist/i18n/descriptor.d.ts +54 -0
  85. package/dist/i18n/en.json.d.ts +49 -0
  86. package/dist/i18n/loader.d.ts +71 -0
  87. package/dist/i18n/locale-store.d.ts +46 -0
  88. package/dist/i18n/locale.d.ts +90 -0
  89. package/dist/i18n/message-format.d.ts +136 -0
  90. package/dist/i18n/resolve-localized.d.ts +17 -0
  91. package/dist/i18n/ru.json.d.ts +49 -0
  92. package/dist/i18n/translator.d.ts +61 -0
  93. package/dist/i18n/validation-message.d.ts +53 -0
  94. package/dist/i18n.d.ts +26 -0
  95. package/dist/i18n.js +86 -0
  96. package/dist/index.d.ts +18 -6
  97. package/dist/index.js +932 -2779
  98. package/dist/loader-BWkigpVe.js +52 -0
  99. package/dist/locale/en.d.ts +2 -0
  100. package/dist/locale/en.js +5 -0
  101. package/dist/locale/en.json +45 -0
  102. package/dist/locale/index.d.ts +18 -0
  103. package/dist/locale/ru.d.ts +2 -0
  104. package/dist/locale/ru.js +44 -0
  105. package/dist/locale/ru.json +45 -0
  106. package/dist/locale-CG54AU2Q.js +219 -0
  107. package/dist/locale.d.ts +2 -0
  108. package/dist/locale.js +9 -0
  109. package/dist/{state → model}/behaviors-value.d.ts +24 -6
  110. package/dist/{state/form-model.d.ts → model/create-model.d.ts} +18 -4
  111. package/dist/{state → model}/derived-registry.d.ts +1 -1
  112. package/dist/model/index.d.ts +42 -0
  113. package/dist/model/model-nodes.d.ts +190 -0
  114. package/dist/model/model-signals-proxy.d.ts +63 -0
  115. package/dist/model/model-value-proxy.d.ts +84 -0
  116. package/dist/{state → model}/safe-effect.d.ts +50 -2
  117. package/dist/model/types.d.ts +239 -0
  118. package/dist/model.d.ts +2 -0
  119. package/dist/model.js +27 -0
  120. package/dist/node-kind-C-r6ZMdo.js +15 -0
  121. package/dist/platforms/react/field-binding/field-adapter.d.ts +87 -0
  122. package/dist/platforms/react/field-binding/field-handle.d.ts +53 -0
  123. package/dist/platforms/react/form-bundle-context.d.ts +27 -0
  124. package/dist/{form → platforms/react}/hooks/types.d.ts +60 -38
  125. package/dist/platforms/react/hooks/use-form-bundle.d.ts +41 -0
  126. package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
  127. package/dist/{form → platforms/react}/hooks/use-form-validation.d.ts +13 -7
  128. package/dist/{form → platforms/react}/hooks/useArrayLength.d.ts +6 -6
  129. package/dist/{form → platforms/react}/hooks/useFormControl.d.ts +7 -9
  130. package/dist/{form → platforms/react}/hooks/useFormControlValue.d.ts +18 -18
  131. package/dist/{form → platforms/react}/hooks/useSignalSubscription.d.ts +9 -1
  132. package/dist/platforms/react/i18n/context.d.ts +18 -0
  133. package/dist/platforms/react/i18n/hooks.d.ts +65 -0
  134. package/dist/platforms/react/i18n/provider.d.ts +59 -0
  135. package/dist/platforms/react/index.d.ts +30 -0
  136. package/dist/react.d.ts +22 -0
  137. package/dist/react.js +505 -0
  138. package/dist/runtime-token.d.ts +22 -0
  139. package/dist/safe-effect-BazLOv1g.js +669 -0
  140. package/dist/schema-controller-CpiO2JoK.js +143 -0
  141. package/dist/signals.d.ts +15 -9
  142. package/dist/signals.js +11 -6
  143. package/dist/strategy-DzvnsWLh.js +375 -0
  144. package/dist/type-guards-D-N_5Ddh.js +19 -0
  145. package/dist/validation-issue-B9mjI8jz.js +7 -0
  146. package/dist/validation-message-Ced9MGxs.js +194 -0
  147. package/dist/validation.d.ts +1 -1
  148. package/dist/validation.js +11 -165
  149. package/dist/validators/email.d.ts +1 -1
  150. package/dist/validators/email.js +5 -8
  151. package/dist/validators/future-date.d.ts +1 -1
  152. package/dist/validators/future-date.js +10 -13
  153. package/dist/validators/integer.d.ts +1 -1
  154. package/dist/validators/integer.js +4 -7
  155. package/dist/validators/is-date.d.ts +1 -1
  156. package/dist/validators/is-date.js +5 -8
  157. package/dist/validators/is-number.d.ts +1 -1
  158. package/dist/validators/is-number.js +4 -7
  159. package/dist/validators/max-age.d.ts +1 -1
  160. package/dist/validators/max-age.js +8 -12
  161. package/dist/validators/max-date.d.ts +1 -1
  162. package/dist/validators/max-date.js +10 -13
  163. package/dist/validators/max-length.d.ts +1 -1
  164. package/dist/validators/max-length.js +7 -10
  165. package/dist/validators/max.d.ts +1 -1
  166. package/dist/validators/max.js +4 -7
  167. package/dist/validators/min-age.d.ts +1 -1
  168. package/dist/validators/min-age.js +10 -11
  169. package/dist/validators/min-date.d.ts +1 -1
  170. package/dist/validators/min-date.js +8 -11
  171. package/dist/validators/min-length.d.ts +1 -1
  172. package/dist/validators/min-length.js +4 -7
  173. package/dist/validators/min.d.ts +1 -1
  174. package/dist/validators/min.js +4 -7
  175. package/dist/validators/multiple-of.d.ts +1 -1
  176. package/dist/validators/multiple-of.js +11 -10
  177. package/dist/validators/non-negative.d.ts +1 -1
  178. package/dist/validators/non-negative.js +2 -5
  179. package/dist/validators/non-zero.d.ts +1 -1
  180. package/dist/validators/non-zero.js +4 -7
  181. package/dist/validators/past-date.d.ts +1 -1
  182. package/dist/validators/past-date.js +10 -13
  183. package/dist/validators/pattern.d.ts +1 -1
  184. package/dist/validators/pattern.js +5 -8
  185. package/dist/validators/phone.d.ts +1 -1
  186. package/dist/validators/phone.js +10 -11
  187. package/dist/validators/required.d.ts +1 -1
  188. package/dist/validators/required.js +4 -7
  189. package/dist/validators/url.d.ts +1 -1
  190. package/dist/validators/url.js +48 -17
  191. package/dist/validators.d.ts +1 -5
  192. package/dist/validators.js +98 -154
  193. package/docs/llms/01-api-reference.md +89 -0
  194. package/docs/llms/02-quick-start.md +181 -0
  195. package/docs/llms/03-api-signatures.md +494 -0
  196. package/docs/llms/04-common-patterns.md +204 -0
  197. package/docs/llms/05-common-mistakes.md +192 -0
  198. package/docs/llms/06-troubleshooting.md +16 -0
  199. package/docs/llms/07-complete-import.md +130 -0
  200. package/docs/llms/08-form-types.md +54 -0
  201. package/docs/llms/09-formschema.md +191 -0
  202. package/docs/llms/10-arrays.md +241 -0
  203. package/docs/llms/11-async-watchfield.md +53 -0
  204. package/docs/llms/12-array-cleanup.md +31 -0
  205. package/docs/llms/13-multi-step.md +162 -0
  206. package/docs/llms/14-extended-mistakes.md +101 -0
  207. package/docs/llms/15-project-structure.md +279 -0
  208. package/docs/llms/16-ui-components.md +229 -0
  209. package/docs/llms/17-nonexistent-api.md +278 -0
  210. package/docs/llms/18-conditional-fields.md +222 -0
  211. package/docs/llms/19-reading-values.md +100 -0
  212. package/docs/llms/20-compute-vs-watch.md +153 -0
  213. package/docs/llms/21-array-operations.md +163 -0
  214. package/docs/llms/22-cycle-detection.md +86 -0
  215. package/docs/llms/23-copy-from.md +141 -0
  216. package/docs/llms/24-sync-fields.md +115 -0
  217. package/docs/llms/25-reset-when.md +122 -0
  218. package/docs/llms/26-transform-value.md +136 -0
  219. package/docs/llms/27-revalidate-when.md +133 -0
  220. package/docs/llms/28-submit-and-reset.md +409 -0
  221. package/docs/llms/29-async-preload.md +203 -0
  222. package/docs/llms/30-type-safety-recipes.md +213 -0
  223. package/docs/llms/31-async-validator-debounce.md +178 -0
  224. package/docs/llms/32-async-options-loading.md +108 -0
  225. package/docs/llms/33-validation-strategy.md +305 -0
  226. package/docs/llms/34-i18n.md +298 -0
  227. package/docs/llms/35-unified-contract.md +309 -0
  228. package/docs/llms/36-issue-messages.md +284 -0
  229. package/docs/llms/37-compiled-schema.md +332 -0
  230. package/docs/llms/38-form-flow.md +396 -0
  231. package/llms-index.json +1 -0
  232. package/llms.txt +10014 -3826
  233. package/package.json +77 -15
  234. package/dist/behaviors-node-DGEFMTQu.js +0 -18
  235. package/dist/behaviors-value-C7dSEhCc.js +0 -134
  236. package/dist/date-utils-dTT_x_Be.js +0 -31
  237. package/dist/derived-registry-CluZCQ7U.js +0 -16
  238. package/dist/form/behaviors.d.ts +0 -133
  239. package/dist/form/error-handler.d.ts +0 -166
  240. package/dist/form/factories/index.d.ts +0 -6
  241. package/dist/form/factories/node-factory.d.ts +0 -188
  242. package/dist/form/form-submitter.d.ts +0 -125
  243. package/dist/form/nodes/array-node.d.ts +0 -360
  244. package/dist/form/nodes/field-node.d.ts +0 -294
  245. package/dist/form/nodes/form-node.d.ts +0 -340
  246. package/dist/form/nodes/group-node.d.ts +0 -288
  247. package/dist/form/nodes/model-array-node.d.ts +0 -121
  248. package/dist/form/status-machine.d.ts +0 -153
  249. package/dist/form/types/deep-schema.d.ts +0 -116
  250. package/dist/form/types/form-proxy.d.ts +0 -141
  251. package/dist/form/unique-id.d.ts +0 -53
  252. package/dist/form/validation/validators/date-utils.d.ts +0 -30
  253. package/dist/form/validation/validators/email.d.ts +0 -23
  254. package/dist/form/validation/validators/future-date.d.ts +0 -23
  255. package/dist/form/validation/validators/integer.d.ts +0 -22
  256. package/dist/form/validation/validators/is-date.d.ts +0 -23
  257. package/dist/form/validation/validators/is-number.d.ts +0 -24
  258. package/dist/form/validation/validators/max-age.d.ts +0 -25
  259. package/dist/form/validation/validators/max-date.d.ts +0 -25
  260. package/dist/form/validation/validators/max-files.d.ts +0 -26
  261. package/dist/form/validation/validators/max-length.d.ts +0 -27
  262. package/dist/form/validation/validators/max-total-file-size.d.ts +0 -26
  263. package/dist/form/validation/validators/max.d.ts +0 -25
  264. package/dist/form/validation/validators/min-age.d.ts +0 -25
  265. package/dist/form/validation/validators/min-date.d.ts +0 -25
  266. package/dist/form/validation/validators/min-files.d.ts +0 -26
  267. package/dist/form/validation/validators/min-length.d.ts +0 -27
  268. package/dist/form/validation/validators/min.d.ts +0 -25
  269. package/dist/form/validation/validators/multiple-of.d.ts +0 -24
  270. package/dist/form/validation/validators/non-negative.d.ts +0 -22
  271. package/dist/form/validation/validators/non-zero.d.ts +0 -22
  272. package/dist/form/validation/validators/past-date.d.ts +0 -23
  273. package/dist/form/validation/validators/pattern.d.ts +0 -33
  274. package/dist/form/validation/validators/required.d.ts +0 -32
  275. package/dist/form/validation/validators/url.d.ts +0 -43
  276. package/dist/form/validation-schema.d.ts +0 -106
  277. package/dist/form/validation-strategy.d.ts +0 -55
  278. package/dist/form/validators.d.ts +0 -6
  279. package/dist/form-model-DYCzGGKF.js +0 -286
  280. package/dist/state/index.d.ts +0 -31
  281. package/dist/state/subscription-manager.d.ts +0 -180
  282. package/dist/state/types.d.ts +0 -144
  283. package/dist/state.d.ts +0 -2
  284. package/dist/state.js +0 -21
  285. package/dist/subscription-manager-705bls97.js +0 -171
@@ -1,19 +1,16 @@
1
- import { p as l, n as t } from "../date-utils-dTT_x_Be.js";
2
- function o(r, e) {
1
+ import { p as l, n as i } from "../date-utils-90-qZbse.js";
2
+ import { v as s } from "../validation-issue-B9mjI8jz.js";
3
+ function d(r, o) {
3
4
  return (n) => {
4
5
  if (n == null || n === "")
5
6
  return null;
6
- const a = l(n);
7
- if (a === null)
7
+ const t = l(n);
8
+ if (t === null)
8
9
  return null;
9
- const i = t(a), s = t(r);
10
- return i < s ? {
11
- code: "date_min",
12
- message: e?.message ?? "invalid",
13
- params: { minDate: r, ...e?.params }
14
- } : null;
10
+ const e = i(t), a = i(r);
11
+ return e < a ? s("date_min", o, { minDate: r }) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- o as minDate
15
+ d as minDate
19
16
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/min-length'
1
+ export * from '../form/validators/min-length'
2
2
  export {}
@@ -1,13 +1,10 @@
1
- function l(r, t) {
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ function l(r, e) {
2
3
  return (n) => {
3
4
  if (n == null || n === "")
4
5
  return null;
5
- const e = n.length;
6
- return typeof e != "number" ? null : e < r ? {
7
- code: "minLength",
8
- message: t?.message ?? "invalid",
9
- params: { minLength: r, actualLength: e, ...t?.params }
10
- } : null;
6
+ const t = n.length;
7
+ return typeof t != "number" ? null : t < r ? Array.isArray(n) ? i("minItems", e, { minLength: r, actualLength: t }) : i("minLength", e, { minLength: r, actualLength: t }) : null;
11
8
  };
12
9
  }
13
10
  export {
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/min'
1
+ export * from '../form/validators/min'
2
2
  export {}
@@ -1,10 +1,7 @@
1
- function e(r, i) {
2
- return (n) => n == null ? null : n < r ? {
3
- code: "min",
4
- message: i?.message ?? "invalid",
5
- params: { min: r, actual: n, ...i?.params }
6
- } : null;
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ function m(n, t) {
3
+ return (r) => typeof r != "number" || Number.isNaN(r) ? null : r < n ? i("min", t, { min: n, actual: r }) : null;
7
4
  }
8
5
  export {
9
- e as min
6
+ m as min
10
7
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/multiple-of'
1
+ export * from '../form/validators/multiple-of'
2
2
  export {}
@@ -1,14 +1,15 @@
1
- function u(e, n) {
2
- return (t) => {
3
- if (t == null || typeof t != "number" || isNaN(t)) return null;
4
- const l = Math.abs(t % e);
5
- return l <= 1e-9 || Math.abs(l - Math.abs(e)) <= 1e-9 ? null : {
6
- code: "multipleOf",
7
- message: n?.message ?? "invalid",
8
- params: { multipleOf: e, ...n?.params }
9
- };
1
+ import { v as u } from "../validation-issue-B9mjI8jz.js";
2
+ function f(t, e) {
3
+ if (!Number.isFinite(t) || t === 0)
4
+ throw new RangeError(
5
+ `[@reformer/core] multipleOf(${String(t)}): делитель должен быть конечным числом, не равным нулю.`
6
+ );
7
+ return (r) => {
8
+ if (r == null || typeof r != "number" || isNaN(r)) return null;
9
+ const n = r / t;
10
+ return Math.abs(n - Math.round(n)) <= 8 * Number.EPSILON * Math.max(1, Math.abs(n)) ? null : u("multipleOf", e, { multipleOf: t });
10
11
  };
11
12
  }
12
13
  export {
13
- u as multipleOf
14
+ f as multipleOf
14
15
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/non-negative'
1
+ export * from '../form/validators/non-negative'
2
2
  export {}
@@ -1,9 +1,6 @@
1
+ import { v as t } from "../validation-issue-B9mjI8jz.js";
1
2
  function e(r) {
2
- return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? {
3
- code: "nonNegative",
4
- message: r?.message ?? "invalid",
5
- params: r?.params
6
- } : null;
3
+ return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? t("nonNegative", r) : null;
7
4
  }
8
5
  export {
9
6
  e as nonNegative
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/non-zero'
1
+ export * from '../form/validators/non-zero'
2
2
  export {}
@@ -1,10 +1,7 @@
1
- function e(r) {
2
- return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n === 0 ? {
3
- code: "nonZero",
4
- message: r?.message ?? "invalid",
5
- params: r?.params
6
- } : null;
1
+ import { v as o } from "../validation-issue-B9mjI8jz.js";
2
+ function i(r) {
3
+ return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n === 0 ? o("nonZero", r) : null;
7
4
  }
8
5
  export {
9
- e as nonZero
6
+ i as nonZero
10
7
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/past-date'
1
+ export * from '../form/validators/past-date'
2
2
  export {}
@@ -1,19 +1,16 @@
1
- import { p as s, n as l, g as o } from "../date-utils-dTT_x_Be.js";
2
- function i(a) {
3
- return (r) => {
4
- if (r == null || r === "")
1
+ import { p as o, n as s, g as u } from "../date-utils-90-qZbse.js";
2
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
3
+ function f(n) {
4
+ return (t) => {
5
+ if (t == null || t === "")
5
6
  return null;
6
- const e = s(r);
7
- if (e === null)
7
+ const r = o(t);
8
+ if (r === null)
8
9
  return null;
9
- const n = l(e), t = o();
10
- return n > t ? {
11
- code: "date_future",
12
- message: a?.message ?? "invalid",
13
- params: a?.params
14
- } : null;
10
+ const a = s(r), e = u();
11
+ return a > e ? i("date_future", n) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- i as pastDate
15
+ f as pastDate
19
16
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/pattern'
1
+ export * from '../form/validators/pattern'
2
2
  export {}
@@ -1,11 +1,8 @@
1
- function s(e, r) {
2
- const t = new RegExp(e.source, e.flags);
3
- return (n) => n ? (t.lastIndex = 0, t.test(n) ? null : {
4
- code: "pattern",
5
- message: r?.message ?? "",
6
- params: { pattern: e.source, ...r?.params }
7
- }) : null;
1
+ import { v as s } from "../validation-issue-B9mjI8jz.js";
2
+ function o(t, e) {
3
+ const n = new RegExp(t.source, t.flags);
4
+ return (r) => r ? (n.lastIndex = 0, n.test(r) ? null : s("pattern", e, { pattern: t.source })) : null;
8
5
  }
9
6
  export {
10
- s as pattern
7
+ o as pattern
11
8
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/phone'
1
+ export * from '../form/validators/phone'
2
2
  export {}
@@ -1,16 +1,15 @@
1
- const t = {
1
+ import { v as e } from "../validation-issue-B9mjI8jz.js";
2
+ const o = {
2
3
  international: /^\+?[1-9]\d{1,14}$/,
3
- ru: /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
4
- us: /^(\+?1)?[\s-]?\(?[2-9]\d{2}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
5
- any: /^\+?\(?[0-9]{1,4}\)?[-\s.]?\(?[0-9]{1,4}\)?[-\s.]?[0-9]{1,9}$/
4
+ // Код города — в парных скобках либо без них: непарная скобка — не номер.
5
+ ru: /^(\+7|7|8)?[\s-]?(?:\([489][0-9]{2}\)|[489][0-9]{2})[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
6
+ us: /^(\+?1)?[\s-]?(?:\([2-9]\d{2}\)|[2-9]\d{2})[\s-]?\d{3}[\s-]?\d{4}$/,
7
+ // От 3 до 15 цифр (предел E.164), между ними — любые скобки, пробелы, точки и дефисы.
8
+ any: /^\+?(?:[\s().-]*\d){3,15}[\s().-]*$/
6
9
  };
7
- function a(s) {
8
- const n = s?.format ?? "any", e = t[n];
9
- return (r) => r ? e.test(r) ? null : {
10
- code: "phone",
11
- message: s?.message ?? "invalid",
12
- params: { format: n, ...s?.params }
13
- } : null;
10
+ function a(n) {
11
+ const r = n?.format ?? "any", t = o[r];
12
+ return (s) => s ? t.test(s) ? null : e("phone", n, { format: r }) : null;
14
13
  }
15
14
  export {
16
15
  a as phone
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/required'
1
+ export * from '../form/validators/required'
2
2
  export {}
@@ -1,10 +1,7 @@
1
- function n(e) {
2
- return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "boolean" && r !== !0 ? {
3
- code: "required",
4
- message: e?.message ?? "",
5
- params: e?.params
6
- } : null;
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ function e(t) {
3
+ return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "number" && Number.isNaN(r) || typeof r == "boolean" && r !== !0 ? i("required", t) : null;
7
4
  }
8
5
  export {
9
- n as required
6
+ e as required
10
7
  };
@@ -1,2 +1,2 @@
1
- export * from '../form/validation/validators/url'
1
+ export * from '../form/validators/url'
2
2
  export {}
@@ -1,22 +1,53 @@
1
- const a = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, t = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
2
- function d(e) {
3
- return (r) => {
4
- if (!r)
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ const f = ["http", "https"], h = /^([a-z][a-z\d+.-]*):\/\//i, a = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)", p = new RegExp(`^${a}(?:\\.${a}){3}$`), L = /^\[[\da-f:.]+\]$/i, w = /^[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?$/u, P = new RegExp("^(?:\\p{L}{2,}|xn--[a-z\\d-]+)$", "iu"), E = /^\d{1,5}$/, x = /\s/;
3
+ function O(t) {
4
+ if (t.toLowerCase() === "localhost" || p.test(t) || L.test(t)) return !0;
5
+ const r = t.split(".");
6
+ return r.length >= 2 && r.every((l) => w.test(l)) && P.test(r[r.length - 1]);
7
+ }
8
+ function d(t, r) {
9
+ const l = t.slice(r), c = l.search(/[/?#]/), e = c === -1 ? l : l.slice(0, c);
10
+ if (e.includes("@")) return !1;
11
+ let s = e, n;
12
+ if (e.startsWith("[")) {
13
+ const o = e.indexOf("]");
14
+ if (o === -1) return !1;
15
+ s = e.slice(0, o + 1);
16
+ const u = e.slice(o + 1);
17
+ if (u !== "") {
18
+ if (!u.startsWith(":")) return !1;
19
+ n = u.slice(1);
20
+ }
21
+ } else {
22
+ const o = e.lastIndexOf(":");
23
+ o !== -1 && (s = e.slice(0, o), n = e.slice(o + 1));
24
+ }
25
+ if (!O(s) || n !== void 0 && !E.test(n)) return !1;
26
+ try {
27
+ return new URL(t), !0;
28
+ } catch {
29
+ return !1;
30
+ }
31
+ }
32
+ function C(t) {
33
+ const r = t?.allowedProtocols !== void 0 && t.allowedProtocols.length > 0, l = (r ? t.allowedProtocols : f).map(
34
+ (e) => e.toLowerCase()
35
+ ), c = () => i("url_protocol", t, {
36
+ allowedProtocols: r ? t.allowedProtocols : [...f]
37
+ });
38
+ return (e) => {
39
+ if (!e)
5
40
  return null;
6
- const l = r;
7
- return (e?.requireProtocol ? t : a).test(l) ? e?.allowedProtocols && e.allowedProtocols.length > 0 && !e.allowedProtocols.some(
8
- (o) => l.toLowerCase().startsWith(`${o}://`)
9
- ) ? {
10
- code: "url_protocol",
11
- message: e?.message ?? "invalid",
12
- params: { allowedProtocols: e.allowedProtocols, ...e?.params }
13
- } : null : {
14
- code: "url",
15
- message: e?.message ?? "invalid",
16
- params: e?.params
17
- };
41
+ if (x.test(e)) return i("url", t);
42
+ const s = h.exec(e);
43
+ if (s === null) {
44
+ if (t?.requireProtocol || e.startsWith("/")) return i("url", t);
45
+ const n = `http://${e}`;
46
+ return d(n, 7) ? r ? c() : null : i("url", t);
47
+ }
48
+ return d(e, s[0].length) ? l.includes(s[1].toLowerCase()) ? null : c() : i("url", t);
18
49
  };
19
50
  }
20
51
  export {
21
- d as url
52
+ C as url
22
53
  };
@@ -1,6 +1,2 @@
1
- export * from './form/validators'
2
- export {}
3
- import _default from './form/validators'
4
- export default _default
5
- export * from './form/validators'
1
+ export * from './form/validators/index'
6
2
  export {}
@@ -1,200 +1,144 @@
1
- import { required as u } from "./validators/required.js";
2
- import { min as a } from "./validators/min.js";
3
- import { max as p } from "./validators/max.js";
4
- import { minLength as c } from "./validators/min-length.js";
5
- import { maxLength as g } from "./validators/max-length.js";
6
- import { email as d } from "./validators/email.js";
7
- import { pattern as z } from "./validators/pattern.js";
8
- import { url as h } from "./validators/url.js";
9
- import { phone as y } from "./validators/phone.js";
10
- import { isNumber as F } from "./validators/is-number.js";
11
- import { integer as x } from "./validators/integer.js";
12
- import { multipleOf as S } from "./validators/multiple-of.js";
13
- import { nonNegative as b } from "./validators/non-negative.js";
14
- import { nonZero as A } from "./validators/non-zero.js";
15
- import { isDate as L } from "./validators/is-date.js";
16
- import { minDate as T } from "./validators/min-date.js";
17
- import { maxDate as C } from "./validators/max-date.js";
18
- import { pastDate as D } from "./validators/past-date.js";
19
- import { futureDate as N } from "./validators/future-date.js";
20
- import { minAge as W } from "./validators/min-age.js";
21
- import { maxAge as _ } from "./validators/max-age.js";
22
- function m(r) {
1
+ import { required as d } from "./validators/required.js";
2
+ import { min as b } from "./validators/min.js";
3
+ import { max as L } from "./validators/max.js";
4
+ import { minLength as D } from "./validators/min-length.js";
5
+ import { maxLength as T } from "./validators/max-length.js";
6
+ import { email as w } from "./validators/email.js";
7
+ import { pattern as k } from "./validators/pattern.js";
8
+ import { url as B } from "./validators/url.js";
9
+ import { phone as O } from "./validators/phone.js";
10
+ import { isNumber as E } from "./validators/is-number.js";
11
+ import { integer as H } from "./validators/integer.js";
12
+ import { multipleOf as K } from "./validators/multiple-of.js";
13
+ import { nonNegative as P } from "./validators/non-negative.js";
14
+ import { nonZero as R } from "./validators/non-zero.js";
15
+ import { isDate as V } from "./validators/is-date.js";
16
+ import { minDate as Y } from "./validators/min-date.js";
17
+ import { maxDate as $ } from "./validators/max-date.js";
18
+ import { pastDate as ee } from "./validators/past-date.js";
19
+ import { futureDate as ne } from "./validators/future-date.js";
20
+ import { minAge as ie } from "./validators/min-age.js";
21
+ import { maxAge as le } from "./validators/max-age.js";
22
+ import { v as l } from "./validation-issue-B9mjI8jz.js";
23
+ function s(r) {
23
24
  if (typeof r != "object" || r === null) return !1;
24
- const i = r;
25
- return !(typeof i.name != "string" || i.size !== void 0 && typeof i.size != "number" || i.type !== void 0 && typeof i.type != "string");
25
+ const t = r;
26
+ return !(typeof t.name != "string" || t.size !== void 0 && typeof t.size != "number" || t.type !== void 0 && typeof t.type != "string");
26
27
  }
27
- function o(r) {
28
- return Array.isArray(r) ? r.filter(m) : m(r) ? [r] : null;
28
+ function f(r) {
29
+ return Array.isArray(r) ? r.filter(s) : s(r) ? [r] : null;
29
30
  }
30
- function s(r, i) {
31
- const e = i.split(",").map((l) => l.trim().toLowerCase()).filter(Boolean);
31
+ function m(r, t) {
32
+ const e = t.split(",").map((o) => o.trim().toLowerCase()).filter(Boolean);
32
33
  if (e.length === 0) return !0;
33
- const n = r.name.toLowerCase(), t = (r.type ?? "").toLowerCase();
34
- return e.some((l) => l.startsWith(".") ? n.endsWith(l) : l.endsWith("/*") ? t.startsWith(l.slice(0, -1)) : l.includes("/") ? t === l : !1);
34
+ const n = r.name.toLowerCase(), i = (r.type ?? "").toLowerCase();
35
+ return e.some((o) => o.startsWith(".") ? n.endsWith(o) : o === "*/*" ? !0 : o.endsWith("/*") ? i.startsWith(o.slice(0, -1)) : o.includes("/") ? i === o : !1);
35
36
  }
36
- function j(r, i) {
37
+ function c(r, t) {
37
38
  return (e) => {
38
39
  if (e == null || e === "")
39
40
  return null;
40
- const n = o(e);
41
+ const n = f(e);
41
42
  if (n === null || n.length === 0) return null;
42
- for (const t of n)
43
- if (typeof t.size == "number" && t.size > r)
44
- return {
45
- code: "maxFileSize",
46
- message: i?.message ?? "invalid",
47
- params: {
48
- maxFileSize: r,
49
- fileName: t.name,
50
- actualSize: t.size,
51
- ...i?.params
52
- }
53
- };
43
+ for (const i of n)
44
+ if (typeof i.size == "number" && i.size > r)
45
+ return l("maxFileSize", t, {
46
+ maxFileSize: r,
47
+ fileName: i.name,
48
+ actualSize: i.size
49
+ });
54
50
  return null;
55
51
  };
56
52
  }
57
- function w(r, i) {
53
+ function x(r, t) {
58
54
  return (e) => {
59
55
  if (e == null || e === "")
60
56
  return null;
61
- const n = o(e);
57
+ const n = f(e);
62
58
  if (n === null || n.length === 0) return null;
63
- for (const t of n)
64
- if (typeof t.size == "number" && t.size < r)
65
- return {
66
- code: "minFileSize",
67
- message: i?.message ?? "invalid",
68
- params: {
69
- minFileSize: r,
70
- fileName: t.name,
71
- actualSize: t.size,
72
- ...i?.params
73
- }
74
- };
59
+ for (const i of n)
60
+ if (typeof i.size == "number" && i.size < r)
61
+ return l("minFileSize", t, {
62
+ minFileSize: r,
63
+ fileName: i.name,
64
+ actualSize: i.size
65
+ });
75
66
  return null;
76
67
  };
77
68
  }
78
- function O(r, i) {
69
+ function a(r, t) {
79
70
  return (e) => {
80
71
  if (e == null || e === "")
81
72
  return null;
82
- const n = o(e);
73
+ const n = f(e);
83
74
  if (n === null || n.length === 0) return null;
84
- for (const t of n)
85
- if (!s(t, r))
86
- return {
87
- code: "fileType",
88
- message: i?.message ?? "invalid",
89
- params: { accept: r, fileName: t.name, ...i?.params }
90
- };
75
+ for (const i of n)
76
+ if (!m(i, r))
77
+ return l("fileType", t, { accept: r, fileName: i.name });
91
78
  return null;
92
79
  };
93
80
  }
94
- function k(r, i) {
81
+ function z(r, t) {
95
82
  return (e) => {
96
83
  if (e == null || e === "")
97
84
  return null;
98
- const n = o(e);
99
- return n === null || n.length === 0 ? null : n.length > r ? {
100
- code: "maxFiles",
101
- message: i?.message ?? "invalid",
102
- params: { maxFiles: r, actualCount: n.length, ...i?.params }
103
- } : null;
85
+ const n = f(e);
86
+ return n === null || n.length === 0 ? null : n.length > r ? l("maxFiles", t, { maxFiles: r, actualCount: n.length }) : null;
104
87
  };
105
88
  }
106
- function q(r, i) {
89
+ function g(r, t) {
107
90
  return (e) => {
108
91
  if (e == null || e === "")
109
92
  return null;
110
- const n = o(e);
111
- return n === null || n.length === 0 ? null : n.length < r ? {
112
- code: "minFiles",
113
- message: i?.message ?? "invalid",
114
- params: { minFiles: r, actualCount: n.length, ...i?.params }
115
- } : null;
93
+ const n = f(e);
94
+ return n === null ? null : n.length < r ? l("minFiles", t, { minFiles: r, actualCount: n.length }) : null;
116
95
  };
117
96
  }
118
- function B(r, i) {
97
+ function h(r, t) {
119
98
  return (e) => {
120
99
  if (e == null || e === "")
121
100
  return null;
122
- const n = o(e);
101
+ const n = f(e);
123
102
  if (n === null || n.length === 0) return null;
124
- const t = n.reduce(
125
- (l, f) => l + (typeof f.size == "number" ? f.size : 0),
103
+ const i = n.reduce(
104
+ (o, u) => o + (typeof u.size == "number" ? u.size : 0),
126
105
  0
127
106
  );
128
- return t > r ? {
129
- code: "maxTotalFileSize",
130
- message: i?.message ?? "invalid",
131
- params: { maxTotalFileSize: r, actualTotal: t, ...i?.params }
132
- } : null;
107
+ return i > r ? l("maxTotalFileSize", t, {
108
+ maxTotalFileSize: r,
109
+ actualTotal: i
110
+ }) : null;
133
111
  };
134
112
  }
135
- const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
136
- __proto__: null,
137
- email: d,
138
- fileType: O,
139
- futureDate: N,
140
- integer: x,
141
- isDate: L,
142
- isFileLike: m,
143
- isNumber: F,
144
- matchesFileAccept: s,
145
- max: p,
146
- maxAge: _,
147
- maxDate: C,
148
- maxFileSize: j,
149
- maxFiles: k,
150
- maxLength: g,
151
- maxTotalFileSize: B,
152
- min: a,
153
- minAge: W,
154
- minDate: T,
155
- minFileSize: w,
156
- minFiles: q,
157
- minLength: c,
158
- multipleOf: S,
159
- nonNegative: b,
160
- nonZero: A,
161
- pastDate: D,
162
- pattern: z,
163
- phone: y,
164
- required: u,
165
- toFileArray: o,
166
- url: h
167
- }, Symbol.toStringTag, { value: "Module" }));
168
113
  export {
169
- te as default,
170
- d as email,
171
- O as fileType,
172
- N as futureDate,
173
- x as integer,
174
- L as isDate,
175
- m as isFileLike,
176
- F as isNumber,
177
- s as matchesFileAccept,
178
- p as max,
179
- _ as maxAge,
180
- C as maxDate,
181
- j as maxFileSize,
182
- k as maxFiles,
183
- g as maxLength,
184
- B as maxTotalFileSize,
185
- a as min,
186
- W as minAge,
187
- T as minDate,
188
- w as minFileSize,
189
- q as minFiles,
190
- c as minLength,
191
- S as multipleOf,
192
- b as nonNegative,
193
- A as nonZero,
194
- D as pastDate,
195
- z as pattern,
196
- y as phone,
197
- u as required,
198
- o as toFileArray,
199
- h as url
114
+ w as email,
115
+ a as fileType,
116
+ ne as futureDate,
117
+ H as integer,
118
+ V as isDate,
119
+ s as isFileLike,
120
+ E as isNumber,
121
+ m as matchesFileAccept,
122
+ L as max,
123
+ le as maxAge,
124
+ $ as maxDate,
125
+ c as maxFileSize,
126
+ z as maxFiles,
127
+ T as maxLength,
128
+ h as maxTotalFileSize,
129
+ b as min,
130
+ ie as minAge,
131
+ Y as minDate,
132
+ x as minFileSize,
133
+ g as minFiles,
134
+ D as minLength,
135
+ K as multipleOf,
136
+ P as nonNegative,
137
+ R as nonZero,
138
+ ee as pastDate,
139
+ k as pattern,
140
+ O as phone,
141
+ d as required,
142
+ f as toFileArray,
143
+ B as url
200
144
  };