@strictly/react-form 0.0.17 → 0.0.18

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.
@@ -7,12 +7,12 @@ $ tsup
7
7
  CLI Target: es6
8
8
  CJS Build start
9
9
  ESM Build start
10
- CJS dist/index.cjs 62.28 KB
11
- CJS ⚡️ Build success in 117ms
12
10
  ESM dist/index.js 58.27 KB
13
- ESM ⚡️ Build success in 140ms
11
+ ESM ⚡️ Build success in 136ms
12
+ CJS dist/index.cjs 62.28 KB
13
+ CJS ⚡️ Build success in 137ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 9749ms
16
- DTS dist/index.d.cts 38.08 KB
17
- DTS dist/index.d.ts 38.08 KB
18
- Done in 10.88s.
15
+ DTS ⚡️ Build success in 10098ms
16
+ DTS dist/index.d.cts 38.06 KB
17
+ DTS dist/index.d.ts 38.06 KB
18
+ Done in 11.26s.
@@ -1,3 +1,3 @@
1
1
  yarn run v1.22.22
2
2
  $ tsc
3
- Done in 7.55s.
3
+ Done in 7.96s.
@@ -1,3 +1,3 @@
1
1
  yarn run v1.22.22
2
2
  $ json -f package.json -f package.exports.json --merge > package.release.json
3
- Done in 0.11s.
3
+ Done in 0.14s.
@@ -26,7 +26,6 @@ import {
26
26
  type ValueOfType,
27
27
  valuePathToTypePath,
28
28
  } from '@strictly/define'
29
- import { type FormMode } from 'core/props'
30
29
  import {
31
30
  computed,
32
31
  observable,
@@ -119,6 +118,8 @@ export type ContextOf<TypePathsToAdapters extends Partial<Readonly<Record<string
119
118
  | {}
120
119
  >
121
120
 
121
+ export type FormMode = 'edit' | 'create'
122
+
122
123
  export abstract class FormModel<
123
124
  T extends Type,
124
125
  ValueToTypePaths extends Readonly<Record<string, string>>,
package/core/props.ts CHANGED
@@ -14,12 +14,8 @@ export type FieldsViewProps<F extends Fields> = {
14
14
  onFieldSubmit?(this: void, key: keyof F): boolean | void,
15
15
  }
16
16
 
17
- export type FormMode = 'edit' | 'create'
18
-
19
17
  export type FormProps<O> = {
20
18
  value: O,
21
19
 
22
20
  onValueChange: (value: O) => void,
23
-
24
- mode: FormMode,
25
21
  }
package/dist/index.d.cts CHANGED
@@ -97,20 +97,6 @@ type FormFieldsOfFieldAdapters<ValuePathsToTypePaths extends Readonly<Record<str
97
97
  };
98
98
  type FormFieldOfFieldAdapter<F extends FieldAdapter | undefined> = F extends FieldAdapter<infer _From, infer To, infer E> ? Field<To, E> : never;
99
99
 
100
- type FieldsViewProps<F extends Fields> = {
101
- fields: F;
102
- onFieldValueChange<K extends keyof F>(this: void, key: K, value: F[K]['value']): void;
103
- onFieldFocus?(this: void, key: keyof F): void;
104
- onFieldBlur?(this: void, key: keyof F): void;
105
- onFieldSubmit?(this: void, key: keyof F): boolean | void;
106
- };
107
- type FormMode = 'edit' | 'create';
108
- type FormProps<O> = {
109
- value: O;
110
- onValueChange: (value: O) => void;
111
- mode: FormMode;
112
- };
113
-
114
100
  type FlattenedListTypesOfType<T extends Type> = FlattenedListTypesOfTypes<SimplifyDeep<FlattenedTypesOfType<T, null>>>;
