@effect-app/vue-components 2.0.0 → 2.1.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.
Files changed (75) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +24 -0
  2. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +1 -1
  3. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -2
  4. package/dist/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +34 -0
  5. package/dist/types/components/OmegaForm/OmegaTaggedUnionInternal.vue.d.ts +32 -0
  6. package/dist/types/components/OmegaForm/index.d.ts +3 -1
  7. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +26 -0
  8. package/dist/vue-components.es.js +30 -26
  9. package/dist/vue-components.es10.js +223 -341
  10. package/dist/vue-components.es11.js +29 -33
  11. package/dist/vue-components.es12.js +357 -2
  12. package/dist/vue-components.es13.js +34 -2
  13. package/dist/vue-components.es14.js +2 -10
  14. package/dist/vue-components.es15.js +2 -5
  15. package/dist/vue-components.es16.js +10 -54
  16. package/dist/vue-components.es17.js +5 -68
  17. package/dist/vue-components.es18.js +54 -6
  18. package/dist/vue-components.es19.js +68 -6
  19. package/dist/vue-components.es2.js +20 -16
  20. package/dist/vue-components.es20.js +6 -3
  21. package/dist/vue-components.es21.js +6 -3
  22. package/dist/vue-components.es22.js +3 -2
  23. package/dist/vue-components.es23.js +3 -2
  24. package/dist/vue-components.es24.js +2 -17
  25. package/dist/vue-components.es25.js +2 -11
  26. package/dist/vue-components.es26.js +2 -136
  27. package/dist/vue-components.es27.js +4 -0
  28. package/dist/vue-components.es28.js +17 -42
  29. package/dist/vue-components.es29.js +11 -2
  30. package/dist/vue-components.es30.js +136 -2
  31. package/dist/vue-components.es32.js +44 -0
  32. package/dist/vue-components.es33.js +2 -7
  33. package/dist/vue-components.es34.js +2 -32
  34. package/dist/vue-components.es37.js +7 -23
  35. package/dist/vue-components.es38.js +32 -5
  36. package/dist/vue-components.es40.js +4 -30
  37. package/dist/vue-components.es41.js +20 -19
  38. package/dist/vue-components.es42.js +5 -12
  39. package/dist/vue-components.es43.js +21 -5
  40. package/dist/vue-components.es44.js +29 -18
  41. package/dist/vue-components.es45.js +22 -9
  42. package/dist/vue-components.es46.js +7 -26
  43. package/dist/vue-components.es47.js +5 -48
  44. package/dist/vue-components.es48.js +19 -26
  45. package/dist/vue-components.es49.js +9 -11
  46. package/dist/vue-components.es5.js +2 -2
  47. package/dist/vue-components.es50.js +26 -60
  48. package/dist/vue-components.es51.js +37 -45
  49. package/dist/vue-components.es52.js +26 -17
  50. package/dist/vue-components.es53.js +10 -32
  51. package/dist/vue-components.es54.js +65 -29
  52. package/dist/vue-components.es55.js +45 -31
  53. package/dist/vue-components.es56.js +17 -2
  54. package/dist/vue-components.es57.js +29 -40
  55. package/dist/vue-components.es58.js +29 -2
  56. package/dist/vue-components.es59.js +44 -0
  57. package/dist/vue-components.es6.js +9 -9
  58. package/dist/vue-components.es60.js +4 -0
  59. package/dist/vue-components.es61.js +46 -0
  60. package/dist/vue-components.es62.js +4 -0
  61. package/dist/vue-components.es7.js +26 -25
  62. package/dist/vue-components.es8.js +51 -198
  63. package/dist/vue-components.es9.js +17 -30
  64. package/package.json +1 -1
  65. package/src/components/OmegaForm/InputProps.ts +32 -0
  66. package/src/components/OmegaForm/OmegaFormStuff.ts +22 -3
  67. package/src/components/OmegaForm/OmegaInput.vue +4 -1
  68. package/src/components/OmegaForm/OmegaInternalInput.vue +35 -13
  69. package/src/components/OmegaForm/OmegaTaggedUnion.vue +73 -0
  70. package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +38 -0
  71. package/src/components/OmegaForm/index.ts +3 -1
  72. package/src/components/OmegaForm/useOmegaForm.ts +178 -11
  73. package/dist/vue-components.es36.js +0 -6
  74. package/dist/vue-components.es39.js +0 -23
  75. /package/dist/{vue-components.es31.js → vue-components.es35.js} +0 -0
