0.1.4 #5

Merged
Thilawyn merged 67 commits from next into master 2025-10-02 18:18:23 +02:00
Showing only changes of commit f6e69a05fd - Show all commits

View File

@@ -11,19 +11,19 @@ export type TypeId = typeof TypeId
export interface Form<in out A, in out I = A, out R = never> export interface Form<in out A, in out I = A, out R = never>
extends Pipeable.Pipeable { extends Pipeable.Pipeable {
readonly schema: Schema.Schema<A, I, R> readonly schema: Schema.Schema<A, I, R>
readonly latestValueSubscribable: Subscribable.Subscribable<NoInfer<A>> readonly latestValueSubscribable: Subscribable.Subscribable<A>
useFieldLatestValueSubscribable<P extends PropertyPath.Paths<NoInfer<A>>>( useFieldLatestValueSubscribable<P extends PropertyPath.Paths<A>>(
path: P path: P
): Subscribable.Subscribable<PropertyPath.ValueFromPath<NoInfer<A>, P>, NoSuchElementException> ): Subscribable.Subscribable<PropertyPath.ValueFromPath<A, P>, NoSuchElementException>
useFieldIssuesSubscribable( useFieldIssuesSubscribable(
path: PropertyPath.Paths<NoInfer<A>> path: PropertyPath.Paths<A>
): Subscribable.Subscribable<readonly ParseResult.ArrayFormatterIssue[]> ): Subscribable.Subscribable<readonly ParseResult.ArrayFormatterIssue[]>
useInput<P extends PropertyPath.Paths<NoInfer<I>>>( useInput<P extends PropertyPath.Paths<I>>(
path: P path: P
): Effect.Effect< ): Effect.Effect<
Form.useInput.Result<PropertyPath.ValueFromPath<NoInfer<I>, P>>, Form.useInput.Result<PropertyPath.ValueFromPath<I, P>>,
ParseResult.ParseError | NoSuchElementException, ParseResult.ParseError | NoSuchElementException,
R R
> >
@@ -43,18 +43,18 @@ export namespace Form {
class FormImpl<in out A, in out I, out R> class FormImpl<in out A, in out I, out R>
extends Pipeable.Class() implements Form<A, I, R> { extends Pipeable.Class() implements Form<A, I, R> {
readonly [TypeId]: TypeId = TypeId readonly [TypeId]: TypeId = TypeId
readonly latestValueSubscribable: Subscribable.Subscribable<NoInfer<A>> readonly latestValueSubscribable: Subscribable.Subscribable<A>
constructor( constructor(
readonly schema: Schema.Schema<A, I, R>, readonly schema: Schema.Schema<A, I, R>,
readonly latestValueRef: SubscriptionRef.SubscriptionRef<NoInfer<A>>, readonly latestValueRef: SubscriptionRef.SubscriptionRef<A>,
readonly errorRef: SubscriptionRef.SubscriptionRef<Option.Option<ParseResult.ParseError>>, readonly errorRef: SubscriptionRef.SubscriptionRef<Option.Option<ParseResult.ParseError>>,
) { ) {
super() super()
this.latestValueSubscribable = latestValueRef this.latestValueSubscribable = latestValueRef
} }
useFieldLatestValueSubscribable<P extends PropertyPath.Paths<NoInfer<A>>>( useFieldLatestValueSubscribable<P extends PropertyPath.Paths<A>>(
path: P path: P
) { ) {
return React.useMemo(() => { return React.useMemo(() => {
@@ -67,7 +67,7 @@ extends Pipeable.Class() implements Form<A, I, R> {
} }
useFieldIssuesSubscribable( useFieldIssuesSubscribable(
path: PropertyPath.Paths<NoInfer<A>> path: PropertyPath.Paths<A>
) { ) {
return React.useMemo(() => { return React.useMemo(() => {
const filter = Option.match({ const filter = Option.match({