@regle/rules 1.20.4 → 1.21.0-beta.2

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @regle/rules v1.20.4
2
+ * @regle/rules v1.21.0-beta.2
3
3
  * (c) 2026 Victor Garcia
4
4
  * @license MIT
5
5
  */
@@ -1,19 +1,17 @@
1
1
  /**
2
- * @regle/rules v1.20.4
2
+ * @regle/rules v1.21.0-beta.2
3
3
  * (c) 2026 Victor Garcia
4
4
  * @license MIT
5
5
  */
6
6
 
7
7
  import { InternalRuleType, createRule, unwrapRuleParameters } from "@regle/core";
8
8
  import { capitalize, computed, effectScope, onScopeDispose, ref, toValue } from "vue";
9
-
10
9
  /**
11
10
  * Server side friendly way of checking for a File
12
11
  */
13
12
  function isFile(value) {
14
13
  return value?.constructor?.name == "File";
15
14
  }
16
-
17
15
  /**
18
16
  * Checks if a value is empty in any way (including arrays and objects).
19
17
  * This is the inverse of `isFilled`.
@@ -58,16 +56,13 @@ function isEmpty(value, considerEmptyArrayInvalid = true, considerEmptyObjectInv
58
56
  }
59
57
  return !String(value).length;
60
58
  }
61
-
62
59
  function isObject(obj) {
63
60
  if (obj && (obj instanceof Date || obj.constructor.name == "File" || obj.constructor.name == "FileList")) return false;
64
61
  return typeof obj === "object" && obj !== null && !Array.isArray(obj);
65
62
  }
66
-
67
63
  function isRuleDef(rule) {
68
64
  return (isObject(rule) || typeof rule === "function") && "_validator" in rule;
69
65
  }
70
-
71
66
  function extractValidator(rule) {
72
67
  let _type;
73
68
  let validator;
@@ -90,7 +85,6 @@ function extractValidator(rule) {
90
85
  _active
91
86
  };
92
87
  }
93
-
94
88
  function withMessage(rule, newMessage) {
95
89
  const { _type, validator, _active, _params, _async } = extractValidator(rule);
96
90
  const newRule = createRule({
@@ -112,7 +106,6 @@ function withMessage(rule, newMessage) {
112
106
  return newRule;
113
107
  } else return newRule;
114
108
  }
115
-
116
109
  function withTooltip(rule, newTooltip) {
117
110
  const { _type, validator, _active, _params, _message, _async } = extractValidator(rule);
118
111
  const newRule = createRule({
@@ -132,7 +125,6 @@ function withTooltip(rule, newTooltip) {
132
125
  return executedRule;
133
126
  } else return newRule;
134
127
  }
135
-
136
128
  function withAsync(rule, depsArray) {
137
129
  let validator;
138
130
  const { _type, _params, _message, _active } = extractValidator(rule);
@@ -151,7 +143,6 @@ function withAsync(rule, depsArray) {
151
143
  newRule._params = augmentedParams;
152
144
  return newRule(...depsArray ?? []);
153
145
  }
154
-
155
146
  function withParams(rule, depsArray) {
156
147
  let validator;
157
148
  const { _type, _params, _message, _active, _async } = extractValidator(rule);
@@ -170,7 +161,6 @@ function withParams(rule, depsArray) {
170
161
  newRule._params = augmentedParams;
171
162
  return newRule(...depsArray);
172
163
  }
173
-
174
164
  function applyIf(_condition, rule, options) {
175
165
  const { _type, validator, _params, _message, _async, _active } = extractValidator(rule);
176
166
  const augmentedParams = (_params ?? []).concat(options?.hideParams ? [] : [_condition]);
@@ -196,7 +186,6 @@ function applyIf(_condition, rule, options) {
196
186
  if (typeof newRule === "function") return newRule(...augmentedParams);
197
187
  else return newRule;
198
188
  }
199
-
200
189
  /**
201
190
  * Checks if the provided value is a valid Date. Used internally for date rules.
202
191
  * Can also validate date strings.
@@ -233,7 +222,6 @@ function isDate(value) {
233
222
  }
234
223
  return !!possibleDate;
235
224
  }
236
-
237
225
  /**
238
226
  * Coerces any string, number, or Date value into a `Date` using the `Date` constructor.
239
227
  *
@@ -259,7 +247,6 @@ function toDate(argument) {
259
247
  else if (typeof argument === "string" || argStr === "[object String]") return new Date(argument);
260
248
  else return /* @__PURE__ */ new Date(NaN);