@@ -27,3 +27,27 @@ export type VuetifyInputProps<From extends Record<PropertyKey, any>, TName exten
27
27
  }[];
28
28
  };
29
29
  } & Pick<InputProps<From, TName>, "field" | "state">;
30
+ export type ExtractTagValue<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = DeepValue<From, TName> extends infer U ? U extends {
31
+ _tag: infer Tag;
32
+ } ? Tag : never : never;
33
+ export type ExtractUnionBranch<T, Tag> = T extends {
34
+ _tag: Tag;
35
+ } ? T : never;
36
+ export type TaggedUnionOption<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = {
37
+ readonly title: string;
38
+ readonly value: ExtractTagValue<From, TName> | null;
39
+ };
40
+ export type TaggedUnionOptionsArray<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = readonly [
41
+ {
42
+ readonly title: string;
43
+ readonly value: null;
44
+ },
45
+ ...ReadonlyArray<{
46
+ readonly title: string;
47
+ readonly value: ExtractTagValue<From, TName>;
48
+ }>
49
+ ];
50
+ export type TaggedUnionProps<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = {
51
+ name: TName;
52
+ options: TaggedUnionOptionsArray<From, TName>;
53
+ };
@@ -3,7 +3,7 @@ import { type DeepKeys, type DeepValue, type FieldAsyncValidateOrFn, type FieldV
3
3
  import { type RuntimeFiber } from "effect/Fiber";
4
4
  import { type OmegaFieldInternalApi } from "./InputProps";
5
5
  import { type OF, type OmegaFormReturn } from "./useOmegaForm";
6
- type Leaves<T, Path extends string = ""> = T extends ReadonlyArray<infer U> ? Leaves<U, `${Path}[number]`> & {} : {
6
+ export type Leaves<T, Path extends string = ""> = T extends ReadonlyArray<infer U> ? Leaves<U, `${Path}[number]`> & {} : {
7
7
  [K in keyof T]: T[K] extends string | boolean | number | null | undefined | symbol | bigint ? `${Path extends "" ? "" : `${Path}.`}${K & string}` : Leaves<T[K], `${Path extends "" ? "" : `${Path}.`}${K & string}`> & {};
8
8
  }[keyof T];
9
9
  type FlexibleArrayPath<T extends string> = T extends `${infer Before}[number]${infer After}` ? T | `${Before}[${number}]${FlexibleArrayPath<After>}` : T;
@@ -1,4 +1,4 @@
1
- import { type DeepKeys } from "@tanstack/vue-form";
1
+ import { type DeepKeys, type DeepValue } from "@tanstack/vue-form";
2
2
  import { type ComputedRef } from "vue";
3
3
  import type { OmegaFieldInternalApi } from "./InputProps";
4
4
  import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
@@ -26,7 +26,7 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends
26
26
  slots: {
27
27
  default?: (props: {
28
28
  field: OmegaFieldInternalApi<From, Name>;
29
- state: import("@tanstack/vue-form").FieldState<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").StandardSchemaV1<import("@tanstack/vue-form").DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateFn<From, Name>, import("@tanstack/vue-form").StandardSchemaV1<import("@tanstack/vue-form").DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateAsyncFn<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>>, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, any, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
29
+ state: import("@tanstack/vue-form").FieldState<From, Name, DeepValue<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").StandardSchemaV1<DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateFn<From, Name>, import("@tanstack/vue-form").StandardSchemaV1<DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateAsyncFn<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>>, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, DeepValue<From, Name>>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, any, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
30
30
  id: string;
31
31
  required?: boolean;
32
32
  minLength?: number | false;
@@ -0,0 +1,34 @@
1
+ import { type DeepKeys, type DeepValue } from "@tanstack/vue-form";
2
+ import { type TaggedUnionOptionsArray } from "./InputProps";
3
+ import { type useOmegaForm } from "./useOmegaForm";
4
+ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
+ props: __VLS_PrettifyLocal<{
6
+ name: Name;
7
+ form: ReturnType<typeof useOmegaForm<From, To>>;
8
+ type?: "select" | "radio";
9
+ options: TaggedUnionOptionsArray<From, Name>;
10
+ label?: string;
11
+ }> & import("vue").PublicProps;
12
+ expose: (exposed: {}) => void;
13
+ attrs: any;
14
+ slots: {
15
+ [x: string]: ((props: {
16
+ field: import("./InputProps").OmegaFieldInternalApi<From, Name>;
17
+ state: NonNullable<NonNullable<DeepValue<From, Name>>>;
18
+ }) => any) | undefined;
19
+ [x: number]: ((props: {
20
+ field: import("./InputProps").OmegaFieldInternalApi<From, Name>;
21
+ state: NonNullable<NonNullable<DeepValue<From, Name>>>;
22
+ }) => any) | undefined;
23
+ } & {
24
+ default?: (props: {}) => any;
25
+ };
26
+ emit: {};
27
+ }>) => import("vue").VNode & {
28
+ __ctx?: Awaited<typeof __VLS_setup>;
29
+ };
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
32
+ type __VLS_PrettifyLocal<T> = {
33
+ [K in keyof T as K]: T[K];
34
+ } & {};
@@ -0,0 +1,32 @@
1
+ import { type DeepKeys, type DeepValue } from "@tanstack/vue-form";
2
+ import { type OmegaFieldInternalApi } from "./InputProps";
3
+ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<{
5
+ state: DeepValue<From, Name>;
6
+ field: OmegaFieldInternalApi<From, Name>;
7
+ }> & import("vue").PublicProps;
8
+ expose: (exposed: {}) => void;
9
+ attrs: any;
10
+ slots: {
11
+ [x: string]: ((props: {
12
+ field: OmegaFieldInternalApi<From, Name>;
13
+ state: NonNullable<NonNullable<DeepValue<From, Name>>>;
14
+ }) => any) | undefined;
15
+ [x: number]: ((props: {
16
+ field: OmegaFieldInternalApi<From, Name>;
17
+ state: NonNullable<NonNullable<DeepValue<From, Name>>>;
18
+ }) => any) | undefined;
19
+ [x: symbol]: ((props: {
20
+ field: OmegaFieldInternalApi<From, Name>;
21
+ state: NonNullable<NonNullable<DeepValue<From, Name>>>;
22
+ }) => any) | undefined;
23
+ };
24
+ emit: {};
25
+ }>) => import("vue").VNode & {
26
+ __ctx?: Awaited<typeof __VLS_setup>;
27
+ };
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_PrettifyLocal<T> = {
31
+ [K in keyof T as K]: T[K];
32
+ } & {};
@@ -1,8 +1,10 @@
1
1
  export * from "./OmegaFormStuff";
2
2
  export { type OmegaConfig, type OmegaFormReturn, useOmegaForm } from "./useOmegaForm";
3
- export { type InputProps, type MergedInputProps } from "./InputProps";
3
+ export { type ExtractTagValue, type ExtractUnionBranch, type InputProps, type MergedInputProps, type TaggedUnionOption, type TaggedUnionOptionsArray, type TaggedUnionProps } from "./InputProps";
4
4
  export { default as OmegaInput } from "./OmegaInput.vue";
5
5
  export { default as OmegaVuetifyInput } from "./OmegaInternalInput.vue";
6
+ export { default as OmegaTaggedUnion } from "./OmegaTaggedUnion.vue";
7
+ export { default as OmegaTaggedUnionInternal } from "./OmegaTaggedUnionInternal.vue";
6
8
  export { useOnClose, usePreventClose } from "./blockDialog";
7
9
  export { getInputType } from "./OmegaFormStuff";
8
10
  export { createUseFormWithCustomInput } from "./createUseFormWithCustomInput";
@@ -36,6 +36,15 @@ export type OmegaConfig<T> = {
36
36
  id?: string;
37
37
  } & keysRule<T>;
38
38
  ignorePreventCloseEvents?: boolean;
39
+ /**
40
+ * Prevents browser window/tab exit when form has unsaved changes.
41
+ * Shows native browser "Leave site?" dialog.
42
+ *
43
+ * @remarks
44
+ * - Opt-in only: Must explicitly enable
45
+ * - Independent from data persistence feature
46
+ */
47
+ preventWindowExit?: "prevent" | "prevent-and-reset" | "nope";
39
48
  input?: any;
40
49
  };
