@plasmicapp/react-web 0.2.139 → 0.2.140

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.
@@ -1280,10 +1280,16 @@ function renderPlasmicSlot(opts) {
1280
1280
  }
1281
1281
  function maybeAsString(node) {
1282
1282
  // Unwrap fragments
1283
- if (isValidElement(node) && (
1284
- // Fragment and Trans don't render DOM elements
1285
- node.type === Fragment || node.type === Trans)) {
1286
- return maybeAsString(node.props.children);
1283
+ if (isValidElement(node)) {
1284
+ // Fragment doesn't render DOM elements
1285
+ if (node.type === Fragment) {
1286
+ return maybeAsString(node.props.children);
1287
+ } else if (node.type === Trans) {
1288
+ // Trans also doesn't render DOM elements. But we don't want to just render
1289
+ // its content string, because we want to keep the <Trans/> for the localization.
1290
+ // So we render the same node, to be wrapped into __wab_slot-string-wrapper.
1291
+ return node;
1292
+ }
1287
1293
  }
1288
1294
  if (typeof node === "string") {
1289
1295
  return node;
@@ -1867,7 +1873,7 @@ function create$StateProxy($$state, leafHandlers) {
1867
1873
  return true;
1868
1874
  }
1869
1875
  };
1870
- var baseObject = !isOutside && !currNode.isLeaf() ? currNode.hasArrayTransition() ? [] : {} : Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
1876
+ var baseObject = !isOutside && !currNode.isLeaf() ? currNode.hasArrayTransition() ? [] : {} : Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject != null ? initialObject : {}));
1871
1877
  var proxyObj = new Proxy(baseObject, handlers);
1872
1878
  if (initialObject) {
1873
1879
  Reflect.ownKeys(initialObject).forEach(function (key) {
@@ -1900,46 +1906,43 @@ function useDollarState(specs, props, $ctx) {
1900
1906
  }()).current;
1901
1907
  $$state.props = props;
1902
1908
  $$state.ctx = $ctx != null ? $ctx : {};
1903
- var $state = React__default.useRef(function () {
1904
- var useRef$state = Object.assign(create$StateProxy($$state, function (node, path, proxyRoot) {
1905
- if (!node.hasState(path)) {
1906
- node.createStateCell(path);
1909
+ var $state = React__default.useRef(Object.assign(create$StateProxy($$state, function (node, path, proxyRoot) {
1910
+ if (!node.hasState(path)) {
1911
+ node.createStateCell(path);
1912
+ var spec = node.getSpec();
1913
+ if (spec.initFunc) {
1914
+ initializeStateValue($$state, node, path, proxyRoot);
1915
+ } else if (!spec.valueProp) {
1916
+ set(proxyRoot, path, spec.initVal);
1917
+ }
1918
+ }
1919
+ return {
1920
+ get: function get(target, property, receiver) {
1907
1921
  var spec = node.getSpec();
1908
- if (spec.initFunc) {
1909
- initializeStateValue($$state, node, path, proxyRoot);
1910
- } else if (!spec.valueProp) {
1911
- set(proxyRoot, path, spec.initVal);
1922
+ if (spec.valueProp) {
1923
+ return $$state.props[spec.valueProp];
1924
+ } else {
1925
+ return Reflect.get(target, property, receiver);
1912
1926
  }
1913
1927
  }
1914
- return {
1915
- get: function get(target, property, receiver) {
1916
- var spec = node.getSpec();
1917
- if (spec.valueProp) {
1918
- return $$state.props[spec.valueProp];
1919
- } else {
1920
- return Reflect.get(target, property, receiver);
1921
- }
1922
- }
1923
- };
1924
- }), {
1925
- registerInitFunc: function registerInitFunc(pathStr, f, repetitionIndex) {
1926
- var _findStateCell = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex),
1927
- node = _findStateCell.node,
1928
- realPath = _findStateCell.realPath;
1929
- if (!node.hasState(realPath)) {
1930
- node.createStateCell(realPath);
1931
- }
1932
- if (!deepEqual(node.getState(realPath).initialValue, f($$state.props, useRef$state, $$state.ctx))) {
1933
- $$state.registrationsQueue.push({
1934
- node: node,
1935
- path: realPath,
1936
- f: f
1937
- });
1938
- }
1928
+ };
1929
+ }), {
1930
+ registerInitFunc: function registerInitFunc(pathStr, f, repetitionIndex) {
1931
+ var _findStateCell = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex),
1932
+ node = _findStateCell.node,
1933
+ realPath = _findStateCell.realPath;
1934
+ if (!node.hasState(realPath)) {
1935
+ node.createStateCell(realPath);
1939
1936
  }
1940
- });
1941
- return useRef$state;
1942
- }()).current;
1937
+ if (!deepEqual(node.getState(realPath).initialValue, f($$state.props, $state, $$state.ctx))) {
1938
+ $$state.registrationsQueue.push({
1939
+ node: node,
1940
+ path: realPath,
1941
+ f: f
1942
+ });
1943
+ }
1944
+ }
1945
+ })).current;
1943
1946
  // For each spec with an initFunc, evaluate it and see if
1944
1947
  // the init value has changed. If so, reset its state.
1945
1948
  var resetSpecs = [];