@effect-app/vue-components 2.4.0 → 2.4.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.
@@ -3,8 +3,14 @@ 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
- export type FieldPath<T, Path extends string = ""> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? `${Path extends "" ? "" : `${Path}`}` : T extends ReadonlyArray<infer U> ? (FieldPath<U, `${Path}[${number}]`> & {}) | Path : {
7
- [K in keyof T]: T[K] extends string | boolean | number | null | undefined | symbol | bigint ? `${Path extends "" ? "" : `${Path}.`}${K & string}` : FieldPath<T[K], `${Path extends "" ? "" : `${Path}.`}${K & string}`> & {};
6
+ type ForceComputation<T> = {
7
+ [K in keyof T]: T[K];
8
+ } & {};
9
+ export type FieldPath<T> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? "" : T extends ReadonlyArray<infer U> ? ForceComputation<FieldPath_<U, `[${number}]`>> : {
10
+ [K in keyof T]: ForceComputation<FieldPath_<T[K], `${K & string}`>>;
11
+ }[keyof T];
12
+ export type FieldPath_<T, Path extends string> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? Path : T extends ReadonlyArray<infer U> ? ForceComputation<FieldPath_<U, `${Path}[${number}]`>> | Path : {
13
+ [K in keyof T]: ForceComputation<FieldPath_<T[K], `${Path}.${K & string}`>>;
8
14
  }[keyof T];
9
15
  export type BaseProps<From, TName extends FieldPath<From> = FieldPath<From>> = {
10
16
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^3.18.0",
@@ -53,7 +53,7 @@
53
53
  "highlight.js": "^11.11.1",
54
54
  "mitt": "^3.0.1",
55
55
  "vue3-highlightjs": "^1.0.5",
56
- "@effect-app/vue": "2.92.1",
56
+ "@effect-app/vue": "2.92.2",
57
57
  "effect-app": "3.12.0"
58
58
  },
59
59
  "scripts": {
@@ -7,13 +7,26 @@ import { getTransformationFrom, useIntl } from "../../utils"
7
7
  import { type OmegaFieldInternalApi } from "./InputProps"
8
8
  import { type OF, type OmegaFormReturn } from "./useOmegaForm"
9
9
 
10
- export type FieldPath<T, Path extends string = ""> = unknown extends T ? string
11
- : T extends string | boolean | number | null | undefined | symbol | bigint ? `${Path extends "" ? "" : `${Path}`}`
12
- : T extends ReadonlyArray<infer U> ? (FieldPath<U, `${Path}[${number}]`> & {}) | Path
10
+ type ForceComputation<T> =
11
+ & {
12
+ [K in keyof T]: T[K]
13
+ }
14
+ & {}
15
+
16
+ export type FieldPath<T> = unknown extends T ? string
17
+ // technically we cannot have primitive at the root
18
+ : T extends string | boolean | number | null | undefined | symbol | bigint ? ""
19
+ // technically we cannot have array at the root
20
+ : T extends ReadonlyArray<infer U> ? ForceComputation<FieldPath_<U, `[${number}]`>>
21
+ : {
22
+ [K in keyof T]: ForceComputation<FieldPath_<T[K], `${K & string}`>>
23
+ }[keyof T]
24
+
25
+ export type FieldPath_<T, Path extends string> = unknown extends T ? string
26
+ : T extends string | boolean | number | null | undefined | symbol | bigint ? Path
27
+ : T extends ReadonlyArray<infer U> ? ForceComputation<FieldPath_<U, `${Path}[${number}]`>> | Path
13
28
  : {
14
- [K in keyof T]: T[K] extends string | boolean | number | null | undefined | symbol | bigint
15
- ? `${Path extends "" ? "" : `${Path}.`}${K & string}`
16
- : FieldPath<T[K], `${Path extends "" ? "" : `${Path}.`}${K & string}`> & {}
29
+ [K in keyof T]: ForceComputation<FieldPath_<T[K], `${Path}.${K & string}`>>
17
30
  }[keyof T]
18
31
 
19
32
  export type BaseProps<From, TName extends FieldPath<From> = FieldPath<From>> = {
@@ -46,7 +46,7 @@ onMounted(() => {
46
46
 
47
47
  <template>
48
48
  <form.Input
49
- :name="`${name}._tag` as FieldPath<From, ''>"
49
+ :name="`${name}._tag` as FieldPath<From>"
50
50
  :label="label"
51
51
  :type="type ?? 'select'"
52
52
  :options="options as unknown as TaggedUnionOption<From, Name>[]"