diff --git a/404.html b/404.html index 3b71e77d..bb972285 100644 --- a/404.html +++ b/404.html @@ -15,7 +15,7 @@
- + \ No newline at end of file diff --git a/advanced/custom-instance.html b/advanced/custom-instance.html index 416e89b1..cefc7003 100644 --- a/advanced/custom-instance.html +++ b/advanced/custom-instance.html @@ -12,7 +12,7 @@ - + @@ -89,8 +89,8 @@ validator: (v) => v > 0, }) } -} - +} + \ No newline at end of file diff --git a/advanced/extending-vue-types.html b/advanced/extending-vue-types.html index 24f1120b..75bd14fd 100644 --- a/advanced/extending-vue-types.html +++ b/advanced/extending-vue-types.html @@ -12,7 +12,7 @@ - + @@ -224,8 +224,8 @@ count: VueTypes.positive, }, }) -</script> - +</script> + \ No newline at end of file diff --git a/advanced/typescript.html b/advanced/typescript.html index 86be37df..1e54cf06 100644 --- a/advanced/typescript.html +++ b/advanced/typescript.html @@ -12,7 +12,7 @@ - + @@ -135,8 +135,8 @@ }

As a general rule, we strongly suggest to use const assertions whenever possible.

ts
props: {
   // type checker and runtime error
   sizes: oneOf(['large'] as const).def('medium')
-}
- +} + \ No newline at end of file diff --git a/assets/advanced_custom-instance.md.Cp6qMF4p.js b/assets/advanced_custom-instance.md.Cv0G-HOW.js similarity index 99% rename from assets/advanced_custom-instance.md.Cp6qMF4p.js rename to assets/advanced_custom-instance.md.Cv0G-HOW.js index 9b7ac5f1..86b5e4e6 100644 --- a/assets/advanced_custom-instance.md.Cp6qMF4p.js +++ b/assets/advanced_custom-instance.md.Cv0G-HOW.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Custom namespaced instance","description":"","frontmatter":{},"headers":[],"relativePath":"advanced/custom-instance.md","filePath":"advanced/custom-instance.md","lastUpdated":1730770044000}'),e={name:"advanced/custom-instance.md"},p=n(`

Custom namespaced instance

The sensibleDefaults and extend features let you customize the library to better fit into your project.

Anyway, they come with a downside: because they mutate the same VueTypes object, applications sharing the same module (ie: importing the same library instance from node_modules) might alter one another the behavior of validators.

For example suppose we have a library core and an application ui both using VueTypes. In core we define a custom default and use it:

js
// core/types.js
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Custom namespaced instance","description":"","frontmatter":{},"headers":[],"relativePath":"advanced/custom-instance.md","filePath":"advanced/custom-instance.md","lastUpdated":1730770177000}'),e={name:"advanced/custom-instance.md"},p=n(`

Custom namespaced instance

The sensibleDefaults and extend features let you customize the library to better fit into your project.

Anyway, they come with a downside: because they mutate the same VueTypes object, applications sharing the same module (ie: importing the same library instance from node_modules) might alter one another the behavior of validators.

For example suppose we have a library core and an application ui both using VueTypes. In core we define a custom default and use it:

