@steveesamson/microform 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,12 +26,12 @@ Once you've added `microform` to your project, use it as shown below, in your vi
26
26
 
27
27
  ```ts
28
28
  <script>
29
- import uForm from "@steveesamson/microform";
29
+ import { uform } from "@steveesamson/microform";
30
30
  // default form data, probably passed as props
31
31
  let defaultData:any = $props();
32
32
 
33
33
  // Instatiate microform
34
- const { form, values, errors, submit, sanity } = uForm({
34
+ const { form, values, errors, submit, sanity } = uform({
35
35
  // Set default form data
36
36
  data:{...defaultData},
37
37
  // Set a global event for validation, can be overriden on a each field.
@@ -400,12 +400,12 @@ Validators could be overriden to provide custom validation and/or messages besid
400
400
  ### Approach 1
401
401
  ```ts
402
402
  <script>
403
- import uForm, { type FieldProps } from "@steveesamson/microform";
403
+ import { type FieldProps, uform } from "@steveesamson/microform";
404
404
  // default form data, probably passed as props
405
405
  export let defaultData:any = {};
406
406
 
407
407
  // Instatiate microform
408
- const { form, values, errors, submit, sanity } = uForm({
408
+ const { form, values, errors, submit, sanity } = uform({
409
409
  // Set default form data
410
410
  data:{...defaultData},
411
411
  // Set a global event for validation, can be overriden on a each field.
@@ -449,12 +449,12 @@ Therefore, the following is equivalent to the configuration in `Approach 1`:
449
449
  ### Approach 2
450
450
  ```ts
451
451
  <script>
452
- import uForm, { type FieldProps, IS_LEN } from "@steveesamson/microform";
452
+ import { type FieldProps, IS_LEN, uform } from "@steveesamson/microform";
453
453
  // default form data, probably passed as props
454
454
  export let defaultData:any = {};
455
455
 
456
456
  // Instatiate microform
457
- const { form, values, errors, submit, sanity } = uForm({
457
+ const { form, values, errors, submit, sanity } = uform({
458
458
  // Set default form data
459
459
  data:{...defaultData},
460
460
  // Set a global event for validation, can be overriden on a each field.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { microForm } from "./index.svelte.js";
1
+ export * from "./types.js";
2
2
  export { IS_EMAIL, IS_ALPHA, IS_ALPHANUM, IS_INTEGER, IS_IP, IS_LEN, IT_MATCHES as IS_MATCH_FOR, IS_MAX, IS_FILE_SIZE_MB as IS_MAX_FILE_SIZE, IS_MAX_LEN, IS_MIN, IS_MIN_LEN, IS_NUMBER, IS_REQUIRED, IS_URL } from "./form-validators.js";
3
- export default microForm;
3
+ export { uform } from "./index.svelte.js";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { microForm } from "./index.svelte.js";
1
+ export * from "./types.js";
2
2
  export { IS_EMAIL, IS_ALPHA, IS_ALPHANUM, IS_INTEGER, IS_IP, IS_LEN, IT_MATCHES as IS_MATCH_FOR, IS_MAX, IS_FILE_SIZE_MB as IS_MAX_FILE_SIZE, IS_MAX_LEN, IS_MIN, IS_MIN_LEN, IS_NUMBER, IS_REQUIRED, IS_URL } from "./form-validators.js";
3
- export default microForm;
3
+ export { uform } from "./index.svelte.js";
@@ -1,7 +1,7 @@
1
1
  import { writable, derived, get } from 'svelte/store';
2
2
  import { formAction } from './form-action.js';
3
3
  import { bindStateToStore } from "./utils.js";
4
- export const microForm = (props) => {
4
+ export const uform = (props) => {
5
5
  // form default values
6
6
  const data = props?.data || {};
7
7
  // form values
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steveesamson/microform",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "postbuild": "touch ./docs/.nojekyll",