@effect-app/vue-components 4.0.0-beta.20 → 4.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -183,6 +183,30 @@ In [tsconfig.json](tsconfig.js), set the following to address [Issue #32](https:
183
183
  }
184
184
  ```
185
185
 
186
+ ## v4 Breaking Changes (from v3)
187
+
188
+ ### 1. Vuetify 4 CSS Reset Removed
189
+
190
+ Vuetify 4 removed the aggressive global CSS reset that v3 included (universal `margin: 0; padding: 0`, list/heading/input resets, etc.). If your app relied on these defaults, opt in to the supplemental reset:
191
+
192
+ ```ts
193
+ import '@effect-app/vue-components/reset.css'
194
+ ```
195
+
196
+ ### 2. Nested union `_tag` handling
197
+
198
+ `S.TaggedStruct` produces a bare `Literal` AST node, while legacy `S.Struct({ _tag: S.Literal("X") })` produces `Union([Literal("X")])` after `AST.toType`. Both patterns now correctly produce `"select"` metadata thanks to the `unwrapSingleLiteralUnion` helper. A `console.warn` is emitted for the legacy pattern to encourage migration to `TaggedStruct`.
199
+
200
+ ### 3. `UndefinedOr` defaults include the key with explicit `undefined`
201
+
202
+ - **v3**: `defaultsValueFromSchema` skipped keys where the recursive call returned `undefined`, so `UndefinedOr` fields were omitted from the result object entirely.
203
+ - **v4**: The key is present in the result with an explicit `undefined` value.
204
+
205
+ ### 4. `S.optionalKey(X).pipe(S.withDecodingDefault(...))` support
206
+
207
+ - **v3**: Not supported. The v3 equivalent `S.optionalWith` encoded defaults inside a `PropertySignatureTransformation`, opaque to AST inspection.
208
+ - **v4**: `defaultsValueFromSchema` detects `PropertySignatureTransformation` and extracts defaults, enabling `withDecodingDefault` as a new pattern for declaring field defaults directly on the schema.
209
+
186
210
  ### On Submit event
187
211
  The :on-submit event could be tricky in `<OmegaForm />` component.
188
212
  This is a prop that is basically a map of Tanstack Form `onSubmit` option and accept a function that return a Promise. If you want to use it as an event, you have to manage the state of loading yourself with `@submit` with a function returning `void`
package/dist/reset.css ADDED
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Supplemental CSS reset for Vuetify 4.
3
+ * Vuetify 4 removed the aggressive global reset that v3 included.
4
+ * Import this file to restore equivalent behavior:
5
+ * import '@effect-app/vue-components/reset.css'
6
+ */
7
+
8
+ body {
9
+ margin: 0;
10
+ }
11
+
12
+ ul,
13
+ ol {
14
+ margin: 0;
15
+ padding: 0;
16
+ list-style: none;
17
+ }
18
+
19
+ h1,
20
+ h2,
21
+ h3,
22
+ h4,
23
+ h5,
24
+ h6 {
25
+ margin: 0;
26
+ font-size: inherit;
27
+ font-weight: inherit;
28
+ }
29
+
30
+ p {
31
+ margin: 0;
32
+ }
33
+
34
+ input,
35
+ textarea,
36
+ select {
37
+ border: 0;
38
+ background: transparent;
39
+ }
40
+
41
+ a {
42
+ text-decoration: none;
43
+ color: inherit;
44
+ }
45
+
46
+ figure,
47
+ details,
48
+ summary {
49
+ margin: 0;
50
+ padding: 0;
51
+ }
@@ -1,6 +1,6 @@
1
1
  import { Effect, S } from "effect-app";
2
2
  import { type DeepKeys, type DeepValue, type FieldAsyncValidateOrFn, type FieldValidateOrFn, type FormApi, type FormAsyncValidateOrFn, type FormOptions, type FormState, type FormValidateOrFn, type StandardSchemaV1, type VueFormApi } from "@tanstack/vue-form";
3
- import type * as Fiber from "effect/Fiber";
3
+ import type { Fiber as EffectFiber } from "effect/Fiber";
4
4
  import { useIntl } from "../../utils";
5
5
  import { type OmegaFieldInternalApi } from "./InputProps";
6
6
  import { type OF, type OmegaFormReturn } from "./useOmegaForm";
@@ -67,7 +67,7 @@ export type FormProps<From, To> = Omit<FormOptions<From, FormValidateOrFn<From>
67
67
  formApi: OmegaFormParams<From, To>;
68
68
  meta: any;
69
69
  value: To;
70
- }) => Promise<any> | Fiber.Fiber<any, any> | Effect.Effect<unknown, any, never>;
70
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>;
71
71
  };
72
72
  export type OmegaFormParams<From, To> = FormApi<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, Record<string, any> | undefined>;
73
73
  export type OmegaFormState<From, To> = FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
@@ -114,10 +114,13 @@ export type MultipleFieldMeta = BaseFieldMeta & {
114
114
  export type BooleanFieldMeta = BaseFieldMeta & {
115
115
  type: "boolean";
116
116
  };
117
+ export type DateFieldMeta = BaseFieldMeta & {
118
+ type: "date";
119
+ };
117
120
  export type UnknownFieldMeta = BaseFieldMeta & {
118
121
  type: "unknown";
119
122
  };
120
- export type FieldMeta = StringFieldMeta | NumberFieldMeta | SelectFieldMeta | MultipleFieldMeta | BooleanFieldMeta | UnknownFieldMeta;
123
+ export type FieldMeta = StringFieldMeta | NumberFieldMeta | SelectFieldMeta | MultipleFieldMeta | BooleanFieldMeta | DateFieldMeta | UnknownFieldMeta;
121
124
  export type MetaRecord<T = string> = {
122
125
  [K in NestedKeyOf<T>]?: FieldMeta;
123
126
  };
@@ -147,7 +150,6 @@ export declare const generateMetaFromSchema: <From, To>(schema: S.Codec<To, From
147
150
  unionMeta: Record<string, MetaRecord<To>>;
148
151
  };
149
152
  export declare const generateInputStandardSchemaFromFieldMeta: (meta: FieldMeta, trans?: ReturnType<typeof useIntl>["trans"]) => StandardSchemaV1<any, any>;
150
- export declare const nullableInput: <A, I, R>(schema: S.Codec<A, I, R>, _defaultValue: () => A) => any;
151
153
  export type OmegaAutoGenMeta<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = Omit<OmegaInputProps<From, To, Name>, "form">;
152
154
  declare const supportedInputs: readonly ["button", "checkbox", "color", "date", "email", "number", "password", "radio", "range", "search", "submit", "tel", "text", "time", "url"];
153
155
  export type SupportedInputs = typeof supportedInputs[number];
@@ -1,15 +1,15 @@
1
1
  import * as o from "./vue-components.es2.js";
2
- import { getTransformationFrom as f, provideIntl as l, useIntl as u, useIntlKey as s } from "./vue-components.es3.js";
2
+ import { getTransformationFrom as p, provideIntl as l, useIntl as s, useIntlKey as u } from "./vue-components.es3.js";
3
3
  import { default as i } from "./vue-components.es4.js";
4
4
  import { default as g } from "./vue-components.es5.js";
5
5
  import { default as I } from "./vue-components.es6.js";
6
6
  import { default as y } from "./vue-components.es7.js";
7
7
  import { default as h } from "./vue-components.es8.js";
8
- import { default as b } from "./vue-components.es9.js";
9
- import { useOmegaForm as M } from "./vue-components.es10.js";
10
- import { useOnClose as U, usePreventClose as j } from "./vue-components.es11.js";
11
- import { createMeta as P, deepMerge as V, defaultsValueFromSchema as k, duplicateSchema as w, generateInputStandardSchemaFromFieldMeta as B, generateMetaFromSchema as D, getInputType as K, isNullableOrUndefined as N, nullableInput as W } from "./vue-components.es12.js";
12
- import { createUseFormWithCustomInput as q } from "./vue-components.es13.js";
8
+ import { default as C } from "./vue-components.es9.js";
9
+ import { useOmegaForm as T } from "./vue-components.es10.js";
10
+ import { useOnClose as b, usePreventClose as j } from "./vue-components.es11.js";
11
+ import { createMeta as P, deepMerge as V, defaultsValueFromSchema as k, duplicateSchema as w, generateInputStandardSchemaFromFieldMeta as B, generateMetaFromSchema as D, getInputType as K, isNullableOrUndefined as N } from "./vue-components.es12.js";
12
+ import { createUseFormWithCustomInput as $ } from "./vue-components.es13.js";
13
13
  function r(a) {
14
14
  for (const e in o)
15
15
  if (Object.prototype.hasOwnProperty.call(o, e)) {
@@ -23,10 +23,10 @@ export {
23
23
  g as Dialog,
24
24
  I as OmegaInput,
25
25
  h as OmegaTaggedUnion,
26
- b as OmegaTaggedUnionInternal,
26
+ C as OmegaTaggedUnionInternal,
27
27
  y as OmegaVuetifyInput,
28
28
  P as createMeta,
29
- q as createUseFormWithCustomInput,
29
+ $ as createUseFormWithCustomInput,
30
30
  V as deepMerge,
31
31
  n as default,
32
32
  k as defaultsValueFromSchema,
@@ -34,13 +34,12 @@ export {
34
34
  B as generateInputStandardSchemaFromFieldMeta,
35
35
  D as generateMetaFromSchema,
36
36
  K as getInputType,
37
- f as getTransformationFrom,
37
+ p as getTransformationFrom,
38
38
  N as isNullableOrUndefined,
39
- W as nullableInput,
40
39
  l as provideIntl,
41
- u as useIntl,
42
- s as useIntlKey,
43
- M as useOmegaForm,
44
- U as useOnClose,
40
+ s as useIntl,
41
+ u as useIntlKey,
42
+ T as useOmegaForm,
43
+ b as useOnClose,
45
44
  j as usePreventClose
46
45
  };
@@ -1,17 +1,17 @@
1
1
  import { useForm as K } from "@tanstack/vue-form";
2
2
  import { Data as T, S as I, Effect as m, Fiber as V, Option as z, Array as P } from "effect-app";
3
- import { runtimeFiberAsPromise as W } from "./vue-components.es18.js";
3
+ import { runtimeFiberAsPromise as W } from "./vue-components.es17.js";
4
4
  import { computed as $, onUnmounted as D, onMounted as G, onBeforeUnmount as Z, watch as R, ref as Q, h as J } from "vue";
5
5
  import { useIntl as X } from "./vue-components.es3.js";
6
- import Y from "./vue-components.es19.js";
7
- import C from "./vue-components.es20.js";
8
- import ee from "./vue-components.es21.js";
6
+ import Y from "./vue-components.es18.js";
7
+ import C from "./vue-components.es19.js";
8
+ import ee from "./vue-components.es20.js";
9
9
  import { generateMetaFromSchema as re, deepMerge as N, defaultsValueFromSchema as te } from "./vue-components.es12.js";
10
10
  import se from "./vue-components.es6.js";
11
11
  import ne from "./vue-components.es8.js";
12
- import oe from "./vue-components.es22.js";
13
- import { trace as H } from "./vue-components.es23.js";
14
- import { context as _ } from "./vue-components.es24.js";
12
+ import oe from "./vue-components.es21.js";
13
+ import { trace as H } from "./vue-components.es22.js";
14
+ import { context as _ } from "./vue-components.es23.js";
15
15
  class ie extends T.TaggedError("FormErrors") {
16
16
  }
17
17
  const M = (a) => function(s) {
@@ -1,6 +1,6 @@
1
- import l from "./vue-components.es29.js";
1
+ import l from "./vue-components.es28.js";
2
2
  import { inject as c, provide as u } from "vue";
3
- import { onMountedWithCleanup as f } from "./vue-components.es16.js";
3
+ import { onMountedWithCleanup as f } from "./vue-components.es29.js";
4
4
  const p = () => l(), i = /* @__PURE__ */ Symbol("DialogBus"), r = () => c(i, null), g = () => {
5
5
  const n = p();
6
6
  return u(i, n), n;