js
// core/types.js
 import VueTypes from 'vue-types'
 
 VueTypes.sensibleDefaults = {
diff --git a/assets/advanced_custom-instance.md.Cp6qMF4p.lean.js b/assets/advanced_custom-instance.md.Cv0G-HOW.lean.js
similarity index 86%
rename from assets/advanced_custom-instance.md.Cp6qMF4p.lean.js
rename to assets/advanced_custom-instance.md.Cv0G-HOW.lean.js
index 0c670c8c..bb1f00bc 100644
--- a/assets/advanced_custom-instance.md.Cp6qMF4p.lean.js
+++ b/assets/advanced_custom-instance.md.Cv0G-HOW.lean.js
@@ -1 +1 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Custom namespaced instance","description":"","frontmatter":{},"headers":[],"relativePath":"advanced/custom-instance.md","filePath":"advanced/custom-instance.md","lastUpdated":1730770044000}'),e={name:"advanced/custom-instance.md"},p=n("",19),t=[p];function l(h,k,d,r,c,E){return a(),i("div",null,t)}const g=s(e,[["render",l]]);export{y as __pageData,g as default};
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Custom namespaced instance","description":"","frontmatter":{},"headers":[],"relativePath":"advanced/custom-instance.md","filePath":"advanced/custom-instance.md","lastUpdated":1730770177000}'),e={name:"advanced/custom-instance.md"},p=n("",19),t=[p];function l(h,k,d,r,c,E){return a(),i("div",null,t)}const g=s(e,[["render",l]]);export{y as __pageData,g as default};
diff --git a/assets/advanced_extending-vue-types.md.764-h470.js b/assets/advanced_extending-vue-types.md.Xp6frQVM.js
similarity index 99%
rename from assets/advanced_extending-vue-types.md.764-h470.js
rename to assets/advanced_extending-vue-types.md.Xp6frQVM.js
index be3cb23b..a7cc9385 100644
--- a/assets/advanced_extending-vue-types.md.764-h470.js
+++ b/assets/advanced_extending-vue-types.md.Xp6frQVM.js
@@ -1,4 +1,4 @@
-import{_ as e,c as p,j as s,a as i,I as n,a2 as t,D as l,o as h}from"./chunks/framework.Dr3U-I6a.js";const V=JSON.parse('{"title":"Extending VueTypes","description":"","frontmatter":{"outline":2},"headers":[],"relativePath":"advanced/extending-vue-types.md","filePath":"advanced/extending-vue-types.md","lastUpdated":1730770044000}'),k={name:"advanced/extending-vue-types.md"},d=s("h1",{id:"extending-vuetypes",tabindex:"-1"},[i("Extending VueTypes "),s("a",{class:"header-anchor",href:"#extending-vuetypes","aria-label":'Permalink to "Extending VueTypes"'},"​")],-1),r={class:"table-of-contents"},E=s("li",null,[s("a",{href:"#standalone-custom-validators"},"Standalone custom validators"),s("ul",null,[s("li",null,[s("a",{href:"#custom-validators-from-scratch"},"Custom validators from scratch")]),s("li",null,[s("a",{href:"#inheriting-from-existing-validators"},"Inheriting from existing validators")])])],-1),g=s("li",null,[s("a",{href:"#extending-namespaced-validators-in-es6"},"Extending namespaced validators in ES6+")],-1),y={href:"#the-extend-method"},o=s("ul",null,[s("li",null,[s("a",{href:"#inherit-from-vuetypes-validators"},"Inherit from VueTypes validators")]),s("li",null,[s("a",{href:"#define-multiple-validators"},"Define multiple validators")]),s("li",null,[s("a",{href:"#typescript"},"Typescript")])],-1),c=t(`

Standalone custom validators

The toType, toValidableType and fromType functions can be used to create custom standalone validators. Indeed, they are used internally by vue-types in native and custom validators.

Custom validators from scratch

In the following example we define a validator for positive numbers:

js
const positive = () =>
+import{_ as e,c as p,j as s,a as i,I as n,a2 as t,D as l,o as h}from"./chunks/framework.Dr3U-I6a.js";const V=JSON.parse('{"title":"Extending VueTypes","description":"","frontmatter":{"outline":2},"headers":[],"relativePath":"advanced/extending-vue-types.md","filePath":"advanced/extending-vue-types.md","lastUpdated":1730770177000}'),k={name:"advanced/extending-vue-types.md"},d=s("h1",{id:"extending-vuetypes",tabindex:"-1"},[i("Extending VueTypes "),s("a",{class:"header-anchor",href:"#extending-vuetypes","aria-label":'Permalink to "Extending VueTypes"'},"​")],-1),r={class:"table-of-contents"},E=s("li",null,[s("a",{href:"#standalone-custom-validators"},"Standalone custom validators"),s("ul",null,[s("li",null,[s("a",{href:"#custom-validators-from-scratch"},"Custom validators from scratch")]),s("li",null,[s("a",{href:"#inheriting-from-existing-validators"},"Inheriting from existing validators")])])],-1),g=s("li",null,[s("a",{href:"#extending-namespaced-validators-in-es6"},"Extending namespaced validators in ES6+")],-1),y={href:"#the-extend-method"},o=s("ul",null,[s("li",null,[s("a",{href:"#inherit-from-vuetypes-validators"},"Inherit from VueTypes validators")]),s("li",null,[s("a",{href:"#define-multiple-validators"},"Define multiple validators")]),s("li",null,[s("a",{href:"#typescript"},"Typescript")])],-1),c=t(`

Standalone custom validators

The toType, toValidableType and fromType functions can be used to create custom standalone validators. Indeed, they are used internally by vue-types in native and custom validators.

Custom validators from scratch

In the following example we define a validator for positive numbers:

js
const positive = () =>
   toType('positive', {
     type: Number,
     validator: (v) => v >= 0,
diff --git a/assets/advanced_extending-vue-types.md.764-h470.lean.js b/assets/advanced_extending-vue-types.md.Xp6frQVM.lean.js
similarity index 96%
rename from assets/advanced_extending-vue-types.md.764-h470.lean.js
rename to assets/advanced_extending-vue-types.md.Xp6frQVM.lean.js
index 1ad1f6cd..16a8e0c3 100644
--- a/assets/advanced_extending-vue-types.md.764-h470.lean.js
+++ b/assets/advanced_extending-vue-types.md.Xp6frQVM.lean.js
@@ -1 +1 @@
-import{_ as e,c as p,j as s,a as i,I as n,a2 as t,D as l,o as h}from"./chunks/framework.Dr3U-I6a.js";const V=JSON.parse('{"title":"Extending VueTypes","description":"","frontmatter":{"outline":2},"headers":[],"relativePath":"advanced/extending-vue-types.md","filePath":"advanced/extending-vue-types.md","lastUpdated":1730770044000}'),k={name:"advanced/extending-vue-types.md"},d=s("h1",{id:"extending-vuetypes",tabindex:"-1"},[i("Extending VueTypes "),s("a",{class:"header-anchor",href:"#extending-vuetypes","aria-label":'Permalink to "Extending VueTypes"'},"​")],-1),r={class:"table-of-contents"},E=s("li",null,[s("a",{href:"#standalone-custom-validators"},"Standalone custom validators"),s("ul",null,[s("li",null,[s("a",{href:"#custom-validators-from-scratch"},"Custom validators from scratch")]),s("li",null,[s("a",{href:"#inheriting-from-existing-validators"},"Inheriting from existing validators")])])],-1),g=s("li",null,[s("a",{href:"#extending-namespaced-validators-in-es6"},"Extending namespaced validators in ES6+")],-1),y={href:"#the-extend-method"},o=s("ul",null,[s("li",null,[s("a",{href:"#inherit-from-vuetypes-validators"},"Inherit from VueTypes validators")]),s("li",null,[s("a",{href:"#define-multiple-validators"},"Define multiple validators")]),s("li",null,[s("a",{href:"#typescript"},"Typescript")])],-1),c=t("",24),F={id:"the-extend-method",tabindex:"-1"},u=s("code",null,"extend()",-1),m=s("a",{class:"header-anchor",href:"#the-extend-method","aria-label":'Permalink to "The `extend()` method "'},"​",-1),v=t("",25);function C(A,D,b,f,B,T){const a=l("Badge");return h(),p("div",null,[d,s("nav",r,[s("ul",null,[E,g,s("li",null,[s("a",y,[i("The extend() method "),n(a,{text:"deprecated",type:"warning"})]),o])])]),c,s("h2",F,[i("The "),u,i(" method "),n(a,{text:"deprecated",type:"warning"}),i(),m]),v])}const _=e(k,[["render",C]]);export{V as __pageData,_ as default};
+import{_ as e,c as p,j as s,a as i,I as n,a2 as t,D as l,o as h}from"./chunks/framework.Dr3U-I6a.js";const V=JSON.parse('{"title":"Extending VueTypes","description":"","frontmatter":{"outline":2},"headers":[],"relativePath":"advanced/extending-vue-types.md","filePath":"advanced/extending-vue-types.md","lastUpdated":1730770177000}'),k={name:"advanced/extending-vue-types.md"},d=s("h1",{id:"extending-vuetypes",tabindex:"-1"},[i("Extending VueTypes "),s("a",{class:"header-anchor",href:"#extending-vuetypes","aria-label":'Permalink to "Extending VueTypes"'},"​")],-1),r={class:"table-of-contents"},E=s("li",null,[s("a",{href:"#standalone-custom-validators"},"Standalone custom validators"),s("ul",null,[s("li",null,[s("a",{href:"#custom-validators-from-scratch"},"Custom validators from scratch")]),s("li",null,[s("a",{href:"#inheriting-from-existing-validators"},"Inheriting from existing validators")])])],-1),g=s("li",null,[s("a",{href:"#extending-namespaced-validators-in-es6"},"Extending namespaced validators in ES6+")],-1),y={href:"#the-extend-method"},o=s("ul",null,[s("li",null,[s("a",{href:"#inherit-from-vuetypes-validators"},"Inherit from VueTypes validators")]),s("li",null,[s("a",{href:"#define-multiple-validators"},"Define multiple validators")]),s("li",null,[s("a",{href:"#typescript"},"Typescript")])],-1),c=t("",24),F={id:"the-extend-method",tabindex:"-1"},u=s("code",null,"extend()",-1),m=s("a",{class:"header-anchor",href:"#the-extend-method","aria-label":'Permalink to "The `extend()` method "'},"​",-1),v=t("",25);function C(A,D,b,f,B,T){const a=l("Badge");return h(),p("div",null,[d,s("nav",r,[s("ul",null,[E,g,s("li",null,[s("a",y,[i("The extend() method "),n(a,{text:"deprecated",type:"warning"})]),o])])]),c,s("h2",F,[i("The "),u,i(" method "),n(a,{text:"deprecated",type:"warning"}),i(),m]),v])}const _=e(k,[["render",C]]);export{V as __pageData,_ as default};
diff --git a/assets/advanced_typescript.md.urPZZNvJ.js b/assets/advanced_typescript.md.BzX_-jDO.js
similarity index 99%
rename from assets/advanced_typescript.md.urPZZNvJ.js
rename to assets/advanced_typescript.md.BzX_-jDO.js
index eb9bb924..1596e673 100644
--- a/assets/advanced_typescript.md.urPZZNvJ.js
+++ b/assets/advanced_typescript.md.BzX_-jDO.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"TypeScript Usage","description":"","frontmatter":{"outline":[2,3]},"headers":[],"relativePath":"advanced/typescript.md","filePath":"advanced/typescript.md","lastUpdated":1730770044000}'),t={name:"advanced/typescript.md"},p=n(`

TypeScript Usage

VueTypes is written in TypeScript and comes with full builtin types support.

Most of the validators can infer the prop type from their configuration:

ts
props: {
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"TypeScript Usage","description":"","frontmatter":{"outline":[2,3]},"headers":[],"relativePath":"advanced/typescript.md","filePath":"advanced/typescript.md","lastUpdated":1730770177000}'),t={name:"advanced/typescript.md"},p=n(`

TypeScript Usage

VueTypes is written in TypeScript and comes with full builtin types support.

Most of the validators can infer the prop type from their configuration:

ts
props: {
   // prop type is \`string\`
   name: string(),
   // ERROR: Argument of type 'boolean' is not assignable to parameter of type 'string'
diff --git a/assets/advanced_typescript.md.urPZZNvJ.lean.js b/assets/advanced_typescript.md.BzX_-jDO.lean.js
similarity index 86%
rename from assets/advanced_typescript.md.urPZZNvJ.lean.js
rename to assets/advanced_typescript.md.BzX_-jDO.lean.js
index 577fd22d..25ad74bd 100644
--- a/assets/advanced_typescript.md.urPZZNvJ.lean.js
+++ b/assets/advanced_typescript.md.BzX_-jDO.lean.js
@@ -1 +1 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"TypeScript Usage","description":"","frontmatter":{"outline":[2,3]},"headers":[],"relativePath":"advanced/typescript.md","filePath":"advanced/typescript.md","lastUpdated":1730770044000}'),t={name:"advanced/typescript.md"},p=n("",41),h=[p];function l(e,k,r,d,E,g){return a(),i("div",null,h)}const o=s(t,[["render",l]]);export{c as __pageData,o as default};
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"TypeScript Usage","description":"","frontmatter":{"outline":[2,3]},"headers":[],"relativePath":"advanced/typescript.md","filePath":"advanced/typescript.md","lastUpdated":1730770177000}'),t={name:"advanced/typescript.md"},p=n("",41),h=[p];function l(e,k,r,d,E,g){return a(),i("div",null,h)}const o=s(t,[["render",l]]);export{c as __pageData,o as default};
diff --git a/assets/guide_configuration.md.N3YrreRA.js b/assets/guide_configuration.md.DcnXNliZ.js
similarity index 98%
rename from assets/guide_configuration.md.N3YrreRA.js
rename to assets/guide_configuration.md.DcnXNliZ.js
index 87985a93..d9a76963 100644
--- a/assets/guide_configuration.md.N3YrreRA.js
+++ b/assets/guide_configuration.md.DcnXNliZ.js
@@ -1,4 +1,4 @@
-import{_ as i,c as s,o as a,a2 as e}from"./chunks/framework.Dr3U-I6a.js";const u=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"guide/configuration.md","filePath":"guide/configuration.md","lastUpdated":1730770044000}'),n={name:"guide/configuration.md"},t=e(`

Configuration

Starting from version 4, VueTypes has a global configuration object that can be used to customize the library's behavior.

The configuration is exposed both as a property of the default export, and as a named export:

ts
// default exported instance
+import{_ as i,c as s,o as a,a2 as e}from"./chunks/framework.Dr3U-I6a.js";const u=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"guide/configuration.md","filePath":"guide/configuration.md","lastUpdated":1730770177000}'),n={name:"guide/configuration.md"},t=e(`

