| 622 | ): Element<Msg, R | Requirements<C[number]>> => buildWith(builder, inputs.length === 0 ? noChildren : children(inputs)) |
| 623 | |
| 624 | const buildWith = <Msg, R>( |
| 625 | builder: ElementBuilder<Msg, any, any, any>, |
| 626 | given: ReadonlyArray<Node<Msg, any>> |
| 627 | ): Element<Msg, R> => { |
| 628 | // What the builder holds from `children` comes first, and what it is |
| 629 | // given now comes after. |
| 630 | const content = builder.content |
| 631 | const all = content === undefined |
| 632 | ? given |
| 633 | : given.length === 0 |
| 634 | ? content |
| 635 | : children([...content, ...given]) |
| 636 | const hooks = builder.hooks |
| 637 | return hooks === undefined |
| 638 | ? elementOf(builder, all) |
| 639 | : forwardTo(builder, hooks, all) |
| 640 | } |
| 641 | |
| 642 | const elementOf = <Msg, R>( |
| 643 | builder: ElementBuilder<Msg, any, any, any>, |