41
50
  export interface OF<From, To> extends OmegaFormApi<From, To> {
@@ -93,6 +102,23 @@ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To exten
93
102
  }>) => import("vue").VNode & {
94
103
  __ctx?: Awaited<typeof __VLS_setup>;
95
104
  };
105
+ TaggedUnion: <Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
106
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
107
+ name: Name;
108
+ type?: "select" | "radio";
109
+ options: import("./InputProps").TaggedUnionOptionsArray<From, Name>;
110
+ label?: string;
111
+ } & {}> & import("vue").PublicProps;
112
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
113
+ attrs: any;
114
+ slots: Record<string, (props: {
115
+ field: import("@tanstack/vue-form").FieldApi<From, Name, DeepValue<From, Name>, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
116
+ state: import("@tanstack/vue-form").FieldState<From, Name, DeepValue<From, Name>, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
117
+ }) => any>;
118
+ emit: {};
119
+ }>) => import("vue").VNode & {
120
+ __ctx?: Awaited<typeof __VLS_setup>;
121
+ };
96
122
  Array: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
97
123
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaArrayProps<From, To>, "form">) & {}> & import("vue").PublicProps;
98
124
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
@@ -1,39 +1,43 @@
1
1
  import * as o from "./vue-components.es2.js";
2
- import { getTransformationFrom as f, provideIntl as u, useIntl as s, useIntlKey as l } from "./vue-components.es3.js";
2
+ import { getTransformationFrom as f, provideIntl as u, useIntl as l, useIntlKey as s } from "./vue-components.es3.js";
3
3
  import { default as i } from "./vue-components.es4.js";