Configuration

Starting from version 4, VueTypes has a global configuration object that can be used to customize the library's behavior.

The configuration is exposed both as a property of the default export, and as a named export:

ts
// default exported instance
 import VueTypes from 'vue-types'
 
 // named export
diff --git a/assets/guide_configuration.md.N3YrreRA.lean.js b/assets/guide_configuration.md.DcnXNliZ.lean.js
similarity index 85%
rename from assets/guide_configuration.md.N3YrreRA.lean.js
rename to assets/guide_configuration.md.DcnXNliZ.lean.js
index e4f4d089..41ca33fd 100644
--- a/assets/guide_configuration.md.N3YrreRA.lean.js
+++ b/assets/guide_configuration.md.DcnXNliZ.lean.js
@@ -1 +1 @@
-import{_ as i,c as s,o as a,a2 as e}from"./chunks/framework.Dr3U-I6a.js";const u=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"guide/configuration.md","filePath":"guide/configuration.md","lastUpdated":1730770044000}'),n={name:"guide/configuration.md"},t=e("",8),o=[t];function l(p,r,h,d,c,k){return a(),s("div",null,o)}const f=i(n,[["render",l]]);export{u as __pageData,f as default};
+import{_ as i,c as s,o as a,a2 as e}from"./chunks/framework.Dr3U-I6a.js";const u=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"guide/configuration.md","filePath":"guide/configuration.md","lastUpdated":1730770177000}'),n={name:"guide/configuration.md"},t=e("",8),o=[t];function l(p,r,h,d,c,k){return a(),s("div",null,o)}const f=i(n,[["render",l]]);export{u as __pageData,f as default};
diff --git a/assets/guide_installation.md.BC9ws-3j.js b/assets/guide_installation.md.XdZnPZZT.js
similarity index 99%
rename from assets/guide_installation.md.BC9ws-3j.js
rename to assets/guide_installation.md.XdZnPZZT.js
index a0facb20..0c859125 100644
--- a/assets/guide_installation.md.BC9ws-3j.js
+++ b/assets/guide_installation.md.XdZnPZZT.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Installation","description":"","frontmatter":{},"headers":[],"relativePath":"guide/installation.md","filePath":"guide/installation.md","lastUpdated":1730770044000}'),e={name:"guide/installation.md"},t=n(`

