@regle/core 1.0.8 → 1.1.0-beta.1

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.
@@ -1899,7 +1899,7 @@ function createReactiveNestedStatus({
1899
1899
  $unwatch();
1900
1900
  createReactiveFieldsStatus();
1901
1901
  },
1902
- { deep: true, flush: "post" }
1902
+ { deep: true, flush: "pre" }
1903
1903
  );
1904
1904
  define$WatchExternalErrors();
1905
1905
  }
@@ -2656,13 +2656,52 @@ function createScopedUseRegle(options) {
2656
2656
  };
2657
2657
  }
2658
2658
  var { useCollectScope, useScopedRegle } = createScopedUseRegle();
2659
+ function createVariant(root, disciminantKey, variants) {
2660
+ const watchableRoot = vue.computed(() => vue.toValue(root)[disciminantKey]);
2661
+ const computedRules = vue.computed(() => {
2662
+ const selectedVariant = variants.find((variant) => {
2663
+ if (variant[disciminantKey] && "literal" in variant[disciminantKey]) {
2664
+ const literalRule = variant[disciminantKey]["literal"];
2665
+ if (isRuleDef(literalRule)) {
2666
+ return vue.unref(literalRule._params?.[0]) === watchableRoot.value;
2667
+ }
2668
+ }
2669
+ });
2670
+ if (selectedVariant) {
2671
+ return selectedVariant;
2672
+ } else {
2673
+ const anyDiscriminantRules = variants.find(
2674
+ (variant) => isObject(variant[disciminantKey]) && !Object.keys(variant[disciminantKey]).some((key) => key === "literal")
2675
+ );
2676
+ if (anyDiscriminantRules) {
2677
+ return anyDiscriminantRules;
2678
+ } else {
2679
+ return {};
2680
+ }
2681
+ }
2682
+ });
2683
+ return computedRules;
2684
+ }
2685
+ function discriminateVariant(root, discriminantKey, discriminantValue) {
2686
+ return isObject(root[discriminantKey]) && "$value" in root[discriminantKey] && root[discriminantKey]?.$value === discriminantValue;
2687
+ }
2688
+ function inferVariantRef(root, discriminantKey, discriminantValue) {
2689
+ let returnedRef;
2690
+ if (discriminateVariant(root, discriminantKey, discriminantValue)) {
2691
+ returnedRef = vue.toRef(root, discriminantKey);
2692
+ }
2693
+ return returnedRef;
2694
+ }
2659
2695
 
2660
2696
  exports.InternalRuleType = InternalRuleType;
2661
2697
  exports.createRule = createRule;
2662
2698
  exports.createScopedUseRegle = createScopedUseRegle;
2699
+ exports.createVariant = createVariant;
2663
2700
  exports.defineRegleConfig = defineRegleConfig;
2701
+ exports.discriminateVariant = discriminateVariant;
2664
2702
  exports.flatErrors = flatErrors;
2665
2703
  exports.inferRules = inferRules;
2704
+ exports.inferVariantRef = inferVariantRef;
2666
2705
  exports.mergeRegles = mergeRegles;
2667
2706
  exports.unwrapRuleParameters = unwrapRuleParameters;
2668
2707
  exports.useCollectScope = useCollectScope;
@@ -139,6 +139,23 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
139
139
  */
140
140
  type EmptyObject = {[emptyObjectSymbol]?: never};
141
141
 
142
+ /**
143
+ Returns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value.
144
+
145
+ @example
146
+ ```
147
+ import type {IsEmptyObject} from 'type-fest';
148
+
149
+ type Pass = IsEmptyObject<{}>; //=> true
150
+ type Fail = IsEmptyObject<[]>; //=> false
151
+ type Fail = IsEmptyObject<null>; //=> false
152
+ ```
153
+
154
+ @see EmptyObject
155
+ @category Object
156
+ */
157
+ type IsEmptyObject<T> = T extends EmptyObject ? true : false;
158
+
142
159
  /**
143
160
  Extract all required keys from the given type.
144
161
 
@@ -1104,13 +1121,9 @@ type RegleSingleField<TState extends Maybe<PrimitiveTypes> = any, TRules extends
1104
1121
  */
1105
1122
  r$: Raw<RegleFieldStatus<TState, TRules, TShortcuts>>;
1106
1123
  } & TAdditionalReturnProperties;
1107
- type isDeepExact<T, U> = {
1108
- [K in keyof T]-?: CheckDeepExact<NonNullable<T[K]>, K extends keyof U ? NonNullable<U[K]> : never>;
1109
- }[keyof T] extends true ? true : false;
1110
- type CheckDeepExact<T, U> = [U] extends [never] ? false : T extends RegleCollectionRuleDecl ? U extends RegleCollectionRuleDecl ? isDeepExact<NonNullable<T['$each']>, UnionToIntersection$1<NonNullable<U['$each']>>> : T extends RegleRuleDecl ? true : T extends ReglePartialRuleTree<any> ? isDeepExact<T, U> : false : T extends RegleRuleDecl ? true : T extends ReglePartialRuleTree<any> ? isDeepExact<T, U> : false;
1111
- type DeepReactiveState<T extends Record<string, any> | undefined> = {
1124
+ type DeepReactiveState<T extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T> extends true ? {
1112
1125
  [K in keyof T]: InferDeepReactiveState<T[K]>;
1113
- };
1126
+ } : never;
1114
1127
  type InferDeepReactiveState<TState> = NonNullable<TState> extends Array<infer U extends Record<string, any>> ? DeepReactiveState<U[]> : NonNullable<TState> extends Date | File ? MaybeRef<TState> : TState extends Record<string, any> | undefined ? DeepReactiveState<TState> : MaybeRef<TState>;