261
249
  }
262
-
263
250
  function debounce(func, wait, { immediate = false, trackDebounceRef } = {}) {
264
251
  let timeout;
265
252
  const debouncedFn = (...args) => {
@@ -299,7 +286,6 @@ function debounce(func, wait, { immediate = false, trackDebounceRef } = {}) {
299
286
  };
300
287
  return debouncedFn;
301
288
  }
302
-
303
289
  /**
304
290
  * Formats a file size in bytes to a human readable string.
305
291
  * @param size - The size in bytes
@@ -312,7 +298,6 @@ function formatFileSize(size) {
312
298
  if (size < 1024 * 1024 * 1024) return `${(size / 1024 / 1024).toFixed(2)} mb`;
313
299
  return `${(size / 1024 / 1024 / 1024).toFixed(2)} gb`;
314
300
  }
315
-
316
301
  /**
317
302
  * Checks if any value you provide is defined (including arrays and objects).
318
303
  * This is almost a must-have for optional fields when writing custom rules.
@@ -346,7 +331,6 @@ function formatFileSize(size) {
346
331
  function isFilled(value, considerEmptyArrayInvalid = true, considerEmptyObjectInvalid = true) {
347
332
  return !isEmpty(typeof value === "string" ? value.trim() : value, considerEmptyArrayInvalid, considerEmptyObjectInvalid);
348
333
  }
349
-
350
334
  /**
351
335
  * Type guard that checks if the passed value is a real `Number`.
352
336
  * Returns `false` for `NaN`, making it safer than `typeof value === "number"`.
@@ -378,7 +362,6 @@ function isNumber(value) {
378
362
  else if (isNaN(value)) return false;
379
363
  else return true;
380
364
  }
381
-
382
365
  /**
383
366
  * Tests a value against one or more regular expressions.
384
367
  * Returns `true` if the value is empty or matches **all** provided patterns.
@@ -413,7 +396,6 @@ function matchRegex(_value, ...expr) {
413
396
  return reg.test(value);
414
397
  });
415
398
  }
416
-
417
399
  /**
418
400
  * Returns the length/size of any data type. Works with strings, arrays, objects and numbers.
419
401
  *
@@ -448,7 +430,6 @@ function getSize(value) {
448
430
  }
449
431
  return String(_value).length;
450
432
  }
451
-
452
433
  /**
453
434
  * Converts any string (or number) into a number using the `Number` constructor.
454
435
  *
@@ -481,7 +462,6 @@ function toNumber(argument) {
481
462
  }
482
463
  return NaN;
483
464
  }
484
-
485
465
  /**
486
466
  * Type guard that checks if the passed value is a real `String`.
487
467
  */
@@ -490,7 +470,6 @@ function isString(value) {
490
470
  else if (typeof value !== "string") return false;
491
471
  return true;
492
472
  }
493
-
494
473
  function isAnyRuleAsync(rules) {
495
474
  return rules.some((rule) => {
496
475
  if (typeof rule === "function") return rule.constructor.name === "AsyncFunction";
@@ -581,7 +560,6 @@ function combineRules(rules, options) {
581
560
  if (typeof newRule === "function") return newRule(...newParams);
582
561
  else return newRule;
583
562
  }
584
-
585
563
  /**
586
564
  * The `and` operator combines multiple rules and validates successfully only if **all** provided rules are valid.
587
565
  *
@@ -615,7 +593,6 @@ function and(...rules) {
615
593
  message: "The value does not match all of the provided validators"
616
594
  });
617
595
  }
618
-
619
596
  /**
620
597
  * The `or` operator validates successfully if **at least one** of the provided rules is valid.
621
598
  *
@@ -649,7 +626,6 @@ function or(...rules) {
649
626
  message: "The value does not match any of the provided validators"
650
627
  });
651
628
  }
652
-
653
629
  /**
654
630
  * The `xor` operator validates successfully if **exactly one** of the provided rules is valid (exclusive or).
655
631
  *
@@ -683,7 +659,6 @@ function xor(...rules) {
683
659
  message: "The value does not match exactly one of the provided validators"
684
660
  });
685
661
  }
686
-
687
662
  /**
688
663
  * The `not` operator passes when the provided rule **fails** and fails when the rule **passes**.
689
664
  * It can be combined with other rules.
@@ -740,7 +715,6 @@ function not(rule, message) {
740
715
  if (typeof newRule === "function") return newRule(...newParams);
741
716
  else return newRule;
742
717
  }
743
-
744
718
  function mapRulesWithCondition(condition, rules, trueCheck) {
745
719
  return Object.entries(toValue(rules)).map(([key, rule]) => {
746
720
  if (typeof rule === "function" || isObject(rule) && "_validator" in rule) return [key, applyIf(trueCheck ? condition : () => !toValue(condition), rule)];
@@ -774,7 +748,6 @@ function assignIf(_condition, rules, otherwiseRules) {
774
748
  let falseRules = otherwiseRules ? mapRulesWithCondition(_condition, otherwiseRules, false) : [];
775
749
  return Object.fromEntries([...trueRules, ...falseRules]);
776
750
  }
777
-
778
751
  /**
779
752
  * Creates a computed ref that checks if all previous rules have passed.
780
753
  */
@@ -854,7 +827,6 @@ function pipe(...rules) {
854
827
  $debounce: 0
855
828
  };
856
829
  }
857
-
858
830
  /** Regex for validating url protocols */
859
831
  const DEFAULT_PROTOCOL_REGEX = /^https?$/;
860
832
  /** Regex for validating url hostnames */
@@ -892,7 +864,6 @@ const EMAIL_REGEX = /^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{
892
864
  const INTEGER_REGEX = /(^[0-9]*$)|(^-[0-9]+$)/;
893
865
  /** Regex for validating numeric strings */
894
866
  const NUMERIC_REGEX = /^\d*(\.\d+)?$/;
895
-
896
867
  /**
897
868
  * Allows only alphabetic characters.
898
869
  *
@@ -923,7 +894,6 @@ const alpha = createRule({
923
894
  },
924
895
  message: "The value must be alphabetical"
925
896
  });
926
-
927
897
  /**
928
898
  * Allows only alphanumeric characters.
929
899
  *
@@ -954,7 +924,6 @@ const alphaNum = createRule({
954
924
  },
955
925
  message: "The value must be alpha-numeric"
956
926
  });
957
-
958
927
  /**
959
928
  * Checks if at least one key is filled in the object.
960
929
  *
@@ -986,7 +955,6 @@ const atLeastOne = createRule({
986
955
  },
987
956
  message: "At least one item is required"
988
957
  });
989
-
990
958
  /**
991
959
  * Checks if a number is in specified bounds. `min` and `max` are both inclusive by default.
992
960
  *
@@ -1033,7 +1001,6 @@ const between = createRule({
1033
1001
  return `The value must be between ${min} and ${max}`;
1034
1002
  }
1035
1003
  });
1036
-
1037
1004
  /**
1038
1005
  * Requires a value to be a native boolean type.
1039
1006
  *
@@ -1061,7 +1028,6 @@ const boolean = createRule({
1061
1028
  },
1062
1029
  message: "The value must be a native boolean"
1063
1030
  });
1064
-
1065
1031
  /**
1066
1032
  * Requires a boolean value to be `true`. This is useful for checkbox inputs like "accept terms".
1067
1033
  *
@@ -1084,7 +1050,6 @@ const checked = createRule({
1084
1050
  message: "The field must be checked",
1085
1051
  required: true
1086
1052
  });
1087
-
1088
1053
  /**
1089
1054
  * Factory function to create string operation rules (contains/startsWith/endsWith).
1090
1055
  * Reduces duplication between similar string validation rules.
@@ -1115,7 +1080,6 @@ function createStringOperationRule({ type, operation }) {
1115
1080
  }
1116
1081
  });
1117
1082
  }
1118
-
1119
1083
  /**
1120
1084
  * Checks if the string contains the specified substring.
1121
1085
  *
@@ -1138,7 +1102,6 @@ const contains = createStringOperationRule({
1138
1102
  type: "contains",
1139
1103
  operation: "contains"
1140
1104
  });
1141
-
1142
1105
  /**
1143
1106
  * Checks if the value matches one or more regular expressions.
1144
1107
  *
@@ -1167,7 +1130,6 @@ const regex = createRule({
1167
1130
  },
1168
1131
  message: "The value must match the required pattern"
1169
1132
  });
1170
-
1171
1133
  /**
1172
1134
  * Requires a string field to contain at least a given number of special characters.
1173
1135
  *
@@ -1205,7 +1167,6 @@ const containsSpecialCharacter = createRule({
1205
1167
  return `This field must contain at least ${minCharactersCount} special character${minCharactersCount > 1 ? "s" : ""}`;
1206
1168
  }
1207
1169
  });
1208
-
1209
1170
  /**
1210
1171
  * Requires a string field to contain at least a given number of uppercase letters.
1211
1172
  *
@@ -1241,7 +1202,6 @@ const containsUppercase = createRule({
1241
1202
  return `This field must contain at least ${minUppercaseCount} uppercase letter${minUppercaseCount > 1 ? "s" : ""}`;
1242
1203
  }
1243
1204
  });
1244
-
1245
1205
  /**
1246
1206
  * Requires a value to be a native `Date` constructor.
1247
1207
  *
@@ -1269,7 +1229,6 @@ const date = createRule({
1269
1229
  },
1270
1230
  message: "The value must be a native Date"
1271
1231
  });
1272
-
1273
1232
  function getUserLocale() {
1274
1233
  if (navigator.languages != void 0) return navigator.languages[0];
1275
1234
  return navigator.language ?? "en-US";
@@ -1278,7 +1237,6 @@ function formatLocaleDate(date) {
1278
1237
  if (date) return new Intl.DateTimeFormat(getUserLocale(), { dateStyle: "short" }).format(new Date(date));
1279
1238
  return "?";
1280
1239
  }
1281
-
1282
1240
  /**
1283
1241
  * Checks if the date is after the given parameter.
1284
1242
  *
@@ -1325,7 +1283,6 @@ const dateAfter = createRule({
1325
1283
  return `The date must be after ${formatLocaleDate(after)}`;
1326
1284
  }
1327
1285
  });
1328
-
1329
1286
  /**
1330
1287
  * Checks if the date is before the given parameter.
1331
1288
  *
@@ -1372,7 +1329,6 @@ const dateBefore = createRule({
1372
1329
  return `The date must be before ${formatLocaleDate(before)}`;
1373
1330
  }
1374
1331
  });
1375
-
1376
1332
  /**
1377
1333
  * Checks if the date falls between the specified bounds.
1378
1334
  *
@@ -1408,7 +1364,6 @@ const dateBetween = createRule({
1408
1364
  return `The date must be between ${formatLocaleDate(before)} and ${formatLocaleDate(after)}`;
1409
1365
  }
1410
1366
  });
1411
-
1412
1367
  /**
1413
1368
  * Allows positive and negative decimal numbers.
1414
1369
  *
@@ -1431,7 +1386,6 @@ const decimal = createRule({
1431
1386
  },
1432
1387
  message: "The value must be decimal"
1433
1388
  });
1434
-
1435
1389
  /**
1436
1390
  * Validates domain names.
1437
1391
  *
@@ -1454,7 +1408,6 @@ const domain = createRule({
1454
1408
  },
1455
1409
  message: "The value is not a valid domain"
1456
1410
  });
1457
-
1458
1411
  /**
1459
1412
  * Validates email addresses. Always verify on the server to ensure the address is real and not already in use.
1460
1413
  *
@@ -1477,7 +1430,6 @@ const email = createRule({
1477
1430
  },
1478
1431
  message: "The value must be a valid email address"
1479
1432
  });
1480
-
1481
1433
  /**
1482
1434
  * Validates if the value is a valid emoji.
1483
1435
  *
@@ -1500,7 +1452,6 @@ const emoji = createRule({
1500
1452
  },
1501
1453
  message: "The value should be a valid emoji"
1502
1454
  });
1503
-
1504
1455
  /**
1505
1456
  * Checks if the string ends with the specified substring.
1506
1457
  *
@@ -1521,7 +1472,6 @@ const endsWith = createStringOperationRule({
1521
1472
  type: "endsWith",
1522
1473
  operation: "endsWith"
1523
1474
  });
1524
-
1525
1475
  /**
1526
1476
  * Requires the input value to have a strict specified length. Works with arrays, objects and strings.
1527
1477
  *
@@ -1563,7 +1513,6 @@ const exactDigits = createRule({
1563
1513
  return `The value should have exactly ${count} digits`;
1564
1514
  }
1565
1515
  });
1566
-
1567
1516
  /**
1568
1517
  * Requires the input value to have a strict specified length. Works with arrays, objects and strings.
1569
1518
  *
@@ -1602,7 +1551,6 @@ const exactLength = createRule({
1602
1551
  return `The value must be exactly ${count} characters long`;
1603
1552
  }
1604
1553
  });
1605
-
1606
1554
  /**
1607
1555
  * Requires a field to have a strict numeric value.
1608
1556
  *
@@ -1641,7 +1589,6 @@ const exactValue = createRule({
1641
1589
  return `The value must be equal to ${count}`;
1642
1590
  }
1643
1591
  });
1644
-
1645
1592
  /**
1646
1593
  * Requires a value to be a native `File` constructor.
1647
1594
  *
@@ -1669,7 +1616,6 @@ const file = createRule({
1669
1616
  },
1670
1617
  message: "The value must be a native File"
1671
1618
  });
1672
-
1673
1619
  /**
1674
1620
  * Requires a value to be a file with a specific type.
1675
1621
  *
@@ -1701,7 +1647,6 @@ const fileType = createRule({
1701
1647
  return `File type is not allowed. Allowed types are: ${accept.map((type) => type.split("/")[1]).join(", ")}.`;
1702
1648
  }
1703
1649
  });
1704
-
1705
1650
  /**
1706
1651
  * Validates hexadecimal values.
1707
1652
  *
@@ -1724,7 +1669,6 @@ const hexadecimal = createRule({
1724
1669
  },
1725
1670
  message: "The value must be hexadecimal"
1726
1671
  });
1727
-
1728
1672
  /**
1729
1673
  * Validates hostnames.
1730
1674
  *
@@ -1747,7 +1691,6 @@ const hostname = createRule({
1747
1691
  },
1748
1692
  message: "The value is not a valid hostname"
1749
1693
  });
1750
-
1751
1694
  /**
1752
1695
  * Validates URLs.
1753
1696
  *
@@ -1785,7 +1728,6 @@ const url = createRule({
1785
1728
  },
1786
1729
  message: "The value must be a valid URL"
1787
1730
  });
1788
-
1789
1731
  /**
1790
1732
  * Validates HTTP URLs.
1791
1733
  *
@@ -1814,7 +1756,6 @@ const httpUrl = createRule({
1814
1756
  },
1815
1757
  message: "The value is not a valid http URL address"
1816
1758
  });
1817
-
1818
1759
  /**
1819
1760
  * Allows only integers (positive and negative).
1820
1761
  *
@@ -1837,7 +1778,6 @@ const integer = createRule({
1837
1778
  },
1838
1779
  message: "The value must be an integer"
1839
1780
  });
1840
-
1841
1781
  function nibbleValid(nibble) {
1842
1782
  if (nibble.length > 3 || nibble.length === 0) return false;
1843
1783
  if (nibble[0] === "0" && nibble !== "0") return false;
@@ -1869,7 +1809,6 @@ const ipv4Address = createRule({
1869
1809
  },
1870
1810
  message: "The value is not a valid IPv4 address"
1871
1811
  });
1872
-
1873
1812
  /**
1874
1813
  * Allow only one possible literal value.
1875
1814
  *
@@ -1892,7 +1831,6 @@ function literal(literal) {
1892
1831
  return true;
1893
1832
  }, [computed(() => toValue(literal))]), ({ $params: [literal] }) => `Value should be ${literal}.`);
1894
1833
  }
1895
-
1896
1834
  /**
1897
1835
  * Validates lowercase strings.
1898
1836
  *
@@ -1915,7 +1853,6 @@ const lowercase = createRule({
1915
1853
  },
1916
1854
  message: "The value must be lowercase"
1917
1855
  });
1918
-
1919
1856
  /**
1920
1857
  * Validates MAC addresses. Call as a function to specify a custom separator (e.g., `':'` or an empty string for `00ff1122334455`).
1921
1858
  *
@@ -1947,7 +1884,6 @@ const macAddress = createRule({
1947
1884
  message: "The value is not a valid MAC Address"
1948
1885
  });
1949
1886
  const hexValid = (hex) => hex.toLowerCase().match(/^[0-9a-f]{2}$/);
1950
-
1951
1887
  /**
1952
1888
  * Requires a value to be a file with a maximum size.
1953
1889
  *
@@ -1982,7 +1918,6 @@ const maxFileSize = createRule({
1982
1918
  return `File size (${formatFileSize(fileSize)}) cannot exceed ${formatFileSize(maxSize)}`;
1983
1919
  }
1984
1920
  });
1985
-
1986
1921
  /**
1987
1922
  * Factory function to create length comparison rules (minLength/maxLength).
1988
1923
  * Reduces duplication between similar length rules.
@@ -2012,7 +1947,6 @@ function createLengthRule({ type, direction }) {
2012
1947
  }
2013
1948
  });
2014
1949
  }
2015
-
2016
1950
  /**
2017
1951
  * Requires the input value to have a maximum specified length, inclusive. Works with arrays, objects and strings.
2018
1952
  *
@@ -2043,7 +1977,6 @@ const maxLength = createLengthRule({
2043
1977
  type: "maxLength",
2044
1978
  direction: "max"
2045
1979
  });
2046
-
2047
1980
  /**
2048
1981
  * Factory function to create value comparison rules (minValue/maxValue).
2049
1982
  * Reduces duplication between similar comparison rules.
@@ -2074,7 +2007,6 @@ function createValueComparisonRule({ type, direction }) {
2074
2007
  }
2075
2008
  });
2076
2009
  }
2077
-
2078
2010
  /**
2079
2011
  * Requires a field to have a specified maximum numeric value.
2080
2012
  *
@@ -2105,7 +2037,6 @@ const maxValue = createValueComparisonRule({
2105
2037
  type: "maxValue",
2106
2038
  direction: "max"
2107
2039
  });
2108
-
2109
2040
  /**
2110
2041
  * Requires a value to be a file with a minimum size.
2111
2042
  *
@@ -2140,7 +2071,6 @@ const minFileSize = createRule({
2140
2071
  return `File size (${formatFileSize(fileSize)}) must be at least ${formatFileSize(minSize)}`;
2141
2072
  }
2142
2073
  });
2143
-
2144
2074
  /**
2145
2075
  * Requires the input value to have a minimum specified length, inclusive. Works with arrays, objects and strings.
2146
2076
  *
@@ -2171,7 +2101,6 @@ const minLength = createLengthRule({
2171
2101
  type: "minLength",
2172
2102
  direction: "min"
2173
2103
  });
2174
-
2175
2104
  /**
2176
2105
  * Requires a field to have a specified minimum numeric value.
2177
2106
  *
@@ -2202,7 +2131,6 @@ const minValue = createValueComparisonRule({
2202
2131
  type: "minValue",
2203
2132
  direction: "min"
2204
2133
  });
2205
-
2206
2134
  function getValidEnumValues(obj) {
2207
2135
  const validKeys = Object.keys(obj).filter((k) => typeof obj[obj[k]] !== "number");
2208
2136
  const filtered = {};
@@ -2235,7 +2163,6 @@ function nativeEnum(enumLike) {
2235
2163
  return true;
2236
2164
  }, [computed(() => toValue(enumLike))]), ({ $params: [enumLike] }) => `The value must be one of the following: ${Object.values(enumLike).join(", ")}`);
2237
2165
  }
2238
-
2239
2166
  /**
2240
2167
  * Requires a value to be a native number type.
2241
2168
  *
@@ -2263,7 +2190,6 @@ const number = createRule({
2263
2190
  },
2264
2191
  message: "The value must be a native number"
2265
2192
  });
2266
-
2267
2193
  /**
2268
2194
  * Allows only numeric values (including numeric strings).
2269
2195
  *
@@ -2286,7 +2212,6 @@ const numeric = createRule({
2286
2212
  },
2287
2213
  message: "The value must be numeric"
2288
2214
  });
2289
-
2290
2215
  /**
2291
2216
  * Allow only one of the values from a fixed Array of possible entries.
2292
2217
  *
@@ -2316,7 +2241,6 @@ const oneOf = createRule({
2316
2241
  return `The value must be one of the following: ${(Array.isArray(options) ? options : Object.values(options)).join(", ")}`;
2317
2242
  }
2318
2243
  });
2319
-
2320
2244
  /**
2321
2245
  * Requires non-empty data. Checks for empty arrays and strings containing only whitespaces.
2322
2246
  *
@@ -2339,7 +2263,6 @@ const required = createRule({
2339
2263
  message: "This field is required",
2340
2264
  required: true
2341
2265
  });
2342
-
2343
2266
  /**
2344
2267
  * Requires non-empty data, only if provided data property, ref, or a function resolves to `true`.
2345
2268
  *
@@ -2374,7 +2297,6 @@ const requiredIf = createRule({
2374
2297
  return condition;
2375
2298
  }
2376
2299
  });
2377
-
2378
2300
  /**
2379
2301
  * Requires non-empty data, only if provided data property, ref, or a function resolves to `false`.
2380
2302
  *
@@ -2409,7 +2331,6 @@ const requiredUnless = createRule({
2409
2331
  return !condition;
2410
2332
  }
2411
2333
  });
2412
-
2413
2334
  /**
2414
2335
  * Checks if the value matches the specified property or ref. Useful for password confirmation fields.
2415
2336
  *
@@ -2444,7 +2365,6 @@ const sameAs = createRule({
2444
2365
  return `The value must be equal to the ${otherName} value`;
2445
2366
  }
2446
2367
  });
2447
-
2448
2368
  /**
2449
2369
  * Checks if the string starts with the specified substring.
2450
2370
  *
@@ -2467,7 +2387,6 @@ const startsWith = createStringOperationRule({
2467
2387
  type: "startsWith",
2468
2388
  operation: "startsWith"
2469
2389
  });
2470
-
2471
2390
  /**
2472
2391
  * Requires a value to be a native string type.
2473
2392
  *
@@ -2495,7 +2414,6 @@ const string = createRule({
2495
2414
  },
2496
2415
  message: "The value must be a string"
2497
2416
  });
2498
-
2499
2417
  /**
2500
2418
  * Define the input type of a rule. No runtime validation.
2501
2419
  *
@@ -2519,7 +2437,6 @@ const string = createRule({
2519
2437
  function type() {
2520
2438
  return (() => true);
2521
2439
  }
2522
-
2523
2440
  /**
2524
2441
  * Validates uppercase strings.
2525
2442
  *
@@ -2542,5 +2459,4 @@ const uppercase = createRule({
2542
2459
  },
2543
2460
  message: "The value must be uppercase"
2544
2461
  });
2545
-
2546
- export { alpha, alphaNum, and, applyIf, assignIf, atLeastOne, between, boolean, checked, contains, containsSpecialCharacter, containsUppercase, date, dateAfter, dateBefore, dateBetween, decimal, domain, email, emoji, endsWith, exactDigits, exactLength, exactValue, file, fileType, getSize, hexadecimal, hostname, httpUrl, integer, ipv4Address, isDate, isEmpty, isFilled, isNumber, literal, lowercase, macAddress, matchRegex, maxFileSize, maxLength, maxValue, minFileSize, minLength, minValue, nativeEnum, not, number, numeric, oneOf, or, pipe, regex, required, requiredIf, requiredUnless, sameAs, startsWith, string, toDate, toNumber, type, uppercase, url, withAsync, withMessage, withParams, withTooltip, xor };
2462
+ export { alpha, alphaNum, and, applyIf, assignIf, atLeastOne, between, boolean, checked, contains, containsSpecialCharacter, containsUppercase, date, dateAfter, dateBefore, dateBetween, decimal, domain, email, emoji, endsWith, exactDigits, exactLength, exactValue, file, fileType, getSize, hexadecimal, hostname, httpUrl, integer, ipv4Address, isDate, isEmpty, isFilled, isNumber, literal, lowercase, macAddress, matchRegex, maxFileSize, maxLength, maxValue, minFileSize, minLength, minValue, nativeEnum, not, number, numeric, oneOf, or, pipe, regex, required, requiredIf, requiredUnless, sameAs, startsWith, string, toDate, toNumber, type, uppercase, url, withAsync, withMessage, withParams, withTooltip, xor };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @regle/rules v1.20.4
2
+ * @regle/rules v1.21.0-beta.2
3
3
  * (c) 2026 Victor Garcia
4
4
  * @license MIT
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regle/rules",
3
- "version": "1.20.4",
3
+ "version": "1.21.0-beta.2",
4
4
  "description": "Collection of rules and helpers for Regle",
5
5
  "homepage": "https://reglejs.dev/",
6
6
  "license": "MIT",
@@ -35,20 +35,20 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "type-fest": "5.4.4",
39
- "@regle/core": "1.20.4"
38
+ "type-fest": "5.5.0",
39
+ "@regle/core": "1.21.0-beta.2"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "24.12.0",
43
43
  "@typescript/native-preview": "7.0.0-dev.20260317.1",
44
44
  "@vue/reactivity": "3.5.30",
45
45
  "@vue/test-utils": "2.4.6",
46
- "tsdown": "0.20.3",
47
- "type-fest": "5.4.4",
46
+ "tsdown": "0.21.4",
47
+ "type-fest": "5.5.0",
48
48
  "typescript": "5.9.3",
49
49
  "vitest": "4.1.0",
50
50
  "vue": "3.5.30",
51
- "vue-tsc": "3.2.5"
51
+ "vue-tsc": "3.2.6"
52
52
  },
53
53
  "scripts": {
54
54
  "typecheck": "tsgo --noEmit",