Installation

VERSION NOTE

This guide covers VueTypes 2+.

  • VueTypes 2 is compatible with Vue 1 and 2.
  • VueTypes 4+ is compatible with Vue 2 and Vue 3.

NPM package

bash
npm install vue-types --save

CDN delivered script

Add the following script tags before your code

html
<script src="https://unpkg.com/vue-types@5"></script>
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Installation","description":"","frontmatter":{},"headers":[],"relativePath":"guide/installation.md","filePath":"guide/installation.md","lastUpdated":1730770177000}'),e={name:"guide/installation.md"},t=n(`

Installation

VERSION NOTE

This guide covers VueTypes 2+.

  • VueTypes 2 is compatible with Vue 1 and 2.
  • VueTypes 4+ is compatible with Vue 2 and Vue 3.

NPM package

bash
npm install vue-types --save

CDN delivered script

Add the following script tags before your code

html
<script src="https://unpkg.com/vue-types@5"></script>
 
 <!-- Or -->
 
diff --git a/assets/guide_installation.md.BC9ws-3j.lean.js b/assets/guide_installation.md.XdZnPZZT.lean.js
similarity index 99%
rename from assets/guide_installation.md.BC9ws-3j.lean.js
rename to assets/guide_installation.md.XdZnPZZT.lean.js
index a0facb20..0c859125 100644
--- a/assets/guide_installation.md.BC9ws-3j.lean.js
+++ b/assets/guide_installation.md.XdZnPZZT.lean.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Installation","description":"","frontmatter":{},"headers":[],"relativePath":"guide/installation.md","filePath":"guide/installation.md","lastUpdated":1730770044000}'),e={name:"guide/installation.md"},t=n(`