1115
1128
  type DeepSafeFormState<TState extends Record<string, any>, TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> | undefined> = [unknown] extends [TState] ? {} : TRules extends undefined ? TState : TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> ? Prettify<{
1116
1129
  [K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? K : never]?: SafeProperty<TState[K], TRules[K]>;
@@ -1146,89 +1159,6 @@ type ResetOptions<TState extends unknown> = RequireOneOrNone<{
1146
1159
  clearExternalErrors?: boolean;
1147
1160
  }, 'toInitialState' | 'toState'>;
1148
1161
 
1149
- interface useRegleFn<TCustomRules extends Partial<AllRulesDeclarations>, TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
1150
- /**
1151
- * Primitive parameter
1152
- * */
1153
- <TState extends Maybe<PrimitiveTypes>, TRules extends RegleRuleDecl<NonNullable<TState>, TCustomRules>>(state: MaybeRef<TState>, rulesFactory: MaybeRefOrGetter<TRules>, options?: Partial<DeepMaybeRef<RegleBehaviourOptions>> & TAdditionalOptions): RegleSingleField<TState, TRules, TShortcuts, TAdditionalReturnProperties>;
1154
- /**
1155
- * Object parameter
1156
- * */
1157
- <TState extends Record<string, any>, TRules extends ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules> & TValid, TValidationGroups extends Record<string, RegleValidationGroupEntry[]>, TValid = isDeepExact<NoInferLegacy<TRules>, ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules>> extends true ? {} : MismatchInfo<NoInferLegacy<TRules>, ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules>>>(state: MaybeRef<TState> | DeepReactiveState<TState>, rulesFactory: MaybeRefOrGetter<TRules>, options?: Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Unwrap<TState>, TRules, TValidationGroups> & TAdditionalOptions): Regle<Unwrap<TState>, TRules, TValidationGroups, TShortcuts, TAdditionalReturnProperties>;
1158
- }
1159
- /**
1160
- * useRegle serves as the foundation for validation logic.
1161
- *
1162
- * It accepts the following inputs:
1163
- *
1164
- * @param state - This can be a plain object, a ref, a reactive object, or a structure containing nested refs.
1165
- * @param rules - These should align with the structure of your state.
1166
- * @param modifiers - Customize regle behaviour
1167
- *
1168
- * ```ts
1169
- * import { useRegle } from '@regle/core';
1170
- import { required } from '@regle/rules';
1171
-
1172
- const { r$ } = useRegle({ email: '' }, {
1173
- email: { required }
1174
- })
1175
- * ```
1176
- * Docs: {@link https://reglejs.dev/core-concepts/}
1177
- */
1178
- declare const useRegle: useRegleFn<Partial<AllRulesDeclarations>, RegleShortcutDefinition<any>, {}, {}>;
1179
-
1180
- interface inferRulesFn<TCustomRules extends Partial<AllRulesDeclarations>> {
1181
- <TState extends Record<string, any>, TRules extends ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules> & TValid, TValid = isDeepExact<NoInferLegacy<TRules>, ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules>> extends true ? {} : MismatchInfo<NoInferLegacy<TRules>, ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules>>>(state: MaybeRef<TState> | DeepReactiveState<TState> | undefined, rulesFactory: TRules): NoInferLegacy<TRules>;
1182
- <TState extends PrimitiveTypes, TRules extends RegleRuleDecl>(state: MaybeRef<TState>, rulesFactory: TRules): NoInferLegacy<TRules>;
1183
- }
1184
- /**
1185
- * Rule type helper to provide autocomplete and typecheck to your form rules or part of your form rules
1186
- * It will just return the rules without any processing.
1187
- *
1188
- * @param state - The state reference
1189
- * @param rules - Your rule tree
1190
- */
1191
- declare const inferRules: inferRulesFn<Partial<AllRulesDeclarations>>;
1192
-
1193
- declare function useRootStorage({ initialState, options, scopeRules, state, customRules, shortcuts, schemaErrors, schemaMode, onValidate, }: {
1194
- scopeRules: Ref<$InternalReglePartialRuleTree>;
1195
- state: Ref<Record<string, any> | PrimitiveTypes>;
1196
- options: ResolvedRegleBehaviourOptions;
1197
- initialState: Ref<Record<string, any> | PrimitiveTypes>;
1198
- customRules?: () => CustomRulesDeclarationTree;
1199
- shortcuts: RegleShortcutDefinition | undefined;
1200
- schemaErrors?: Ref<any | undefined>;
1201
- schemaMode?: boolean;
1202
- onValidate?: () => Promise<$InternalRegleResult>;
1203
- }): {
1204
- regle: $InternalRegleStatusType | undefined;
1205
- };
1206
-
1207
- /**
1208
- * Converts an nested $errors object to a flat array of string errors
1209
- *
1210
- * Can also flatten to an array containing the path of each error with the options.includePath
1211
- */
1212
- declare function flatErrors(errors: $InternalRegleErrors, options: {
1213
- includePath: true;
1214
- }): {
1215
- error: string;
1216
- path: string;
1217
- }[];
1218
- declare function flatErrors(errors: $InternalRegleErrors, options?: {
1219
- includePath?: false;
1220
- }): string[];
1221
-
1222
- type InferRegleRoot<T extends (...args: any[]) => Regle<any, any, any, any>> = T extends (...args: any[]) => infer U ? U extends Regle<any, any, any, any> ? Prettify<U['r$']> : never : never;
1223
- type InferRegleRules<T extends useRegleFn<any, any>> = T extends useRegleFn<infer U, any> ? UnwrapRuleTree<Partial<U> & Partial<DefaultValidators>> : {};
1224
- type InferRegleShortcuts<T extends useRegleFn<any, any>> = T extends useRegleFn<any, infer U> ? U : {};
1225
- type RegleEnforceRequiredRules<TRules extends keyof DefaultValidators> = {
1226
- [K in TRules]-?: UnwrapRuleWithParams<DefaultValidators[K]>;
1227
- };
1228
- type RegleEnforceCustomRequiredRules<T extends Partial<AllRulesDeclarations> | useRegleFn<any>, TRules extends T extends useRegleFn<any> ? keyof InferRegleRules<T> : keyof T> = {
1229
- [K in TRules]-?: T extends useRegleFn<any> ? K extends keyof InferRegleRules<T> ? UnwrapRuleWithParams<InferRegleRules<T>[K]> : never : K extends keyof T ? NonNullable<T[K]> : never;
1230
- };
1231
-
1232
1162
  /**
1233
1163
  * Negates a boolean type.
1234
1164
  */