4
- import { default as x } from "./vue-components.es5.js";
5
- import { default as g } from "./vue-components.es6.js";
6
- import { default as F } from "./vue-components.es7.js";
7
- import { useOmegaForm as h } from "./vue-components.es8.js";
8
- import { useOnClose as S, usePreventClose as b } from "./vue-components.es9.js";
9
- import { createMeta as j, duplicateSchema as v, generateInputStandardSchemaFromFieldMeta as P, generateMetaFromSchema as T, getInputType as k, nullableInput as w } from "./vue-components.es10.js";
10
- import { createUseFormWithCustomInput as D } from "./vue-components.es11.js";
11
- function a(r) {
4
+ import { default as g } from "./vue-components.es5.js";
5
+ import { default as I } from "./vue-components.es6.js";
6
+ import { default as y } from "./vue-components.es7.js";
7
+ import { default as h } from "./vue-components.es8.js";
8
+ import { default as S } from "./vue-components.es9.js";
9
+ import { useOmegaForm as b } from "./vue-components.es10.js";
10
+ import { useOnClose as U, usePreventClose as j } from "./vue-components.es11.js";
11
+ import { createMeta as P, duplicateSchema as k, generateInputStandardSchemaFromFieldMeta as w, generateMetaFromSchema as B, getInputType as D, nullableInput as K } from "./vue-components.es12.js";
12
+ import { createUseFormWithCustomInput as W } from "./vue-components.es13.js";
13
+ function r(a) {
12
14
  for (const e in o)
13
15
  if (Object.prototype.hasOwnProperty.call(o, e)) {
14
16
  const t = o[e];
15
- t && typeof t == "object" && r.component(e, t);
17
+ t && typeof t == "object" && a.component(e, t);
16
18
  }
17
19
  }
18
- const n = { install: a };
20
+ const n = { install: r };
19
21
  export {
20
22
  i as CommandButton,
21
- x as Dialog,
22
- g as OmegaInput,
23
- F as OmegaVuetifyInput,
24
- j as createMeta,
25
- D as createUseFormWithCustomInput,
23
+ g as Dialog,
24
+ I as OmegaInput,
25
+ h as OmegaTaggedUnion,
26
+ S as OmegaTaggedUnionInternal,
27
+ y as OmegaVuetifyInput,
28
+ P as createMeta,
29
+ W as createUseFormWithCustomInput,
26
30
  n as default,
27
- v as duplicateSchema,
28
- P as generateInputStandardSchemaFromFieldMeta,
29
- T as generateMetaFromSchema,
30
- k as getInputType,
31
+ k as duplicateSchema,
32
+ w as generateInputStandardSchemaFromFieldMeta,
33
+ B as generateMetaFromSchema,
34
+ D as getInputType,
31
35
  f as getTransformationFrom,
32
- w as nullableInput,
36
+ K as nullableInput,
33
37
  u as provideIntl,
34
- s as useIntl,
35
- l as useIntlKey,
36
- h as useOmegaForm,
37
- S as useOnClose,
38
- b as usePreventClose
38
+ l as useIntl,
39
+ s as useIntlKey,
40
+ b as useOmegaForm,
41
+ U as useOnClose,
42
+ j as usePreventClose
39
43
  };