@plasmicapp/react-web 0.2.226 → 0.2.228

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.
@@ -6,10 +6,10 @@ import * as React from 'react';
6
6
  import React__default, { useLayoutEffect, useEffect } from 'react';
7
7
  import get from 'dlv';
8
8
  export { default as get } from 'dlv';
9
+ import { usePlasmicLinkMaybe, DataProvider, PlasmicLinkProvider, usePlasmicCanvasContext } from '@plasmicapp/host';
9
10
  import * as ReactDOM from 'react-dom';
10
11
  import ReactDOM__default from 'react-dom';
11
12
  import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
12
- import { DataProvider, usePlasmicCanvasContext } from '@plasmicapp/host';
13
13
  import { useFocusRing, useFocusable, FocusScope } from '@react-aria/focus';
14
14
  import { proxy, ref, useSnapshot, getVersion, subscribe } from 'valtio';
15
15
  import clone from 'clone';
@@ -1368,6 +1368,19 @@ var PLASMIC_IMAGE_LOADER = {
1368
1368
  };
1369
1369
 
1370
1370
  var PlasmicLink = React__default.forwardRef(function PlasmicLink(props, ref) {
1371
+ var _a;
1372
+ // The usePlasmicLinkMaybe function may be undefined, if host is not up-to-date
1373
+ var Link = (_a = usePlasmicLinkMaybe === null || usePlasmicLinkMaybe === void 0 ? void 0 : usePlasmicLinkMaybe()) !== null && _a !== void 0 ? _a : PlasmicLinkInternal;
1374
+ if (Link === PlasmicLink || Link === PlasmicLinkInternal) {
1375
+ // Just in case, break the cycle
1376
+ return React__default.createElement(PlasmicLinkInternal, __assign({}, props, { ref: ref }));
1377
+ }
1378
+ else {
1379
+ // Don't pass component/platform props to non-PlasmicLinkInternal
1380
+ return React__default.createElement(Link, __assign({}, omit(props, "component", "platform"), { ref: ref }));
1381
+ }
1382
+ });
1383
+ var PlasmicLinkInternal = React__default.forwardRef(function PlasmicLinkInternal(props, ref) {
1371
1384
  // props.href is required for nextjs; if no props.href,
1372
1385
  // then we just render the default anchor element
1373
1386
  if (props.platform === "nextjs" && props.href) {
@@ -1612,8 +1625,8 @@ function createUseScreenVariants(isMulti, screenQueries) {
1612
1625
 
1613
1626
  var PlasmicRootContext = React.createContext(undefined);
1614
1627
  function PlasmicRootProvider(props) {
1615
- var _a;
1616
- 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; props.i18n;
1628
+ var _a, _b;
1629
+ 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;
1617
1630
  var context = React.useMemo(function () { return ({
1618
1631
  platform: platform,
1619
1632
  }); }, [platform]);
@@ -1630,7 +1643,8 @@ function PlasmicRootProvider(props) {
1630
1643
  React.createElement(SSRProvider, null,
1631
1644
  React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1632
1645
  React.createElement(PlasmicTranslatorContext.Provider, { value: (_a = props.i18n) !== null && _a !== void 0 ? _a : props.translator },
1633
- React.createElement(PlasmicHeadContext.Provider, { value: props.Head }, children)))))));
1646
+ React.createElement(PlasmicHeadContext.Provider, { value: props.Head },
1647
+ React.createElement(PlasmicLinkProvider, { Link: (_b = props.Link) !== null && _b !== void 0 ? _b : PlasmicLinkInternal }, children))))))));
1634
1648
  }
1635
1649
  var useIsSSR = useIsSSR$1;
1636
1650
  function useHasPlasmicRoot() {