@plasmicapp/react-web 1.0.5 → 1.0.6

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 CHANGED
@@ -13751,6 +13751,63 @@ interface PlasmicRootProviderProps extends PlasmicDataSourceContextValue {
13751
13751
  disableLoadingBoundary?: boolean;
13752
13752
  suspenseFallback?: React$1.ReactNode;
13753
13753
  }
13754
+ /**
13755
+ * PlasmicRootProvider sets up the React context that Plasmic-generated components
13756
+ * rely on including data sources, i18n, Head, and Link.
13757
+ *
13758
+ * In Next.js app router, props passed from a Server to a Client Components must be serializable
13759
+ * but several PlasmicRootProvider props are not (e.g. `loader`, `Link` from `next/link`).
13760
+ * We recommend defining a Client Component wrapper (`ClientPlasmicRootProvider` in
13761
+ * `plasmic-init-client.tsx`) that imports non-serializable values and passes them to
13762
+ * PlasmicRootProvider (and only accepts serializable props from its caller).
13763
+ *
13764
+ * Loader example:
13765
+ *
13766
+ * ```tsx
13767
+ * // plasmic-init-client.tsx
13768
+ * "use client";
13769
+ * import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
13770
+ * import { PLASMIC } from "@/plasmic-init";
13771
+ * export function ClientPlasmicRootProvider(
13772
+ * props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">
13773
+ * ) {
13774
+ * return <PlasmicRootProvider loader={PLASMIC} {...props} />;
13775
+ * }
13776
+ * ```
13777
+ *
13778
+ * Codegen example:
13779
+ *
13780
+ * ```tsx
13781
+ * // plasmic-init-client.tsx
13782
+ * "use client";
13783
+ * import { PlasmicRootProvider } from "@plasmicapp/react-web";
13784
+ * import Link from "next/link";
13785
+ * export function ClientPlasmicRootProvider(
13786
+ * props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "Link">
13787
+ * ) {
13788
+ * return <PlasmicRootProvider Link={Link} {...props} />;
13789
+ * }
13790
+ * ```
13791
+ *
13792
+ * A Server Component can then render `ClientPlasmicRootProvider` and pass
13793
+ * serializable props such as prefetched data and children:
13794
+ *
13795
+ * ```tsx
13796
+ * import { PLASMIC } from "@/plasmic-init";
13797
+ * import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
13798
+ * export default async function MyPage() {
13799
+ * const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
13800
+ * return (
13801
+ * <ClientPlasmicRootProvider prefetchedData={prefetchedData}>
13802
+ * {yourContent()}
13803
+ * </ClientPlasmicRootProvider>
13804
+ * );
13805
+ * }
13806
+ * ```
13807
+ *
13808
+ * See https://nextjs.org/docs/app/getting-started/server-and-client-components#passing-data-from-server-to-client-components
13809
+ * for more on the Server/Client Component boundary.
13810
+ */
13754
13811
  declare function PlasmicRootProvider(props: PlasmicRootProviderProps): React$1.JSX.Element;
13755
13812
  declare const useIsSSR: typeof useIsSSR$1;
13756
13813
 
package/dist/index.cjs.js CHANGED
@@ -1795,6 +1795,63 @@ function createUseScreenVariants(isMulti, screenQueries) {
1795
1795
  }
1796
1796
 
1797
1797
  var PlasmicRootContext = React__namespace.createContext(undefined);
1798
+ /**
1799
+ * PlasmicRootProvider sets up the React context that Plasmic-generated components
1800
+ * rely on including data sources, i18n, Head, and Link.
1801
+ *
1802
+ * In Next.js app router, props passed from a Server to a Client Components must be serializable
1803
+ * but several PlasmicRootProvider props are not (e.g. `loader`, `Link` from `next/link`).
1804
+ * We recommend defining a Client Component wrapper (`ClientPlasmicRootProvider` in
1805
+ * `plasmic-init-client.tsx`) that imports non-serializable values and passes them to
1806
+ * PlasmicRootProvider (and only accepts serializable props from its caller).
1807
+ *
1808
+ * Loader example:
1809
+ *
1810
+ * ```tsx
1811
+ * // plasmic-init-client.tsx
1812
+ * "use client";
1813
+ * import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
1814
+ * import { PLASMIC } from "@/plasmic-init";
1815
+ * export function ClientPlasmicRootProvider(
1816
+ * props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">
1817
+ * ) {
1818
+ * return <PlasmicRootProvider loader={PLASMIC} {...props} />;
1819
+ * }
1820
+ * ```
1821
+ *
1822
+ * Codegen example:
1823
+ *
1824
+ * ```tsx
1825
+ * // plasmic-init-client.tsx
1826
+ * "use client";
1827
+ * import { PlasmicRootProvider } from "@plasmicapp/react-web";
1828
+ * import Link from "next/link";
1829
+ * export function ClientPlasmicRootProvider(
1830
+ * props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "Link">
1831
+ * ) {
1832
+ * return <PlasmicRootProvider Link={Link} {...props} />;
1833
+ * }
1834
+ * ```
1835
+ *
1836
+ * A Server Component can then render `ClientPlasmicRootProvider` and pass
1837
+ * serializable props such as prefetched data and children:
1838
+ *
1839
+ * ```tsx
1840
+ * import { PLASMIC } from "@/plasmic-init";
1841
+ * import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
1842
+ * export default async function MyPage() {
1843
+ * const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
1844
+ * return (
1845
+ * <ClientPlasmicRootProvider prefetchedData={prefetchedData}>
1846
+ * {yourContent()}
1847
+ * </ClientPlasmicRootProvider>
1848
+ * );
1849
+ * }
1850
+ * ```
1851
+ *
1852
+ * See https://nextjs.org/docs/app/getting-started/server-and-client-components#passing-data-from-server-to-client-components
1853
+ * for more on the Server/Client Component boundary.
1854
+ */
1798
1855
  function PlasmicRootProvider(props) {
1799
1856
  var _a;
1800
1857
  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;