mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-25 18:52:39 +00:00
* feat(plugins): add React Native UI primitives Give client plugins host-owned adaptive UI without exposing app internals. Preserve plugin runtime contexts when modal content moves through the compact portal host. * docs(plugins): clarify host UI reference * refactor(plugins): harden host UI boundary Replace mocked pass-through coverage with a real browser plugin journey, keep host runtime ownership inside the evaluator, preserve toast context across compact portals, and expose modal content as a compound component. * fix(plugins): defer native UI presentation runtime Loading the plugin evaluator initialized the modal and toast presentation stacks even when no plugin requested host UI. Keep the capability stable while delaying platform-heavy presentation code until Modal.Content renders. * refactor(plugins): move modal metadata to root Keep Modal.Content body-only while the top-level Modal owns the host-rendered title and leading icon. This leaves presentation metadata stable as the compound API gains future regions.
19 lines
654 B
TypeScript
19 lines
654 B
TypeScript
import type { PaseoApi } from "@getpaseo/client";
|
|
import { createContext, useContext, type ReactNode } from "react";
|
|
|
|
const PaseoApiContext = createContext<PaseoApi | null>(null);
|
|
|
|
export function usePaseoContextValue(): PaseoApi | null {
|
|
return useContext(PaseoApiContext);
|
|
}
|
|
|
|
export function PaseoApiProvider({ children, paseo }: { children: ReactNode; paseo: PaseoApi }) {
|
|
return <PaseoApiContext.Provider value={paseo}>{children}</PaseoApiContext.Provider>;
|
|
}
|
|
|
|
export function usePaseo(): PaseoApi {
|
|
const paseo = usePaseoContextValue();
|
|
if (!paseo) throw new Error("usePaseo must run inside a contributed plugin surface");
|
|
return paseo;
|
|
}
|