@plasmicapp/react-web 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.d.ts +65 -2
- package/dist/index.cjs.js +57 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +57 -0
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/ssr.d.ts +57 -0
- package/package.json +4 -4
- package/skinny/dist/index.js +2 -2
- package/skinny/dist/plume/checkbox/index.js +1 -1
- package/skinny/dist/plume/menu/index.js +1 -1
- package/skinny/dist/plume/menu-button/index.js +1 -1
- package/skinny/dist/plume/select/index.js +1 -1
- package/skinny/dist/plume/switch/index.js +1 -1
- package/skinny/dist/render/ssr.d.ts +57 -0
- package/skinny/dist/{ssr-e496f477.js → ssr-6a83562a.js} +58 -1
- package/skinny/dist/{ssr-e496f477.js.map → ssr-6a83562a.js.map} +1 -1
package/dist/react-web.esm.js
CHANGED
|
@@ -1776,6 +1776,63 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
|
|
1778
1778
|
var PlasmicRootContext = React.createContext(undefined);
|
|
1779
|
+
/**
|
|
1780
|
+
* PlasmicRootProvider sets up the React context that Plasmic-generated components
|
|
1781
|
+
* rely on including data sources, i18n, Head, and Link.
|
|
1782
|
+
*
|
|
1783
|
+
* In Next.js app router, props passed from a Server to a Client Components must be serializable
|
|
1784
|
+
* but several PlasmicRootProvider props are not (e.g. `loader`, `Link` from `next/link`).
|
|
1785
|
+
* We recommend defining a Client Component wrapper (`ClientPlasmicRootProvider` in
|
|
1786
|
+
* `plasmic-init-client.tsx`) that imports non-serializable values and passes them to
|
|
1787
|
+
* PlasmicRootProvider (and only accepts serializable props from its caller).
|
|
1788
|
+
*
|
|
1789
|
+
* Loader example:
|
|
1790
|
+
*
|
|
1791
|
+
* ```tsx
|
|
1792
|
+
* // plasmic-init-client.tsx
|
|
1793
|
+
* "use client";
|
|
1794
|
+
* import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
|
|
1795
|
+
* import { PLASMIC } from "@/plasmic-init";
|
|
1796
|
+
* export function ClientPlasmicRootProvider(
|
|
1797
|
+
* props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">
|
|
1798
|
+
* ) {
|
|
1799
|
+
* return <PlasmicRootProvider loader={PLASMIC} {...props} />;
|
|
1800
|
+
* }
|
|
1801
|
+
* ```
|
|
1802
|
+
*
|
|
1803
|
+
* Codegen example:
|
|
1804
|
+
*
|
|
1805
|
+
* ```tsx
|
|
1806
|
+
* // plasmic-init-client.tsx
|
|
1807
|
+
* "use client";
|
|
1808
|
+
* import { PlasmicRootProvider } from "@plasmicapp/react-web";
|
|
1809
|
+
* import Link from "next/link";
|
|
1810
|
+
* export function ClientPlasmicRootProvider(
|
|
1811
|
+
* props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "Link">
|
|
1812
|
+
* ) {
|
|
1813
|
+
* return <PlasmicRootProvider Link={Link} {...props} />;
|
|
1814
|
+
* }
|
|
1815
|
+
* ```
|
|
1816
|
+
*
|
|
1817
|
+
* A Server Component can then render `ClientPlasmicRootProvider` and pass
|
|
1818
|
+
* serializable props such as prefetched data and children:
|
|
1819
|
+
*
|
|
1820
|
+
* ```tsx
|
|
1821
|
+
* import { PLASMIC } from "@/plasmic-init";
|
|
1822
|
+
* import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
|
|
1823
|
+
* export default async function MyPage() {
|
|
1824
|
+
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
1825
|
+
* return (
|
|
1826
|
+
* <ClientPlasmicRootProvider prefetchedData={prefetchedData}>
|
|
1827
|
+
* {yourContent()}
|
|
1828
|
+
* </ClientPlasmicRootProvider>
|
|
1829
|
+
* );
|
|
1830
|
+
* }
|
|
1831
|
+
* ```
|
|
1832
|
+
*
|
|
1833
|
+
* See https://nextjs.org/docs/app/getting-started/server-and-client-components#passing-data-from-server-to-client-components
|
|
1834
|
+
* for more on the Server/Client Component boundary.
|
|
1835
|
+
*/
|
|
1779
1836
|
function PlasmicRootProvider(props) {
|
|
1780
1837
|
var _a;
|
|
1781
1838
|
var platform = props.platform, children = props.children, userAuthToken = props.userAuthToken, isUserLoading = props.isUserLoading, authRedirectUri = props.authRedirectUri, user = props.user, disableLoadingBoundary = props.disableLoadingBoundary, suspenseFallback = props.suspenseFallback;
|