Installation

VERSION NOTE

This guide covers VueTypes 2+.

  • VueTypes 2 is compatible with Vue 1 and 2.
  • VueTypes 4+ is compatible with Vue 2 and Vue 3.

NPM package

bash
npm install vue-types --save

CDN delivered script

Add the following script tags before your code

html
<script src="https://unpkg.com/vue-types@5"></script>
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Installation","description":"","frontmatter":{},"headers":[],"relativePath":"guide/installation.md","filePath":"guide/installation.md","lastUpdated":1730770177000}'),e={name:"guide/installation.md"},t=n(`

Installation

VERSION NOTE

This guide covers VueTypes 2+.

  • VueTypes 2 is compatible with Vue 1 and 2.
  • VueTypes 4+ is compatible with Vue 2 and Vue 3.

NPM package

bash
npm install vue-types --save

CDN delivered script

Add the following script tags before your code

html
<script src="https://unpkg.com/vue-types@5"></script>
 
 <!-- Or -->
 
diff --git a/assets/guide_namespaced.md.DGdoNyR4.js b/assets/guide_namespaced.md.Ba43SGvO.js
similarity index 99%
rename from assets/guide_namespaced.md.DGdoNyR4.js
rename to assets/guide_namespaced.md.Ba43SGvO.js
index 9f1e28bd..69228be6 100644
--- a/assets/guide_namespaced.md.DGdoNyR4.js
+++ b/assets/guide_namespaced.md.Ba43SGvO.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Namespaced Usage","description":"","frontmatter":{},"headers":[],"relativePath":"guide/namespaced.md","filePath":"guide/namespaced.md","lastUpdated":1730770044000}'),n={name:"guide/namespaced.md"},e=t(`

Namespaced Usage

The default export of vue-types exposes an ES6 class object that mimics React prop-type.

The class object exposes both native and custom validators.

Native Validators

Native validators are exposed as static getter factories:

js
import VueTypes from 'vue-types'
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Namespaced Usage","description":"","frontmatter":{},"headers":[],"relativePath":"guide/namespaced.md","filePath":"guide/namespaced.md","lastUpdated":1730770177000}'),n={name:"guide/namespaced.md"},e=t(`

Namespaced Usage

The default export of vue-types exposes an ES6 class object that mimics React prop-type.

The class object exposes both native and custom validators.

Native Validators

Native validators are exposed as static getter factories:

