@lehnihon/bit-form 2.1.0 → 2.1.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.
Files changed (65) hide show
  1. package/dist/angular/index.cjs +1 -1
  2. package/dist/angular/index.cjs.map +1 -1
  3. package/dist/angular/index.d.cts +72 -46
  4. package/dist/angular/index.d.ts +72 -46
  5. package/dist/angular/index.js +1 -1
  6. package/dist/angular/index.js.map +1 -1
  7. package/dist/bus-vCbulIYH.d.cts +141 -0
  8. package/dist/bus-vCbulIYH.d.ts +141 -0
  9. package/dist/chunk-2QNUW6ZN.cjs +133 -0
  10. package/dist/chunk-2QNUW6ZN.cjs.map +1 -0
  11. package/dist/chunk-F6LJWWEW.js +2 -0
  12. package/dist/chunk-F6LJWWEW.js.map +1 -0
  13. package/dist/chunk-LPRLSFPT.cjs +2 -0
  14. package/dist/chunk-LPRLSFPT.cjs.map +1 -0
  15. package/dist/chunk-N6IA7HQL.js +133 -0
  16. package/dist/chunk-N6IA7HQL.js.map +1 -0
  17. package/dist/devtools/bridge.cjs +1 -1
  18. package/dist/devtools/bridge.js +1 -1
  19. package/dist/devtools/index.cjs +1 -1
  20. package/dist/devtools/index.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +5 -24
  23. package/dist/index.d.ts +5 -24
  24. package/dist/index.js +1 -1
  25. package/dist/public-types-ChP5j3xc.d.ts +69 -0
  26. package/dist/public-types-Nv__uZTR.d.cts +69 -0
  27. package/dist/react/index.cjs +1 -1
  28. package/dist/react/index.cjs.map +1 -1
  29. package/dist/react/index.d.cts +7 -47
  30. package/dist/react/index.d.ts +7 -47
  31. package/dist/react/index.js +1 -1
  32. package/dist/react/index.js.map +1 -1
  33. package/dist/react-native/index.cjs +1 -1
  34. package/dist/react-native/index.cjs.map +1 -1
  35. package/dist/react-native/index.d.cts +16 -5
  36. package/dist/react-native/index.d.ts +16 -5
  37. package/dist/react-native/index.js +1 -1
  38. package/dist/react-native/index.js.map +1 -1
  39. package/dist/resolvers/joi.d.cts +1 -1
  40. package/dist/resolvers/joi.d.ts +1 -1
  41. package/dist/resolvers/yup.d.cts +1 -1
  42. package/dist/resolvers/yup.d.ts +1 -1
  43. package/dist/resolvers/zod.d.cts +1 -1
  44. package/dist/resolvers/zod.d.ts +1 -1
  45. package/dist/{use-bit-watch-iCGj-kYp.d.ts → use-bit-watch-BRekIj2W.d.cts} +92 -28
  46. package/dist/{use-bit-watch-BLCTa7d4.d.cts → use-bit-watch-hA0AqCkC.d.ts} +92 -28
  47. package/dist/vue/index.cjs +1 -1
  48. package/dist/vue/index.cjs.map +1 -1
  49. package/dist/vue/index.d.cts +66 -46
  50. package/dist/vue/index.d.ts +66 -46
  51. package/dist/vue/index.js +1 -1
  52. package/dist/vue/index.js.map +1 -1
  53. package/package.json +7 -2
  54. package/dist/bus-uG4EmM-Z.d.cts +0 -295
  55. package/dist/bus-uG4EmM-Z.d.ts +0 -295
  56. package/dist/chunk-ET36BANJ.js +0 -2
  57. package/dist/chunk-ET36BANJ.js.map +0 -1
  58. package/dist/chunk-NDFMZWBP.js +0 -133
  59. package/dist/chunk-NDFMZWBP.js.map +0 -1
  60. package/dist/chunk-PCVPCFPX.cjs +0 -2
  61. package/dist/chunk-PCVPCFPX.cjs.map +0 -1
  62. package/dist/chunk-VFLQH47Q.cjs +0 -133
  63. package/dist/chunk-VFLQH47Q.cjs.map +0 -1
  64. package/dist/index-1fP1eJH8.d.ts +0 -211
  65. package/dist/index-9vxGUNPP.d.cts +0 -211
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bit-form/bit-form/dist/vue/index.cjs","../../src/vue/context.ts","../../src/vue/use-bit-form.ts","../../src/vue/use-bit-field.ts","../../src/vue/use-bit-array.ts"],"names":["BIT_STORE_KEY","provideBitStore","store","provide","useBitStore","inject","useBitForm","state","shallowRef","submitError","ref","lastResponse","unsubscribe","onUnmounted","getValues","getErrors","getTouched","getDirtyValues","isValid","computed","isSubmitting","isDirty","onSuccess","e","handler","values","dirtyValues","result","err","isValidationErrorShape","extractServerErrors","useBitField","path","config","options","maskOption","resolvedMask","rawValue","getDeepValue","displayValue","val","modelValue","rawError","error","touched","invalid","isValidating","isHidden","isRequired","hasError","setValue","setBlur","generateId","useBitArray","getSnapshot","initialValues","ids","newValues","currentIds","diff","newIds"],"mappings":"AAAA,0uBAA8D,0BCAhB,IAIjCA,CAAAA,CAA6C,MAAA,CAAO,WAAW,CAAA,CAErE,SAASC,CAAAA,CAAgBC,CAAAA,CAAsB,CACpDC,0BAAAA,CAAQH,CAAeE,CAAK,CAC9B,CAEO,SAASE,CAAAA,CAAAA,CAAgC,CAC9C,IAAMF,CAAAA,CAAQG,yBAAAA,CAAoB,CAAA,CAClC,EAAA,CAAI,CAACH,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,2DACF,CAAA,CACF,OAAOA,CACT,CCjBA,SAIgBI,CAAAA,CAAAA,CAA+B,CAC7C,IAAMJ,CAAAA,CAAQE,CAAAA,CAAe,CAAA,CACvBG,CAAAA,CAAQC,6BAAAA,CAAWN,CAAM,QAAA,CAAS,CAAC,CAAA,CACnCO,CAAAA,CAAcC,sBAAAA,IAAsB,CAAA,CACpCC,CAAAA,CAAeD,sBAAAA,IAAiB,CAAA,CAEhCE,CAAAA,CAAcV,CAAAA,CAAM,SAAA,CAAU,CAAA,CAAA,EAAM,CACxCK,CAAAA,CAAM,KAAA,CAAQ,CAAE,GAAGL,CAAAA,CAAM,QAAA,CAAS,CAAE,CACtC,CAAC,CAAA,CAEDW,8BAAAA,CAAuB,CAAA,CAEvB,IAAMC,CAAAA,CAAY,CAAA,CAAA,EAAMP,CAAAA,CAAM,KAAA,CAAM,MAAA,CAC9BQ,CAAAA,CAAY,CAAA,CAAA,EAAMR,CAAAA,CAAM,KAAA,CAAM,MAAA,CAC9BS,CAAAA,CAAa,CAAA,CAAA,EAAMT,CAAAA,CAAM,KAAA,CAAM,OAAA,CAC/BU,CAAAA,CAAiB,C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CAAY,CAAA,EAAM,CAChBD,CAAAA,CAAY,CAAA,CACRV,CAAAA,CAAM,gBAAA,EACRA,CAAAA,CAAM,gBAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/bit-form/bit-form/dist/vue/index.cjs","sourcesContent":[null,"import { inject, provide, InjectionKey } from \"vue\";\nimport { BitStore } from \"../core/store\";\n\n// Chave única para evitar colisões\nexport const BIT_STORE_KEY: InjectionKey<BitStore<any>> = Symbol(\"BIT_STORE\");\n\nexport function provideBitStore(store: BitStore<any>) {\n provide(BIT_STORE_KEY, store);\n}\n\nexport function useBitStore<T extends object>() {\n const store = inject(BIT_STORE_KEY);\n if (!store)\n throw new Error(\n \"BitForm Vue hooks devem ser usados sob um provideBitStore\",\n );\n return store as BitStore<T>;\n}\n","import { computed, onUnmounted, shallowRef, ref } from \"vue\";\nimport { useBitStore } from \"./context\";\nimport { isValidationErrorShape, extractServerErrors } from \"../core/utils\";\n\nexport function useBitForm<T extends object>() {\n const store = useBitStore<T>();\n const state = shallowRef(store.getState());\n const submitError = ref<Error | null>(null);\n const lastResponse = ref<unknown>(null);\n\n const unsubscribe = store.subscribe(() => {\n state.value = { ...store.getState() };\n });\n\n onUnmounted(unsubscribe);\n\n const getValues = () => state.value.values;\n const getErrors = () => state.value.errors;\n const getTouched = () => state.value.touched;\n const getDirtyValues = () => store.getDirtyValues();\n\n const isValid = computed(() => state.value.isValid);\n const isSubmitting = computed(() => state.value.isSubmitting);\n const isDirty = computed(() => state.value.isDirty);\n\n const onSubmit = (\n handler: (values: T, dirtyValues?: Partial<T>) => Promise<unknown>,\n ) => {\n return (e?: Event) => {\n e?.preventDefault?.();\n submitError.value = null;\n return store.submit(async (values, dirtyValues) => {\n try {\n const result = await handler(values, dirtyValues);\n lastResponse.value = result;\n submitError.value = null;\n } catch (err) {\n if (isValidationErrorShape(err)) {\n store.setServerErrors(extractServerErrors(err));\n } else {\n submitError.value =\n err instanceof Error ? err : new Error(String(err));\n }\n }\n });\n };\n };\n\n const reset = () => {\n store.reset();\n submitError.value = null;\n lastResponse.value = null;\n };\n\n const meta = {\n isValid,\n isDirty,\n isSubmitting,\n submitError,\n lastResponse,\n };\n\n return {\n // Metadata (grouped)\n meta,\n // Getters\n getValues,\n getErrors,\n getTouched,\n getDirtyValues,\n // Main actions (frequent use - flat)\n submit: (\n onSuccess: (values: T, dirtyValues?: Partial<T>) => void | Promise<void>,\n ) => {\n return (e?: Event) => {\n e?.preventDefault?.();\n return store.submit(onSuccess);\n };\n },\n onSubmit,\n reset,\n setValues: store.setValues.bind(store),\n setError: store.setError.bind(store),\n setErrors: store.setErrors.bind(store),\n setServerErrors: store.setServerErrors.bind(store),\n setField: store.setField.bind(store),\n blurField: store.blurField.bind(store),\n validate: store.validate.bind(store),\n // Array mutations (grouped)\n mutations: {\n pushItem: store.pushItem.bind(store),\n prependItem: store.prependItem.bind(store),\n removeItem: store.removeItem.bind(store),\n insertItem: store.insertItem.bind(store),\n moveItem: store.moveItem.bind(store),\n swapItems: store.swapItems.bind(store),\n },\n };\n}\n","import { computed, onUnmounted, shallowRef } from \"vue\";\nimport { useBitStore } from \"./context\";\nimport { BitFieldOptions, BitFieldDefinition, getDeepValue } from \"../core\";\n\nexport interface UseBitFieldVueMeta {\n error: Readonly<any>;\n touched: Readonly<any>;\n invalid: Readonly<any>;\n isValidating: Readonly<any>;\n isDirty: Readonly<any>;\n isHidden: Readonly<any>;\n isRequired: Readonly<any>;\n hasError: Readonly<any>;\n}\n\nexport interface UseBitFieldVueResult<TValue = any> {\n // Main handlers and values (flat)\n value: Readonly<any>;\n displayValue: Readonly<any>;\n modelValue: any;\n setValue: (val: any) => void;\n setBlur: () => void;\n onInput: (val: any) => void;\n onBlur: () => void;\n // Metadata (grouped)\n meta: UseBitFieldVueMeta;\n}\n\nexport function useBitField<TValue = any>(\n path: string,\n config?: BitFieldDefinition<any>,\n options?: BitFieldOptions,\n): UseBitFieldVueResult<TValue> {\n const store = useBitStore<any>();\n\n if (config) {\n store.registerField(path as string, config as any);\n }\n\n const maskOption =\n options?.mask ?? store.config.fields?.[path as string]?.mask;\n const resolvedMask = maskOption\n ? typeof maskOption === \"string\"\n ? store.config.masks?.[maskOption]\n : maskOption\n : undefined;\n\n const state = shallowRef(store.getState());\n\n const unsubscribe = store.subscribe(() => {\n state.value = store.getState();\n });\n\n onUnmounted(() => {\n unsubscribe();\n if (store.unregisterField) {\n store.unregisterField(path as string);\n }\n });\n\n const rawValue = computed(\n () => getDeepValue(state.value.values, path as string) as TValue,\n );\n\n const displayValue = computed(() => {\n const val = rawValue.value;\n if (val === undefined || val === null || val === \"\") return \"\";\n\n return resolvedMask ? resolvedMask.format(val as any) : String(val);\n });\n\n const modelValue = computed({\n get: () => displayValue.value,\n set: (val: any) => {\n if (!resolvedMask) {\n store.setField(path, val);\n return;\n }\n\n store.setField(path, resolvedMask.parse(String(val ?? \"\")));\n },\n });\n\n const rawError = computed(() => state.value.errors[path]);\n const error = computed(() =>\n state.value.touched[path] ? state.value.errors[path] : undefined,\n );\n const touched = computed(() => !!state.value.touched[path]);\n const invalid = computed(() => !!(touched.value && error.value));\n\n const isValidating = computed(() => {\n state.value;\n return store.isFieldValidating(path);\n });\n\n const isDirty = computed(() => {\n state.value;\n return store.isFieldDirty(path);\n });\n\n const isHidden = computed(() => {\n state.value;\n return store.isHidden(path);\n });\n\n const isRequired = computed(() => {\n state.value;\n return store.isRequired(path);\n });\n\n const hasError = computed(() => !!rawError.value);\n\n const setValue = (val: any) => {\n modelValue.value = val;\n };\n\n const setBlur = () => store.blurField(path);\n\n const onInput = (val: any) => {\n setValue(val);\n };\n\n const onBlur = () => {\n setBlur();\n };\n\n return {\n // Main handlers and values (flat)\n value: rawValue,\n displayValue,\n modelValue,\n setValue,\n setBlur,\n onInput,\n onBlur,\n // Metadata (grouped)\n meta: {\n error,\n touched,\n invalid,\n isValidating,\n isDirty,\n isHidden,\n isRequired,\n hasError,\n },\n };\n}\n","import { ref, computed, onUnmounted } from \"vue\";\nimport { useBitStore } from \"./context\";\nimport {\n getDeepValue,\n BitArrayPath,\n BitPathValue,\n BitArrayItem,\n BitPath,\n} from \"../core\";\n\nconst generateId = () => Math.random().toString(36).substring(2, 9);\n\nexport function useBitArray<\n TForm extends object = any,\n P extends BitArrayPath<TForm> = BitArrayPath<TForm>,\n>(path: P) {\n const store = useBitStore<TForm>();\n\n type Item = BitArrayItem<BitPathValue<TForm, P>>;\n\n const getSnapshot = (): Item[] => {\n const val = getDeepValue(\n store.getState().values,\n path as string,\n ) as BitPathValue<TForm, P> | undefined;\n return Array.isArray(val) ? (val as Item[]) : [];\n };\n\n const initialValues = getSnapshot();\n const values = ref<Item[]>(initialValues);\n const ids = ref<string[]>(initialValues.map(generateId));\n\n const unsubscribe = store.subscribe(() => {\n const newValues = getSnapshot();\n values.value = [...newValues];\n\n if (newValues.length !== ids.value.length) {\n const currentIds = [...ids.value];\n if (newValues.length > currentIds.length) {\n const diff = newValues.length - currentIds.length;\n const newIds = Array.from({ length: diff }, generateId);\n ids.value = [...currentIds, ...newIds];\n } else {\n ids.value = currentIds.slice(0, newValues.length);\n }\n }\n });\n\n onUnmounted(() => {\n unsubscribe();\n if (store.unregisterPrefix) {\n store.unregisterPrefix(`${path as string}.`);\n }\n });\n\n const fields = computed(() =>\n values.value.map((v, i) => ({\n key: ids.value[i] || `temp-${i}`,\n value: v,\n index: i,\n })),\n );\n\n const length = computed(() => values.value.length);\n\n return {\n fields,\n length,\n append: (val: Item) => {\n ids.value.push(generateId());\n store.pushItem(path, val);\n },\n prepend: (val: Item) => {\n ids.value.unshift(generateId());\n store.prependItem(path, val);\n },\n insert: (index: number, val: Item) => {\n ids.value.splice(index, 0, generateId());\n store.insertItem(path, index, val);\n },\n remove: (index: number) => {\n ids.value.splice(index, 1);\n store.removeItem(path, index);\n },\n move: (from: number, to: number) => {\n const currentIds = [...ids.value];\n const [id] = currentIds.splice(from, 1);\n currentIds.splice(to, 0, id);\n ids.value = currentIds;\n store.moveItem(path, from, to);\n },\n swap: (a: number, b: number) => {\n const currentIds = [...ids.value];\n [currentIds[a], currentIds[b]] = [currentIds[b], currentIds[a]];\n ids.value = currentIds;\n store.swapItems(path, a, b);\n },\n replace: (items: Item[]) => {\n ids.value = items.map(generateId);\n store.setField(path as unknown as BitPath<TForm>, items as any);\n },\n clear: () => {\n ids.value = [];\n store.setField(path as unknown as BitPath<TForm>, [] as any);\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bit-form/bit-form/dist/vue/index.cjs","../../src/vue/context.ts","../../src/vue/use-bit-form.ts","../../src/vue/use-bit-field.ts","../../src/vue/use-bit-array.ts"],"names":["BIT_STORE_KEY","provideBitStore","store","provide","useBitStore","inject","useBitForm","state","shallowRef","submitError","ref","lastResponse","unsubscribe","onUnmounted","getValues","getErrors","getTouched","getDirtyValues","isValid","computed","isSubmitting","isDirty","onSuccess","e","handler","values","dirtyValues","result","err","isValidationErrorShape","extractServerErrors","useBitField","path","resolvedMask","rawValue","getDeepValue","displayValue","val","modelValue","rawError","error","touched","invalid","isValidating","isHidden","isRequired","hasError","setValue","setBlur","generateId","useBitArray","getSnapshot","initialValues","ids","newValues","currentIds","diff","newIds"],"mappings":"AAAA,0uBAA8D,0BCAhB,IAIjCA,CAAAA,CACX,MAAA,CAAO,WAAW,CAAA,CAEb,SAASC,CAAAA,CAAkCC,CAAAA,CAA6B,CAC7EC,0BAAAA,CAAQH,CAAeE,CAAK,CAC9B,CAEO,SAASE,CAAAA,CAAAA,CAAgC,CAC9C,IAAMF,CAAAA,CAAQG,yBAAAA,CAAoB,CAAA,CAClC,EAAA,CAAI,CAACH,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,2DACF,CAAA,CACF,OAAOA,CACT,CClBA,SAIgBI,CAAAA,CAAAA,CAA+B,CAC7C,IAAMJ,CAAAA,CAAQE,CAAAA,CAAe,CAAA,CACvBG,CAAAA,CAAQC,6BAAAA,CAAWN,CAAM,QAAA,CAAS,CAAC,CAAA,CACnCO,CAAAA,CAAcC,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,GAAGE,CAAM,CACvC,CAAA,KACEJ,CAAAA,CAAI,KAAA,CAAQE,CAAAA,CAAW,KAAA,CAAM,CAAA,CAAGD,CAAAA,CAAU,MAAM,CAEpD,CACF,CAAC,CAAA,CAEDzC,8BAAAA,CAAY,CAAA,EAAM,CAChBD,CAAAA,CAAY,CAAA,CACRV,CAAAA,CAAM,gBAAA,EACRA,CAAAA,CAAM,gBAAA,CAAiB,CAAA,EAAA","file":"/home/runner/work/bit-form/bit-form/dist/vue/index.cjs","sourcesContent":[null,"import { inject, provide, InjectionKey } from \"vue\";\nimport type { BitFrameworkStore } from \"../core\";\n\n// Chave única para evitar colisões\nexport const BIT_STORE_KEY: InjectionKey<BitFrameworkStore<any>> =\n Symbol(\"BIT_STORE\");\n\nexport function provideBitStore<T extends object>(store: BitFrameworkStore<T>) {\n provide(BIT_STORE_KEY, store);\n}\n\nexport function useBitStore<T extends object>() {\n const store = inject(BIT_STORE_KEY);\n if (!store)\n throw new Error(\n \"BitForm Vue hooks devem ser usados sob um provideBitStore\",\n );\n return store as BitFrameworkStore<T>;\n}\n","import { computed, onUnmounted, shallowRef, ref } from \"vue\";\nimport { useBitStore } from \"./context\";\nimport { isValidationErrorShape, extractServerErrors } from \"../core/utils\";\n\nexport function useBitForm<T extends object>() {\n const store = useBitStore<T>();\n const state = shallowRef(store.getState());\n const submitError = ref<Error | null>(null);\n const lastResponse = ref<unknown>(null);\n\n const unsubscribe = store.subscribe(() => {\n state.value = { ...store.getState() };\n });\n\n onUnmounted(unsubscribe);\n\n const getValues = () => state.value.values;\n const getErrors = () => state.value.errors;\n const getTouched = () => state.value.touched;\n const getDirtyValues = () => store.getDirtyValues();\n\n const isValid = computed(() => state.value.isValid);\n const isSubmitting = computed(() => state.value.isSubmitting);\n const isDirty = computed(() => state.value.isDirty);\n\n const onSubmit = (\n handler: (values: T, dirtyValues?: Partial<T>) => Promise<unknown>,\n ) => {\n return (e?: Event) => {\n e?.preventDefault?.();\n submitError.value = null;\n return store.submit(async (values, dirtyValues) => {\n try {\n const result = await handler(values, dirtyValues);\n lastResponse.value = result;\n submitError.value = null;\n } catch (err) {\n if (isValidationErrorShape(err)) {\n store.setServerErrors(extractServerErrors(err));\n } else {\n submitError.value =\n err instanceof Error ? err : new Error(String(err));\n }\n }\n });\n };\n };\n\n const reset = () => {\n store.reset();\n submitError.value = null;\n lastResponse.value = null;\n };\n\n const meta = {\n isValid,\n isDirty,\n isSubmitting,\n submitError,\n lastResponse,\n };\n\n return {\n // Metadata (grouped)\n meta,\n // Getters\n getValues,\n getErrors,\n getTouched,\n getDirtyValues,\n // Main actions (frequent use - flat)\n submit: (\n onSuccess: (values: T, dirtyValues?: Partial<T>) => void | Promise<void>,\n ) => {\n return (e?: Event) => {\n e?.preventDefault?.();\n return store.submit(onSuccess);\n };\n },\n onSubmit,\n reset,\n setValues: store.setValues.bind(store),\n setError: store.setError.bind(store),\n setErrors: store.setErrors.bind(store),\n setServerErrors: store.setServerErrors.bind(store),\n setField: store.setField.bind(store),\n blurField: store.blurField.bind(store),\n validate: store.validate.bind(store),\n // Array mutations (grouped)\n mutations: {\n pushItem: store.pushItem.bind(store),\n prependItem: store.prependItem.bind(store),\n removeItem: store.removeItem.bind(store),\n insertItem: store.insertItem.bind(store),\n moveItem: store.moveItem.bind(store),\n swapItems: store.swapItems.bind(store),\n },\n };\n}\n","import { computed, onUnmounted, shallowRef } from \"vue\";\nimport { useBitStore } from \"./context\";\nimport { getDeepValue } from \"../core\";\nimport type { UseBitFieldVueMeta, UseBitFieldVueResult } from \"./types\";\n\nexport function useBitField<TValue = any>(\n path: string,\n): UseBitFieldVueResult<TValue> {\n const store = useBitStore<any>();\n\n const resolvedMask = store.resolveMask(path as string);\n\n const state = shallowRef(store.getState());\n\n const unsubscribe = store.subscribe(() => {\n state.value = store.getState();\n });\n\n onUnmounted(() => {\n unsubscribe();\n if (store.unregisterField) {\n store.unregisterField(path as string);\n }\n });\n\n const rawValue = computed(\n () => getDeepValue(state.value.values, path as string) as TValue,\n );\n\n const displayValue = computed(() => {\n const val = rawValue.value;\n if (val === undefined || val === null || val === \"\") return \"\";\n\n return resolvedMask ? resolvedMask.format(val as any) : String(val);\n });\n\n const modelValue = computed({\n get: () => displayValue.value,\n set: (val: any) => {\n if (!resolvedMask) {\n store.setField(path, val);\n return;\n }\n\n store.setField(path, resolvedMask.parse(String(val ?? \"\")));\n },\n });\n\n const rawError = computed(() => state.value.errors[path]);\n const error = computed(() =>\n state.value.touched[path] ? state.value.errors[path] : undefined,\n );\n const touched = computed(() => !!state.value.touched[path]);\n const invalid = computed(() => !!(touched.value && error.value));\n\n const isValidating = computed(() => {\n state.value;\n return store.isFieldValidating(path);\n });\n\n const isDirty = computed(() => {\n state.value;\n return store.isFieldDirty(path);\n });\n\n const isHidden = computed(() => {\n state.value;\n return store.isHidden(path);\n });\n\n const isRequired = computed(() => {\n state.value;\n return store.isRequired(path);\n });\n\n const hasError = computed(() => !!rawError.value);\n\n const setValue = (val: any) => {\n modelValue.value = val;\n };\n\n const setBlur = () => store.blurField(path);\n\n const onInput = (val: any) => {\n setValue(val);\n };\n\n const onBlur = () => {\n setBlur();\n };\n\n return {\n // Main handlers and values (flat)\n value: rawValue,\n displayValue,\n modelValue,\n setValue,\n setBlur,\n onInput,\n onBlur,\n // Metadata (grouped)\n meta: {\n error,\n touched,\n invalid,\n isValidating,\n isDirty,\n isHidden,\n isRequired,\n hasError,\n },\n };\n}\n","import { ref, computed, onUnmounted } from \"vue\";\nimport { useBitStore } from \"./context\";\nimport {\n getDeepValue,\n BitArrayPath,\n BitPathValue,\n BitArrayItem,\n BitPath,\n} from \"../core\";\n\nconst generateId = () => Math.random().toString(36).substring(2, 9);\n\nexport function useBitArray<\n TForm extends object = any,\n P extends BitArrayPath<TForm> = BitArrayPath<TForm>,\n>(path: P) {\n const store = useBitStore<TForm>();\n\n type Item = BitArrayItem<BitPathValue<TForm, P>>;\n\n const getSnapshot = (): Item[] => {\n const val = getDeepValue(\n store.getState().values,\n path as string,\n ) as BitPathValue<TForm, P> | undefined;\n return Array.isArray(val) ? (val as Item[]) : [];\n };\n\n const initialValues = getSnapshot();\n const values = ref<Item[]>(initialValues);\n const ids = ref<string[]>(initialValues.map(generateId));\n\n const unsubscribe = store.subscribe(() => {\n const newValues = getSnapshot();\n values.value = [...newValues];\n\n if (newValues.length !== ids.value.length) {\n const currentIds = [...ids.value];\n if (newValues.length > currentIds.length) {\n const diff = newValues.length - currentIds.length;\n const newIds = Array.from({ length: diff }, generateId);\n ids.value = [...currentIds, ...newIds];\n } else {\n ids.value = currentIds.slice(0, newValues.length);\n }\n }\n });\n\n onUnmounted(() => {\n unsubscribe();\n if (store.unregisterPrefix) {\n store.unregisterPrefix(`${path as string}.`);\n }\n });\n\n const fields = computed(() =>\n values.value.map((v, i) => ({\n key: ids.value[i] || `temp-${i}`,\n value: v,\n index: i,\n })),\n );\n\n const length = computed(() => values.value.length);\n\n return {\n fields,\n length,\n append: (val: Item) => {\n ids.value.push(generateId());\n store.pushItem(path, val);\n },\n prepend: (val: Item) => {\n ids.value.unshift(generateId());\n store.prependItem(path, val);\n },\n insert: (index: number, val: Item) => {\n ids.value.splice(index, 0, generateId());\n store.insertItem(path, index, val);\n },\n remove: (index: number) => {\n ids.value.splice(index, 1);\n store.removeItem(path, index);\n },\n move: (from: number, to: number) => {\n const currentIds = [...ids.value];\n const [id] = currentIds.splice(from, 1);\n currentIds.splice(to, 0, id);\n ids.value = currentIds;\n store.moveItem(path, from, to);\n },\n swap: (a: number, b: number) => {\n const currentIds = [...ids.value];\n [currentIds[a], currentIds[b]] = [currentIds[b], currentIds[a]];\n ids.value = currentIds;\n store.swapItems(path, a, b);\n },\n replace: (items: Item[]) => {\n ids.value = items.map(generateId);\n store.setField(path as unknown as BitPath<TForm>, items as any);\n },\n clear: () => {\n ids.value = [];\n store.setField(path as unknown as BitPath<TForm>, [] as any);\n },\n };\n}\n"]}
@@ -1,13 +1,13 @@
1
- import { B as BitStore } from '../index-9vxGUNPP.cjs';
2
- import { d as BitErrors, o as BitTouched, b as BitPath, c as BitPathValue, h as BitArrayPath, g as BitArrayItem, k as BitFieldDefinition, l as BitFieldOptions, S as ScopeStatus, V as ValidateScopeResult } from '../bus-uG4EmM-Z.cjs';
1
+ import { b as BitFrameworkStore } from '../public-types-Nv__uZTR.cjs';
2
+ import { e as BitErrors, m as BitTouched, j as BitPath, k as BitPathValue, S as ScopeStatus, V as ValidateScopeResult, c as BitArrayPath, b as BitArrayItem } from '../bus-vCbulIYH.cjs';
3
3
  import * as vue from 'vue';
