child(element: ReactElement): ReactElement { childList.add(element) return element } operator fun String.unaryPlus() { childList.add(this) } fun <P : RProps> child(type: Any, props: P, children: List<Any>) = child(createElement(type, props, *children.toTypedArray())) fun <P : RProps> child(type: Any, props: P, handler: RHandler<P>): ReactElement { val children = with(RElementBuilder(props)) { handler() childList } return child(type, props, children) } operator fun <P : RProps> RClass<P>.invoke(handler: RHandler<P>) = child(this, jsObject {}, handler) operator fun <T> RProvider<T>.invoke(value: T, handler: RHandler<RProviderProps<T>>) = child(this, jsObject { this.value = value }, handler) operator fun <T> RConsumer<T>.invoke(handler: RBuilder.(T) -> Unit) = child(this, jsObject<RConsumerProps<T>> { this.children = { value -> buildElements { handler(value) } } }) {} fun <P : RProps> RClass<P>.node( props: P, children: List<Any> = emptyList() ) = child(this, clone(props), children) fun <P : RProps, C : Component<P, *>> child(klazz: KClass<C>, handler: RHandler<P>): ReactElement { val rClass = klazz.js as RClass<P> return rClass(handler) } inline fun <P : RProps, reified C : Component<P, *>> child(noinline handler: RHandler<P>) = child(C::class, handler) fun <P : RProps, C : Component<P, *>> node( klazz: KClass<C>, props: P, children: List<Any> = emptyList() ): ReactElement { val rClass = klazz.js as RClass<P> return rClass.node(props, children) } inline fun <P : RProps, reified C : Component<P, *>> node(props: P, children: List<Any> = emptyList()) = node(C::class, props, children) fun RProps.children() { childList.addAll(Children.toArray(children)) } } ίʔυϦʔσΟϯά LPUMJOSFBDU 3#VJMEFSΫϥε w %0.ཁૉΛ֨ೲ͢ΔDIJME-JTUϓϩύςΟΛ࣋ͭ w DIJMEϝιουɺଞʹͭ w 3$PNQPOFOUΛՃ w QSPQTͱࢠཁૉΛݸผͷҾͰՃFUD fun child(type: Any, props: P, children: List<Any>): ReactElement fun child(type: Any, props: P, handler: RHandler<P>): ReactElement fun child(klazz: KClass<C>, handler: RHandler<P>): ReactElement inline fun child(noinline handler: RHandler<P>): ReactElement