@@ -1340,6 +1270,7 @@ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever<Union> extends t
1340
1270
  * Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
1341
1271
  */
1342
1272
  type UnionToTuple<Union> = TuplifyUnion<Union>;
1273
+ type IsUnion<T> = Not<Extends<UnionToTuple<T>['length'], 1>>;
1343
1274
 
1344
1275
  /**
1345
1276
  * The simple(ish) way to get overload info from a function
@@ -1663,6 +1594,91 @@ type DeepBrand<T> = IsNever<T> extends true ? {
1663
1594
  */
1664
1595
  type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>;
1665
1596
 
1597
+ type MaybeVariantStatus<TState extends Record<string, any> | undefined = Record<string, any>, TRules extends ReglePartialRuleTree<NonNullable<TState>> = Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}> = IsUnion<NonNullable<TState>> extends true ? Omit<RegleStatus<TState, TRules, TShortcuts>, '$fields'> & {
1598
+ $fields: {
1599
+ [TIndex in keyof TupleToPlainObj<UnionToTuple$1<TState>>]: TIndex extends `${infer TIndexInt extends number}` ? {
1600
+ [TKey in keyof UnionToTuple$1<TState>[TIndexInt] as TKey extends keyof JoinDiscriminatedUnions<TRules> ? TKey : never]-?: InferRegleStatusType<NonNullable<TKey extends keyof JoinDiscriminatedUnions<TRules> ? JoinDiscriminatedUnions<TRules>[TKey] : {}>, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts>;
1601
+ } & {
1602
+ [TKey in keyof UnionToTuple$1<TState>[TIndexInt] as TKey extends keyof JoinDiscriminatedUnions<TRules> ? never : TKey]: InferRegleStatusType<{}, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts>;
1603
+ } : {};
1604
+ }[keyof TupleToPlainObj<UnionToTuple$1<TState>>];
1605
+ } : RegleStatus<TState, TRules, TShortcuts>;
1606
+
1607
+ interface useRegleFn<TCustomRules extends Partial<AllRulesDeclarations>, TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
1608
+ <TState extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules extends ReglePartialRuleTree<Unwrap<TState extends Record<string, any> ? TState : {}>, Partial<AllRulesDeclarations> & TCustomRules>, TDecl extends RegleRuleDecl<NonNullable<TState>, Partial<AllRulesDeclarations> & TCustomRules>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]>>(state: Maybe<MaybeRef<TState> | DeepReactiveState<TState>>, rulesFactory: TState extends MaybeInput<PrimitiveTypes> ? MaybeRefOrGetter<TDecl> : TState extends Record<string, any> ? MaybeRefOrGetter<TRules> : {}, options?: TState extends MaybeInput<PrimitiveTypes> ? Partial<DeepMaybeRef<RegleBehaviourOptions>> & TAdditionalOptions : Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<JoinDiscriminatedUnions<TState extends Record<string, any> ? Unwrap<TState> : {}>, TState extends Record<string, any> ? TRules : {}, TValidationGroups> & TAdditionalOptions): TState extends MaybeInput<PrimitiveTypes> ? RegleSingleField<TState, TDecl, TShortcuts, TAdditionalReturnProperties> : Regle<TState extends Record<string, any> ? Unwrap<TState> : {}, TRules, TValidationGroups, TShortcuts, TAdditionalReturnProperties>;
1609
+ }
1610
+ /**
1611
+ * useRegle serves as the foundation for validation logic.
1612
+ *
1613
+ * It accepts the following inputs:
1614
+ *
1615
+ * @param state - This can be a plain object, a ref, a reactive object, or a structure containing nested refs.
1616
+ * @param rules - These should align with the structure of your state.
1617
+ * @param modifiers - Customize regle behaviour
1618
+ *
1619
+ * ```ts
1620
+ * import { useRegle } from '@regle/core';
1621
+ import { required } from '@regle/rules';
1622
+
1623
+ const { r$ } = useRegle({ email: '' }, {
1624
+ email: { required }
1625
+ })
1626
+ * ```
1627
+ * Docs: {@link https://reglejs.dev/core-concepts/}
1628
+ */
1629
+ declare const useRegle: useRegleFn<Partial<AllRulesDeclarations>, RegleShortcutDefinition<any>, {}, {}>;
1630
+
1631
+ interface inferRulesFn<TCustomRules extends Partial<AllRulesDeclarations>> {
1632
+ <TState extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules extends TState extends MaybeInput<PrimitiveTypes> ? RegleRuleDecl<NonNullable<TState>, TCustomRules> : TState extends Record<string, any> ? ReglePartialRuleTree<Unwrap<TState>, Partial<AllRulesDeclarations> & TCustomRules> : {}>(state: MaybeRef<TState> | DeepReactiveState<TState>, rulesFactory: TRules): NoInferLegacy<TRules>;
1633
+ }
1634
+ /**
1635
+ * Rule type helper to provide autocomplete and typecheck to your form rules or part of your form rules
1636
+ * It will just return the rules without any processing.
1637
+ *
1638
+ * @param state - The state reference
1639
+ * @param rules - Your rule tree
1640
+ */
1641
+ declare const inferRules: inferRulesFn<Partial<AllRulesDeclarations>>;
1642
+
1643
+ declare function useRootStorage({ initialState, options, scopeRules, state, customRules, shortcuts, schemaErrors, schemaMode, onValidate, }: {
1644
+ scopeRules: Ref<$InternalReglePartialRuleTree>;
1645
+ state: Ref<Record<string, any> | PrimitiveTypes>;
1646
+ options: ResolvedRegleBehaviourOptions;
1647
+ initialState: Ref<Record<string, any> | PrimitiveTypes>;
1648
+ customRules?: () => CustomRulesDeclarationTree;
1649
+ shortcuts: RegleShortcutDefinition | undefined;
1650
+ schemaErrors?: Ref<any | undefined>;
1651
+ schemaMode?: boolean;
1652
+ onValidate?: () => Promise<$InternalRegleResult>;
1653
+ }): {
1654
+ regle: $InternalRegleStatusType | undefined;
1655
+ };
1656
+
1657
+ /**
1658
+ * Converts an nested $errors object to a flat array of string errors
1659
+ *
1660
+ * Can also flatten to an array containing the path of each error with the options.includePath
1661
+ */
1662
+ declare function flatErrors(errors: $InternalRegleErrors, options: {
1663
+ includePath: true;
1664
+ }): {
1665
+ error: string;
1666
+ path: string;
1667
+ }[];
1668
+ declare function flatErrors(errors: $InternalRegleErrors, options?: {
1669
+ includePath?: false;
1670
+ }): string[];
1671
+
1672
+ type InferRegleRoot<T extends (...args: any[]) => Regle<any, any, any, any>> = T extends (...args: any[]) => infer U ? U extends Regle<any, any, any, any> ? Prettify<U['r$']> : never : never;
1673
+ type InferRegleRules<T extends useRegleFn<any, any>> = T extends useRegleFn<infer U, any> ? UnwrapRuleTree<Partial<U> & Partial<DefaultValidators>> : {};
1674
+ type InferRegleShortcuts<T extends useRegleFn<any, any>> = T extends useRegleFn<any, infer U> ? U : {};
1675
+ type RegleEnforceRequiredRules<TRules extends keyof DefaultValidators> = {
1676
+ [K in TRules]-?: UnwrapRuleWithParams<DefaultValidators[K]>;
1677
+ };
1678
+ type RegleEnforceCustomRequiredRules<T extends Partial<AllRulesDeclarations> | useRegleFn<any>, TRules extends T extends useRegleFn<any> ? keyof InferRegleRules<T> : keyof T> = {
1679
+ [K in TRules]-?: T extends useRegleFn<any> ? K extends keyof InferRegleRules<T> ? UnwrapRuleWithParams<InferRegleRules<T>[K]> : never : K extends keyof T ? NonNullable<T[K]> : never;
1680
+ };
1681
+
1666
1682
  /**
1667
1683
  * Borrowed from vitest
1668
1684
  */
