@regle/schemas 1.11.0 → 1.12.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.
@@ -1,5 +1,5 @@
1
1
  import * as _regle_core0 from "@regle/core";
2
- import { ArrayElement, CreateScopedUseRegleOptions, DeepMaybeRef, DeepReactiveState, HasNamedKeys, HaveAnyRequiredProps, JoinDiscriminatedUnions, LocalRegleBehaviourOptions, Maybe, NoInferLegacy, PrimitiveTypes, RegleBehaviourOptions, RegleCollectionErrors, RegleCommonStatus, RegleErrorTree, RegleFieldIssue, RegleIssuesTree, RegleRuleStatus, RegleShortcutDefinition, TupleToPlainObj, UseScopedRegleOptions, useCollectScopeFn } from "@regle/core";
2
+ import { ArrayElement, CreateScopedUseRegleOptions, DeepMaybeRef, DeepReactiveState, HasNamedKeys, HaveAnyRequiredProps, JoinDiscriminatedUnions, LocalRegleBehaviourOptions, Maybe, MaybeOutput, NoInferLegacy, PrimitiveTypes, RegleBehaviourOptions, RegleCollectionErrors, RegleCommonStatus, RegleErrorTree, RegleFieldIssue, RegleIssuesTree, RegleRuleStatus, RegleShortcutDefinition, RegleStaticImpl, TupleToPlainObj, UseScopedRegleOptions, useCollectScopeFn } from "@regle/core";
3
3
  import * as vue0 from "vue";
4
4
  import { MaybeRef, Raw, UnwrapNestedRefs } from "vue";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
@@ -64,11 +64,24 @@ type RegleSchemaStatus<TState extends Record<string, any> | undefined = Record<s
64
64
  /**
65
65
  * @public
66
66
  */
67
- type InferRegleSchemaStatusType<TState extends unknown, TShortcuts extends RegleShortcutDefinition = {}> = NonNullable<TState> extends Array<infer A> ? A extends Record<string, any> ? RegleSchemaCollectionStatus<NonNullable<TState>, TShortcuts> : RegleSchemaFieldStatus<TState, TShortcuts> : NonNullable<TState> extends Date | File ? RegleSchemaFieldStatus<TState, TShortcuts> : unknown extends TState ? RegleSchemaFieldStatus<TState extends EmptyObject ? unknown : TState, TShortcuts> : NonNullable<TState> extends Record<string, any> ? MaybeSchemaVariantStatus<NonNullable<TState> extends Record<string, any> ? NonNullable<TState> : {}, TShortcuts> : RegleSchemaFieldStatus<TState, TShortcuts>;
67
+ type InferRegleSchemaStatusType<TState extends unknown, TShortcuts extends RegleShortcutDefinition = {}> = NonNullable<TState> extends Array<infer A> ? A extends Record<string, any> ? RegleSchemaCollectionStatus<NonNullable<TState>, TShortcuts> : RegleSchemaFieldStatus<TState, TShortcuts> : NonNullable<TState> extends Date | File ? RegleSchemaFieldStatus<TState, TShortcuts> : unknown extends TState ? RegleSchemaFieldStatus<TState extends EmptyObject ? unknown : TState, TShortcuts> : NonNullable<TState> extends Record<string, any> ? NonNullable<NonNullable<TState>> extends RegleStaticImpl<infer U> ? RegleSchemaFieldStatus<Raw<U>, TShortcuts> : MaybeSchemaVariantStatus<NonNullable<TState> extends Record<string, any> ? NonNullable<TState> : {}, TShortcuts> : RegleSchemaFieldStatus<TState, TShortcuts>;
68
68
  /**
69
69
  * @public
70
70
  */
