@formisch/preact 0.7.0 → 0.7.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.
@@ -11,6 +11,7 @@ import { JSX } from "preact";
11
11
  type Schema = v.GenericSchema | v.GenericSchemaAsync;
12
12
  //#endregion
13
13
  //#region src/types/signal.d.ts
14
+
14
15
  /**
15
16
  * Batch interface.
16
17
  */
@@ -475,7 +476,7 @@ declare function getInput<TSchema extends Schema, TFieldPath extends RequiredPat
475
476
  *
476
477
  * @returns A submit event handler function to attach to the form element.
477
478
  */
478
- declare function handleSubmit<TSchema extends Schema>(form: BaseFormStore<TSchema>, handler: SubmitHandler<TSchema>): (event: SubmitEvent) => void;
479
+ declare function handleSubmit<TSchema extends Schema>(form: BaseFormStore<TSchema>, handler: SubmitHandler<TSchema>): (event: SubmitEvent) => Promise<void>;
479
480
  //#endregion
480
481
  //#region src/insert/insert.d.ts
481
482
  /**
@@ -278,9 +278,8 @@ function getElementInput(element, internalFieldStore) {
278
278
  return element.checked;
279
279
  }
280
280
  if (element.type === "radio") {
281
- const prevValue = untrack(() => /* @__PURE__ */ getFieldInput(internalFieldStore));
282
- if (element.checked) return [...prevValue, element.value];
283
- return prevValue.filter((value) => value !== element.value);
281
+ if (element.checked) return element.value;
282
+ return untrack(() => /* @__PURE__ */ getFieldInput(internalFieldStore));
284
283
  }
285
284
  if (element.type === "file") {
286
285
  if (element.multiple) return [...element.files];
@@ -811,7 +810,7 @@ function usePathSignal(path) {
811
810
  //#region src/hooks/useField/useField.ts
812
811
  /* @__NO_SIDE_EFFECTS__ */
813
812
  function useField(form, config) {
814
- const pathSignal = usePathSignal(config.path);
813
+ const pathSignal = /* @__PURE__ */ usePathSignal(config.path);
815
814
  const internalFormStore = form[INTERNAL];
816
815
  const internalFieldStore = useComputed(() => getFieldStore(internalFormStore, pathSignal.value));
817
816
  useSignalEffect(() => {
@@ -856,7 +855,7 @@ function useField(form, config) {
856
855
  //#region src/hooks/useFieldArray/useFieldArray.ts
857
856
  /* @__NO_SIDE_EFFECTS__ */
858
857
  function useFieldArray(form, config) {
859
- const pathSignal = usePathSignal(config.path);
858
+ const pathSignal = /* @__PURE__ */ usePathSignal(config.path);
860
859
  const internalFieldStore = useComputed(() => getFieldStore(form[INTERNAL], pathSignal.value));
861
860
  return useMemo(() => ({
862
861
  path: pathSignal,
@@ -904,8 +903,7 @@ function useForm(config) {
904
903
  */
905
904
  /* @__NO_SIDE_EFFECTS__ */
906
905
  function Field({ of, path, children }) {
907
- const field = useField(of, { path });
908
- return children(field);
906
+ return children(/* @__PURE__ */ useField(of, { path }));
909
907
  }
910
908
 
911
909
  //#endregion
@@ -922,14 +920,13 @@ function Field({ of, path, children }) {
922
920
  */
923
921
  /* @__NO_SIDE_EFFECTS__ */
924
922
  function FieldArray({ of, path, children }) {
925
- const field = useFieldArray(of, { path });
926
- return children(field);
923
+ return children(/* @__PURE__ */ useFieldArray(of, { path }));
927
924
  }
928
925
 
929
926
  //#endregion
930
927
  //#region src/components/Form/Form.tsx
931
928
  /* @__NO_SIDE_EFFECTS__ */
932
- function Form({ of, onSubmit,...other }) {
929
+ function Form({ of, onSubmit, ...other }) {
933
930
  return /* @__PURE__ */ jsx("form", {
934
931
  ...other,
935
932
  novalidate: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/preact",
3
3
  "description": "The modular and type-safe form library for Preact",
4
- "version": "0.7.0",
4
+ "version": "0.7.2",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -39,12 +39,12 @@
39
39
  "eslint": "^9.31.0",
40
40
  "eslint-config-preact": "^2.0.0",
41
41
  "preact": "^10.25.3",
42
- "tsdown": "^0.12.9",
42
+ "tsdown": "^0.16.8",
43
43
  "typescript": "^5.8.3",
44
44
  "typescript-eslint": "^8.37.0",
45
45
  "vite": "^6.0.4",
46
- "@formisch/core": "0.4.2",
47
- "@formisch/methods": "0.5.0"
46
+ "@formisch/methods": "0.5.1",
47
+ "@formisch/core": "0.4.3"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@preact/signals": "^2.0.0",