@@ -1675,13 +1691,46 @@ type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, No
1675
1691
  } : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `[Regle error] The parent property does not match the form schema`;
1676
1692
 
1677
1693
  type RemoveCommonKey<T extends readonly any[], K extends PropertyKey> = T extends [infer F, ...infer R] ? [Prettify<Omit<F, K>>, ...RemoveCommonKey<R, K>] : [];
1678
- type JoinDiscriminatedUnions<TUnion extends unknown> = isRecordLiteral<TUnion> extends true ? Prettify<Partial<UnionToIntersection$1<RemoveCommonKey<UnionToTuple$1<TUnion>, keyof NonNullable<TUnion>>[number]>> & Pick<NonNullable<TUnion>, keyof NonNullable<TUnion>>> : TUnion;
1694
+ /**
1695
+ * Get item value from object, otherwise fallback to undefined. Avoid TS to not be able to infer keys not present on all unions
1696
+ */
1697
+ type GetMaybeObjectValue<O extends Record<string, any>, K extends string> = K extends keyof O ? O[K] : undefined;
1698
+ /**
1699
+ * Combine all unions values to be able to get even the normally "never" values, act as an intersection type
1700
+ */
1701
+ type RetrieveUnionUnknownValues<T extends readonly any[], TKeys extends string> = T extends [
1702
+ infer F extends Record<string, any>,
1703
+ ...infer R
1704
+ ] ? [
1705
+ {
1706
+ [K in TKeys as GetMaybeObjectValue<F, K> extends NonNullable<GetMaybeObjectValue<F, K>> ? never : K]?: GetMaybeObjectValue<F, K>;
1707
+ } & {
1708
+ [K in TKeys as GetMaybeObjectValue<F, K> extends NonNullable<GetMaybeObjectValue<F, K>> ? K : never]: GetMaybeObjectValue<F, K>;
1709
+ },
1710
+ ...RetrieveUnionUnknownValues<R, TKeys>
1711
+ ] : [];
1712
+ /**
1713
+ * Get all possible keys from an union, even the ones present only on one union
1714
+ */
1715
+ type RetrieveUnionUnknownKeysOf<T extends readonly any[]> = T extends [infer F, ...infer R] ? [keyof F, ...RetrieveUnionUnknownKeysOf<R>] : [];
1716
+ /**
1717
+ * Transforms an union and apply undefined values to non-present keys to support intersection
1718
+ */
1719
+ type NormalizeUnion<TUnion> = RetrieveUnionUnknownValues<NonNullable<UnionToTuple$1<TUnion>>, RetrieveUnionUnknownKeysOf<NonNullable<UnionToTuple$1<TUnion>>>[number]>[number];
1720
+ /**
1721
+ * Combine all members of an union type, merging types for each keys, and keeping loose types
1722
+ */
1723
+ type JoinDiscriminatedUnions<TUnion extends unknown> = isRecordLiteral<TUnion> extends true ? Prettify<Partial<UnionToIntersection$1<RemoveCommonKey<UnionToTuple$1<TUnion>, keyof NormalizeUnion<TUnion>>[number]>> & Pick<NormalizeUnion<TUnion>, keyof NormalizeUnion<TUnion>>> : TUnion;
1724
+ type LazyJoinDiscriminatedUnions<TUnion extends unknown> = isRecordLiteral<TUnion> extends true ? Prettify<Partial<UnionToIntersection$1<RemoveCommonKey<UnionToTuple$1<TUnion>, keyof NonNullable<TUnion>>[number]>> & Pick<NonNullable<TUnion>, keyof NonNullable<TUnion>>> : TUnion;
1679
1725
  type EnumLike = {
1680
1726
  [k: string]: string | number;
1681
1727
  [nu: number]: string;
1682
1728
  };
