@plasmicapp/react-web 0.2.430 → 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 +9 -20
  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
@@ -4,7 +4,7 @@ import { usePlasmicDataSourceContext, PlasmicDataSourceContextProvider } from '@
4
4
  export { PlasmicDataSourceContextProvider, useCurrentUser } from '@plasmicapp/data-sources-context';
5
5
  import * as plasmicQuery from '@plasmicapp/query';
6
6
  import * as React from 'react';
7
- import React__default, { useLayoutEffect, useEffect } from 'react';
7
+ import React__default from 'react';
8
8
  import { usePlasmicLinkMaybe, PlasmicTranslatorContext as PlasmicTranslatorContext$1, usePlasmicTranslator as usePlasmicTranslator$1, DataProvider, PlasmicLinkProvider, usePlasmicCanvasContext } from '@plasmicapp/host';
9
9
  import get from 'dlv';
10
10
  export { default as get } from 'dlv';
@@ -526,7 +526,7 @@ function PlasmicIcon(props) {
526
526
 
527
527
  var isBrowser = typeof window !== "undefined";
528
528
  var NONE = Symbol("NONE");
529
- var useIsomorphicLayoutEffect$1 = isBrowser
529
+ var useIsomorphicLayoutEffect = isBrowser
530
530
  ? React__default.useLayoutEffect
531
531
  : React__default.useEffect;
532
532
  function createElementWithChildren(elementType, props, children) {
@@ -1739,7 +1739,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
1739
1739
  // register our forceUpdate. This ensures that if there was
1740
1740
  // a window resize event between render and effects, that the
1741
1741
  // listener will be registered in time
1742
- useIsomorphicLayoutEffect$1(function () {
1742
+ useIsomorphicLayoutEffect(function () {
1743
1743
  var updateIfChanged = function () {
1744
1744
  if (curScreenVariants &&
1745
1745
  lastScreenVariantsRef.current.join("") !== curScreenVariants.join("")) {
@@ -1777,7 +1777,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
1777
1777
 
1778
1778
  var PlasmicRootContext = React.createContext(undefined);
1779
1779
  function PlasmicRootProvider(props) {
1780
- var _a, _b;
1780
+ var _a;
1781
1781
  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;
1782
1782
  var context = React.useMemo(function () { return ({
1783
1783
  platform: platform,
@@ -1794,9 +1794,9 @@ function PlasmicRootProvider(props) {
1794
1794
  React.createElement(PlasmicRootContext.Provider, { value: context },
1795
1795
  React.createElement(MaybeWrap, { cond: reactMajorVersion < 18, wrapper: function (children_) { return React.createElement(SSRProvider, null, children_); } },
1796
1796
  React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1797
- React.createElement(PlasmicTranslatorContext.Provider, { value: (_a = props.i18n) !== null && _a !== void 0 ? _a : props.translator },
1797
+ React.createElement(PlasmicTranslatorContext.Provider, { value: props.i18n },
1798
1798
  React.createElement(PlasmicHeadContext.Provider, { value: props.Head },
1799
- React.createElement(SafePlasmicLinkProvider, { Link: (_b = props.Link) !== null && _b !== void 0 ? _b : PlasmicLinkInternal }, children))))))));
1799
+ React.createElement(SafePlasmicLinkProvider, { Link: (_a = props.Link) !== null && _a !== void 0 ? _a : PlasmicLinkInternal }, children))))))));
1800
1800
  }
1801
1801
  /**
1802
1802
  * A PlasmicLinkProvider that anticipates PlasmicLinkProvider may not exist yet from
@@ -2187,9 +2187,6 @@ function findStateCell(root, pathStr, repetitionIndex) {
2187
2187
  }
2188
2188
 
2189
2189
  var defer = setTimeout;
2190
- function isNum$1(value) {
2191
- return typeof value === "symbol" ? false : !isNaN(+value);
2192
- }
2193
2190
  function canProxy(value) {
2194
2191
  return typeof value === "object" && value != null;
2195
2192
  }
@@ -2300,11 +2297,11 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
2300
2297
  var stateCell = _a.stateCell;
2301
2298
  stateCell.listeners.push(function () {
2302
2299
  var _a;
2303
- var newValue = invokeInitFuncBackwardsCompatible(initialStateCell.node.getSpec().initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2300
+ var newValue = invokeInitFunc(initialStateCell.node.getSpec().initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2304
2301
  set(proxyRoot, initialStateCell.path, newValue);
2305
2302
  });
2306
2303
  });
2307
- var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2304
+ var initialValue = invokeInitFunc(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
2308
2305
  var initialSpec = initialStateCell.node.getSpec();
2309
2306
  // Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
2310
2307
  // and we still want to clear some states and return the initialValue.
@@ -2330,7 +2327,7 @@ function create$StateProxy($$state, leafHandlers) {
2330
2327
  var proxyRoot;
2331
2328
  var rec = function (currPath, currNode) {
2332
2329
  var getNextPath = function (property) { return __spreadArray(__spreadArray([], __read(currPath), false), [
2333
- isNum$1(property) ? +property : property,
2330
+ isNum(property) ? +property : property,
2334
2331
  ], false); };
2335
2332
  var spec = currNode.getSpec();
2336
2333
  var handlers = {
@@ -2338,7 +2335,7 @@ function create$StateProxy($$state, leafHandlers) {
2338
2335
  var _a, _b;
2339
2336
  if (!currNode.isLeaf() &&
2340
2337
  !currNode.hasArrayTransition() &&
2341
- !isNum$1(property)) {
2338
+ !isNum(property)) {
2342
2339
  throw new InvalidOperation("Can't delete a property in the middle of the state spec");
2343
2340
  }
2344
2341
  delete get($$state.stateValues, currPath)[property];
@@ -2485,13 +2482,8 @@ function extractDollarStateParametersBackwardCompatible() {
2485
2482
  };
2486
2483
  }
2487
2484
  }
2488
- function invokeInitFuncBackwardsCompatible(initFunc, env) {
2489
- if (initFunc.length > 1) {
2490
- return initFunc(env.$props, env.$state, env.$ctx);
2491
- }
2492
- else {
2493
- return initFunc(env);
2494
- }
2485
+ function invokeInitFunc(initFunc, env) {
2486
+ return initFunc(env);
2495
2487
  }
2496
2488
  function useDollarState(specs) {
2497
2489
  var rest = [];
@@ -2646,7 +2638,7 @@ function useDollarState(specs) {
2646
2638
  var _a;
2647
2639
  if (stateCell.initFunc) {
2648
2640
  try {
2649
- var newInit = invokeInitFuncBackwardsCompatible(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
2641
+ var newInit = invokeInitFunc(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
2650
2642
  if (!deepEqual(newInit, stateCell.initialValue)) {
2651
2643
  resetSpecs.push({ stateCell: stateCell });
2652
2644
  }
@@ -2756,7 +2748,6 @@ function generateStateOnChangePropForCodeComponents($state, stateName, plasmicSt
2756
2748
  function generateStateValueProp($state, path) {
2757
2749
  return get($state, path);
2758
2750
  }
2759
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
2760
2751
  function isPlasmicStateProxy(obj) {
2761
2752
  return (obj != null && typeof obj === "object" && !!obj[PLASMIC_STATE_PROXY_SYMBOL]);
2762
2753
  }
@@ -2870,8 +2861,9 @@ function set(obj, keys, val) {
2870
2861
  var i = 0, l = keys.length, t = obj, x, k;
2871
2862
  while (i < l) {
2872
2863
  k = "" + keys[i++];
2873
- if (k === "__proto__" || k === "constructor" || k === "prototype")
2864
+ if (k === "__proto__" || k === "constructor" || k === "prototype") {
2874
2865
  break;
2866
+ }
2875
2867
  var newValue = i === l
2876
2868
  ? val
2877
2869
  : typeof (x = t[k]) === typeof keys
@@ -2937,29 +2929,35 @@ var isRegExp = function (a) {
2937
2929
  */
2938
2930
  function deepEqual(a, b) {
2939
2931
  var e_4, _a, e_5, _b, e_6, _c;
2940
- if (a === b)
2932
+ if (a === b) {
2941
2933
  return true;
2934
+ }
2942
2935
  if (a && b && typeof a == "object" && typeof b == "object") {
2943
2936
  // if (a.constructor !== b.constructor) return false;
2944
- var length, i, keys;
2937
+ var length_1, i = void 0, keys = void 0;
2945
2938
  if (Array.isArray(a)) {
2946
- length = a.length;
2947
- if (length != b.length)
2939
+ length_1 = a.length;
2940
+ if (length_1 != b.length) {
2948
2941
  return false;
2949
- for (i = length; i-- !== 0;)
2950
- if (!deepEqual(a[i], b[i]))
2942
+ }
2943
+ for (i = length_1; i-- !== 0;) {
2944
+ if (!deepEqual(a[i], b[i])) {
2951
2945
  return false;
2946
+ }
2947
+ }
2952
2948
  return true;
2953
2949
  }
2954
2950
  // if ((a instanceof Map) && (b instanceof Map)) {
2955
2951
  if (isInstanceOfMap(a) && isInstanceOfMap(b)) {
2956
- if (a.size !== b.size)
2952
+ if (a.size !== b.size) {
2957
2953
  return false;
2954
+ }
2958
2955
  try {
2959
2956
  for (var _d = __values(a.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
2960
2957
  i = _e.value;
2961
- if (!b.has(i[0]))
2958
+ if (!b.has(i[0])) {
2962
2959
  return false;
2960
+ }
2963
2961
  }
2964
2962
  }
2965
2963
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -2972,8 +2970,9 @@ function deepEqual(a, b) {
2972
2970
  try {
2973
2971
  for (var _f = __values(a.entries()), _g = _f.next(); !_g.done; _g = _f.next()) {
2974
2972
  i = _g.value;
2975
- if (!deepEqual(i[1], b.get(i[0])))
2973
+ if (!deepEqual(i[1], b.get(i[0]))) {
2976
2974
  return false;
2975
+ }
2977
2976
  }
2978
2977
  }
2979
2978
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -2987,13 +2986,15 @@ function deepEqual(a, b) {
2987
2986
  }
2988
2987
  // if ((a instanceof Set) && (b instanceof Set)) {
2989
2988
  if (isInstanceOfSet(a) && isInstanceOfSet(b)) {
2990
- if (a.size !== b.size)
2989
+ if (a.size !== b.size) {
2991
2990
  return false;
2991
+ }
2992
2992
  try {
2993
2993
  for (var _h = __values(a.entries()), _j = _h.next(); !_j.done; _j = _h.next()) {
2994
2994
  i = _j.value;
2995
- if (!b.has(i[0]))
2995
+ if (!b.has(i[0])) {
2996
2996
  return false;
2997
+ }
2997
2998
  }
2998
2999
  }
2999
3000
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
@@ -3006,20 +3007,24 @@ function deepEqual(a, b) {
3006
3007
  return true;
3007
3008
  }
3008
3009
  // if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
3009
- if (isRegExp(a) && isRegExp(b))
3010
+ if (isRegExp(a) && isRegExp(b)) {
3010
3011
  return a.source === b.source && a.flags === b.flags;
3012
+ }
3011
3013
  // if (a.valueOf !== Object.prototype.valueOf)
3012
3014
  // return a.valueOf() === b.valueOf();
3013
3015
  // if (a.toString !== Object.prototype.toString)
3014
3016
  // return a.toString() === b.toString();
3015
3017
  keys = Object.keys(a);
3016
- length = keys.length;
3017
- if (length !== Object.keys(b).length)
3018
+ length_1 = keys.length;
3019
+ if (length_1 !== Object.keys(b).length) {
3018
3020
  return false;
3019
- for (i = length; i-- !== 0;)
3020
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
3021
+ }
3022
+ for (i = length_1; i-- !== 0;) {
3023
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
3021
3024
  return false;
3022
- for (i = length; i-- !== 0;) {
3025
+ }
3026
+ }
3027
+ for (i = length_1; i-- !== 0;) {
3023
3028
  var key = keys[i];
3024
3029
  if (key === "_owner" && a.$$typeof) {
3025
3030
  // React-specific: avoid traversing React elements' _owner.
@@ -3027,8 +3032,9 @@ function deepEqual(a, b) {
3027
3032
  // and is not needed when comparing the actual elements (and not their owners)
3028
3033
  continue;
3029
3034
  }
3030
- if (!deepEqual(a[key], b[key]))
3035
+ if (!deepEqual(a[key], b[key])) {
3031
3036
  return false;
3037
+ }
3032
3038
  }
3033
3039
  return true;
3034
3040
  }
@@ -4174,7 +4180,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
4174
4180
  var triggerWidth = triggerRef.current && (overlayMatchTriggerWidth || overlayMinTriggerWidth)
4175
4181
  ? triggerRef.current.offsetWidth
4176
4182
  : undefined;
4177
- useIsomorphicLayoutEffect$1(function () {
4183
+ useIsomorphicLayoutEffect(function () {
4178
4184
  if (!isRendered &&
4179
4185
  triggerRef.current &&
4180
4186
  (overlayMatchTriggerWidth || overlayMinTriggerWidth)) {
@@ -4201,7 +4207,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
4201
4207
  onClose: state.close,
4202
4208
  containerPadding: 0,
4203
4209
  }), overlayPositionProps = _d.overlayProps, updatePosition = _d.updatePosition, placementAxis = _d.placement;
4204
- useIsomorphicLayoutEffect$1(function () {
4210
+ useIsomorphicLayoutEffect(function () {
4205
4211
  if (state.isOpen) {
4206
4212
  requestAnimationFrame(function () {
4207
4213
  updatePosition();