@plasmicapp/react-web 0.2.356 → 0.2.358

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.
@@ -7,7 +7,7 @@ import * as React from 'react';
7
7
  import React__default, { useLayoutEffect, useEffect } from 'react';
8
8
  import get from 'dlv';
9
9
  export { default as get } from 'dlv';
10
- import { usePlasmicLinkMaybe, DataProvider, PlasmicLinkProvider, usePlasmicCanvasContext } from '@plasmicapp/host';
10
+ import { usePlasmicLinkMaybe, PlasmicTranslatorContext as PlasmicTranslatorContext$1, usePlasmicTranslator as usePlasmicTranslator$1, DataProvider, PlasmicLinkProvider, usePlasmicCanvasContext } from '@plasmicapp/host';
11
11
  import * as ReactDOM from 'react-dom';
12
12
  import ReactDOM__default from 'react-dom';
13
13
  import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
@@ -1474,11 +1474,9 @@ function isInternalHref(href) {
1474
1474
  return /^\/(?!\/)/.test(href);
1475
1475
  }
1476
1476
 
1477
- var PlasmicTranslatorContext = React__default.createContext(undefined);
1478
- function isIterable(val) {
1479
- return val != null && typeof val[Symbol.iterator] === "function";
1480
- }
1481
- function usePlasmicTranslator() {
1477
+ // Make the refactor to host backwards compatible for loader
1478
+ var PlasmicTranslatorContext = PlasmicTranslatorContext$1 !== null && PlasmicTranslatorContext$1 !== void 0 ? PlasmicTranslatorContext$1 : React__default.createContext(undefined);
1479
+ var usePlasmicTranslator = usePlasmicTranslator$1 !== null && usePlasmicTranslator$1 !== void 0 ? usePlasmicTranslator$1 : (function () {
1482
1480
  var _t = React__default.useContext(PlasmicTranslatorContext);
1483
1481
  var translator = _t
1484
1482
  ? typeof _t === "function"
@@ -1486,7 +1484,7 @@ function usePlasmicTranslator() {
1486
1484
  : _t.translator
1487
1485
  : undefined;
1488
1486
  return translator;
1489
- }
1487
+ });
1490
1488
  function genTranslatableString(elt, opts) {
1491
1489
  var components = {};
1492
1490
  var componentsCount = 0;
@@ -1566,6 +1564,9 @@ function warnNoTranslationFunctionAtMostOnce() {
1566
1564
  function hasKey(v, key) {
1567
1565
  return typeof v === "object" && v !== null && key in v;
1568
1566
  }
1567
+ function isIterable(val) {
1568
+ return val != null && typeof val[Symbol.iterator] === "function";
1569
+ }
1569
1570
 
1570
1571
  function PlasmicSlot(props) {
1571
1572
  return renderPlasmicSlot(props);
@@ -1720,10 +1721,10 @@ function PlasmicRootProvider(props) {
1720
1721
  authRedirectUri: authRedirectUri,
1721
1722
  }); }, [userAuthToken, isUserLoading, user, authRedirectUri]);
1722
1723
  var reactMajorVersion = +React.version.split(".")[0];
1723
- return (React.createElement(MaybeWrap, { cond: !disableLoadingBoundary && reactMajorVersion >= 18, wrapper: function (children) { return (React.createElement(DataProvider, { name: "plasmicInternalEnableLoadingBoundary", hidden: true, data: true },
1724
- React.createElement(React.Suspense, { fallback: suspenseFallback !== null && suspenseFallback !== void 0 ? suspenseFallback : "Loading..." }, children))); } },
1724
+ return (React.createElement(MaybeWrap, { cond: !disableLoadingBoundary && reactMajorVersion >= 18, wrapper: function (children_) { return (React.createElement(DataProvider, { name: "plasmicInternalEnableLoadingBoundary", hidden: true, data: true },
1725
+ React.createElement(React.Suspense, { fallback: suspenseFallback !== null && suspenseFallback !== void 0 ? suspenseFallback : "Loading..." }, children_))); } },
1725
1726
  React.createElement(PlasmicRootContext.Provider, { value: context },
1726
- React.createElement(MaybeWrap, { cond: reactMajorVersion < 18, wrapper: function (children) { return React.createElement(SSRProvider, null, children); } },
1727
+ React.createElement(MaybeWrap, { cond: reactMajorVersion < 18, wrapper: function (children_) { return React.createElement(SSRProvider, null, children_); } },
1727
1728
  React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1728
1729
  React.createElement(PlasmicTranslatorContext.Provider, { value: (_a = props.i18n) !== null && _a !== void 0 ? _a : props.translator },
1729
1730
  React.createElement(PlasmicHeadContext.Provider, { value: props.Head },
@@ -2091,7 +2092,7 @@ function subscribeToValtio($$state, statePath, node) {
2091
2092
  }
2092
2093
  }
2093
2094
  function initializeStateValue($$state, initialStateCell, proxyRoot) {
2094
- var _a, _b, _c;
2095
+ var _a;
2095
2096
  var initialStateName = initialStateCell.node.getSpec().path;
2096
2097
  var stateAccess = new Set();
2097
2098
  $$state.stateInitializationEnv.visited.add(initialStateName);
@@ -2148,16 +2149,12 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
2148
2149
  : clonedValue;
2149
2150
  set(proxyRoot, initialStateCell.path, value);
2150
2151
  }
2151
- catch (_d) {
2152
+ catch (_b) {
2152
2153
  // Setting the state to undefined to make sure it gets re-initialized
2153
2154
  // in case it changes values.
2154
2155
  initialStateCell.initialValue = undefined;
2155
2156
  set(proxyRoot, initialStateCell.path, undefined);
2156
2157
  }
2157
- //immediately fire onChange
2158
- if (initialSpec.onChangeProp) {
2159
- (_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
2160
- }
2161
2158
  $$state.stateInitializationEnv.visited.delete(initialStateName);
2162
2159
  $$state.stateInitializationEnv.stack.pop();
2163
2160
  return initialValue;
@@ -2498,7 +2495,9 @@ function useDollarState(specs) {
2498
2495
  var spec = node.getSpec();
2499
2496
  if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
2500
2497
  var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
2501
- initializeStateValue($$state, stateCell, $state);
2498
+ if (stateCell.initialValue === UNINITIALIZED) {
2499
+ initializeStateValue($$state, stateCell, $state);
2500
+ }
2502
2501
  }
2503
2502
  });
2504
2503
  }, []);