js
import VueTypes from 'vue-types'
 
 export default {
   props: {
diff --git a/assets/guide_namespaced.md.DGdoNyR4.lean.js b/assets/guide_namespaced.md.Ba43SGvO.lean.js
similarity index 85%
rename from assets/guide_namespaced.md.DGdoNyR4.lean.js
rename to assets/guide_namespaced.md.Ba43SGvO.lean.js
index adbdfd06..a4c4ae87 100644
--- a/assets/guide_namespaced.md.DGdoNyR4.lean.js
+++ b/assets/guide_namespaced.md.Ba43SGvO.lean.js
@@ -1 +1 @@
-import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Namespaced Usage","description":"","frontmatter":{},"headers":[],"relativePath":"guide/namespaced.md","filePath":"guide/namespaced.md","lastUpdated":1730770044000}'),n={name:"guide/namespaced.md"},e=t("",31),l=[e];function p(h,k,d,r,o,E){return a(),i("div",null,l)}const c=s(n,[["render",p]]);export{y as __pageData,c as default};
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.Dr3U-I6a.js";const y=JSON.parse('{"title":"Namespaced Usage","description":"","frontmatter":{},"headers":[],"relativePath":"guide/namespaced.md","filePath":"guide/namespaced.md","lastUpdated":1730770177000}'),n={name:"guide/namespaced.md"},e=t("",31),l=[e];function p(h,k,d,r,o,E){return a(),i("div",null,l)}const c=s(n,[["render",p]]);export{y as __pageData,c as default};
diff --git a/assets/guide_troubleshooting.md.CgzWrMwQ.js b/assets/guide_troubleshooting.md.BrSEdPYb.js
similarity index 97%
rename from assets/guide_troubleshooting.md.CgzWrMwQ.js
rename to assets/guide_troubleshooting.md.BrSEdPYb.js
index 18d8ba14..be97e2f5 100644
--- a/assets/guide_troubleshooting.md.CgzWrMwQ.js
+++ b/assets/guide_troubleshooting.md.BrSEdPYb.js
@@ -1 +1 @@
-import{_ as e,c as r,o as t,a2 as o}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Troubleshooting","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"guide/troubleshooting.md","filePath":"guide/troubleshooting.md","lastUpdated":1730770044000}'),a={name:"guide/troubleshooting.md"},i=o('

Troubleshooting

ESLint reports a vue/require-default-prop error for certain vue-types validators.

If your uses eslint-plugin-vue v6 or lower, you might receive a linting error related to the vue/require-default-prop rule for validators using the .isRequired or .loose flag (see vue-types#179).

The best solution to fix this issue is to upgrade the library eslint-plugin-vue to v7.

However, if you cannot upgrade the library, you can install eslint-plugin-vue-types. The plugin extends eslint-plugin-vue and filters out most incorrectly flagged usage cases.

Read the plugin documentation for installation and usage details.

',7),s=[i];function l(u,n,p,d,c,h){return t(),r("div",null,s)}const v=e(a,[["render",l]]);export{g as __pageData,v as default}; +import{_ as e,c as r,o as t,a2 as o}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Troubleshooting","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"guide/troubleshooting.md","filePath":"guide/troubleshooting.md","lastUpdated":1730770177000}'),a={name:"guide/troubleshooting.md"},i=o('

Troubleshooting

ESLint reports a vue/require-default-prop error for certain vue-types validators.

If your uses eslint-plugin-vue v6 or lower, you might receive a linting error related to the vue/require-default-prop rule for validators using the .isRequired or .loose flag (see vue-types#179).

The best solution to fix this issue is to upgrade the library eslint-plugin-vue to v7.

However, if you cannot upgrade the library, you can install eslint-plugin-vue-types. The plugin extends eslint-plugin-vue and filters out most incorrectly flagged usage cases.

Read the plugin documentation for installation and usage details.

',7),s=[i];function l(u,n,p,d,c,h){return t(),r("div",null,s)}const v=e(a,[["render",l]]);export{g as __pageData,v as default}; diff --git a/assets/guide_troubleshooting.md.CgzWrMwQ.lean.js b/assets/guide_troubleshooting.md.BrSEdPYb.lean.js similarity index 86% rename from assets/guide_troubleshooting.md.CgzWrMwQ.lean.js rename to assets/guide_troubleshooting.md.BrSEdPYb.lean.js index 819436e7..dee5d94b 100644 --- a/assets/guide_troubleshooting.md.CgzWrMwQ.lean.js +++ b/assets/guide_troubleshooting.md.BrSEdPYb.lean.js @@ -1 +1 @@ -import{_ as e,c as r,o as t,a2 as o}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Troubleshooting","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"guide/troubleshooting.md","filePath":"guide/troubleshooting.md","lastUpdated":1730770044000}'),a={name:"guide/troubleshooting.md"},i=o("",7),s=[i];function l(u,n,p,d,c,h){return t(),r("div",null,s)}const v=e(a,[["render",l]]);export{g as __pageData,v as default}; +import{_ as e,c as r,o as t,a2 as o}from"./chunks/framework.Dr3U-I6a.js";const g=JSON.parse('{"title":"Troubleshooting","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"guide/troubleshooting.md","filePath":"guide/troubleshooting.md","lastUpdated":1730770177000}'),a={name:"guide/troubleshooting.md"},i=o("",7),s=[i];function l(u,n,p,d,c,h){return t(),r("div",null,s)}const v=e(a,[["render",l]]);export{g as __pageData,v as default}; diff --git a/assets/guide_validators.md.IRVAvhrk.js b/assets/guide_validators.md.C537pVpa.js similarity index 99% rename from assets/guide_validators.md.IRVAvhrk.js rename to assets/guide_validators.md.C537pVpa.js index 65f7a5ed..6a6c73ae 100644 --- a/assets/guide_validators.md.IRVAvhrk.js +++ b/assets/guide_validators.md.C537pVpa.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Validators","description":"","frontmatter":{"title":"Validators"},"headers":[],"relativePath":"guide/validators.md","filePath":"guide/validators.md","lastUpdated":1730770044000}'),t={name:"guide/validators.md"},e=n(`

Using VueTypes Validators

VueTypes is a collection of prop validators. Each validator is basically a factory function returning an object (validator object) compatible with Vue prop validation.

Differently from simple Vue prop validation objects, VueTypes prop validator objects provide some additional chainable properties and methods to control things like required and default values.

Validators can be imported as named functions from vue-types:

js
import Vue from 'vue'
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Validators","description":"","frontmatter":{"title":"Validators"},"headers":[],"relativePath":"guide/validators.md","filePath":"guide/validators.md","lastUpdated":1730770177000}'),t={name:"guide/validators.md"},e=n(`

Using VueTypes Validators

VueTypes is a collection of prop validators. Each validator is basically a factory function returning an object (validator object) compatible with Vue prop validation.

Differently from simple Vue prop validation objects, VueTypes prop validator objects provide some additional chainable properties and methods to control things like required and default values.

Validators can be imported as named functions from vue-types:

js
import Vue from 'vue'
 import { number, oneOf } from 'vue-types'
 
 export default {
diff --git a/assets/guide_validators.md.IRVAvhrk.lean.js b/assets/guide_validators.md.C537pVpa.lean.js
similarity index 85%
rename from assets/guide_validators.md.IRVAvhrk.lean.js
rename to assets/guide_validators.md.C537pVpa.lean.js
index b6410106..9af4ace4 100644
--- a/assets/guide_validators.md.IRVAvhrk.lean.js
+++ b/assets/guide_validators.md.C537pVpa.lean.js
@@ -1 +1 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Validators","description":"","frontmatter":{"title":"Validators"},"headers":[],"relativePath":"guide/validators.md","filePath":"guide/validators.md","lastUpdated":1730770044000}'),t={name:"guide/validators.md"},e=n("",110),p=[e];function l(h,k,r,d,o,E){return a(),i("div",null,p)}const y=s(t,[["render",l]]);export{c as __pageData,y as default};
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Validators","description":"","frontmatter":{"title":"Validators"},"headers":[],"relativePath":"guide/validators.md","filePath":"guide/validators.md","lastUpdated":1730770177000}'),t={name:"guide/validators.md"},e=n("",110),p=[e];function l(h,k,r,d,o,E){return a(),i("div",null,p)}const y=s(t,[["render",l]]);export{c as __pageData,y as default};
diff --git a/assets/index.md.XWyHxouW.js b/assets/index.md.Cp0oo36t.js
similarity index 98%
rename from assets/index.md.XWyHxouW.js
rename to assets/index.md.Cp0oo36t.js
index 94a8d597..14a7c0a7 100644
--- a/assets/index.md.XWyHxouW.js
+++ b/assets/index.md.Cp0oo36t.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Introduction","description":"","frontmatter":{"title":"Introduction"},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1730770044000}'),e={name:"index.md"},p=n(`

VueTypes

VueTypes is a collection of configurable prop validators for Vue.js, inspired by React prop-types.

Try it now!

VERSION NOTE

This is the documentation for VueTypes 2 and above. If you are using an older version, refer to the documentation here.

Starting from v4, vue-types is compatible with both vue@2 and vue@3.

When to use

While basic prop validation in Vue.js is straight-forward and convenient, fine-grained validation can become verbose on complex components.

VueTypes offers a compact and fluent interface to define your project's props.

Usage example

Imagine a typical Vue.js component with a set of props:

js
export default {
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Introduction","description":"","frontmatter":{"title":"Introduction"},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1730770177000}'),e={name:"index.md"},p=n(`

VueTypes

VueTypes is a collection of configurable prop validators for Vue.js, inspired by React prop-types.

Try it now!

VERSION NOTE

This is the documentation for VueTypes 2 and above. If you are using an older version, refer to the documentation here.

Starting from v4, vue-types is compatible with both vue@2 and vue@3.

When to use

While basic prop validation in Vue.js is straight-forward and convenient, fine-grained validation can become verbose on complex components.

VueTypes offers a compact and fluent interface to define your project's props.

Usage example

Imagine a typical Vue.js component with a set of props:

js
export default {
   props: {
     id: {
       type: Number,
diff --git a/assets/index.md.XWyHxouW.lean.js b/assets/index.md.Cp0oo36t.lean.js
similarity index 69%
rename from assets/index.md.XWyHxouW.lean.js
rename to assets/index.md.Cp0oo36t.lean.js
index f729be00..1d958823 100644
--- a/assets/index.md.XWyHxouW.lean.js
+++ b/assets/index.md.Cp0oo36t.lean.js
@@ -1 +1 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Introduction","description":"","frontmatter":{"title":"Introduction"},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1730770044000}'),e={name:"index.md"},p=n("",16),t=[p];function l(h,k,r,E,d,o){return a(),i("div",null,t)}const y=s(e,[["render",l]]);export{c as __pageData,y as default};
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.Dr3U-I6a.js";const c=JSON.parse('{"title":"Introduction","description":"","frontmatter":{"title":"Introduction"},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1730770177000}'),e={name:"index.md"},p=n("",16),t=[p];function l(h,k,r,E,d,o){return a(),i("div",null,t)}const y=s(e,[["render",l]]);export{c as __pageData,y as default};
diff --git a/guide/configuration.html b/guide/configuration.html
index 661d8224..903a96a9 100644
--- a/guide/configuration.html
+++ b/guide/configuration.html
@@ -12,7 +12,7 @@
     
     
     
-    
+    
     
     
   
@@ -26,8 +26,8 @@
 VueTypes.config === config

Configuration Options

  • silent: (boolean, default false) set to true to prevent VueTypes from logging validation warnings.

TIP

Until version 2, VueTypes warning behavior was matching the Vue.config.silent global config parameter. But that global property has been removed in Vue@3.

To reproduce that behavior in application running Vue@2 you can use:

ts
import { config } from 'vue-types'
 import Vue from 'vue'
 
-config.silent = Vue.config.silent
  • logLevel: (string, default warn) allows choosing which console method will be used to display validation errors. Available options are log, warn, error, debug andinfo.
- +config.silent = Vue.config.silent
  • logLevel: (string, default warn) allows choosing which console method will be used to display validation errors. Available options are log, warn, error, debug andinfo.
+ \ No newline at end of file diff --git a/guide/installation.html b/guide/installation.html index 8774b57d..a8a5adae 100644 --- a/guide/installation.html +++ b/guide/installation.html @@ -12,7 +12,7 @@ - + @@ -86,8 +86,8 @@ vueTypes: { shim: true, }, -} - +} + \ No newline at end of file diff --git a/guide/namespaced.html b/guide/namespaced.html index e33f5ccd..d3f58e10 100644 --- a/guide/namespaced.html +++ b/guide/namespaced.html @@ -12,7 +12,7 @@ - + @@ -98,8 +98,8 @@ // this password prop must include at least a digit password: passwordType.validate((v) => /[0-9]/test.(v)), }, -} - +} + \ No newline at end of file diff --git a/guide/troubleshooting.html b/guide/troubleshooting.html index b3fd67cf..4ccd05d6 100644 --- a/guide/troubleshooting.html +++ b/guide/troubleshooting.html @@ -12,13 +12,13 @@ - + -
Skip to content

Troubleshooting

ESLint reports a vue/require-default-prop error for certain vue-types validators.

If your uses eslint-plugin-vue v6 or lower, you might receive a linting error related to the vue/require-default-prop rule for validators using the .isRequired or .loose flag (see vue-types#179).

The best solution to fix this issue is to upgrade the library eslint-plugin-vue to v7.

However, if you cannot upgrade the library, you can install eslint-plugin-vue-types. The plugin extends eslint-plugin-vue and filters out most incorrectly flagged usage cases.

Read the plugin documentation for installation and usage details.

- +
Skip to content

Troubleshooting

ESLint reports a vue/require-default-prop error for certain vue-types validators.

If your uses eslint-plugin-vue v6 or lower, you might receive a linting error related to the vue/require-default-prop rule for validators using the .isRequired or .loose flag (see vue-types#179).

The best solution to fix this issue is to upgrade the library eslint-plugin-vue to v7.

However, if you cannot upgrade the library, you can install eslint-plugin-vue-types. The plugin extends eslint-plugin-vue and filters out most incorrectly flagged usage cases.

Read the plugin documentation for installation and usage details.

+ \ No newline at end of file diff --git a/guide/validators.html b/guide/validators.html index d262208d..1b7c6f09 100644 --- a/guide/validators.html +++ b/guide/validators.html @@ -12,7 +12,7 @@ - + @@ -267,8 +267,8 @@ validateType(Number, 10) // true // returns an error message on failure -validateType(String, 10, false) // 'value "10" should be of type "string"`

toType / toValidableType

Convert an object compatible with Vue.js prop validation to a VueTypes validator object.

See Standalone custom validators for more details.

fromType

Creates a new validator object from a previously defined one.

See Inheriting from existing validators for more details.

createTypes

Returns a namespaced collection of validators.

See Custom namespaced instance for more details.

- +validateType(String, 10, false) // 'value "10" should be of type "string"`

toType / toValidableType

Convert an object compatible with Vue.js prop validation to a VueTypes validator object.

See Standalone custom validators for more details.

fromType

Creates a new validator object from a previously defined one.

See Inheriting from existing validators for more details.

createTypes

Returns a namespaced collection of validators.

See Custom namespaced instance for more details.

+ \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index 4f0d9ec6..35194a01 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"advanced_custom-instance.md":"Cp6qMF4p","advanced_extending-vue-types.md":"764-h470","advanced_typescript.md":"urPZZNvJ","guide_configuration.md":"N3YrreRA","guide_installation.md":"BC9ws-3j","guide_namespaced.md":"DGdoNyR4","guide_troubleshooting.md":"CgzWrMwQ","guide_validators.md":"IRVAvhrk","index.md":"XWyHxouW"} +{"advanced_custom-instance.md":"Cv0G-HOW","advanced_extending-vue-types.md":"Xp6frQVM","advanced_typescript.md":"BzX_-jDO","guide_configuration.md":"DcnXNliZ","guide_installation.md":"XdZnPZZT","guide_namespaced.md":"Ba43SGvO","guide_troubleshooting.md":"BrSEdPYb","guide_validators.md":"C537pVpa","index.md":"Cp0oo36t"} diff --git a/index.html b/index.html index 5d072002..9b6b2d0f 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ - + @@ -63,8 +63,8 @@ methods: { // ... }, -} - +} + \ No newline at end of file