hanap-labs 4.1.2 → 4.2.0

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.
@@ -888,7 +888,7 @@ var mt = {
888
888
  title: "",
889
889
  durationMs: 0,
890
890
  colorClass: mt.success
891
- }), Z = i(void 0), gt = (e) => Array.isArray(e) ? e[0] ?? "Something went wrong" : e, _t = () => {
891
+ }), Z = i(void 0), gt = (e) => Array.isArray(e) ? e.length > 0 ? e.join("\n") : "Something went wrong" : e, _t = () => {
892
892
  Z.value !== void 0 && (clearTimeout(Z.value), Z.value = void 0);
893
893
  }, vt = () => {
894
894
  X.value.visible = !1, _t();
@@ -928,43 +928,43 @@ function Ct() {
928
928
  }
929
929
  //#endregion
930
930
  //#region src/composables/ui/usePopup.ts
931
- var wt = 0, Tt = null, Et = null, $ = i({
931
+ var wt = 0, Tt = null, Et = null, Dt = 300, $ = i({
932
932
  isVisible: !1,
933
933
  type: "confirm",
934
934
  component: null,
935
935
  props: void 0,
936
936
  loading: !1
937
- }), Dt = () => {
937
+ }), Ot = () => {
938
938
  Tt = null, Et = null;
939
- }, Ot = () => {
940
- Dt(), $.value = {
939
+ }, kt = () => {
940
+ Ot(), $.value = {
941
941
  isVisible: !1,
942
942
  type: "confirm",
943
943
  component: null,
944
944
  props: void 0,
945
945
  loading: !1
946
946
  };
947
- }, kt = () => {
948
- setTimeout(Ot, 300);
949
- }, At = (e) => {
947
+ }, At = () => {
948
+ setTimeout(kt, Dt);
949
+ }, jt = (e) => {
950
950
  console.error("[usePopup] popup callback failed", e);
951
- }, jt = (e) => e instanceof Promise, Mt = () => {
951
+ }, Mt = (e) => e instanceof Promise, Nt = () => {
952
952
  if (Et !== null) try {
953
953
  let e = Et();
954
- jt(e) && e.catch(At);
954
+ Mt(e) && e.catch(jt);
955
955
  } catch (e) {
956
- At(e);
956
+ jt(e);
957
957
  }
958
- }, Nt = () => {
959
- $.value.isVisible = !1, kt();
960
- }, Pt = (e) => {
958
+ }, Pt = () => {
959
+ $.value.isVisible = !1, At();
960
+ }, Ft = (e) => {
961
961
  let t = {
962
962
  onConfirm: (n) => (wt === e && (Tt = n), t),
963
963
  onCancel: (n) => (wt === e && (Et = n), t)
964
964
  };
965
965
  return t;
966
- }, Ft = (e) => {
967
- Dt();
966
+ }, It = (e) => {
967
+ Ot();
968
968
  let n = wt + 1;
969
969
  return wt = n, e.type === "confirm" ? ($.value = {
970
970
  isVisible: !0,
@@ -980,38 +980,38 @@ var wt = 0, Tt = null, Et = null, $ = i({
980
980
  hideIcon: e.hideIcon
981
981
  },
982
982
  loading: !1
983
- }, Pt(n)) : ($.value = {
983
+ }, Ft(n)) : ($.value = {
984
984
  isVisible: !0,
985
985
  type: "custom",
986
986
  component: t(e.component),
987
987
  props: e.props,
988
988
  loading: !1
989
- }, Pt(n));
990
- }, It = () => {
991
- $.value.loading || (Nt(), Mt());
989
+ }, Ft(n));
992
990
  }, Lt = () => {
991
+ $.value.loading || (Pt(), Nt());
992
+ }, Rt = () => {
993
993
  if (!$.value.loading) {
994
994
  if (Tt === null) {
995
- Nt();
995
+ Pt();
996
996
  return;
997
997
  }
998
998
  try {
999
999
  let e = Tt();
1000
- if (!jt(e)) {
1001
- Nt();
1000
+ if (!Mt(e)) {
1001
+ Pt();
1002
1002
  return;
1003
1003
  }
1004
1004
  $.value.loading = !0, e.then(() => {
1005
- $.value.loading = !1, Nt();
1005
+ $.value.loading = !1, Pt();
1006
1006
  }).catch((e) => {
1007
- $.value.loading = !1, At(e);
1007
+ $.value.loading = !1, jt(e);
1008
1008
  });
1009
1009
  } catch (e) {
1010
- At(e);
1010
+ jt(e);
1011
1011
  }
1012
1012
  }
1013
1013
  };
1014
- function Rt() {
1014
+ function zt() {
1015
1015
  let t = e(() => $.value.loading);
1016
1016
  return {
1017
1017
  isVisible: e(() => $.value.isVisible),
@@ -1020,10 +1020,10 @@ function Rt() {
1020
1020
  type: e(() => $.value.type),
1021
1021
  component: e(() => $.value.component),
1022
1022
  props: e(() => $.value.props),
1023
- open: Ft,
1024
- close: It,
1025
- confirm: Lt
1023
+ open: It,
1024
+ close: Lt,
1025
+ confirm: Rt
1026
1026
  };
1027
1027
  }
1028
1028
  //#endregion
1029
- export { m as a, p as i, Ct as n, g as o, pt as r, _ as s, Rt as t };
1029
+ export { m as a, p as i, Ct as n, g as o, pt as r, _ as s, zt as t };
@@ -1,2 +1,2 @@
1
- import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b, v as x, w as S, x as C, y as w } from "../chunks/components-Br1GnFMZ.js";
1
+ import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b, v as x, w as S, x as C, y as w } from "../chunks/components-D54CJnNa.js";
2
2
  export { C as HLAvatar, t as HLBreadcrumb, a as HLButton, w as HLCard, r as HLCheckbox, y as HLDatepicker, e as HLIcon, l as HLInput, x as HLLabel, u as HLMenuAction, g as HLNotify, p as HLNotifyToast, f as HLPopup, b as HLPopupContent, h as HLSelect, i as HLSkeleton, _ as HLTable, d as HLTabs, m as HLTextarea, S as HL_ICON_NAMES, s as createNotifyPlugin, v as createPopupPlugin, n as getHLIconSvg, c as unmountNotifyHost, o as unmountPopupHost };
@@ -1,3 +1,3 @@
1
- import { n as e, r as t, t as n } from "../chunks/usePopup-BdVwAd1y.js";
2
- import { a as r, i, n as a, o, r as s, s as c, t as l } from "../chunks/composables-siB8Ytxt.js";
1
+ import { n as e, r as t, t as n } from "../chunks/usePopup-5KO7GsFF.js";
2
+ import { a as r, i, n as a, o, r as s, s as c, t as l } from "../chunks/composables-D3jAKf-3.js";
3
3
  export { i as createQueryPlugin, a as createUseMutation, r as createUseQuery, t as useFloat, l as useForm, s as useMutation, e as useNotify, n as usePopup, o as useQuery, c as useTheme };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as e, n as t, r as n, t as r } from "./chunks/usePopup-BdVwAd1y.js";
2
- import { C as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as ee, h as te, i as ne, l as re, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./chunks/components-Br1GnFMZ.js";
1
+ import { a as e, n as t, r as n, t as r } from "./chunks/usePopup-5KO7GsFF.js";
2
+ import { C as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as ee, h as te, i as ne, l as re, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./chunks/components-D54CJnNa.js";
3
3
  import { t as ge } from "./chunks/helpers-CBknuK3h.js";
4
- import { a as _e, i as ve, n as ye, o as be, r as xe, s as Se, t as Ce } from "./chunks/composables-siB8Ytxt.js";
4
+ import { a as _e, i as ve, n as ye, o as be, r as xe, s as Se, t as Ce } from "./chunks/composables-D3jAKf-3.js";
5
5
  import { createToolkitAutoImportModules as we, createToolkitAutoImportOptions as Te, createToolkitComponentsResolver as Ee } from "./auto-import/index.js";
6
6
  //#region node_modules/zod/v4/core/core.js
7
7
  var De, Oe = /* @__PURE__ */ Object.freeze({ status: "aborted" });
@@ -0,0 +1,2 @@
1
+ import type { Ref } from "vue";
2
+ export declare function toReadonlyRef<TValue>(source: Ref<TValue>): Readonly<Ref<TValue>>;
@@ -15,6 +15,7 @@ type MutationOptions<TData, TError, TVariables, TContext> = {
15
15
  onError?: MutationErrorHandler<TError, TVariables, TContext>;
16
16
  onSettled?: MutationSettledHandler<TData, TError, TVariables, TContext>;
17
17
  };
18
+ type UseMutationGlobalOptions = Pick<MutationOptions<never, never, never, never>, "gcTime" | "retry" | "retryDelay">;
18
19
  type UseMutationReturn<TData, TError, TVariables, TContext = unknown> = {
19
20
  data: Readonly<Ref<TData | undefined>>;
20
21
  error: Readonly<Ref<TError | null>>;
@@ -29,6 +30,6 @@ type UseMutationReturn<TData, TError, TVariables, TContext = unknown> = {
29
30
  run: (...args: MutationRunArgs<TVariables>) => Promise<TData>;
30
31
  status: Readonly<Ref<HLMutationStatus>>;
31
32
  };
32
- export declare function createUseMutation<TGlobalError = Error>(): <TData = unknown, TError = TGlobalError, TVariables = void, TContext = unknown>(mutationFn: MutationFunction<TData, TVariables>, options?: MutationOptions<TData, TError, TVariables, TContext>) => UseMutationReturn<TData, TError, TVariables, TContext>;
33
+ export declare function createUseMutation<TGlobalError = Error>(globalOptions?: UseMutationGlobalOptions): <TData = unknown, TError = TGlobalError, TVariables = void, TContext = unknown>(mutationFn: MutationFunction<TData, TVariables>, options?: MutationOptions<TData, TError, TVariables, TContext>) => UseMutationReturn<TData, TError, TVariables, TContext>;
33
34
  export declare const useMutation: <TData = unknown, TError = Error, TVariables = void, TContext = unknown>(mutationFn: MutationFunction<TData, TVariables>, options?: MutationOptions<TData, TError, TVariables, TContext> | undefined) => UseMutationReturn<TData, TError, TVariables, TContext>;
34
- export type { HLMutationStatus, MutationErrorHandler, MutationFunction, MutationMutateHandler, MutationOptions, MutationRunArgs, MutationSettledHandler, MutationSuccessHandler, UseMutationReturn, };
35
+ export type { HLMutationStatus, MutationErrorHandler, MutationFunction, MutationMutateHandler, MutationOptions, MutationRunArgs, MutationSettledHandler, MutationSuccessHandler, UseMutationGlobalOptions, UseMutationReturn, };
@@ -1,5 +1,7 @@
1
1
  import { type Ref } from "vue";
2
- type FormShape = Record<string, unknown>;
2
+ type FormShape = {
3
+ [key: string]: unknown;
4
+ };
3
5
  type FormErrors = Record<string, string[]>;
4
6
  type FormFieldErrors = Record<string, string[] | undefined>;
5
7
  type FormValidatorSuccess<TValues extends FormShape> = {
@@ -43,4 +45,4 @@ interface UseFormReturn<TValues extends FormShape> extends UseFormState<TValues>
43
45
  onSubmit: <TResult>(handler: FormSubmitHandler<TValues, TResult>) => UseFormSubmitReturn<TValues, TResult>;
44
46
  }
45
47
  export declare function useForm<TValues extends FormShape>(initialValues: TValues, schema?: FormValidator<TValues>): UseFormReturn<TValues>;
46
- export type { FormErrors, FormValidator, FormValidatorError, FormValidatorFailure, FormValidatorResult, FormValidatorSuccess, FormSubmitHandler, ValidationResult, };
48
+ export type { FormErrors, FormSubmitHandler, FormValidator, FormValidatorError, FormValidatorFailure, FormValidatorResult, FormValidatorSuccess, UseFormReturn, UseFormState, ValidationResult, };
@@ -11,6 +11,6 @@ export type { EnabledResolver, HLQueryContext, HLQueryKey, HLQueryStatus, QueryE
11
11
  export { createQueryPlugin } from "./data/queryPlugin";
12
12
  export type { HLQueryPluginOptions } from "./data/queryPlugin";
13
13
  export { createUseMutation, useMutation } from "./data/useMutation";
14
- export type { HLMutationStatus, MutationErrorHandler, MutationFunction, MutationMutateHandler, MutationOptions, MutationRunArgs, MutationSettledHandler, MutationSuccessHandler, UseMutationReturn, } from "./data/useMutation";
14
+ export type { HLMutationStatus, MutationErrorHandler, MutationFunction, MutationMutateHandler, MutationOptions, MutationRunArgs, MutationSettledHandler, MutationSuccessHandler, UseMutationGlobalOptions, UseMutationReturn, } from "./data/useMutation";
15
15
  export { useForm } from "./form/useForm";
16
- export type { FormErrors, FormValidator, FormValidatorError, FormValidatorFailure, FormValidatorResult, FormValidatorSuccess, ValidationResult, } from "./form/useForm";
16
+ export type { FormErrors, FormSubmitHandler, FormValidator, FormValidatorError, FormValidatorFailure, FormValidatorResult, FormValidatorSuccess, UseFormReturn, UseFormState, ValidationResult, } from "./form/useForm";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hanap-labs",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "vue",