1683
1729
  type enumType<T extends Record<string, unknown>> = T[keyof T];
1684
1730
  type UnwrapMaybeRef<T extends MaybeRef<any> | DeepReactiveState<any>> = T extends Ref<any> ? UnwrapRef<T> : UnwrapNestedRefs<T>;
1731
+ type TupleToPlainObj<T> = {
1732
+ [I in keyof T & `${number}`]: T[I];
1733
+ };
1685
1734
 
1686
1735
  type CreateFn<T extends any[]> = (...args: T) => any;
1687
1736
  /**
@@ -1856,8 +1905,10 @@ type DefaultValidators = {
1856
1905
  exactLength: RegleRuleWithParamsDefinition<string | any[] | Record<PropertyKey, any>, [
1857
1906
  count: number
1858
1907
  ], false, boolean>;
1908
+ exactValue: RegleRuleWithParamsDefinition<number, [count: number], false, boolean>;
1859
1909
  integer: RegleRuleDefinition<string | number, [], false, boolean, string | number>;
1860
1910
  ipAddress: RegleRuleDefinition<string, [], false, boolean, string>;
1911
+ literal: RegleRuleDefinition<string | number, [literal: string | number], false, boolean, string | number>;
1861
1912
  macAddress: RegleRuleWithParamsDefinition<string, [separator?: string | undefined], false, boolean>;
1862
1913
  maxLength: RegleRuleWithParamsDefinition<string | any[] | Record<PropertyKey, any>, [
1863
1914
  count: number,
@@ -1876,7 +1927,6 @@ type DefaultValidators = {
1876
1927
  required: RegleRuleDefinition<unknown, []>;
1877
1928
  sameAs: RegleRuleWithParamsDefinition<unknown, [target: unknown, otherName?: string], false, boolean>;
1878
1929
  startsWith: RegleRuleWithParamsDefinition<string, [part: Maybe<string>], false, boolean>;
1879
- exactValue: RegleRuleWithParamsDefinition<number, [count: number], false, boolean>;
1880
1930
  url: RegleRuleDefinition<string, [], false, boolean, string>;
1881
1931
  };
1882
1932
 
@@ -1903,7 +1953,7 @@ type RegleRuleTree<TForm extends Record<string, any>, TCustomRules extends Parti
1903
1953
  * @public
1904
1954
  */
1905
1955
  type RegleComputedRules<TForm extends MaybeRef<Record<string, any>> | DeepReactiveState<Record<string, any>>, TCustomRules extends Partial<AllRulesDeclarations> | Regle<any, any> = Partial<AllRulesDeclarations>, TState = Unwrap<TForm>, TCustom = TCustomRules extends Regle<any, infer R> ? R extends ReglePartialRuleTree<any, infer C> ? C : Partial<AllRulesDeclarations> : TCustomRules> = {
1906
- [TKey in keyof TState]?: RegleFormPropertyType<TState[TKey], TCustom extends Partial<AllRulesDeclarations> ? TCustom : {}>;
1956
+ [TKey in keyof JoinDiscriminatedUnions<TState>]?: RegleFormPropertyType<JoinDiscriminatedUnions<TState>[TKey], TCustom extends Partial<AllRulesDeclarations> ? TCustom : {}>;
1907
1957
  };
1908
1958
  /**
1909
1959
  * @internal
@@ -1926,7 +1976,7 @@ type $InternalFormPropertyTypes = $InternalRegleRuleDecl | $InternalRegleCollect
1926
1976
  * Rule tree for a form property
1927
1977
  */