71
- type RegleSchemaFieldStatus<TState = any, TShortcuts extends RegleShortcutDefinition = {}> = Omit<RegleCommonStatus<TState>, '$pending'> & {
71
+ type RegleSchemaFieldStatus<TState = any, TShortcuts extends RegleShortcutDefinition = {}> = Omit<RegleCommonStatus<TState>, '$pending' | '$value' | '$silentValue' | '$initialValue' | '$originalValue'> & {
72
+ /** A reference to the original validated model. It can be used to bind your form with v-model.*/
73
+ $value: MaybeOutput<UnwrapNestedRefs<TState>>;
74
+ /** $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. */
75
+ $silentValue: MaybeOutput<UnwrapNestedRefs<TState>>;
76
+ /**
77
+ * This value reflect the current initial value of the field.
78
+ * The initial value is different than the original value as the initial value can be mutated when using `$reset`.
79
+ */
80
+ readonly $initialValue: MaybeOutput<UnwrapNestedRefs<TState>>;
81
+ /**
82
+ * This value reflect the original value of the field at original call. This can't be mutated
83
+ */
84
+ readonly $originalValue: MaybeOutput<UnwrapNestedRefs<TState>>;
72
85
  /** Collection of all the error messages, collected for all children properties and nested forms.
73
86
  *
74
87
  * Only contains errors from properties where $dirty equals true. */
@@ -132,7 +145,7 @@ type RegleSchemaBehaviourOptions = {
132
145
  onValidate?: boolean;
133
146
  };
134
147
  };
135
- type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy' | 'rewardEarly'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
148
+ type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
136
149
  interface useRegleSchemaFn<TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
137
150
  <TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(...params: [state: MaybeRef<PartialDeep<NoInferLegacy<TState>, {
138
151
  recurseIntoArrays: true;
@@ -218,7 +231,7 @@ type CreateScopedUseRegleSchemaOptions<TCustomRegle extends useRegleSchemaFn<any
218
231
  */
219
232
  customUseRegle?: TCustomRegle;
220
233
  };
221
- declare const useCollectSchemaScope: <TValue$1 extends Record<string, unknown>[] = Record<string, unknown>[]>(namespace?: vue0.MaybeRefOrGetter<string>) => {
234
+ declare const useCollectSchemaScope: <TValue$1 extends Record<string, unknown>[] = Record<string, unknown>[]>(namespace?: vue0.MaybeRefOrGetter<string | string[]>) => {
222
235
  r$: _regle_core0.MergedScopedRegles<TValue$1>;
223
236
  }, useScopedRegleSchema: useRegleSchemaFn<_regle_core0.RegleShortcutDefinition<any>, {}, {}>;
224
237
  declare const createScopedUseRegleSchema: <TCustomRegle extends useRegleSchemaFn = useRegleSchemaFn, TAsRecord extends boolean = false, TReturnedRegle extends useRegleSchemaFn<any, any, any> = (TCustomRegle extends useRegleSchemaFn<infer S> ? useRegleSchemaFn<S, {
@@ -143,39 +143,55 @@ function createUseRegleSchemaComposable(options, shortcuts) {
143
143
  const initialState = ref(isObject(processedState.value) ? { ...cloneDeep(processedState.value) } : cloneDeep(processedState.value));
144
144
  const originalState = isObject(processedState.value) ? { ...cloneDeep(processedState.value) } : cloneDeep(processedState.value);
145
145
  const customErrors = ref({});
146
+ const previousIssues = ref([]);
146
147
  let onValidate = void 0;
148
+ function getIssuePath(issue) {
149
+ return issue.path?.map((item) => typeof item === "object" ? item.key : item.toString()).join(".") ?? "";
150
+ }
147
151
  if (!computedSchema.value?.["~standard"]) throw new Error(`Only "standard-schema" compatible libraries are supported`);
148
- function issuesToRegleErrors(result) {
152
+ function filterIssues(issues, isValidate = false) {
153
+ if (!isValidate && resolvedOptions.rewardEarly) {
154
+ if (previousIssues.value.length) return previousIssues.value.filter((issue) => issues.some((i) => getIssuePath(i) === getIssuePath(issue)));
155
+ return [];
156
+ }
157
+ return issues;
158
+ }
159
+ function issuesToRegleErrors(result, isValidate = false) {
149
160
  const output = {};
150
- if (result.issues) result.issues.map((issue) => {
151
- let $path = issue.path?.map((item) => typeof item === "object" ? item.key : item.toString()).join(".") ?? "";
152
- const lastItem = issue.path?.[issue.path.length - 1];
153
- const lastItemKey = typeof lastItem === "object" ? lastItem.key : lastItem;
154
- const isArray = (typeof lastItem === "object" && "value" in lastItem ? Array.isArray(lastItem.value) : false) || ("type" in issue ? issue.type === "array" : false) || Array.isArray(getDotPath(processedState.value, $path));
155
- if (!isArray && typeof lastItemKey === "number") $path = issue.path?.slice(0, issue.path.length - 1)?.map((item) => typeof item === "object" ? item.key : item.toString()).join(".") ?? "";
156
- return {
157
- ...issue,
158
- $path,
159
- isArray,
160
- $property: lastItemKey,
161
- $rule: "schema",
162
- $message: issue.message
163
- };
164
- }).forEach(({ isArray, $path, ...issue }) => {
165
- setObjectError(output, $path, [issue], isArray);
166
- });
161
+ let filteredIssues = filterIssues(result.issues ?? [], isValidate);
162
+ if (result.issues?.length) {
163
+ const issues = filteredIssues.map((issue) => {
164
+ let $path = getIssuePath(issue);
165
+ const lastItem = issue.path?.[issue.path.length - 1];
166
+ const lastItemKey = typeof lastItem === "object" ? lastItem.key : lastItem;
167
+ const isArray = (typeof lastItem === "object" && "value" in lastItem ? Array.isArray(lastItem.value) : false) || ("type" in issue ? issue.type === "array" : false) || Array.isArray(getDotPath(processedState.value, $path));
168
+ if (!isArray && typeof lastItemKey === "number") $path = issue.path?.slice(0, issue.path.length - 1)?.map((item) => typeof item === "object" ? item.key : item.toString()).join(".") ?? "";
169
+ return {
170
+ ...issue,
171
+ $path,
172
+ isArray,
173
+ $property: lastItemKey,
174
+ $rule: "schema",
175
+ $message: issue.message
176
+ };
177
+ });
178
+ issues.forEach(({ isArray, $path, ...issue }) => {
179
+ setObjectError(output, $path, [issue], isArray);
180
+ });
181
+ previousIssues.value = issues;
182
+ } else previousIssues.value = [];
167
183
  return output;
168
184
  }
169
185
  async function computeErrors(isValidate = false) {
170
186
  let result = computedSchema.value["~standard"].validate(processedState.value);
171
187
  if (result instanceof Promise) result = await result;
172
- if (isSingleField.value) customErrors.value = result.issues?.map((issue) => ({
188
+ if (isSingleField.value) customErrors.value = filterIssues(result.issues ?? [], isValidate)?.map((issue) => ({
173
189
  $message: issue.message,
174
190
  $property: issue.path?.[issue.path.length - 1]?.toString() ?? "-",
175
191
  $rule: "schema",
176
192
  ...issue
177
193
  })) ?? [];
178
- else customErrors.value = issuesToRegleErrors(result);
194
+ else customErrors.value = issuesToRegleErrors(result, isValidate);
179
195
  if (!result.issues) {
180
196
  if (isValidate && syncOnValidate || !isValidate && syncOnUpdate) {
181
197
  unWatchState?.();
@@ -188,7 +204,10 @@ function createUseRegleSchemaComposable(options, shortcuts) {
188
204
  }
189
205
  let unWatchState;
190
206
  function defineWatchState() {
191
- unWatchState = watch([processedState, computedSchema], () => computeErrors(), { deep: true });
207
+ unWatchState = watch([processedState, computedSchema], () => {
208
+ if (resolvedOptions.silent) return;
209
+ computeErrors();
210
+ }, { deep: true });
192
211
  }
193
212
  defineWatchState();
194
213
  computeErrors();
@@ -1 +1 @@
1
- import{createScopedUseRegle as e,useRootStorage as t}from"@regle/core";import{computed as n,getCurrentScope as r,isRef as i,onScopeDispose as a,ref as o,unref as s,watch as c}from"vue";function l(e){return e?.constructor?.name==`File`||e?.constructor?.name==`FileList`}function u(e,t=!0){return e==null?!0:e instanceof Date?isNaN(e.getTime()):l(e)?e.size<=0:Array.isArray(e)?t?e.length===0:!1:typeof e==`object`&&e?Object.keys(e).length===0:!String(e).length}function d(e){if(typeof e.source.flags==`string`)return e.source.flags;{let t=[];return e.global&&t.push(`g`),e.ignoreCase&&t.push(`i`),e.multiline&&t.push(`m`),e.sticky&&t.push(`y`),e.unicode&&t.push(`u`),t.join(``)}}function f(e,t=0){if(t>20)return e;let n=e,r={}.toString.call(e).slice(8,-1);if(r==`Set`&&(n=new Set([...e].map(e=>f(e,t++)))),r==`Map`&&(n=new Map([...e].map(e=>[f(e[0]),f(e[1])]))),r==`Date`&&(n=new Date(e.getTime())),r==`RegExp`&&(n=RegExp(e.source,d(e))),r==`Array`||r==`Object`)for(let r in n=Array.isArray(e)?[]:{},e)n[r]=f(e[r],t++);return n}function p(e){return e&&(e instanceof Date||e.constructor.name==`File`||e.constructor.name==`FileList`)?!1:typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e,t,n,r){var i,a;if(Array.isArray(t)&&(i=t.slice(0)),typeof t==`string`&&(i=t.split(`.`)),typeof t==`symbol`&&(i=[t]),!Array.isArray(i))throw Error(`props arg must be an array, a string or a symbol`);if(a=i.pop(),!a)return!1;g(a);for(var o;o=i.shift();)if(g(o),isNaN(parseInt(o))?(e[o]===void 0&&(e[o]={}),e=e[o]):(e.$each??=[],u(e.$each[o])&&(e.$each[o]={}),e=e.$each[o]),!e||typeof e!=`object`)return!1;return r?e[a]?e[a].$self=(e[a].$self??=[]).concat(n):e[a]={$self:n}:Array.isArray(e[a])?e[a]=e[a].concat(n):e[a]=n,!0}function h(e,t,n){if(!e)return n;var r,i;if(Array.isArray(t)&&(r=t.slice(0)),typeof t==`string`&&(r=t.split(`.`)),typeof t==`symbol`&&(r=[t]),!Array.isArray(r))throw Error(`props arg must be an array, a string or a symbol`);for(;r.length;)if(i=r.shift(),!e||!i||(e=e[i],e===void 0))return n;return e}function g(e){if(e==`__proto__`||e==`constructor`||e==`prototype`)throw Error(`setting of prototype values not supported`)}function _(e,...t){for(var n=[].slice.call(arguments),r,i=n.length;r=n[i-1],i--;)if(!r||typeof r!=`object`&&typeof r!=`function`)throw Error(`expected object, got `+r);for(var a=n[0],o=n.slice(1),s=o.length,i=0;i<s;i++){var c=o[i];for(var l in c)a[l]=c[l]}return a}function v(e,l){let u={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function d(e,d,g){let v=n(()=>s(d)),{syncState:y={onUpdate:!1,onValidate:!1},...b}=g??{},{onUpdate:x=!1,onValidate:S=!1}=y,C={...u,...b},w=n(()=>!p(T.value)),T=i(e)?e:o(e),E=o(p(T.value)?{...f(T.value)}:f(T.value)),D=p(T.value)?{...f(T.value)}:f(T.value),O=o({}),k;if(!v.value?.[`~standard`])throw Error(`Only "standard-schema" compatible libraries are supported`);function A(e){let t={};return e.issues&&e.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``,n=e.path?.[e.path.length-1],r=typeof n==`object`?n.key:n,i=(typeof n==`object`&&`value`in n?Array.isArray(n.value):!1)||(`type`in e?e.type===`array`:!1)||Array.isArray(h(T.value,t));return!i&&typeof r==`number`&&(t=e.path?.slice(0,e.path.length-1)?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``),{...e,$path:t,isArray:i,$property:r,$rule:`schema`,$message:e.message}}).forEach(({isArray:e,$path:n,...r})=>{m(t,n,[r],e)}),t}async function j(e=!1){let t=v.value[`~standard`].validate(T.value);return t instanceof Promise&&(t=await t),w.value?O.value=t.issues?.map(e=>({$message:e.message,$property:e.path?.[e.path.length-1]?.toString()??`-`,$rule:`schema`,...e}))??[]:O.value=A(t),t.issues||(e&&S||!e&&x)&&(M?.(),p(T.value)?T.value=_(T.value,t.value):T.value=t.value,N()),t}let M;function N(){M=c([T,v],()=>j(),{deep:!0})}return N(),j(),k=async()=>{try{return{valid:!(await j(!0)).issues?.length,data:T.value,errors:{},issues:{}}}catch(e){return Promise.reject(e)}},r()&&a(()=>{M()}),{r$:t({scopeRules:n(()=>({})),state:T,options:C,schemaErrors:O,initialState:E,originalState:D,shortcuts:l,schemaMode:!0,onValidate:k}).regle}}return d}const y=v();function b(e,t){return e}function x(){function e(e,t){return t}return e}const S=x();function C({modifiers:e,shortcuts:t}){return{useRegleSchema:v(e,t),inferSchema:x()}}const{useCollectScope:w,useScopedRegle:T}=e({customUseRegle:y}),E=t=>{let{customStore:n,customUseRegle:r=y,asRecord:i=!1}=t??{};return e({customStore:n,customUseRegle:r,asRecord:i})};export{E as createScopedUseRegleSchema,C as defineRegleSchemaConfig,S as inferSchema,w as useCollectSchemaScope,y as useRegleSchema,T as useScopedRegleSchema,b as withDeps};
1
+ import{createScopedUseRegle as e,useRootStorage as t}from"@regle/core";import{computed as n,getCurrentScope as r,isRef as i,onScopeDispose as a,ref as o,unref as s,watch as c}from"vue";function l(e){return e?.constructor?.name==`File`||e?.constructor?.name==`FileList`}function u(e,t=!0){return e==null?!0:e instanceof Date?isNaN(e.getTime()):l(e)?e.size<=0:Array.isArray(e)?t?e.length===0:!1:typeof e==`object`&&e?Object.keys(e).length===0:!String(e).length}function d(e){if(typeof e.source.flags==`string`)return e.source.flags;{let t=[];return e.global&&t.push(`g`),e.ignoreCase&&t.push(`i`),e.multiline&&t.push(`m`),e.sticky&&t.push(`y`),e.unicode&&t.push(`u`),t.join(``)}}function f(e,t=0){if(t>20)return e;let n=e,r={}.toString.call(e).slice(8,-1);if(r==`Set`&&(n=new Set([...e].map(e=>f(e,t++)))),r==`Map`&&(n=new Map([...e].map(e=>[f(e[0]),f(e[1])]))),r==`Date`&&(n=new Date(e.getTime())),r==`RegExp`&&(n=RegExp(e.source,d(e))),r==`Array`||r==`Object`)for(let r in n=Array.isArray(e)?[]:{},e)n[r]=f(e[r],t++);return n}function p(e){return e&&(e instanceof Date||e.constructor.name==`File`||e.constructor.name==`FileList`)?!1:typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e,t,n,r){var i,a;if(Array.isArray(t)&&(i=t.slice(0)),typeof t==`string`&&(i=t.split(`.`)),typeof t==`symbol`&&(i=[t]),!Array.isArray(i))throw Error(`props arg must be an array, a string or a symbol`);if(a=i.pop(),!a)return!1;g(a);for(var o;o=i.shift();)if(g(o),isNaN(parseInt(o))?(e[o]===void 0&&(e[o]={}),e=e[o]):(e.$each??=[],u(e.$each[o])&&(e.$each[o]={}),e=e.$each[o]),!e||typeof e!=`object`)return!1;return r?e[a]?e[a].$self=(e[a].$self??=[]).concat(n):e[a]={$self:n}:Array.isArray(e[a])?e[a]=e[a].concat(n):e[a]=n,!0}function h(e,t,n){if(!e)return n;var r,i;if(Array.isArray(t)&&(r=t.slice(0)),typeof t==`string`&&(r=t.split(`.`)),typeof t==`symbol`&&(r=[t]),!Array.isArray(r))throw Error(`props arg must be an array, a string or a symbol`);for(;r.length;)if(i=r.shift(),!e||!i||(e=e[i],e===void 0))return n;return e}function g(e){if(e==`__proto__`||e==`constructor`||e==`prototype`)throw Error(`setting of prototype values not supported`)}function _(e,...t){for(var n=[].slice.call(arguments),r,i=n.length;r=n[i-1],i--;)if(!r||typeof r!=`object`&&typeof r!=`function`)throw Error(`expected object, got `+r);for(var a=n[0],o=n.slice(1),s=o.length,i=0;i<s;i++){var c=o[i];for(var l in c)a[l]=c[l]}return a}function v(e,l){let u={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function d(e,d,g){let v=n(()=>s(d)),{syncState:y={onUpdate:!1,onValidate:!1},...b}=g??{},{onUpdate:x=!1,onValidate:S=!1}=y,C={...u,...b},w=n(()=>!p(T.value)),T=i(e)?e:o(e),E=o(p(T.value)?{...f(T.value)}:f(T.value)),D=p(T.value)?{...f(T.value)}:f(T.value),O=o({}),k=o([]),A;function j(e){return e.path?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``}if(!v.value?.[`~standard`])throw Error(`Only "standard-schema" compatible libraries are supported`);function M(e,t=!1){return!t&&C.rewardEarly?k.value.length?k.value.filter(t=>e.some(e=>j(e)===j(t))):[]:e}function N(e,t=!1){let n={},r=M(e.issues??[],t);if(e.issues?.length){let e=r.map(e=>{let t=j(e),n=e.path?.[e.path.length-1],r=typeof n==`object`?n.key:n,i=(typeof n==`object`&&`value`in n?Array.isArray(n.value):!1)||(`type`in e?e.type===`array`:!1)||Array.isArray(h(T.value,t));return!i&&typeof r==`number`&&(t=e.path?.slice(0,e.path.length-1)?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``),{...e,$path:t,isArray:i,$property:r,$rule:`schema`,$message:e.message}});e.forEach(({isArray:e,$path:t,...r})=>{m(n,t,[r],e)}),k.value=e}else k.value=[];return n}async function P(e=!1){let t=v.value[`~standard`].validate(T.value);return t instanceof Promise&&(t=await t),w.value?O.value=M(t.issues??[],e)?.map(e=>({$message:e.message,$property:e.path?.[e.path.length-1]?.toString()??`-`,$rule:`schema`,...e}))??[]:O.value=N(t,e),t.issues||(e&&S||!e&&x)&&(F?.(),p(T.value)?T.value=_(T.value,t.value):T.value=t.value,I()),t}let F;function I(){F=c([T,v],()=>{C.silent||P()},{deep:!0})}return I(),P(),A=async()=>{try{return{valid:!(await P(!0)).issues?.length,data:T.value,errors:{},issues:{}}}catch(e){return Promise.reject(e)}},r()&&a(()=>{F()}),{r$:t({scopeRules:n(()=>({})),state:T,options:C,schemaErrors:O,initialState:E,originalState:D,shortcuts:l,schemaMode:!0,onValidate:A}).regle}}return d}const y=v();function b(e,t){return e}function x(){function e(e,t){return t}return e}const S=x();function C({modifiers:e,shortcuts:t}){return{useRegleSchema:v(e,t),inferSchema:x()}}const{useCollectScope:w,useScopedRegle:T}=e({customUseRegle:y}),E=t=>{let{customStore:n,customUseRegle:r=y,asRecord:i=!1}=t??{};return e({customStore:n,customUseRegle:r,asRecord:i})};export{E as createScopedUseRegleSchema,C as defineRegleSchemaConfig,S as inferSchema,w as useCollectSchemaScope,y as useRegleSchema,T as useScopedRegleSchema,b as withDeps};
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@regle/schemas",
3
- "version": "1.11.0",
3
+ "version": "1.12.0-beta.1",
4
4
  "description": "Schemas adapter for Regle",
5
5
  "dependencies": {
6
6
  "@standard-schema/spec": "1.0.0",
7
7
  "type-fest": "5.2.0",
8
- "@regle/core": "1.11.0",
9
- "@regle/rules": "1.11.0"
8
+ "@regle/core": "1.12.0-beta.1",
9
+ "@regle/rules": "1.12.0-beta.1"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "valibot": "^1.0.0",
@@ -32,7 +32,7 @@
32
32
  "tsdown": "0.16.6",
33
33
  "type-fest": "5.2.0",
34
34
  "typescript": "5.9.3",
35
- "valibot": "1.1.0",
35
+ "valibot": "1.2.0",
36
36
  "vitest": "4.0.13",
37
37
  "vue": "3.5.25",
38
38
  "vue-tsc": "3.1.5",