4
- import { ComputedRef } from 'vue';
4
+ import { ComputedRef, Ref } from 'vue';
5
5
  import * as _vue_reactivity from '@vue/reactivity';
6
6
  import * as _vue_shared from '@vue/shared';
7
7
  import { a as BitUploadFn, B as BitDeleteUploadFn } from '../types-C2mpfhp1.cjs';
8
8
 
9
- declare function provideBitStore(store: BitStore<any>): void;
10
- declare function useBitStore<T extends object>(): BitStore<T>;
9
+ declare function provideBitStore<T extends object>(store: BitFrameworkStore<T>): void;
10
+ declare function useBitStore<T extends object>(): BitFrameworkStore<T>;
11
11
 
12
12
  declare function useBitForm<T extends object>(): {
13
13
  meta: {
@@ -24,7 +24,7 @@ declare function useBitForm<T extends object>(): {
24
24
  submit: (onSuccess: (values: T, dirtyValues?: Partial<T>) => void | Promise<void>) => (e?: Event) => Promise<void>;
25
25
  onSubmit: (handler: (values: T, dirtyValues?: Partial<T>) => Promise<unknown>) => (e?: Event) => Promise<void>;
26
26
  reset: () => void;
27
- setValues: (newValues: T) => void;
27
+ setValues: (values: T) => void;
28
28
  setError: (path: string, message: string | undefined) => void;
29
29
  setErrors: (errors: BitErrors<T>) => void;
30
30
  setServerErrors: (serverErrors: Record<string, string[] | string>) => void;
@@ -35,15 +35,18 @@ declare function useBitForm<T extends object>(): {
35
35
  scopeFields?: string[];
36
36
  }) => Promise<boolean>;
37
37
  mutations: {
38
- pushItem: <P extends BitArrayPath<T>>(path: P, value: BitArrayItem<BitPathValue<T, P>>) => void;
39
- prependItem: <P extends BitArrayPath<T>>(path: P, value: BitArrayItem<BitPathValue<T, P>>) => void;
40
- removeItem: <P extends BitArrayPath<T>>(path: P, index: number) => void;
41
- insertItem: <P extends BitArrayPath<T>>(path: P, index: number, value: BitArrayItem<BitPathValue<T, P>>) => void;
42
- moveItem: <P extends BitArrayPath<T>>(path: P, from: number, to: number) => void;
43
- swapItems: <P extends BitArrayPath<T>>(path: P, indexA: number, indexB: number) => void;
38
+ pushItem: (path: any, value: any) => void;
39
+ prependItem: (path: any, value: any) => void;
40
+ removeItem: (path: any, index: number) => void;
41
+ insertItem: (path: any, index: number, value: any) => void;
42
+ moveItem: (path: any, from: number, to: number) => void;
43
+ swapItems: (path: any, indexA: number, indexB: number) => void;
44
44
  };
45
45
  };
46
46
 
47
+ /**
48
+ * Metadata describing the current state of a form field (Vue reactive).
49
+ */
47
50
  interface UseBitFieldVueMeta {
48
51
  error: Readonly<any>;
49
52
  touched: Readonly<any>;
@@ -54,6 +57,10 @@ interface UseBitFieldVueMeta {
54
57
  isRequired: Readonly<any>;
55
58
  hasError: Readonly<any>;
56
59
  }
60
+ /**
61
+ * Result from useBitField hook in Vue.
62
+ * Provides field state, value, handlers, and metadata with Vue reactivity.
63
+ */
57
64
  interface UseBitFieldVueResult<TValue = any> {
58
65
  value: Readonly<any>;
59
66
  displayValue: Readonly<any>;
@@ -64,7 +71,52 @@ interface UseBitFieldVueResult<TValue = any> {
64
71
  onBlur: () => void;
65
72
  meta: UseBitFieldVueMeta;
66
73
  }
67
- declare function useBitField<TValue = any>(path: string, config?: BitFieldDefinition<any>, options?: BitFieldOptions): UseBitFieldVueResult<TValue>;
74
+ /**
75
+ * Result from useBitSteps hook in Vue.
76
+ * Provides multi-step form navigation and validation with Vue reactivity.
77
+ */
78
+ interface UseBitStepsResult {
79
+ step: ComputedRef<number>;
80
+ stepIndex: Ref<number>;
81
+ scope: ComputedRef<string>;
82
+ next: () => Promise<boolean>;
83
+ prev: () => void;
84
+ goTo: (step: number) => void;
85
+ isFirst: ComputedRef<boolean>;
86
+ isLast: ComputedRef<boolean>;
87
+ status: Ref<ScopeStatus>;
88
+ errors: ComputedRef<Record<string, string>>;
89
+ isValid: ComputedRef<boolean>;
90
+ isDirty: ComputedRef<boolean>;
91
+ validate: () => Promise<ValidateScopeResult>;
92
+ getErrors: () => Record<string, string>;
93
+ }
94
+ /**
95
+ * Result from useBitUpload hook in Vue.
96
+ * Provides file upload functionality with integrated validation (Vue reactive).
97
+ */
98
+ interface UseBitUploadResult {
99
+ value: ComputedRef<string | File | null>;
100
+ setValue: (value: string | File | null) => void;
101
+ error: ComputedRef<string | undefined>;
102
+ isValidating: ComputedRef<boolean>;
103
+ upload: (file: File | null | undefined) => Promise<void>;
104
+ remove: () => Promise<void>;
105
+ }
106
+ /**
107
+ * Result from useBitHistory hook in Vue.
108
+ * Provides form history undo/redo capabilities (Vue reactive).
109
+ */
110
+ interface UseBitHistoryResult {
111
+ canUndo: Readonly<any>;
112
+ canRedo: Readonly<any>;
113
+ historyIndex: Readonly<any>;
114
+ historySize: Readonly<any>;
115
+ undo: () => void;
116
+ redo: () => void;
117
+ }
118
+
119
+ declare function useBitField<TValue = any>(path: string): UseBitFieldVueResult<TValue>;
68
120
 
69
121
  declare function useBitArray<TForm extends object = any, P extends BitArrayPath<TForm> = BitArrayPath<TForm>>(path: P): {
70
122
  fields: vue.ComputedRef<{
@@ -83,14 +135,6 @@ declare function useBitArray<TForm extends object = any, P extends BitArrayPath<
83
135
  clear: () => void;
84
136
  };
85
137
 
86
- interface UseBitHistoryResult {
87
- canUndo: vue.ComputedRef<boolean>;
88
- canRedo: vue.ComputedRef<boolean>;
89
- historyIndex: vue.ComputedRef<number>;
90
- historySize: vue.ComputedRef<number>;
91
- undo: () => void;
92
- redo: () => void;
93
- }
94
138
  declare function useBitHistory<T extends object = any>(): UseBitHistoryResult;
95
139
 
96
140
  declare function useBitScope(scopeName: string): {
@@ -111,22 +155,6 @@ declare function useBitScope(scopeName: string): {
111
155
  isDirty: vue.ComputedRef<boolean>;
112
156
  };
113
157
 
114
- interface UseBitStepsResult {
115
- step: vue.ComputedRef<number>;
116
- stepIndex: vue.Ref<number>;
117
- scope: vue.ComputedRef<string>;
118
- next: () => Promise<boolean>;
119
- prev: () => void;
120
- goTo: (step: number) => void;
121
- isFirst: vue.ComputedRef<boolean>;
122
- isLast: vue.ComputedRef<boolean>;
123
- status: vue.Ref<ScopeStatus>;
124
- errors: vue.ComputedRef<Record<string, string>>;
125
- isValid: vue.ComputedRef<boolean>;
126
- isDirty: vue.ComputedRef<boolean>;
127
- validate: () => Promise<ValidateScopeResult>;
128
- getErrors: () => Record<string, string>;
129
- }
130
158
  declare function useBitSteps(scopeNames: string[]): UseBitStepsResult;
131
159
 
132
160
  declare function useBitWatch<TForm extends object = any, P extends BitPath<TForm> = BitPath<TForm>>(path: P): vue.DeepReadonly<vue.UnwrapNestedRefs<[BitPathValue<TForm, P>] extends [vue.Ref<any, any>] ? _vue_shared.IfAny<vue.Ref<any, any> & BitPathValue<TForm, P>, vue.Ref<vue.Ref<any, any> & BitPathValue<TForm, P>, vue.Ref<any, any> & BitPathValue<TForm, P>>, vue.Ref<any, any> & BitPathValue<TForm, P>> : vue.Ref<vue.UnwrapRef<BitPathValue<TForm, P>>, BitPathValue<TForm, P> | vue.UnwrapRef<BitPathValue<TForm, P>>>>>;
@@ -137,14 +165,6 @@ declare function useBitWatch<TForm extends object = any, P extends BitPath<TForm
137
165
  * Minimal upload API integrated with global field validation lifecycle.
138
166
  */
139
167
 
140
- interface UseBitUploadResult {
141
- value: ComputedRef<string | File | null>;
142
- setValue: (value: string | File | null) => void;
143
- error: ComputedRef<string | undefined>;
144
- isValidating: ComputedRef<boolean>;
145
- upload: (file: File | null | undefined) => Promise<void>;
146
- remove: () => Promise<void>;
147
- }
148
168
  declare function useBitUpload(fieldPath: string, uploadFn: BitUploadFn, deleteFile?: BitDeleteUploadFn): UseBitUploadResult;
149
169
 
150
- export { ScopeStatus, type UseBitFieldVueMeta, type UseBitFieldVueResult, type UseBitUploadResult, ValidateScopeResult, provideBitStore, useBitArray, useBitField, useBitForm, useBitHistory, useBitScope, useBitSteps, useBitStore, useBitUpload, useBitWatch };
170
+ export { ScopeStatus, type UseBitFieldVueMeta, type UseBitFieldVueResult, type UseBitHistoryResult, type UseBitStepsResult, type UseBitUploadResult, ValidateScopeResult, provideBitStore, useBitArray, useBitField, useBitForm, useBitHistory, useBitScope, useBitSteps, useBitStore, useBitUpload, useBitWatch };
@@ -1,13 +1,13 @@
1
- import { B as BitStore } from '../index-1fP1eJH8.js';
2
- import { d as BitErrors, o as BitTouched, b as BitPath, c as BitPathValue, h as BitArrayPath, g as BitArrayItem, k as BitFieldDefinition, l as BitFieldOptions, S as ScopeStatus, V as ValidateScopeResult } from '../bus-uG4EmM-Z.js';
1
+ import { b as BitFrameworkStore } from '../public-types-ChP5j3xc.js';
2
+ import { e as BitErrors, m as BitTouched, j as BitPath, k as BitPathValue, S as ScopeStatus, V as ValidateScopeResult, c as BitArrayPath, b as BitArrayItem } from '../bus-vCbulIYH.js';
3
3
  import * as vue from 'vue';
4
- import { ComputedRef } from 'vue';
4
+ import { ComputedRef, Ref } from 'vue';
5
5
  import * as _vue_reactivity from '@vue/reactivity';
6
6
  import * as _vue_shared from '@vue/shared';
7
7
  import { a as BitUploadFn, B as BitDeleteUploadFn } from '../types-C2mpfhp1.js';
8
8
 
9
- declare function provideBitStore(store: BitStore<any>): void;
10
- declare function useBitStore<T extends object>(): BitStore<T>;
9
+ declare function provideBitStore<T extends object>(store: BitFrameworkStore<T>): void;
10
+ declare function useBitStore<T extends object>(): BitFrameworkStore<T>;
11
11
 
12
12
  declare function useBitForm<T extends object>(): {
13
13
  meta: {
@@ -24,7 +24,7 @@ declare function useBitForm<T extends object>(): {
24
24
  submit: (onSuccess: (values: T, dirtyValues?: Partial<T>) => void | Promise<void>) => (e?: Event) => Promise<void>;
25
25
  onSubmit: (handler: (values: T, dirtyValues?: Partial<T>) => Promise<unknown>) => (e?: Event) => Promise<void>;
26
26
  reset: () => void;
27
- setValues: (newValues: T) => void;
27
+ setValues: (values: T) => void;
28
28
  setError: (path: string, message: string | undefined) => void;
29
29
  setErrors: (errors: BitErrors<T>) => void;
30
30
  setServerErrors: (serverErrors: Record<string, string[] | string>) => void;
@@ -35,15 +35,18 @@ declare function useBitForm<T extends object>(): {
35
35
  scopeFields?: string[];
36
36
  }) => Promise<boolean>;
37
37
  mutations: {
38
- pushItem: <P extends BitArrayPath<T>>(path: P, value: BitArrayItem<BitPathValue<T, P>>) => void;
39
- prependItem: <P extends BitArrayPath<T>>(path: P, value: BitArrayItem<BitPathValue<T, P>>) => void;
40
- removeItem: <P extends BitArrayPath<T>>(path: P, index: number) => void;
41
- insertItem: <P extends BitArrayPath<T>>(path: P, index: number, value: BitArrayItem<BitPathValue<T, P>>) => void;
42
- moveItem: <P extends BitArrayPath<T>>(path: P, from: number, to: number) => void;
43
- swapItems: <P extends BitArrayPath<T>>(path: P, indexA: number, indexB: number) => void;
38
+ pushItem: (path: any, value: any) => void;
39
+ prependItem: (path: any, value: any) => void;
40
+ removeItem: (path: any, index: number) => void;
41
+ insertItem: (path: any, index: number, value: any) => void;
42
+ moveItem: (path: any, from: number, to: number) => void;
43
+ swapItems: (path: any, indexA: number, indexB: number) => void;
44
44
  };
45
45
  };
46
46
 
47
+ /**
48
+ * Metadata describing the current state of a form field (Vue reactive).
49
+ */
47
50
  interface UseBitFieldVueMeta {
48
51
  error: Readonly<any>;
49
52
  touched: Readonly<any>;
@@ -54,6 +57,10 @@ interface UseBitFieldVueMeta {
54
57
  isRequired: Readonly<any>;
55
58
  hasError: Readonly<any>;
56
59
  }
60
+ /**
61
+ * Result from useBitField hook in Vue.
62
+ * Provides field state, value, handlers, and metadata with Vue reactivity.
63
+ */
57
64
  interface UseBitFieldVueResult<TValue = any> {
58
65
  value: Readonly<any>;
59
66
  displayValue: Readonly<any>;
@@ -64,7 +71,52 @@ interface UseBitFieldVueResult<TValue = any> {
64
71
  onBlur: () => void;
65
72
  meta: UseBitFieldVueMeta;
66
73
  }
67
- declare function useBitField<TValue = any>(path: string, config?: BitFieldDefinition<any>, options?: BitFieldOptions): UseBitFieldVueResult<TValue>;
74
+ /**
75
+ * Result from useBitSteps hook in Vue.
76
+ * Provides multi-step form navigation and validation with Vue reactivity.
77
+ */
78
+ interface UseBitStepsResult {
79
+ step: ComputedRef<number>;
80
+ stepIndex: Ref<number>;
81
+ scope: ComputedRef<string>;
82
+ next: () => Promise<boolean>;
83
+ prev: () => void;
84
+ goTo: (step: number) => void;
85
+ isFirst: ComputedRef<boolean>;
86
+ isLast: ComputedRef<boolean>;
87
+ status: Ref<ScopeStatus>;
88
+ errors: ComputedRef<Record<string, string>>;
89
+ isValid: ComputedRef<boolean>;
90
+ isDirty: ComputedRef<boolean>;
91
+ validate: () => Promise<ValidateScopeResult>;
92
+ getErrors: () => Record<string, string>;
93
+ }
94
+ /**
95
+ * Result from useBitUpload hook in Vue.
96
+ * Provides file upload functionality with integrated validation (Vue reactive).
97
+ */
98
+ interface UseBitUploadResult {
99
+ value: ComputedRef<string | File | null>;
100
+ setValue: (value: string | File | null) => void;
101
+ error: ComputedRef<string | undefined>;
102
+ isValidating: ComputedRef<boolean>;
103
+ upload: (file: File | null | undefined) => Promise<void>;
104
+ remove: () => Promise<void>;
105
+ }
106
+ /**
107
+ * Result from useBitHistory hook in Vue.
108
+ * Provides form history undo/redo capabilities (Vue reactive).
109
+ */
110
+ interface UseBitHistoryResult {
111
+ canUndo: Readonly<any>;
112
+ canRedo: Readonly<any>;
113
+ historyIndex: Readonly<any>;
114
+ historySize: Readonly<any>;
115
+ undo: () => void;
116
+ redo: () => void;
117
+ }
118
+
119
+ declare function useBitField<TValue = any>(path: string): UseBitFieldVueResult<TValue>;
68
120
 
69
121
  declare function useBitArray<TForm extends object = any, P extends BitArrayPath<TForm> = BitArrayPath<TForm>>(path: P): {
70
122
  fields: vue.ComputedRef<{
@@ -83,14 +135,6 @@ declare function useBitArray<TForm extends object = any, P extends BitArrayPath<
83
135
  clear: () => void;
84
136
  };
85
137
 
86
- interface UseBitHistoryResult {
87
- canUndo: vue.ComputedRef<boolean>;
88
- canRedo: vue.ComputedRef<boolean>;
89
- historyIndex: vue.ComputedRef<number>;
90
- historySize: vue.ComputedRef<number>;
91
- undo: () => void;
92
- redo: () => void;
93
- }
94
138
  declare function useBitHistory<T extends object = any>(): UseBitHistoryResult;
95
139
 
96
140
  declare function useBitScope(scopeName: string): {
@@ -111,22 +155,6 @@ declare function useBitScope(scopeName: string): {
111
155
  isDirty: vue.ComputedRef<boolean>;
112
156
  };
113
157
 
114
- interface UseBitStepsResult {
115
- step: vue.ComputedRef<number>;
116
- stepIndex: vue.Ref<number>;
117
- scope: vue.ComputedRef<string>;
118
- next: () => Promise<boolean>;
119
- prev: () => void;
120
- goTo: (step: number) => void;
121
- isFirst: vue.ComputedRef<boolean>;
122
- isLast: vue.ComputedRef<boolean>;
123
- status: vue.Ref<ScopeStatus>;
124
- errors: vue.ComputedRef<Record<string, string>>;
125
- isValid: vue.ComputedRef<boolean>;
126
- isDirty: vue.ComputedRef<boolean>;
127
- validate: () => Promise<ValidateScopeResult>;
128
- getErrors: () => Record<string, string>;
129
- }
130
158
  declare function useBitSteps(scopeNames: string[]): UseBitStepsResult;
131
159
 
132
160
  declare function useBitWatch<TForm extends object = any, P extends BitPath<TForm> = BitPath<TForm>>(path: P): vue.DeepReadonly<vue.UnwrapNestedRefs<[BitPathValue<TForm, P>] extends [vue.Ref<any, any>] ? _vue_shared.IfAny<vue.Ref<any, any> & BitPathValue<TForm, P>, vue.Ref<vue.Ref<any, any> & BitPathValue<TForm, P>, vue.Ref<any, any> & BitPathValue<TForm, P>>, vue.Ref<any, any> & BitPathValue<TForm, P>> : vue.Ref<vue.UnwrapRef<BitPathValue<TForm, P>>, BitPathValue<TForm, P> | vue.UnwrapRef<BitPathValue<TForm, P>>>>>;
@@ -137,14 +165,6 @@ declare function useBitWatch<TForm extends object = any, P extends BitPath<TForm
137
165
  * Minimal upload API integrated with global field validation lifecycle.
138
166
  */
139
167
 
140
- interface UseBitUploadResult {
141
- value: ComputedRef<string | File | null>;
142
- setValue: (value: string | File | null) => void;
143
- error: ComputedRef<string | undefined>;
144
- isValidating: ComputedRef<boolean>;
145
- upload: (file: File | null | undefined) => Promise<void>;
146
- remove: () => Promise<void>;
147
- }
148
168
  declare function useBitUpload(fieldPath: string, uploadFn: BitUploadFn, deleteFile?: BitDeleteUploadFn): UseBitUploadResult;
149
169
 
150
- export { ScopeStatus, type UseBitFieldVueMeta, type UseBitFieldVueResult, type UseBitUploadResult, ValidateScopeResult, provideBitStore, useBitArray, useBitField, useBitForm, useBitHistory, useBitScope, useBitSteps, useBitStore, useBitUpload, useBitWatch };
170
+ export { ScopeStatus, type UseBitFieldVueMeta, type UseBitFieldVueResult, type UseBitHistoryResult, type UseBitStepsResult, type UseBitUploadResult, ValidateScopeResult, provideBitStore, useBitArray, useBitField, useBitForm, useBitHistory, useBitScope, useBitSteps, useBitStore, useBitUpload, useBitWatch };
package/dist/vue/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{d as k,e as V,h as A,i as C}from"../chunk-NDFMZWBP.js";import{inject as z,provide as W}from"vue";var j=Symbol("BIT_STORE");function _(e){W(j,e)}function c(){let e=z(j);if(!e)throw new Error("BitForm Vue hooks devem ser usados sob um provideBitStore");return e}import{computed as w,onUnmounted as L,shallowRef as $,ref as M}from"vue";function Y(){let e=c(),t=$(e.getState()),s=M(null),o=M(null),n=e.subscribe(()=>{t.value={...e.getState()}});L(n);let i=()=>t.value.values,u=()=>t.value.errors,y=()=>t.value.touched,m=()=>e.getDirtyValues(),r=w(()=>t.value.isValid),a=w(()=>t.value.isSubmitting),d=w(()=>t.value.isDirty);return{meta:{isValid:r,isDirty:d,isSubmitting:a,submitError:s,lastResponse:o},getValues:i,getErrors:u,getTouched:y,getDirtyValues:m,submit:S=>b=>(b?.preventDefault?.(),e.submit(S)),onSubmit:S=>b=>(b?.preventDefault?.(),s.value=null,e.submit(async(E,p)=>{try{let l=await S(E,p);o.value=l,s.value=null}catch(l){A(l)?e.setServerErrors(C(l)):s.value=l instanceof Error?l:new Error(String(l))}})),reset:()=>{e.reset(),s.value=null,o.value=null},setValues:e.setValues.bind(e),setError:e.setError.bind(e),setErrors:e.setErrors.bind(e),setServerErrors:e.setServerErrors.bind(e),setField:e.setField.bind(e),blurField:e.blurField.bind(e),validate:e.validate.bind(e),mutations:{pushItem:e.pushItem.bind(e),prependItem:e.prependItem.bind(e),removeItem:e.removeItem.bind(e),insertItem:e.insertItem.bind(e),moveItem:e.moveItem.bind(e),swapItems:e.swapItems.bind(e)}}}import{computed as f,onUnmounted as G,shallowRef as J}from"vue";function P(e,t,s){let o=c();t&&o.registerField(e,t);let n=s?.mask??o.config.fields?.[e]?.mask,i=n?typeof n=="string"?o.config.masks?.[n]:n:void 0,u=J(o.getState()),y=o.subscribe(()=>{u.value=o.getState()});G(()=>{y(),o.unregisterField&&o.unregisterField(e)});let m=f(()=>V(u.value.values,e)),r=f(()=>{let v=m.value;return v==null||v===""?"":i?i.format(v):String(v)}),a=f({get:()=>r.value,set:v=>{if(!i){o.setField(e,v);return}o.setField(e,i.parse(String(v??"")))}}),d=f(()=>u.value.errors[e]),g=f(()=>u.value.touched[e]?u.value.errors[e]:void 0),h=f(()=>!!u.value.touched[e]),x=f(()=>!!(h.value&&g.value)),S=f(()=>(u.value,o.isFieldValidating(e))),b=f(()=>(u.value,o.isFieldDirty(e))),E=f(()=>(u.value,o.isHidden(e))),p=f(()=>(u.value,o.isRequired(e))),l=f(()=>!!d.value),B=v=>{a.value=v},I=()=>o.blurField(e);return{value:m,displayValue:r,modelValue:a,setValue:B,setBlur:I,onInput:v=>{B(v)},onBlur:()=>{I()},meta:{error:g,touched:h,invalid:x,isValidating:S,isDirty:b,isHidden:E,isRequired:p,hasError:l}}}import{ref as O,computed as H,onUnmounted as Q}from"vue";var R=()=>Math.random().toString(36).substring(2,9);function X(e){let t=c(),s=()=>{let r=V(t.getState().values,e);return Array.isArray(r)?r:[]},o=s(),n=O(o),i=O(o.map(R)),u=t.subscribe(()=>{let r=s();if(n.value=[...r],r.length!==i.value.length){let a=[...i.value];if(r.length>a.length){let d=r.length-a.length,g=Array.from({length:d},R);i.value=[...a,...g]}else i.value=a.slice(0,r.length)}});Q(()=>{u(),t.unregisterPrefix&&t.unregisterPrefix(`${e}.`)});let y=H(()=>n.value.map((r,a)=>({key:i.value[a]||`temp-${a}`,value:r,index:a}))),m=H(()=>n.value.length);return{fields:y,length:m,append:r=>{i.value.push(R()),t.pushItem(e,r)},prepend:r=>{i.value.unshift(R()),t.prependItem(e,r)},insert:(r,a)=>{i.value.splice(r,0,R()),t.insertItem(e,r,a)},remove:r=>{i.value.splice(r,1),t.removeItem(e,r)},move:(r,a)=>{let d=[...i.value],[g]=d.splice(r,1);d.splice(a,0,g),i.value=d,t.moveItem(e,r,a)},swap:(r,a)=>{let d=[...i.value];[d[r],d[a]]=[d[a],d[r]],i.value=d,t.swapItems(e,r,a)},replace:r=>{i.value=r.map(R),t.setField(e,r)},clear:()=>{i.value=[],t.setField(e,[])}}}import{computed as T,onUnmounted as Z,shallowRef as N}from"vue";function ee(){let e=c(),t=N(e.getHistoryMetadata()),s=e.subscribe(()=>{t.value=e.getHistoryMetadata()});Z(s);let o=()=>e.undo(),n=()=>e.redo();return{canUndo:T(()=>t.value.canUndo),canRedo:T(()=>t.value.canRedo),historyIndex:T(()=>t.value.historyIndex),historySize:T(()=>t.value.historySize),undo:o,redo:n}}import{ref as te,computed as D,onMounted as re,onUnmounted as oe}from"vue";function se(e,t){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}function ne(e){let t=c(),s=te(t.getStepStatus(e)),o;re(()=>{o=t.subscribe(()=>{let r=t.getStepStatus(e);(r.hasErrors!==s.value.hasErrors||r.isDirty!==s.value.isDirty||!se(r.errors,s.value.errors))&&(s.value=r)})}),oe(()=>{o?.()});let n=async()=>{let r=await t.validate({scope:e}),a=t.getStepErrors(e);return{valid:r,errors:a}},i=()=>t.getStepErrors(e),u=D(()=>!s.value.hasErrors),y=D(()=>s.value.isDirty),m=D(()=>s.value.errors);return{scopeName:e,status:s,errors:m,validate:n,getErrors:i,isValid:u,isDirty:y}}import{ref as q,computed as F,watch as ie,onMounted as ae,onUnmounted as ue}from"vue";function le(e,t){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}function de(e){let t=c(),s=q(0),o=F(()=>e[s.value]??""),n=q(t.getStepStatus(o.value)),i;ie(o,p=>{n.value=t.getStepStatus(p)});let u=()=>{let p=o.value,l=t.getStepStatus(p);(l.hasErrors!==n.value.hasErrors||l.isDirty!==n.value.isDirty||!le(l.errors,n.value.errors))&&(n.value=l)};ae(()=>{i=t.subscribe(u)}),ue(()=>{i?.()});let y=async()=>{let p=o.value,l=await t.validate({scope:p}),B=t.getStepErrors(p);return{valid:l,errors:B}},m=()=>t.getStepErrors(o.value),r=async()=>{let p=o.value,l=t.getConfig().scopes?.[p];if(t.hasValidationsInProgress(l))return!1;let B=await t.validate({scope:p});if(B)s.value=Math.min(s.value+1,e.length-1);else{let I=t.getStepErrors(p),U=Object.keys(I);U.length>0&&t.markFieldsTouched(U)}return B},a=()=>{s.value=Math.max(s.value-1,0)},d=p=>{s.value=Math.max(0,Math.min(p-1,e.length-1))},g=F(()=>s.value+1),h=F(()=>s.value===0),x=F(()=>s.value>=e.length-1),S=F(()=>!n.value.hasErrors),b=F(()=>n.value.isDirty),E=F(()=>n.value.errors);return{step:g,stepIndex:s,scope:o,next:r,prev:a,goTo:d,isFirst:h,isLast:x,status:n,errors:E,isValid:S,isDirty:b,validate:y,getErrors:m}}import{ref as ce,onUnmounted as me,readonly as pe}from"vue";function ve(e){let t=c(),s=V(t.getState().values,e),o=ce(s),n=t.watch(e,i=>{k(o.value,i)||(o.value=i)});return me(n),pe(o)}import{computed as K}from"vue";function fe(e,t,s){let o=c(),n=P(e),i=null,u=async m=>{if(m){o.beginFieldValidation(e),await o.clearFieldAsyncError(e);try{let r=await t(m);n.setValue(r.url),i=r.key,await o.clearFieldAsyncError(e)}catch(r){let a=r instanceof Error?r.message:"Upload failed";await o.setFieldAsyncError(e,a)}finally{o.endFieldValidation(e)}}},y=async()=>{if(i&&s)try{await s(i)}catch(m){let r=m instanceof Error?m.message:"Delete failed";await o.setFieldAsyncError(e,r);return}n.setValue(null),i=null,await o.clearFieldAsyncError(e)};return{value:n.value,setValue:n.setValue,error:K(()=>n.meta.error.value),isValidating:K(()=>n.meta.isValidating.value||!1),upload:u,remove:y}}export{_ as provideBitStore,X as useBitArray,P as useBitField,Y as useBitForm,ee as useBitHistory,ne as useBitScope,de as useBitSteps,c as useBitStore,fe as useBitUpload,ve as useBitWatch};
1
+ import{d as D,e as V,h as k,i as A}from"../chunk-N6IA7HQL.js";import{inject as W,provide as _}from"vue";var j=Symbol("BIT_STORE");function z(e){_(j,e)}function m(){let e=W(j);if(!e)throw new Error("BitForm Vue hooks devem ser usados sob um provideBitStore");return e}import{computed as w,onUnmounted as C,shallowRef as $,ref as M}from"vue";function L(){let e=m(),t=$(e.getState()),s=M(null),o=M(null),n=e.subscribe(()=>{t.value={...e.getState()}});C(n);let i=()=>t.value.values,v=()=>t.value.errors,y=()=>t.value.touched,d=()=>e.getDirtyValues(),r=w(()=>t.value.isValid),a=w(()=>t.value.isSubmitting),u=w(()=>t.value.isDirty);return{meta:{isValid:r,isDirty:u,isSubmitting:a,submitError:s,lastResponse:o},getValues:i,getErrors:v,getTouched:y,getDirtyValues:d,submit:S=>B=>(B?.preventDefault?.(),e.submit(S)),onSubmit:S=>B=>(B?.preventDefault?.(),s.value=null,e.submit(async(F,l)=>{try{let c=await S(F,l);o.value=c,s.value=null}catch(c){k(c)?e.setServerErrors(A(c)):s.value=c instanceof Error?c:new Error(String(c))}})),reset:()=>{e.reset(),s.value=null,o.value=null},setValues:e.setValues.bind(e),setError:e.setError.bind(e),setErrors:e.setErrors.bind(e),setServerErrors:e.setServerErrors.bind(e),setField:e.setField.bind(e),blurField:e.blurField.bind(e),validate:e.validate.bind(e),mutations:{pushItem:e.pushItem.bind(e),prependItem:e.prependItem.bind(e),removeItem:e.removeItem.bind(e),insertItem:e.insertItem.bind(e),moveItem:e.moveItem.bind(e),swapItems:e.swapItems.bind(e)}}}import{computed as f,onUnmounted as Y,shallowRef as G}from"vue";function R(e){let t=m(),s=t.resolveMask(e),o=G(t.getState()),n=t.subscribe(()=>{o.value=t.getState()});Y(()=>{n(),t.unregisterField&&t.unregisterField(e)});let i=f(()=>V(o.value.values,e)),v=f(()=>{let p=i.value;return p==null||p===""?"":s?s.format(p):String(p)}),y=f({get:()=>v.value,set:p=>{if(!s){t.setField(e,p);return}t.setField(e,s.parse(String(p??"")))}}),d=f(()=>o.value.errors[e]),r=f(()=>o.value.touched[e]?o.value.errors[e]:void 0),a=f(()=>!!o.value.touched[e]),u=f(()=>!!(a.value&&r.value)),g=f(()=>(o.value,t.isFieldValidating(e))),I=f(()=>(o.value,t.isFieldDirty(e))),x=f(()=>(o.value,t.isHidden(e))),S=f(()=>(o.value,t.isRequired(e))),B=f(()=>!!d.value),F=p=>{y.value=p},l=()=>t.blurField(e);return{value:i,displayValue:v,modelValue:y,setValue:F,setBlur:l,onInput:p=>{F(p)},onBlur:()=>{l()},meta:{error:r,touched:a,invalid:u,isValidating:g,isDirty:I,isHidden:x,isRequired:S,hasError:B}}}import{ref as H,computed as O,onUnmounted as J}from"vue";var h=()=>Math.random().toString(36).substring(2,9);function Q(e){let t=m(),s=()=>{let r=V(t.getState().values,e);return Array.isArray(r)?r:[]},o=s(),n=H(o),i=H(o.map(h)),v=t.subscribe(()=>{let r=s();if(n.value=[...r],r.length!==i.value.length){let a=[...i.value];if(r.length>a.length){let u=r.length-a.length,g=Array.from({length:u},h);i.value=[...a,...g]}else i.value=a.slice(0,r.length)}});J(()=>{v(),t.unregisterPrefix&&t.unregisterPrefix(`${e}.`)});let y=O(()=>n.value.map((r,a)=>({key:i.value[a]||`temp-${a}`,value:r,index:a}))),d=O(()=>n.value.length);return{fields:y,length:d,append:r=>{i.value.push(h()),t.pushItem(e,r)},prepend:r=>{i.value.unshift(h()),t.prependItem(e,r)},insert:(r,a)=>{i.value.splice(r,0,h()),t.insertItem(e,r,a)},remove:r=>{i.value.splice(r,1),t.removeItem(e,r)},move:(r,a)=>{let u=[...i.value],[g]=u.splice(r,1);u.splice(a,0,g),i.value=u,t.moveItem(e,r,a)},swap:(r,a)=>{let u=[...i.value];[u[r],u[a]]=[u[a],u[r]],i.value=u,t.swapItems(e,r,a)},replace:r=>{i.value=r.map(h),t.setField(e,r)},clear:()=>{i.value=[],t.setField(e,[])}}}import{computed as T,onUnmounted as X,shallowRef as Z}from"vue";function N(){let e=m(),t=Z(e.getHistoryMetadata()),s=e.subscribe(()=>{t.value=e.getHistoryMetadata()});X(s);let o=()=>e.undo(),n=()=>e.redo();return{canUndo:T(()=>t.value.canUndo),canRedo:T(()=>t.value.canRedo),historyIndex:T(()=>t.value.historyIndex),historySize:T(()=>t.value.historySize),undo:o,redo:n}}import{ref as ee,computed as U,onMounted as te,onUnmounted as re}from"vue";function se(e,t){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}function oe(e){let t=m(),s=ee(t.getStepStatus(e)),o;te(()=>{o=t.subscribe(()=>{let r=t.getStepStatus(e);(r.hasErrors!==s.value.hasErrors||r.isDirty!==s.value.isDirty||!se(r.errors,s.value.errors))&&(s.value=r)})}),re(()=>{o?.()});let n=async()=>{let r=await t.validate({scope:e}),a=t.getStepErrors(e);return{valid:r,errors:a}},i=()=>t.getStepErrors(e),v=U(()=>!s.value.hasErrors),y=U(()=>s.value.isDirty),d=U(()=>s.value.errors);return{scopeName:e,status:s,errors:d,validate:n,getErrors:i,isValid:v,isDirty:y}}import{ref as q,computed as b,watch as ne,onMounted as ie,onUnmounted as ae}from"vue";function ue(e,t){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}function le(e){let t=m(),s=q(0),o=b(()=>e[s.value]??""),n=q(t.getStepStatus(o.value)),i;ne(o,l=>{n.value=t.getStepStatus(l)});let v=()=>{let l=o.value,c=t.getStepStatus(l);(c.hasErrors!==n.value.hasErrors||c.isDirty!==n.value.isDirty||!ue(c.errors,n.value.errors))&&(n.value=c)};ie(()=>{i=t.subscribe(v)}),ae(()=>{i?.()});let y=async()=>{let l=o.value,c=await t.validate({scope:l}),E=t.getStepErrors(l);return{valid:c,errors:E}},d=()=>t.getStepErrors(o.value),r=async()=>{let l=o.value,c=t.getScopeFields(l);if(t.hasValidationsInProgress(c))return!1;let E=await t.validate({scope:l});if(E)s.value=Math.min(s.value+1,e.length-1);else{let p=t.getStepErrors(l),P=Object.keys(p);P.length>0&&t.markFieldsTouched(P)}return E},a=()=>{s.value=Math.max(s.value-1,0)},u=l=>{s.value=Math.max(0,Math.min(l-1,e.length-1))},g=b(()=>s.value+1),I=b(()=>s.value===0),x=b(()=>s.value>=e.length-1),S=b(()=>!n.value.hasErrors),B=b(()=>n.value.isDirty),F=b(()=>n.value.errors);return{step:g,stepIndex:s,scope:o,next:r,prev:a,goTo:u,isFirst:I,isLast:x,status:n,errors:F,isValid:S,isDirty:B,validate:y,getErrors:d}}import{ref as ce,onUnmounted as me,readonly as de}from"vue";function pe(e){let t=m(),s=V(t.getState().values,e),o=ce(s),n=t.watch(e,i=>{D(o.value,i)||(o.value=i)});return me(n),de(o)}import{computed as K}from"vue";function ve(e,t,s){let o=m(),n=R(e),i=null,v=async d=>{if(d){o.beginFieldValidation(e),await o.clearFieldAsyncError(e);try{let r=await t(d);n.setValue(r.url),i=r.key,await o.clearFieldAsyncError(e)}catch(r){let a=r instanceof Error?r.message:"Upload failed";await o.setFieldAsyncError(e,a)}finally{o.endFieldValidation(e)}}},y=async()=>{if(i&&s)try{await s(i)}catch(d){let r=d instanceof Error?d.message:"Delete failed";await o.setFieldAsyncError(e,r);return}n.setValue(null),i=null,await o.clearFieldAsyncError(e)};return{value:n.value,setValue:n.setValue,error:K(()=>n.meta.error.value),isValidating:K(()=>n.meta.isValidating.value||!1),upload:v,remove:y}}export{z as provideBitStore,Q as useBitArray,R as useBitField,L as useBitForm,N as useBitHistory,oe as useBitScope,le as useBitSteps,m as useBitStore,ve as useBitUpload,pe as useBitWatch};
2
2
  //# sourceMappingURL=index.js.map