1928
1978
  type RegleRuleDecl<TValue extends any = any, TCustomRules extends Partial<AllRulesDeclarations> = Partial<AllRulesDeclarations>> = FieldRegleBehaviourOptions & {
1929
- [TKey in keyof TCustomRules]?: NonNullable<TCustomRules[TKey]> extends RegleRuleWithParamsDefinition<any, infer TParams> ? RegleRuleDefinition<TValue, [...TParams, ...args: [...any[]]], boolean> : NonNullable<TCustomRules[TKey]> extends RegleRuleDefinition<any, any, any, any> ? FormRuleDeclaration<TValue, any> : FormRuleDeclaration<TValue, any> | FieldRegleBehaviourOptions[keyof FieldRegleBehaviourOptions];
1979
+ [TKey in keyof TCustomRules]?: NonNullable<TCustomRules[TKey]> extends RegleRuleWithParamsDefinition<any, infer TParams> ? RegleRuleDefinition<TValue, [...TParams, ...args: [...any[]]], boolean> : NonNullable<TCustomRules[TKey]> extends RegleRuleDefinition<any, any[], any, any> ? FormRuleDeclaration<TValue, any[]> : FormRuleDeclaration<TValue, any[]> | FieldRegleBehaviourOptions[keyof FieldRegleBehaviourOptions];
1930
1980
  };
1931
1981
  /**
1932
1982
  * @internal
@@ -2011,7 +2061,7 @@ type $InternalRegleResult = {
2011
2061
  /**
2012
2062
  * @public
2013
2063
  */
