@plasmicapp/react-web 0.2.226 → 0.2.227

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,18 @@ 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) {
1375
+ // Just in case, break the cycle
1376
+ return React__default.createElement(PlasmicLinkInternal, __assign({}, props, { ref: ref }));
1377
+ }
1378
+ else {
1379
+ return React__default.createElement(Link, __assign({}, props, { ref: ref }));
1380
+ }
1381
+ });
1382
+ var PlasmicLinkInternal = React__default.forwardRef(function PlasmicLinkInternal(props, ref) {
1371
1383
  // props.href is required for nextjs; if no props.href,
1372
1384
  // then we just render the default anchor element
1373
1385
  if (props.platform === "nextjs" && props.href) {
@@ -1612,8 +1624,8 @@ function createUseScreenVariants(isMulti, screenQueries) {
1612
1624
 
1613
1625
  var PlasmicRootContext = React.createContext(undefined);
1614
1626
  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;
1627
+ var _a, _b;
1628
+ 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
1629
  var context = React.useMemo(function () { return ({
1618
1630
  platform: platform,
1619
1631
  }); }, [platform]);
@@ -1630,7 +1642,8 @@ function PlasmicRootProvider(props) {
1630
1642
  React.createElement(SSRProvider, null,
1631
1643
  React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1632
1644
  React.createElement(PlasmicTranslatorContext.Provider, { value: (_a = props.i18n) !== null && _a !== void 0 ? _a : props.translator },
1633
- React.createElement(PlasmicHeadContext.Provider, { value: props.Head }, children)))))));
1645
+ React.createElement(PlasmicHeadContext.Provider, { value: props.Head },
1646
+ React.createElement(PlasmicLinkProvider, { Link: (_b = props.Link) !== null && _b !== void 0 ? _b : PlasmicLinkInternal }, children))))))));
1634
1647
  }
1635
1648
  var useIsSSR = useIsSSR$1;
1636
1649
  function useHasPlasmicRoot() {