diff --git a/404.html b/404.html index bb972285..eda3993a 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 cefc7003..c8cc18f8 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 75bd14fd..9f41a5ed 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 1e54cf06..51d85193 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.Cv0G-HOW.js b/assets/advanced_custom-instance.md.BhHWRemn.js similarity index 99% rename from assets/advanced_custom-instance.md.Cv0G-HOW.js rename to assets/advanced_custom-instance.md.BhHWRemn.js index 86b5e4e6..837ca71c 100644 --- a/assets/advanced_custom-instance.md.Cv0G-HOW.js +++ b/assets/advanced_custom-instance.md.BhHWRemn.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":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{_ 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":1732060631000}'),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.Cv0G-HOW.lean.js b/assets/advanced_custom-instance.md.BhHWRemn.lean.js
similarity index 86%
rename from assets/advanced_custom-instance.md.Cv0G-HOW.lean.js
rename to assets/advanced_custom-instance.md.BhHWRemn.lean.js
index bb1f00bc..9b21cfcf 100644
--- a/assets/advanced_custom-instance.md.Cv0G-HOW.lean.js
+++ b/assets/advanced_custom-instance.md.BhHWRemn.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":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};
+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":1732060631000}'),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.Xp6frQVM.js b/assets/advanced_extending-vue-types.md.ncFXH5sk.js
similarity index 99%
rename from assets/advanced_extending-vue-types.md.Xp6frQVM.js
rename to assets/advanced_extending-vue-types.md.ncFXH5sk.js
index a7cc9385..8ca1c04b 100644
--- a/assets/advanced_extending-vue-types.md.Xp6frQVM.js
+++ b/assets/advanced_extending-vue-types.md.ncFXH5sk.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":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 = () =>
+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":1732060631000}'),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.Xp6frQVM.lean.js b/assets/advanced_extending-vue-types.md.ncFXH5sk.lean.js
similarity index 96%
rename from assets/advanced_extending-vue-types.md.Xp6frQVM.lean.js
rename to assets/advanced_extending-vue-types.md.ncFXH5sk.lean.js
index 16a8e0c3..fdc70057 100644
--- a/assets/advanced_extending-vue-types.md.Xp6frQVM.lean.js
+++ b/assets/advanced_extending-vue-types.md.ncFXH5sk.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":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};
+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":1732060631000}'),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.BzX_-jDO.js b/assets/advanced_typescript.md._64S16zB.js
similarity index 99%
rename from assets/advanced_typescript.md.BzX_-jDO.js
rename to assets/advanced_typescript.md._64S16zB.js
index 1596e673..93f6127a 100644
--- a/assets/advanced_typescript.md.BzX_-jDO.js
+++ b/assets/advanced_typescript.md._64S16zB.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":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: {
+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":1732060631000}'),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.BzX_-jDO.lean.js b/assets/advanced_typescript.md._64S16zB.lean.js
similarity index 86%
rename from assets/advanced_typescript.md.BzX_-jDO.lean.js
rename to assets/advanced_typescript.md._64S16zB.lean.js
index 25ad74bd..a65f4033 100644
--- a/assets/advanced_typescript.md.BzX_-jDO.lean.js
+++ b/assets/advanced_typescript.md._64S16zB.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":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};
+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":1732060631000}'),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.DcnXNliZ.js b/assets/guide_configuration.md.DbZ-evHD.js
similarity index 98%
rename from assets/guide_configuration.md.DcnXNliZ.js
rename to assets/guide_configuration.md.DbZ-evHD.js
index d9a76963..d3ac1264 100644
--- a/assets/guide_configuration.md.DcnXNliZ.js
+++ b/assets/guide_configuration.md.DbZ-evHD.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":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{_ 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":1732060631000}'),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.DcnXNliZ.lean.js b/assets/guide_configuration.md.DbZ-evHD.lean.js
similarity index 85%
rename from assets/guide_configuration.md.DcnXNliZ.lean.js
rename to assets/guide_configuration.md.DbZ-evHD.lean.js
index 41ca33fd..24f8ccde 100644
--- a/assets/guide_configuration.md.DcnXNliZ.lean.js
+++ b/assets/guide_configuration.md.DbZ-evHD.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":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};
+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":1732060631000}'),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.XdZnPZZT.js b/assets/guide_installation.md.BXQzoruK.js
similarity index 99%
rename from assets/guide_installation.md.XdZnPZZT.js
rename to assets/guide_installation.md.BXQzoruK.js
index 0c859125..82c17f38 100644
--- a/assets/guide_installation.md.XdZnPZZT.js
+++ b/assets/guide_installation.md.BXQzoruK.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":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>
+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":1732060631000}'),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.XdZnPZZT.lean.js b/assets/guide_installation.md.BXQzoruK.lean.js
similarity index 99%
rename from assets/guide_installation.md.XdZnPZZT.lean.js
rename to assets/guide_installation.md.BXQzoruK.lean.js
index 0c859125..82c17f38 100644
--- a/assets/guide_installation.md.XdZnPZZT.lean.js
+++ b/assets/guide_installation.md.BXQzoruK.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":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>
+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":1732060631000}'),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.Ba43SGvO.js b/assets/guide_namespaced.md.njgj3jYg.js
similarity index 99%
rename from assets/guide_namespaced.md.Ba43SGvO.js
rename to assets/guide_namespaced.md.njgj3jYg.js
index 69228be6..6cb98104 100644
--- a/assets/guide_namespaced.md.Ba43SGvO.js
+++ b/assets/guide_namespaced.md.njgj3jYg.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":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'
+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":1732060631000}'),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.Ba43SGvO.lean.js b/assets/guide_namespaced.md.njgj3jYg.lean.js
similarity index 70%
rename from assets/guide_namespaced.md.Ba43SGvO.lean.js
rename to assets/guide_namespaced.md.njgj3jYg.lean.js
index a4c4ae87..dcffce3f 100644
--- a/assets/guide_namespaced.md.Ba43SGvO.lean.js
+++ b/assets/guide_namespaced.md.njgj3jYg.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":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};
+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":1732060631000}'),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.BrSEdPYb.js b/assets/guide_troubleshooting.md.4-ek-5jc.js
similarity index 97%
rename from assets/guide_troubleshooting.md.BrSEdPYb.js
rename to assets/guide_troubleshooting.md.4-ek-5jc.js
index be97e2f5..f4f4be2c 100644
--- a/assets/guide_troubleshooting.md.BrSEdPYb.js
+++ b/assets/guide_troubleshooting.md.4-ek-5jc.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":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}; +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":1732060631000}'),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.BrSEdPYb.lean.js b/assets/guide_troubleshooting.md.4-ek-5jc.lean.js similarity index 86% rename from assets/guide_troubleshooting.md.BrSEdPYb.lean.js rename to assets/guide_troubleshooting.md.4-ek-5jc.lean.js index dee5d94b..e28b8917 100644 --- a/assets/guide_troubleshooting.md.BrSEdPYb.lean.js +++ b/assets/guide_troubleshooting.md.4-ek-5jc.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":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}; +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":1732060631000}'),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.C537pVpa.js b/assets/guide_validators.md.FJHl80Ph.js similarity index 99% rename from assets/guide_validators.md.C537pVpa.js rename to assets/guide_validators.md.FJHl80Ph.js index 6a6c73ae..ad569161 100644 --- a/assets/guide_validators.md.C537pVpa.js +++ b/assets/guide_validators.md.FJHl80Ph.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":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{_ 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":1732060631000}'),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.C537pVpa.lean.js b/assets/guide_validators.md.FJHl80Ph.lean.js
similarity index 85%
rename from assets/guide_validators.md.C537pVpa.lean.js
rename to assets/guide_validators.md.FJHl80Ph.lean.js
index 9af4ace4..7f744d8e 100644
--- a/assets/guide_validators.md.C537pVpa.lean.js
+++ b/assets/guide_validators.md.FJHl80Ph.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":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};
+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":1732060631000}'),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.Cp0oo36t.js b/assets/index.md.CqAONvgu.js
similarity index 98%
rename from assets/index.md.Cp0oo36t.js
rename to assets/index.md.CqAONvgu.js
index 14a7c0a7..bc9c1d2d 100644
--- a/assets/index.md.Cp0oo36t.js
+++ b/assets/index.md.CqAONvgu.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":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 {
+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":1732060631000}'),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.Cp0oo36t.lean.js b/assets/index.md.CqAONvgu.lean.js
similarity index 69%
rename from assets/index.md.Cp0oo36t.lean.js
rename to assets/index.md.CqAONvgu.lean.js
index 1d958823..b6228682 100644
--- a/assets/index.md.Cp0oo36t.lean.js
+++ b/assets/index.md.CqAONvgu.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":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};
+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":1732060631000}'),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 903a96a9..359c41c2 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 a8a5adae..a09cbd2f 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 d3f58e10..2bcadc7e 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 4ccd05d6..e40d256e 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 1b7c6f09..981dac0e 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 35194a01..a382ef0a 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"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"} +{"advanced_custom-instance.md":"BhHWRemn","advanced_extending-vue-types.md":"ncFXH5sk","advanced_typescript.md":"_64S16zB","guide_configuration.md":"DbZ-evHD","guide_installation.md":"BXQzoruK","guide_namespaced.md":"njgj3jYg","guide_troubleshooting.md":"4-ek-5jc","guide_validators.md":"FJHl80Ph","index.md":"CqAONvgu"} diff --git a/index.html b/index.html index 9b6b2d0f..d3b746d4 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ - + @@ -63,8 +63,8 @@ methods: { // ... }, -} - +} + \ No newline at end of file