2014
- type RegleRoot<TState extends Record<string, any> = Record<string, any>, TRules extends ReglePartialRuleTree<TState> = Record<string, any>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]> = never, TShortcuts extends RegleShortcutDefinition = {}> = RegleStatus<TState, TRules, TShortcuts> & ([TValidationGroups] extends [never] ? {} : {
2064
+ type RegleRoot<TState extends Record<string, any> = Record<string, any>, TRules extends ReglePartialRuleTree<TState> = Record<string, any>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]> = never, TShortcuts extends RegleShortcutDefinition = {}> = MaybeVariantStatus<TState, TRules, TShortcuts> & ([TValidationGroups] extends [never] ? {} : {
2015
2065
  /**
2016
2066
  * Collection of validation groups used declared with the `validationGroups` modifier
2017
2067
  */
@@ -2071,9 +2121,9 @@ type SuperCompatibleRegleCollectionErrors = $InternalRegleCollectionErrors;
2071
2121
  type RegleStatus<TState extends Record<string, any> | undefined = Record<string, any>, TRules extends ReglePartialRuleTree<NonNullable<TState>> = Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}> = RegleCommonStatus<TState> & {
2072
2122
  /** Represents all the children of your object. You can access any nested child at any depth to get the relevant data you need for your form. */
2073
2123
  readonly $fields: {
2074
- readonly [TKey in keyof TState]: InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts>;
2124
+ readonly [TKey in keyof TState as IsEmptyObject<TRules[TKey]> extends true ? never : TKey]: InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts>;
2075
2125
  } & {
2076
- readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? TKey : never : never]-?: InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts>;
2126
+ readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? IsEmptyObject<TRules[TKey]> extends true ? TKey : never : never : never]-?: InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts>;
2077
2127
  };
2078
2128
  /**
2079
2129
  * Collection of all the error messages, collected for all children properties and nested forms.
@@ -2105,7 +2155,7 @@ interface $InternalRegleStatus extends $InternalRegleCommonStatus {
2105
2155
  /**
2106
2156
  * @public
2107
2157
  */
2108
- type InferRegleStatusType<TRule extends RegleCollectionRuleDecl | RegleRuleDecl | ReglePartialRuleTree<any>, TState extends Record<PropertyKey, any> = any, TKey extends PropertyKey = string, TShortcuts extends RegleShortcutDefinition = {}> = NonNullable<TState[TKey]> extends Array<infer U extends Record<string, any>> ? ExtendOnlyRealRecord<U> extends true ? TRule extends RegleCollectionRuleDefinition<any, any> ? ExtractFromGetter<TRule['$each']> extends ReglePartialRuleTree<any> ? RegleCollectionStatus<TState[TKey], ExtractFromGetter<TRule['$each']>, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : RegleCollectionStatus<TState[TKey], {}, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : TRule extends ReglePartialRuleTree<any> ? NonNullable<TState[TKey]> extends Array<any> ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? RegleStatus<TState[TKey], TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? RegleStatus<TState[TKey], ReglePartialRuleTree<TState[TKey]>, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts>;
2158
+ type InferRegleStatusType<TRule extends RegleCollectionRuleDecl | RegleRuleDecl | ReglePartialRuleTree<any>, TState extends Record<PropertyKey, any> = any, TKey extends PropertyKey = string, TShortcuts extends RegleShortcutDefinition = {}> = NonNullable<TState[TKey]> extends Array<infer U extends Record<string, any>> ? ExtendOnlyRealRecord<U> extends true ? TRule extends RegleCollectionRuleDefinition<any, any> ? ExtractFromGetter<TRule['$each']> extends ReglePartialRuleTree<any> ? RegleCollectionStatus<TState[TKey], ExtractFromGetter<TRule['$each']>, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : RegleCollectionStatus<TState[TKey], {}, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : TRule extends ReglePartialRuleTree<any> ? NonNullable<TState[TKey]> extends Array<any> ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? MaybeVariantStatus<TState[TKey], TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? MaybeVariantStatus<TState[TKey], ReglePartialRuleTree<TState[TKey]>, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts>;
2109
2159
  /**
2110
2160
  * @internal
2111
2161
  * @reference {@link InferRegleStatusType}
@@ -2116,9 +2166,9 @@ type $InternalRegleStatusType = $InternalRegleCollectionStatus | $InternalRegleS
2116
2166
  */
2117
2167
  type RegleFieldStatus<TState extends any = any, TRules extends RegleFormPropertyType<any, Partial<AllRulesDeclarations>> = Record<string, any>, TShortcuts extends RegleShortcutDefinition = never> = Omit<RegleCommonStatus<TState>, '$value'> & {
2118
2168
  /** A reference to the original validated model. It can be used to bind your form with v-model.*/
2119
- $value: Maybe<UnwrapNestedRefs<TState>>;
2169
+ $value: MaybeOutput<UnwrapNestedRefs<TState>>;
2120
2170
  /** $value variant that will not "touch" the field and update the value silently, running only the rules, so you can easily swap values without impacting user interaction. */
2121
- $silentValue: Maybe<UnwrapNestedRefs<TState>>;
2171
+ $silentValue: MaybeOutput<UnwrapNestedRefs<TState>>;
2122
2172
  /** Collection of all the error messages, collected for all children properties and nested forms.
2123
2173
  *
2124
2174
  * Only contains errors from properties where $dirty equals true. */
@@ -2132,7 +2182,7 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
2132
2182
  /** Represents the inactive status. Is true when this state have empty rules */
2133
2183
  readonly $inactive: boolean;
2134
2184
  /** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
2135
- $extractDirtyFields: (filterNullishValues?: boolean) => Maybe<TState>;
2185
+ $extractDirtyFields: (filterNullishValues?: boolean) => MaybeOutput<TState>;
2136
2186
  /** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
2137
2187
  $validate: () => Promise<RegleResult<TState, TRules>>;
2138
2188
  /** This is reactive tree containing all the declared rules of your field. To know more about the rule properties check the rules properties section */
@@ -2233,7 +2283,7 @@ type RegleRuleStatus<TValue = any, TParams extends any[] = any[], TMetadata exte
2233
2283
  /** Reset the $valid, $metadata and $pending states */
2234
2284
  $reset(): void;
2235
2285
  /** Returns the original rule validator function. */
2236
- $validator: ((value: Maybe<TValue>, ...args: any[]) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>) & ((value: TValue, ...args: [TParams] extends [never[]] ? [] : [unknown[]] extends [TParams] ? any[] : TParams) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>);
2286
+ $validator: ((value: MaybeInput<TValue>, ...args: any[]) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>) & ((value: TValue, ...args: [TParams] extends [never[]] ? [] : [unknown[]] extends [TParams] ? any[] : TParams) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>);
2237
2287
  } & ([TParams] extends [never[]] ? {} : [unknown[]] extends [TParams] ? {
2238
2288
  readonly $params?: any[];
2239
2289
  } : {
@@ -2272,9 +2322,9 @@ interface $InternalRegleRuleStatus {
2272
2322
  */
2273
2323
  type RegleCollectionStatus<TState extends any[] = any[], TRules extends ReglePartialRuleTree<ArrayElement<TState>> = Record<string, any>, TFieldRule extends RegleCollectionRuleDecl<any, any> = never, TShortcuts extends RegleShortcutDefinition = {}> = Omit<RegleCommonStatus<TState>, '$value'> & {
2274
2324
  /** A reference to the original validated model. It can be used to bind your form with v-model.*/
2275
- $value: Maybe<TState>;
2325
+ $value: MaybeOutput<TState>;
2276
2326
  /** $value variant that will not "touch" the field and update the value silently, running only the rules, so you can easily swap values without impacting user interaction. */
2277
- $silentValue: Maybe<TState>;
2327
+ $silentValue: MaybeOutput<TState>;
2278
2328
  /** Collection of status of every item in your collection. Each item will be a field you can access, or map on it to display your elements. */
2279
2329
  readonly $each: Array<InferRegleStatusType<NonNullable<TRules>, NonNullable<TState>, number, TShortcuts>>;
2280
2330
  /** Represents the status of the collection itself. You can have validation rules on the array like minLength, this field represents the isolated status of the collection. */
@@ -2451,4 +2501,36 @@ declare const useScopedRegle: useRegleFn<Partial<AllRulesDeclarations>, never, {
2451
2501
  namespace?: MaybeRefOrGetter<string>;
2452
2502
  }>;
2453
2503
 
2454
- export { type $InternalRegleStatus, type AllRulesDeclarations, type CommonComparationOptions, type DeepMaybeRef, type DeepReactiveState, type FormRuleDeclaration, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MergedRegles, type MismatchInfo, type NoInferLegacy, type PrimitiveTypes, type Regle, type RegleBehaviourOptions, type RegleCollectionErrors, type RegleCollectionRuleDecl, type RegleCollectionRuleDefinition, type RegleCollectionStatus, type RegleCommonStatus, type RegleComputedRules, type RegleEnforceCustomRequiredRules, type RegleEnforceRequiredRules, type RegleErrorTree, type RegleExternalCollectionErrors, type RegleExternalErrorTree, type RegleFieldStatus, type RegleFormPropertyType, type RegleInternalRuleDefs, type ReglePartialRuleTree, type RegleResult, type RegleRoot, type RegleRuleCore, type RegleRuleDecl, type RegleRuleDefinition, type RegleRuleDefinitionProcessor, type RegleRuleDefinitionWithMetadataProcessor, type RegleRuleInit, type RegleRuleMetadataConsumer, type RegleRuleMetadataDefinition, type RegleRuleMetadataExtended, type RegleRuleRaw, type RegleRuleStatus, type RegleRuleTypeReturn, type RegleRuleWithParamsDefinition, type RegleShortcutDefinition, type RegleSingleField, type RegleStatus, type RegleUniversalParams, type RegleValidationErrors, type RegleValidationGroupEntry, type RegleValidationGroupOutput, type RegleRuleTree as RegleValidationTree, type ResolvedRegleBehaviourOptions, type ScopedInstancesRecord, type ScopedInstancesRecordLike, type SuperCompatibleRegleCollectionErrors, type SuperCompatibleRegleCollectionStatus, type SuperCompatibleRegleFieldStatus, type SuperCompatibleRegleResult, type SuperCompatibleRegleRoot, type SuperCompatibleRegleRuleStatus, type SuperCompatibleRegleStatus, type Unwrap, type UnwrapRegleUniversalParams, type UnwrapRuleWithParams, createRule, createScopedUseRegle, defineRegleConfig, flatErrors, inferRules, mergeRegles, unwrapRuleParameters, useCollectScope, useRegle, useRootStorage, useScopedRegle };
2504
+ type PossibleLiteralTypes<T extends Record<string, any>, TKey extends keyof T> = {
2505
+ [TVal in NonNullable<T[TKey]>]: {
2506
+ [K in TKey]-?: Omit<RegleRuleDecl<TVal, Partial<AllRulesDeclarations>>, 'literal'> & {
2507
+ literal?: RegleRuleDefinition<TVal, [literal: TVal], false, boolean, string | number>;
2508
+ };
2509
+ };
2510
+ };
2511
+ type RequiredForm<T extends Record<string, any>, TKey extends keyof T> = Omit<ReglePartialRuleTree<T>, TKey> & PossibleLiteralTypes<T, TKey>[keyof PossibleLiteralTypes<T, TKey>];
2512
+ type Variant1<T extends Record<string, any>, TKey extends keyof T> = [
2513
+ RequiredForm<T, TKey>,
2514
+ ...RequiredForm<T, TKey>[]
2515
+ ];
2516
+ /**
2517
+ *
2518
+ * Autocomplete may not work here because of https://github.com/microsoft/TypeScript/issues/49547
2519
+ */
2520
+ declare function createVariant<const TForm extends Record<string, any>, const TDiscriminant extends keyof JoinDiscriminatedUnions<TForm>, const TVariants extends Variant1<JoinDiscriminatedUnions<TForm>, TDiscriminant>>(root: MaybeRefOrGetter<TForm> | DeepReactiveState<TForm>, disciminantKey: TDiscriminant, variants: [...TVariants]): Ref<TVariants[number]>;
2521
+ declare function discriminateVariant<TRoot extends {
2522
+ [x: string]: unknown;
2523
+ }, TKey extends keyof TRoot, const TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot[TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
2524
+ $value: infer V;
2525
+ } ? V : unknown>(root: TRoot, discriminantKey: TKey, discriminantValue: TValue): root is Extract<TRoot, {
2526
+ [K in TKey]: RegleFieldStatus<TValue, any, any>;
2527
+ }>;
2528
+ declare function inferVariantRef<TRoot extends {
2529
+ [x: string]: unknown;
2530
+ }, TKey extends keyof TRoot, const TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot[TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
2531
+ $value: infer V;
2532
+ } ? V : unknown>(root: TRoot, discriminantKey: TKey, discriminantValue: TValue): Ref<Extract<TRoot, {
2533
+ [K in TKey]: RegleFieldStatus<TValue, any, any>;
2534
+ }>> | undefined;
2535
+
2536
+ export { type $InternalRegleStatus, type AllRulesDeclarations, type CommonComparationOptions, type DeepMaybeRef, type DeepReactiveState, type FormRuleDeclaration, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MaybeVariantStatus, type MergedRegles, type MismatchInfo, type NoInferLegacy, type PrimitiveTypes, type Regle, type RegleBehaviourOptions, type RegleCollectionErrors, type RegleCollectionRuleDecl, type RegleCollectionRuleDefinition, type RegleCollectionStatus, type RegleCommonStatus, type RegleComputedRules, type RegleEnforceCustomRequiredRules, type RegleEnforceRequiredRules, type RegleErrorTree, type RegleExternalCollectionErrors, type RegleExternalErrorTree, type RegleFieldStatus, type RegleFormPropertyType, type RegleInternalRuleDefs, type ReglePartialRuleTree, type RegleResult, type RegleRoot, type RegleRuleCore, type RegleRuleDecl, type RegleRuleDefinition, type RegleRuleDefinitionProcessor, type RegleRuleDefinitionWithMetadataProcessor, type RegleRuleInit, type RegleRuleMetadataConsumer, type RegleRuleMetadataDefinition, type RegleRuleMetadataExtended, type RegleRuleRaw, type RegleRuleStatus, type RegleRuleTypeReturn, type RegleRuleWithParamsDefinition, type RegleShortcutDefinition, type RegleSingleField, type RegleStatus, type RegleUniversalParams, type RegleValidationErrors, type RegleValidationGroupEntry, type RegleValidationGroupOutput, type RegleRuleTree as RegleValidationTree, type ResolvedRegleBehaviourOptions, type ScopedInstancesRecord, type ScopedInstancesRecordLike, type SuperCompatibleRegleCollectionErrors, type SuperCompatibleRegleCollectionStatus, type SuperCompatibleRegleFieldStatus, type SuperCompatibleRegleResult, type SuperCompatibleRegleRoot, type SuperCompatibleRegleRuleStatus, type SuperCompatibleRegleStatus, type Unwrap, type UnwrapRegleUniversalParams, type UnwrapRuleWithParams, createRule, createScopedUseRegle, createVariant, defineRegleConfig, discriminateVariant, flatErrors, inferRules, inferVariantRef, mergeRegles, unwrapRuleParameters, useCollectScope, useRegle, useRootStorage, useScopedRegle };