@regle/core 1.3.0-beta.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/regle-core.d.ts +32 -4
- package/package.json +1 -1
package/dist/regle-core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
import { MaybeRef, MaybeRefOrGetter, Raw, Ref, UnwrapNestedRefs, UnwrapRef } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/types/utils/misc.types.d.ts
|
|
@@ -1853,11 +1853,39 @@ declare function flatErrors(errors: $InternalRegleErrors, options?: {
|
|
|
1853
1853
|
|
|
1854
1854
|
//#endregion
|
|
1855
1855
|
//#region src/types/utils/props.types.d.ts
|
|
1856
|
+
/**
|
|
1857
|
+
* Infer type of the `r$` of any function returning a regle instance
|
|
1858
|
+
*/
|
|
1856
1859
|
type InferRegleRoot<T extends (...args: any[]) => SuperCompatibleRegle> = T extends ((...args: any[]) => infer U) ? U extends SuperCompatibleRegle ? U['r$'] : never : never;
|
|
1860
|
+
/**
|
|
1861
|
+
* Infer custom rules declared in a global configuration
|
|
1862
|
+
*/
|
|
1857
1863
|
type InferRegleRules<T extends useRegleFn<any, any>> = T extends useRegleFn<infer U, any> ? UnwrapRuleTree<Partial<U> & Partial<DefaultValidators>> : {};
|
|
1864
|
+
/**
|
|
1865
|
+
* Infer custom shortcuts declared in a global configuration
|
|
1866
|
+
*/
|
|
1858
1867
|
type InferRegleShortcuts<T extends useRegleFn<any, any>> = T extends useRegleFn<any, infer U> ? U : {};
|
|
1868
|
+
/**
|
|
1869
|
+
* Extract a set rules and setting them as required
|
|
1870
|
+
*/
|
|
1859
1871
|
type RegleEnforceRequiredRules<TRules extends keyof DefaultValidators> = Omit<Partial<DefaultValidatorsTree>, TRules> & { [K in TRules]-?: UnwrapRuleWithParams<DefaultValidators[K]> };
|
|
1872
|
+
/**
|
|
1873
|
+
* Extract a set of custom rules from a global configuration and setting them as required
|
|
1874
|
+
|
|
1875
|
+
*/
|
|
1860
1876
|
type RegleEnforceCustomRequiredRules<T extends Partial<AllRulesDeclarations> | useRegleFn<any, any>, TRules extends (T extends useRegleFn<any, any> ? keyof InferRegleRules<T> : keyof T)> = Omit<Partial<DefaultValidatorsTree>, TRules> & { [K in TRules]-?: T extends useRegleFn<any, any> ? K extends keyof InferRegleRules<T> ? NonNullable<UnwrapRuleWithParams<InferRegleRules<T>[K]>> : never : K extends keyof T ? NonNullable<T[K]> : never };
|
|
1877
|
+
/**
|
|
1878
|
+
* Extract custom rules and custom shortcuts and apply them to a RegleFieldStatus type
|
|
1879
|
+
*/
|
|
1880
|
+
type RegleCustomFieldStatus<T extends useRegleFn<any, any>, TState extends unknown = any, TRules extends RegleFormPropertyType<any, Partial<AllRulesDeclarations>> = InferRegleRules<T>> = RegleFieldStatus<TState, TRules, InferRegleShortcuts<T>>;
|
|
1881
|
+
/**
|
|
1882
|
+
* Extract custom rules and custom shortcuts and apply them to a RegleFieldStatus type
|
|
1883
|
+
*/
|
|
1884
|
+
type RegleCustomStatus<T extends useRegleFn<any, any>, TState extends Record<string, any> | undefined = Record<string, any>, TRules extends ReglePartialRuleTree<NonNullable<TState>> = InferRegleRules<T>> = RegleStatus<TState, TRules, InferRegleShortcuts<T>>;
|
|
1885
|
+
/**
|
|
1886
|
+
* Extract custom rules and custom shortcuts and apply them to a RegleFieldStatus type
|
|
1887
|
+
*/
|
|
1888
|
+
type RegleCustomCollectionStatus<T extends useRegleFn<any, any>, TState extends any[] = any[], TRules extends ReglePartialRuleTree<ArrayElement<TState>> = InferRegleRules<T>> = RegleCollectionStatus<TState, TRules, InferRegleShortcuts<T>>;
|
|
1861
1889
|
|
|
1862
1890
|
//#endregion
|
|
1863
1891
|
//#region src/types/utils/object.types.d.ts
|
|
@@ -2744,13 +2772,13 @@ declare function createScopedUseRegle<TCustomRegle extends useRegleFn<any, any>
|
|
|
2744
2772
|
useScopedRegle: TReturnedRegle;
|
|
2745
2773
|
useCollectScope: useCollectScopeFn<TAsRecord>;
|
|
2746
2774
|
};
|
|
2747
|
-
declare const useCollectScope: <TValue extends Record<string, unknown>[] = Record<string, unknown>[]>(namespace?:
|
|
2775
|
+
declare const useCollectScope: <TValue extends Record<string, unknown>[] = Record<string, unknown>[]>(namespace?: vue0.MaybeRefOrGetter<string>) => {
|
|
2748
2776
|
r$: MergedScopedRegles<TValue>;
|
|
2749
2777
|
}, useScopedRegle: useRegleFn<Partial<AllRulesDeclarations>, never, {
|
|
2750
2778
|
dispose: () => void;
|
|
2751
2779
|
register: () => void;
|
|
2752
2780
|
}, {
|
|
2753
|
-
namespace?:
|
|
2781
|
+
namespace?: vue0.MaybeRefOrGetter<string>;
|
|
2754
2782
|
}>;
|
|
2755
2783
|
//#endregion
|
|
2756
2784
|
//#region src/core/createVariant.d.ts
|
|
@@ -2832,4 +2860,4 @@ declare function defineRules<TRules extends RegleUnknownRulesTree>(rules: TRules
|
|
|
2832
2860
|
declare function refineRules<TRules extends RegleUnknownRulesTree, TRefinement extends ReglePartialRuleTree<InferInput<TRules>> & RegleUnknownRulesTree>(rules: TRules, refinement: (state: Ref<InferInput<TRules>>) => TRefinement): (state: Ref<InferInput<TRules>>) => Merge<TRules, TRefinement>;
|
|
2833
2861
|
|
|
2834
2862
|
//#endregion
|
|
2835
|
-
export { $InternalRegleStatus, AllRulesDeclarations, CommonAlphaOptions, CommonComparisonOptions, CreateScopedUseRegleOptions, DeepMaybeRef, DeepReactiveState, DefaultValidatorsTree, FormRuleDeclaration, HaveAnyRequiredProps, InferInput, InferRegleRoot, InferRegleRule, InferRegleRules, InferRegleShortcuts, InferRegleStatusType, InferSafeOutput, InlineRuleDeclaration, InternalRuleType, JoinDiscriminatedUnions, LocalRegleBehaviourOptions, Maybe, MaybeInput, MaybeOutput, MaybeReadonly, MaybeVariantStatus, MergedRegles, MergedScopedRegles, NarrowVariant, NoInferLegacy, PrimitiveTypes, Regle, RegleBehaviourOptions, RegleCollectionErrors, RegleCollectionRuleDecl, RegleCollectionRuleDefinition, RegleCollectionStatus, RegleCommonStatus, RegleComputedRules, RegleEnforceCustomRequiredRules, RegleEnforceRequiredRules, RegleErrorTree, RegleExternalCollectionErrors, RegleExternalErrorTree, RegleFieldStatus, RegleFormPropertyType, RegleInternalRuleDefs, ReglePartialRuleTree, RegleResult, RegleRoot, RegleRuleCore, RegleRuleDecl, RegleRuleDefinition, RegleRuleDefinitionProcessor, RegleRuleDefinitionWithMetadataProcessor, RegleRuleInit, RegleRuleMetadataConsumer, RegleRuleMetadataDefinition, RegleRuleMetadataExtended, RegleRuleRaw, RegleRuleStatus, RegleRuleTypeReturn, RegleRuleWithParamsDefinition, RegleShortcutDefinition, RegleSingleField, RegleStatus, RegleUniversalParams, RegleUnknownRulesTree, RegleValidationErrors, RegleValidationGroupEntry, RegleValidationGroupOutput, RegleRuleTree as RegleValidationTree, ResolvedRegleBehaviourOptions, ScopedInstancesRecord, ScopedInstancesRecordLike, SuperCompatibleRegle, SuperCompatibleRegleCollectionErrors, SuperCompatibleRegleCollectionStatus, SuperCompatibleRegleFieldStatus, SuperCompatibleRegleResult, SuperCompatibleRegleRoot, SuperCompatibleRegleRuleStatus, SuperCompatibleRegleStatus, Unwrap, UnwrapRegleUniversalParams, UnwrapRuleWithParams, UseScopedRegleOptions, createRule, createScopedUseRegle, createVariant, defineRegleConfig, defineRules, extendRegleConfig, flatErrors, inferRules, inferRulesFn, mergeRegles, narrowVariant, refineRules, unwrapRuleParameters, useCollectScope, useCollectScopeFn, useRegle, useRegleFn, useRootStorage, useScopedRegle, variantToRef };
|
|
2863
|
+
export { $InternalRegleStatus, AllRulesDeclarations, CommonAlphaOptions, CommonComparisonOptions, CreateScopedUseRegleOptions, DeepMaybeRef, DeepReactiveState, DefaultValidatorsTree, FormRuleDeclaration, HaveAnyRequiredProps, InferInput, InferRegleRoot, InferRegleRule, InferRegleRules, InferRegleShortcuts, InferRegleStatusType, InferSafeOutput, InlineRuleDeclaration, InternalRuleType, JoinDiscriminatedUnions, LocalRegleBehaviourOptions, Maybe, MaybeInput, MaybeOutput, MaybeReadonly, MaybeVariantStatus, MergedRegles, MergedScopedRegles, NarrowVariant, NoInferLegacy, PrimitiveTypes, Regle, RegleBehaviourOptions, RegleCollectionErrors, RegleCollectionRuleDecl, RegleCollectionRuleDefinition, RegleCollectionStatus, RegleCommonStatus, RegleComputedRules, RegleCustomCollectionStatus, RegleCustomFieldStatus, RegleCustomStatus, RegleEnforceCustomRequiredRules, RegleEnforceRequiredRules, RegleErrorTree, RegleExternalCollectionErrors, RegleExternalErrorTree, RegleFieldStatus, RegleFormPropertyType, RegleInternalRuleDefs, ReglePartialRuleTree, RegleResult, RegleRoot, RegleRuleCore, RegleRuleDecl, RegleRuleDefinition, RegleRuleDefinitionProcessor, RegleRuleDefinitionWithMetadataProcessor, RegleRuleInit, RegleRuleMetadataConsumer, RegleRuleMetadataDefinition, RegleRuleMetadataExtended, RegleRuleRaw, RegleRuleStatus, RegleRuleTypeReturn, RegleRuleWithParamsDefinition, RegleShortcutDefinition, RegleSingleField, RegleStatus, RegleUniversalParams, RegleUnknownRulesTree, RegleValidationErrors, RegleValidationGroupEntry, RegleValidationGroupOutput, RegleRuleTree as RegleValidationTree, ResolvedRegleBehaviourOptions, ScopedInstancesRecord, ScopedInstancesRecordLike, SuperCompatibleRegle, SuperCompatibleRegleCollectionErrors, SuperCompatibleRegleCollectionStatus, SuperCompatibleRegleFieldStatus, SuperCompatibleRegleResult, SuperCompatibleRegleRoot, SuperCompatibleRegleRuleStatus, SuperCompatibleRegleStatus, Unwrap, UnwrapRegleUniversalParams, UnwrapRuleWithParams, UseScopedRegleOptions, createRule, createScopedUseRegle, createVariant, defineRegleConfig, defineRules, extendRegleConfig, flatErrors, inferRules, inferRulesFn, mergeRegles, narrowVariant, refineRules, unwrapRuleParameters, useCollectScope, useCollectScopeFn, useRegle, useRegleFn, useRootStorage, useScopedRegle, variantToRef };
|