@plasmicapp/react-web 0.2.429 → 1.0.0

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.
Files changed (36) hide show
  1. package/dist/all.d.ts +727 -480
  2. package/dist/index.cjs.js +48 -42
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/react-web.esm.js +49 -43
  5. package/dist/react-web.esm.js.map +1 -1
  6. package/dist/render/ssr.d.ts +1 -5
  7. package/dist/states/helpers.d.ts +0 -2
  8. package/dist/states/types.d.ts +0 -1
  9. package/package.json +13 -24
  10. package/skinny/dist/index.js +46 -40
  11. package/skinny/dist/index.js.map +1 -1
  12. package/skinny/dist/plume/checkbox/index.js +1 -1
  13. package/skinny/dist/plume/menu/index.js +1 -1
  14. package/skinny/dist/plume/menu-button/index.js +1 -1
  15. package/skinny/dist/plume/select/index.js +1 -1
  16. package/skinny/dist/plume/switch/index.js +1 -1
  17. package/skinny/dist/render/ssr.d.ts +1 -5
  18. package/skinny/dist/{ssr-6d9f9c44.js → ssr-e496f477.js} +4 -4
  19. package/skinny/dist/ssr-e496f477.js.map +1 -0
  20. package/skinny/dist/states/helpers.d.ts +0 -2
  21. package/skinny/dist/states/types.d.ts +0 -1
  22. package/dist/nextjs-app-router/index.d.ts +0 -1
  23. package/dist/nextjs-app-router/react-server/index.d.ts +0 -15
  24. package/lib/nextjs-app-router/index.cjs.js +0 -11
  25. package/lib/nextjs-app-router/index.cjs.js.map +0 -1
  26. package/lib/nextjs-app-router/index.d.ts +0 -1
  27. package/lib/nextjs-app-router/index.js +0 -2
  28. package/lib/nextjs-app-router/index.js.map +0 -1
  29. package/lib/nextjs-app-router/react-server/index.cjs.js +0 -143
  30. package/lib/nextjs-app-router/react-server/index.cjs.js.map +0 -1
  31. package/lib/nextjs-app-router/react-server/index.d.ts +0 -15
  32. package/lib/nextjs-app-router/react-server/index.js +0 -130
  33. package/lib/nextjs-app-router/react-server/index.js.map +0 -1
  34. package/skinny/dist/nextjs-app-router/index.d.ts +0 -1
  35. package/skinny/dist/nextjs-app-router/react-server/index.d.ts +0 -15
  36. package/skinny/dist/ssr-6d9f9c44.js.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -545,7 +545,7 @@ function PlasmicIcon(props) {
545
545
 
546
546
  var isBrowser = typeof window !== "undefined";
547
547
  var NONE = Symbol("NONE");
548
- var useIsomorphicLayoutEffect$1 = isBrowser
548
+ var useIsomorphicLayoutEffect = isBrowser
549
549
  ? React.useLayoutEffect
550
550
  : React.useEffect;
551
551
  function createElementWithChildren(elementType, props, children) {
@@ -1758,7 +1758,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
1758
1758
  // register our forceUpdate. This ensures that if there was
1759
1759
  // a window resize event between render and effects, that the
1760
1760
  // listener will be registered in time
1761
- useIsomorphicLayoutEffect$1(function () {
1761
+ useIsomorphicLayoutEffect(function () {
1762
1762
  var updateIfChanged = function () {
1763
1763
  if (curScreenVariants &&
1764
1764
  lastScreenVariantsRef.current.join("") !== curScreenVariants.join("")) {
@@ -1796,7 +1796,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
1796
1796
 
1797
1797
  var PlasmicRootContext = React__namespace.createContext(undefined);
1798
1798
  function PlasmicRootProvider(props) {
1799
- var _a, _b;
1799
+ var _a;
1800
1800
  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;
1801
1801
  var context = React__namespace.useMemo(function () { return ({
1802
1802
  platform: platform,
@@ -1813,9 +1813,9 @@ function PlasmicRootProvider(props) {
1813
1813
  React__namespace.createElement(PlasmicRootContext.Provider, { value: context },
1814
1814
  React__namespace.createElement(MaybeWrap, { cond: reactMajorVersion < 18, wrapper: function (children_) { return React__namespace.createElement(ssr.SSRProvider, null, children_); } },
1815
1815
  React__namespace.createElement(dataSourcesContext.PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1816
- React__namespace.createElement(PlasmicTranslatorContext.Provider, { value: (_a = props.i18n) !== null && _a !== void 0 ? _a : props.translator },
1816
+ React__namespace.createElement(PlasmicTranslatorContext.Provider, { value: props.i18n },
1817
1817
  React__namespace.createElement(PlasmicHeadContext.Provider, { value: props.Head },
1818
- React__namespace.createElement(SafePlasmicLinkProvider, { Link: (_b = props.Link) !== null && _b !== void 0 ? _b : PlasmicLinkInternal }, children))))))));
1818
+ React__namespace.createElement(SafePlasmicLinkProvider, { Link: (_a = props.Link) !== null && _a !== void 0 ? _a : PlasmicLinkInternal }, children))))))));
1819
1819
  }
1820
1820
  /**
1821
1821
  * A PlasmicLinkProvider that anticipates PlasmicLinkProvider may not exist yet from
@@ -2206,9 +2206,6 @@ function findStateCell(root, pathStr, repetitionIndex) {
2206
2206
  }
2207
2207
 
2208
2208
  var defer = setTimeout;
2209
- function isNum$1(value) {
2210
- return typeof value === "symbol" ? false : !isNaN(+value);
2211
- }
2212
2209
  function canProxy(value) {
2213
2210
  return typeof value === "object" && value != null;
2214
2211
  }
@@ -2319,11 +2316,11 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
2319
2316
  var stateCell = _a.stateCell;
2320
2317
  stateCell.listeners.push(function () {
2321
2318
  var _a;
2322
- var newValue = invokeInitFuncBackwardsCompatible(initialStateCell.node.getSpec().initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2319
+ var newValue = invokeInitFunc(initialStateCell.node.getSpec().initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2323
2320
  set(proxyRoot, initialStateCell.path, newValue);
2324
2321
  });
2325
2322
  });
2326
- var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2323
+ var initialValue = invokeInitFunc(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2327
2324
  var initialSpec = initialStateCell.node.getSpec();
2328
2325
  // Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
2329
2326
  // and we still want to clear some states and return the initialValue.
@@ -2349,7 +2346,7 @@ function create$StateProxy($$state, leafHandlers) {
2349
2346
  var proxyRoot;
2350
2347
  var rec = function (currPath, currNode) {
2351
2348
  var getNextPath = function (property) { return __spreadArray(__spreadArray([], __read(currPath), false), [
2352
- isNum$1(property) ? +property : property,
2349
+ isNum(property) ? +property : property,
2353
2350
  ], false); };
2354
2351
  var spec = currNode.getSpec();
2355
2352
  var handlers = {
@@ -2357,7 +2354,7 @@ function create$StateProxy($$state, leafHandlers) {
2357
2354
  var _a, _b;
2358
2355
  if (!currNode.isLeaf() &&
2359
2356
  !currNode.hasArrayTransition() &&
2360
- !isNum$1(property)) {
2357
+ !isNum(property)) {
2361
2358
  throw new InvalidOperation("Can't delete a property in the middle of the state spec");
2362
2359
  }
2363
2360
  delete get($$state.stateValues, currPath)[property];
@@ -2504,13 +2501,8 @@ function extractDollarStateParametersBackwardCompatible() {
2504
2501
  };
2505
2502
  }
2506
2503
  }
2507
- function invokeInitFuncBackwardsCompatible(initFunc, env) {
2508
- if (initFunc.length > 1) {
2509
- return initFunc(env.$props, env.$state, env.$ctx);
2510
- }
2511
- else {
2512
- return initFunc(env);
2513
- }
2504
+ function invokeInitFunc(initFunc, env) {
2505
+ return initFunc(env);
2514
2506
  }
2515
2507
  function useDollarState(specs) {
2516
2508
  var rest = [];
@@ -2665,7 +2657,7 @@ function useDollarState(specs) {
2665
2657
  var _a;
2666
2658
  if (stateCell.initFunc) {
2667
2659
  try {
2668
- var newInit = invokeInitFuncBackwardsCompatible(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
2660
+ var newInit = invokeInitFunc(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
2669
2661
  if (!deepEqual(newInit, stateCell.initialValue)) {
2670
2662
  resetSpecs.push({ stateCell: stateCell });
2671
2663
  }
@@ -2775,7 +2767,6 @@ function generateStateOnChangePropForCodeComponents($state, stateName, plasmicSt
2775
2767
  function generateStateValueProp($state, path) {
2776
2768
  return get($state, path);
2777
2769
  }
2778
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
2779
2770
  function isPlasmicStateProxy(obj) {
2780
2771
  return (obj != null && typeof obj === "object" && !!obj[PLASMIC_STATE_PROXY_SYMBOL]);
2781
2772
  }
@@ -2889,8 +2880,9 @@ function set(obj, keys, val) {
2889
2880
  var i = 0, l = keys.length, t = obj, x, k;
2890
2881
  while (i < l) {
2891
2882
  k = "" + keys[i++];
2892
- if (k === "__proto__" || k === "constructor" || k === "prototype")
2883
+ if (k === "__proto__" || k === "constructor" || k === "prototype") {
2893
2884
  break;
2885
+ }
2894
2886
  var newValue = i === l
2895
2887
  ? val
2896
2888
  : typeof (x = t[k]) === typeof keys
@@ -2956,29 +2948,35 @@ var isRegExp = function (a) {
2956
2948
  */
2957
2949
  function deepEqual(a, b) {
2958
2950
  var e_4, _a, e_5, _b, e_6, _c;
2959
- if (a === b)
2951
+ if (a === b) {
2960
2952
  return true;
2953
+ }
2961
2954
  if (a && b && typeof a == "object" && typeof b == "object") {
2962
2955
  // if (a.constructor !== b.constructor) return false;
2963
- var length, i, keys;
2956
+ var length_1, i = void 0, keys = void 0;
2964
2957
  if (Array.isArray(a)) {
2965
- length = a.length;
2966
- if (length != b.length)
2958
+ length_1 = a.length;
2959
+ if (length_1 != b.length) {
2967
2960
  return false;
2968
- for (i = length; i-- !== 0;)
2969
- if (!deepEqual(a[i], b[i]))
2961
+ }
2962
+ for (i = length_1; i-- !== 0;) {
2963
+ if (!deepEqual(a[i], b[i])) {
2970
2964
  return false;
2965
+ }
2966
+ }
2971
2967
  return true;
2972
2968
  }
2973
2969
  // if ((a instanceof Map) && (b instanceof Map)) {
2974
2970
  if (isInstanceOfMap(a) && isInstanceOfMap(b)) {
2975
- if (a.size !== b.size)
2971
+ if (a.size !== b.size) {
2976
2972
  return false;
2973
+ }
2977
2974
  try {
2978
2975
  for (var _d = __values(a.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
2979
2976
  i = _e.value;
2980
- if (!b.has(i[0]))
2977
+ if (!b.has(i[0])) {
2981
2978
  return false;
2979
+ }
2982
2980
  }
2983
2981
  }
2984
2982
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -2991,8 +2989,9 @@ function deepEqual(a, b) {
2991
2989
  try {
2992
2990
  for (var _f = __values(a.entries()), _g = _f.next(); !_g.done; _g = _f.next()) {
2993
2991
  i = _g.value;
2994
- if (!deepEqual(i[1], b.get(i[0])))
2992
+ if (!deepEqual(i[1], b.get(i[0]))) {
2995
2993
  return false;
2994
+ }
2996
2995
  }
2997
2996
  }
2998
2997
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -3006,13 +3005,15 @@ function deepEqual(a, b) {
3006
3005
  }
3007
3006
  // if ((a instanceof Set) && (b instanceof Set)) {
3008
3007
  if (isInstanceOfSet(a) && isInstanceOfSet(b)) {
3009
- if (a.size !== b.size)
3008
+ if (a.size !== b.size) {
3010
3009
  return false;
3010
+ }
3011
3011
  try {
3012
3012
  for (var _h = __values(a.entries()), _j = _h.next(); !_j.done; _j = _h.next()) {
3013
3013
  i = _j.value;
3014
- if (!b.has(i[0]))
3014
+ if (!b.has(i[0])) {
3015
3015
  return false;
3016
+ }
3016
3017
  }
3017
3018
  }
3018
3019
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
@@ -3025,20 +3026,24 @@ function deepEqual(a, b) {
3025
3026
  return true;
3026
3027
  }
3027
3028
  // if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
3028
- if (isRegExp(a) && isRegExp(b))
3029
+ if (isRegExp(a) && isRegExp(b)) {
3029
3030
  return a.source === b.source && a.flags === b.flags;
3031
+ }
3030
3032
  // if (a.valueOf !== Object.prototype.valueOf)
3031
3033
  // return a.valueOf() === b.valueOf();
3032
3034
  // if (a.toString !== Object.prototype.toString)
3033
3035
  // return a.toString() === b.toString();
3034
3036
  keys = Object.keys(a);
3035
- length = keys.length;
3036
- if (length !== Object.keys(b).length)
3037
+ length_1 = keys.length;
3038
+ if (length_1 !== Object.keys(b).length) {
3037
3039
  return false;
3038
- for (i = length; i-- !== 0;)
3039
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
3040
+ }
3041
+ for (i = length_1; i-- !== 0;) {
3042
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
3040
3043
  return false;
3041
- for (i = length; i-- !== 0;) {
3044
+ }
3045
+ }
3046
+ for (i = length_1; i-- !== 0;) {
3042
3047
  var key = keys[i];
3043
3048
  if (key === "_owner" && a.$$typeof) {
3044
3049
  // React-specific: avoid traversing React elements' _owner.
@@ -3046,8 +3051,9 @@ function deepEqual(a, b) {
3046
3051
  // and is not needed when comparing the actual elements (and not their owners)
3047
3052
  continue;
3048
3053
  }
3049
- if (!deepEqual(a[key], b[key]))
3054
+ if (!deepEqual(a[key], b[key])) {
3050
3055
  return false;
3056
+ }
3051
3057
  }
3052
3058
  return true;
3053
3059
  }
@@ -4193,7 +4199,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
4193
4199
  var triggerWidth = triggerRef.current && (overlayMatchTriggerWidth || overlayMinTriggerWidth)
4194
4200
  ? triggerRef.current.offsetWidth
4195
4201
  : undefined;
4196
- useIsomorphicLayoutEffect$1(function () {
4202
+ useIsomorphicLayoutEffect(function () {
4197
4203
  if (!isRendered &&
4198
4204
  triggerRef.current &&
4199
4205
  (overlayMatchTriggerWidth || overlayMinTriggerWidth)) {
@@ -4220,7 +4226,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
4220
4226
  onClose: state.close,
4221
4227
  containerPadding: 0,
4222
4228
  }), overlayPositionProps = _d.overlayProps, updatePosition = _d.updatePosition, placementAxis = _d.placement;
4223
- useIsomorphicLayoutEffect$1(function () {
4229
+ useIsomorphicLayoutEffect(function () {
4224
4230
  if (state.isOpen) {
4225
4231
  requestAnimationFrame(function () {
4226
4232
  updatePosition();