diff --git a/docs/components/Demo.vue b/docs/components/Demo.vue new file mode 100644 index 0000000..10a4fad --- /dev/null +++ b/docs/components/Demo.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file diff --git a/docs/content/en/demo.md b/docs/content/en/demo.md new file mode 100644 index 0000000..8114ef4 --- /dev/null +++ b/docs/content/en/demo.md @@ -0,0 +1,76 @@ +--- +title: Demo +position: 11 +--- + +## Form Validation + + + + +## Code of the form + +```vue[~/components/Demo.vue] + + + +``` + + +## Validation template + +```javascript[~/validations/auth.js] +import { Template, required, minLength, maxLength } from 'vuito'; + +export const signIn = new Template({ + username: [ + { test: required, message: 'Please enter a username.' }, + { test: minLength(3), message: 'Username is too short.' }, + { test: maxLength(20), message: 'Username is too big.' }, + ], + password: [ + { test: required, message: 'Please enter a password.' }, + { test: minLength(12), message: 'Password is too short.' }, + ], +}); +``` \ No newline at end of file diff --git a/docs/content/en/index.md b/docs/content/en/index.md index 60cd86b..1fe9035 100644 --- a/docs/content/en/index.md +++ b/docs/content/en/index.md @@ -14,7 +14,9 @@ features: Simple, lightweight, isomorphic, template-based validation library. -If you want to play with the library, you can do so [right here](https://runkit.com/mathix420/vuito-example). +If you want to see a demo of this library, go to [the demo section](/demo). + +And if you want to play with the library, you can do so [right here](https://runkit.com/mathix420/vuito-example). ## Installation diff --git a/docs/package-lock.json b/docs/package-lock.json index 40f110b..5049a65 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -9,7 +9,9 @@ "version": "1.0.0", "dependencies": { "@nuxt/content-theme-docs": "^0.10.1", - "nuxt": "^2.15.8" + "@vuito/vue": "^1.2.0", + "nuxt": "^2.15.8", + "vuito": "^1.2.1" } }, "node_modules/@algolia/cache-browser-local-storage": { @@ -3391,6 +3393,15 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" }, + "node_modules/@vuito/vue": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vuito/vue/-/vue-1.2.0.tgz", + "integrity": "sha512-3aFOzQ7TF+SYJeqkd2cozEGjaOVaKMCef/9856hyMpHuDiZB5deIDg1VLSwAi91zV+x+GOO3dhIZEutxvsgacg==", + "peerDependencies": { + "vue": "^2.0.0", + "vuito": "*" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", @@ -15533,6 +15544,11 @@ "vue": "^2.0.0" } }, + "node_modules/vuito": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/vuito/-/vuito-1.2.1.tgz", + "integrity": "sha512-G3fZeXDFZ11liLQZaW1MbjY7Q6nu86+vO1WG++6mveuBF2uHVpJcwyEDRAjeMJw/l8+RqGYZjl34Q+OEBXqJkA==" + }, "node_modules/watchpack": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", @@ -19491,6 +19507,12 @@ } } }, + "@vuito/vue": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vuito/vue/-/vue-1.2.0.tgz", + "integrity": "sha512-3aFOzQ7TF+SYJeqkd2cozEGjaOVaKMCef/9856hyMpHuDiZB5deIDg1VLSwAi91zV+x+GOO3dhIZEutxvsgacg==", + "requires": {} + }, "@webassemblyjs/ast": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", @@ -28996,6 +29018,11 @@ "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", "requires": {} }, + "vuito": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/vuito/-/vuito-1.2.1.tgz", + "integrity": "sha512-G3fZeXDFZ11liLQZaW1MbjY7Q6nu86+vO1WG++6mveuBF2uHVpJcwyEDRAjeMJw/l8+RqGYZjl34Q+OEBXqJkA==" + }, "watchpack": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", diff --git a/docs/package.json b/docs/package.json index 7b23498..37daf0b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -10,6 +10,8 @@ }, "dependencies": { "@nuxt/content-theme-docs": "^0.10.1", - "nuxt": "^2.15.8" + "@vuito/vue": "^1.2.0", + "nuxt": "^2.15.8", + "vuito": "^1.2.1" } } diff --git a/docs/validations/auth.js b/docs/validations/auth.js new file mode 100644 index 0000000..3b4ec5e --- /dev/null +++ b/docs/validations/auth.js @@ -0,0 +1,13 @@ +import { Template, required, minLength, maxLength } from 'vuito'; + +export const signIn = new Template({ + username: [ + { test: required, message: 'Please enter a username.' }, + { test: minLength(3), message: 'Username is too short.' }, + { test: maxLength(20), message: 'Username is too big.' }, + ], + password: [ + { test: required, message: 'Please enter a password.' }, + { test: minLength(12), message: 'Password is too short.' }, + ], +}); \ No newline at end of file