0.1.0 #1

Merged
Thilawyn merged 81 commits from next into master 2025-07-17 21:17:57 +02:00
2 changed files with 13 additions and 5 deletions
Showing only changes of commit a0a78187df - Show all commits

View File

@@ -61,12 +61,20 @@ export const use: {
}) })
export const withRuntime: { export const withRuntime: {
<E, R, P extends {} = {}>(context: React.Context<Runtime.Runtime<R>>): (self: ReactComponent<E, R | Scope.Scope, P>) => React.FC<P> <E, R, P extends {} = {}>(
<E, R, P extends {} = {}>(self: ReactComponent<E, R | Scope.Scope, P>, context: React.Context<Runtime.Runtime<R>>): React.FC<P> context: React.Context<Runtime.Runtime<R>>,
} = Function.dual(2, <E, R, P extends {}>( options?: ReactHook.ScopeOptions,
): (self: ReactComponent<E, R | Scope.Scope, P>) => React.FC<P>
<E, R, P extends {} = {}>(
self: ReactComponent<E, R | Scope.Scope, P>,
context: React.Context<Runtime.Runtime<R>>,
options?: ReactHook.ScopeOptions,
): React.FC<P>
} = Function.dual(3, <E, R, P extends {}>(
self: ReactComponent<E, R | Scope.Scope, P>, self: ReactComponent<E, R | Scope.Scope, P>,
context: React.Context<Runtime.Runtime<R>>, context: React.Context<Runtime.Runtime<R>>,
options?: ReactHook.ScopeOptions,
): React.FC<P> => function WithRuntime(props) { ): React.FC<P> => function WithRuntime(props) {
const runtime = React.useContext(context) const runtime = React.useContext(context)
return React.createElement(Runtime.runSync(runtime)(useFC(self)), props) return React.createElement(Runtime.runSync(runtime)(useFC(self, options)), props)
}) })

View File

@@ -13,6 +13,6 @@ export const Route = createFileRoute("/")({
}), }),
ReactComponent.withDisplayName("Index"), ReactComponent.withDisplayName("Index"),
ReactComponent.withRuntime(runtime.context), ReactComponent.withRuntime(runtime.context, { finalizerExecutionMode: "fork" }),
) )
}) })