115
101
  type FlattenedListTypesOfTypes<T extends Readonly<Record<string, Type>>> = {
116
102
  [K in keyof T as T[K]['definition'] extends ListTypeDef ? K : never]: T[K];
@@ -135,6 +121,7 @@ type ValuePathsToAdaptersOf<TypePathsToAdapters extends Partial<Readonly<Record<
135
121
  type ContextOf<TypePathsToAdapters extends Partial<Readonly<Record<string, FieldAdapter>>>> = UnionToIntersection<{
136
122
  readonly [K in keyof TypePathsToAdapters]: TypePathsToAdapters[K] extends undefined ? undefined : unknown extends ContextOfFieldAdapter<NonNullable<TypePathsToAdapters[K]>> ? never : ContextOfFieldAdapter<NonNullable<TypePathsToAdapters[K]>>;
137
123
  }[keyof TypePathsToAdapters] | {}>;
124
+ type FormMode = 'edit' | 'create';
138
125
  declare abstract class FormModel<T extends Type, ValueToTypePaths extends Readonly<Record<string, string>>, TypePathsToAdapters extends FlattenedTypePathsToAdaptersOf<FlattenedValuesOfType<T, '*'>, ContextType>, ContextType = ContextOf<TypePathsToAdapters>, ValuePathsToAdapters extends ValuePathsToAdaptersOf<TypePathsToAdapters, ValueToTypePaths> = ValuePathsToAdaptersOf<TypePathsToAdapters, ValueToTypePaths>> {
139
126
  readonly type: T;
140
127
  private readonly originalValue;
@@ -224,6 +211,18 @@ type SubFormFieldAdapters<SubAdapters extends Record<string, FieldAdapter>, Type
224
211
  };
225
212
  declare function subFormFieldAdapters<SubAdapters extends Record<string, FieldAdapter>, TypePath extends string, TypePathsToValuePaths extends Record<TypePath, string>>(subAdapters: SubAdapters, parentTypePath: TypePath): SubFormFieldAdapters<SubAdapters, TypePath, TypePathsToValuePaths[TypePath]>;
226
213
 
214
+ type FieldsViewProps<F extends Fields> = {
215
+ fields: F;
216
+ onFieldValueChange<K extends keyof F>(this: void, key: K, value: F[K]['value']): void;
217
+ onFieldFocus?(this: void, key: keyof F): void;
218
+ onFieldBlur?(this: void, key: keyof F): void;
219
+ onFieldSubmit?(this: void, key: keyof F): boolean | void;
220
+ };
221
+ type FormProps<O> = {
222
+ value: O;
223
+ onValueChange: (value: O) => void;
224
+ };
225
+
227
226
  declare class IntegerToStringConverter<E, ValuePath extends string, Context> implements TwoWayFieldConverter<number, string, E, ValuePath, Context> {
228
227
  private readonly isNanError;
229
228
  private readonly base;
package/dist/index.d.ts CHANGED
@@ -97,20 +97,6 @@ type FormFieldsOfFieldAdapters<ValuePathsToTypePaths extends Readonly<Record<str
97
97
  };
98
98
  type FormFieldOfFieldAdapter<F extends FieldAdapter | undefined> = F extends FieldAdapter<infer _From, infer To, infer E> ? Field<To, E> : never;
99
99
 
100
- type FieldsViewProps<F extends Fields> = {
101
- fields: F;
102
- onFieldValueChange<K extends keyof F>(this: void, key: K, value: F[K]['value']): void;
103
- onFieldFocus?(this: void, key: keyof F): void;
104
- onFieldBlur?(this: void, key: keyof F): void;
105
- onFieldSubmit?(this: void, key: keyof F): boolean | void;
106
- };
107
- type FormMode = 'edit' | 'create';
108
- type FormProps<O> = {
109
- value: O;
110
- onValueChange: (value: O) => void;
111
- mode: FormMode;
112
- };
113
-
114
100
  type FlattenedListTypesOfType<T extends Type> = FlattenedListTypesOfTypes<SimplifyDeep<FlattenedTypesOfType<T, null>>>;
115
101
  type FlattenedListTypesOfTypes<T extends Readonly<Record<string, Type>>> = {
116
102
  [K in keyof T as T[K]['definition'] extends ListTypeDef ? K : never]: T[K];
@@ -135,6 +121,7 @@ type ValuePathsToAdaptersOf<TypePathsToAdapters extends Partial<Readonly<Record<
135
121
  type ContextOf<TypePathsToAdapters extends Partial<Readonly<Record<string, FieldAdapter>>>> = UnionToIntersection<{
136
122
  readonly [K in keyof TypePathsToAdapters]: TypePathsToAdapters[K] extends undefined ? undefined : unknown extends ContextOfFieldAdapter<NonNullable<TypePathsToAdapters[K]>> ? never : ContextOfFieldAdapter<NonNullable<TypePathsToAdapters[K]>>;
137
123
  }[keyof TypePathsToAdapters] | {}>;
124
+ type FormMode = 'edit' | 'create';
138
125
  declare abstract class FormModel<T extends Type, ValueToTypePaths extends Readonly<Record<string, string>>, TypePathsToAdapters extends FlattenedTypePathsToAdaptersOf<FlattenedValuesOfType<T, '*'>, ContextType>, ContextType = ContextOf<TypePathsToAdapters>, ValuePathsToAdapters extends ValuePathsToAdaptersOf<TypePathsToAdapters, ValueToTypePaths> = ValuePathsToAdaptersOf<TypePathsToAdapters, ValueToTypePaths>> {
139
126
  readonly type: T;
140
127
  private readonly originalValue;
@@ -224,6 +211,18 @@ type SubFormFieldAdapters<SubAdapters extends Record<string, FieldAdapter>, Type
224
211
  };
225
212
  declare function subFormFieldAdapters<SubAdapters extends Record<string, FieldAdapter>, TypePath extends string, TypePathsToValuePaths extends Record<TypePath, string>>(subAdapters: SubAdapters, parentTypePath: TypePath): SubFormFieldAdapters<SubAdapters, TypePath, TypePathsToValuePaths[TypePath]>;
226
213
 
214
+ type FieldsViewProps<F extends Fields> = {
215
+ fields: F;
216
+ onFieldValueChange<K extends keyof F>(this: void, key: K, value: F[K]['value']): void;
217
+ onFieldFocus?(this: void, key: keyof F): void;
218
+ onFieldBlur?(this: void, key: keyof F): void;
219
+ onFieldSubmit?(this: void, key: keyof F): boolean | void;
220
+ };
221
+ type FormProps<O> = {
222
+ value: O;
223
+ onValueChange: (value: O) => void;
224
+ };
225
+
227
226
  declare class IntegerToStringConverter<E, ValuePath extends string, Context> implements TwoWayFieldConverter<number, string, E, ValuePath, Context> {
228
227
  private readonly isNanError;
229
228
  private readonly base;
package/package.json CHANGED
@@ -70,7 +70,7 @@
70
70
  "test:watch": "vitest"
71
71
  },
72
72
  "type": "module",
73
- "version": "0.0.17",
73
+ "version": "0.0.18",
74
74
  "exports": {
75
75
  ".": {
76
76
  "import": {