@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
@@ -1,5 +1,5 @@
1
1
  import { PlasmicDataSourceContextValue } from "@plasmicapp/data-sources-context";
2
- import { PlasmicI18NContextValue, PlasmicTranslator } from "@plasmicapp/host";
2
+ import { PlasmicI18NContextValue } from "@plasmicapp/host";
3
3
  import { useIsSSR as useAriaIsSSR } from "@react-aria/ssr";
4
4
  import * as React from "react";
5
5
  export { PlasmicDataSourceContextProvider, useCurrentUser, } from "@plasmicapp/data-sources-context";
@@ -10,10 +10,6 @@ export interface PlasmicRootProviderProps extends PlasmicDataSourceContextValue
10
10
  platform?: "nextjs" | "gatsby";
11
11
  children?: React.ReactNode;
12
12
  i18n?: PlasmicI18NContextValue;
13
- /**
14
- * @deprecated use i18n.translator instead
15
- */
16
- translator?: PlasmicTranslator;
17
13
  Head?: React.ComponentType<any>;
18
14
  Link?: React.ComponentType<any>;
19
15
  disableLoadingBoundary?: boolean;
@@ -1,5 +1,4 @@
1
1
  import type { ComponentHelpers } from "@plasmicapp/host";
2
- import { useLayoutEffect } from "react";
3
2
  import { StateSpecNode } from "./graph";
4
3
  import { $State, InitFunc, ObjectPath, StateCell } from "./types";
5
4
  export declare function initializeCodeComponentStates($state: $State, states: {
@@ -14,7 +13,6 @@ export declare function initializePlasmicStates($state: $State, states: {
14
13
  export declare function generateStateOnChangeProp($state: $State, path: ObjectPath): (val: any) => void;
15
14
  export declare function generateStateOnChangePropForCodeComponents($state: $State, stateName: string, plasmicStatePath: ObjectPath, componentHelpers: ComponentHelpers<any>): (val: any) => void;
16
15
  export declare function generateStateValueProp($state: $State, path: ObjectPath): any;
17
- export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
18
16
  export declare function isPlasmicStateProxy(obj: any): boolean;
19
17
  export declare function is$StateProxy(obj: any): number | boolean | undefined;
20
18
  export declare function getStateCells($state: $State, root: StateSpecNode<any>): StateCell<any>[];
@@ -12,7 +12,6 @@ export type NoUndefinedField<T> = {
12
12
  [P in keyof T]-?: T[P];
13
13
  };
14
14
  export type InitFunc<T> = (env: NoUndefinedField<InitFuncEnv>) => T;
15
- export type DeprecatedInitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>) => T;
16
15
  export type ObjectPath = (string | number)[];
17
16
  export interface $StateSpec<T> {
18
17
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/react-web",
3
- "version": "0.2.430",
3
+ "version": "1.0.0",
4
4
  "description": "plasmic library for rendering in the presentational style",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,16 +65,6 @@
65
65
  },
66
66
  "./additional-types-PlasmicImg": {
67
67
  "types": "./dist/render/PlasmicImg/index.d.ts"
68
- },
69
- "./lib/nextjs-app-router": {
70
- "types": "./lib/nextjs-app-router/index.d.ts",
71
- "import": "./lib/nextjs-app-router/index.js",
72
- "require": "./lib/nextjs-app-router/index.cjs.js"
73
- },
74
- "./lib/nextjs-app-router/react-server": {
75
- "types": "./lib/nextjs-app-router/react-server/index.d.ts",
76
- "import": "./lib/nextjs-app-router/react-server/index.js",
77
- "require": "./lib/nextjs-app-router/react-server/index.cjs.js"
78
68
  }
79
69
  },
80
70
  "files": [
@@ -96,10 +86,10 @@
96
86
  },
97
87
  "dependencies": {
98
88
  "@plasmicapp/auth-react": "0.0.27",
99
- "@plasmicapp/data-sources": "0.1.209",
89
+ "@plasmicapp/data-sources": "1.0.0",
100
90
  "@plasmicapp/data-sources-context": "0.1.23",
101
- "@plasmicapp/host": "1.0.240",
102
- "@plasmicapp/loader-splits": "1.0.69",
91
+ "@plasmicapp/host": "2.0.0",
92
+ "@plasmicapp/loader-splits": "1.0.70",
103
93
  "@plasmicapp/nextjs-app-router": "1.0.22",
104
94
  "@plasmicapp/prepass": "1.0.24",
105
95
  "@plasmicapp/query": "0.1.84",
@@ -124,7 +114,6 @@
124
114
  "classnames": "^2.5.1",
125
115
  "clone": "^2.1.2",
126
116
  "dlv": "^1.1.3",
127
- "fast-deep-equal": "^3.1.3",
128
117
  "valtio": "^1.6.4"
129
118
  },
130
119
  "devDependencies": {
@@ -143,15 +132,15 @@
143
132
  "@types/dlv": "^1.1.2",
144
133
  "@types/react": "^18",
145
134
  "@types/react-dom": "^18",
146
- "react": "^18.2.0",
147
- "react-dom": "^18.2.0",
135
+ "react": "18.3.1",
136
+ "react-dom": "18.3.1",
148
137
  "rollup": "^3.26.1",
149
138
  "rollup-plugin-dts": "^5.3.0",
150
139
  "rollup-plugin-typescript2": "^0.36.0"
151
140
  },
152
141
  "peerDependencies": {
153
- "react": ">=16.8.0",
154
- "react-dom": ">=16.8.0"
142
+ "react": ">=18.0.0",
143
+ "react-dom": ">=18.0.0"
155
144
  },
156
- "gitHead": "e1ca5cfd7107719663e14b557a79161e7e657a1a"
145
+ "gitHead": "cf4b7bfc318b5360730e4e080925370e37870858"
157
146
  }
@@ -4,12 +4,12 @@ import { usePlasmicDataSourceContext } from '@plasmicapp/data-sources-context';
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
  export { PlasmicHead, plasmicHeadMeta } from './render/PlasmicHead/index.js';
9
9
  export { PlasmicImg } from './render/PlasmicImg/index.js';
10
- import { T as Trans } from './ssr-6d9f9c44.js';
11
- export { P as PlasmicLink, a as PlasmicRootProvider, g as genTranslatableString, u as useIsSSR, b as usePlasmicTranslator } from './ssr-6d9f9c44.js';
12
- import { m as mergeProps, c as createElementWithChildren, e as ensureNotArray, N as NONE, a as mergePropVals, i as isReactNode, b as isBrowser, u as useIsomorphicLayoutEffect$1 } from './react-utils-2892a561.js';
10
+ import { T as Trans } from './ssr-e496f477.js';
11
+ export { P as PlasmicLink, a as PlasmicRootProvider, g as genTranslatableString, u as useIsSSR, b as usePlasmicTranslator } from './ssr-e496f477.js';
12
+ import { m as mergeProps, c as createElementWithChildren, e as ensureNotArray, N as NONE, a as mergePropVals, i as isReactNode, b as isBrowser, u as useIsomorphicLayoutEffect } from './react-utils-2892a561.js';
13
13
  import get from 'dlv';
14
14
  export { default as get } from 'dlv';
15
15
  import ReactDOM__default from 'react-dom';
@@ -704,7 +704,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
704
704
  // register our forceUpdate. This ensures that if there was
705
705
  // a window resize event between render and effects, that the
706
706
  // listener will be registered in time
707
- useIsomorphicLayoutEffect$1(function () {
707
+ useIsomorphicLayoutEffect(function () {
708
708
  var updateIfChanged = function () {
709
709
  if (curScreenVariants &&
710
710
  lastScreenVariantsRef.current.join("") !== curScreenVariants.join("")) {
@@ -1097,9 +1097,6 @@ function findStateCell(root, pathStr, repetitionIndex) {
1097
1097
  }
1098
1098
 
1099
1099
  var defer = setTimeout;
1100
- function isNum$1(value) {
1101
- return typeof value === "symbol" ? false : !isNaN(+value);
1102
- }
1103
1100
  function canProxy(value) {
1104
1101
  return typeof value === "object" && value != null;
1105
1102
  }
@@ -1210,11 +1207,11 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
1210
1207
  var stateCell = _a.stateCell;
1211
1208
  stateCell.listeners.push(function () {
1212
1209
  var _a;
1213
- var newValue = invokeInitFuncBackwardsCompatible(initialStateCell.node.getSpec().initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
1210
+ var newValue = invokeInitFunc(initialStateCell.node.getSpec().initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
1214
1211
  set(proxyRoot, initialStateCell.path, newValue);
1215
1212
  });
1216
1213
  });
1217
- var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
1214
+ var initialValue = invokeInitFunc(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
1218
1215
  var initialSpec = initialStateCell.node.getSpec();
1219
1216
  // Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
1220
1217
  // and we still want to clear some states and return the initialValue.
@@ -1240,7 +1237,7 @@ function create$StateProxy($$state, leafHandlers) {
1240
1237
  var proxyRoot;
1241
1238
  var rec = function (currPath, currNode) {
1242
1239
  var getNextPath = function (property) { return __spreadArray(__spreadArray([], __read(currPath), false), [
1243
- isNum$1(property) ? +property : property,
1240
+ isNum(property) ? +property : property,
1244
1241
  ], false); };
1245
1242
  var spec = currNode.getSpec();
1246
1243
  var handlers = {
@@ -1248,7 +1245,7 @@ function create$StateProxy($$state, leafHandlers) {
1248
1245
  var _a, _b;
1249
1246
  if (!currNode.isLeaf() &&
1250
1247
  !currNode.hasArrayTransition() &&
1251
- !isNum$1(property)) {
1248
+ !isNum(property)) {
1252
1249
  throw new InvalidOperation("Can't delete a property in the middle of the state spec");
1253
1250
  }
1254
1251
  delete get($$state.stateValues, currPath)[property];
@@ -1395,13 +1392,8 @@ function extractDollarStateParametersBackwardCompatible() {
1395
1392
  };
1396
1393
  }
1397
1394
  }
1398
- function invokeInitFuncBackwardsCompatible(initFunc, env) {
1399
- if (initFunc.length > 1) {
1400
- return initFunc(env.$props, env.$state, env.$ctx);
1401
- }
1402
- else {
1403
- return initFunc(env);
1404
- }
1395
+ function invokeInitFunc(initFunc, env) {
1396
+ return initFunc(env);
1405
1397
  }
1406
1398
  function useDollarState(specs) {
1407
1399
  var rest = [];
@@ -1556,7 +1548,7 @@ function useDollarState(specs) {
1556
1548
  var _a;
1557
1549
  if (stateCell.initFunc) {
1558
1550
  try {
1559
- var newInit = invokeInitFuncBackwardsCompatible(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
1551
+ var newInit = invokeInitFunc(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
1560
1552
  if (!deepEqual(newInit, stateCell.initialValue)) {
1561
1553
  resetSpecs.push({ stateCell: stateCell });
1562
1554
  }
@@ -1666,7 +1658,6 @@ function generateStateOnChangePropForCodeComponents($state, stateName, plasmicSt
1666
1658
  function generateStateValueProp($state, path) {
1667
1659
  return get($state, path);
1668
1660
  }
1669
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
1670
1661
  function isPlasmicStateProxy(obj) {
1671
1662
  return (obj != null && typeof obj === "object" && !!obj[PLASMIC_STATE_PROXY_SYMBOL]);
1672
1663
  }
@@ -1780,8 +1771,9 @@ function set(obj, keys, val) {
1780
1771
  var i = 0, l = keys.length, t = obj, x, k;
1781
1772
  while (i < l) {
1782
1773
  k = "" + keys[i++];
1783
- if (k === "__proto__" || k === "constructor" || k === "prototype")
1774
+ if (k === "__proto__" || k === "constructor" || k === "prototype") {
1784
1775
  break;
1776
+ }
1785
1777
  var newValue = i === l
1786
1778
  ? val
1787
1779
  : typeof (x = t[k]) === typeof keys
@@ -1847,29 +1839,35 @@ var isRegExp = function (a) {
1847
1839
  */
1848
1840
  function deepEqual(a, b) {
1849
1841
  var e_4, _a, e_5, _b, e_6, _c;
1850
- if (a === b)
1842
+ if (a === b) {
1851
1843
  return true;
1844
+ }
1852
1845
  if (a && b && typeof a == "object" && typeof b == "object") {
1853
1846
  // if (a.constructor !== b.constructor) return false;
1854
- var length, i, keys;
1847
+ var length_1, i = void 0, keys = void 0;
1855
1848
  if (Array.isArray(a)) {
1856
- length = a.length;
1857
- if (length != b.length)
1849
+ length_1 = a.length;
1850
+ if (length_1 != b.length) {
1858
1851
  return false;
1859
- for (i = length; i-- !== 0;)
1860
- if (!deepEqual(a[i], b[i]))
1852
+ }
1853
+ for (i = length_1; i-- !== 0;) {
1854
+ if (!deepEqual(a[i], b[i])) {
1861
1855
  return false;
1856
+ }
1857
+ }
1862
1858
  return true;
1863
1859
  }
1864
1860
  // if ((a instanceof Map) && (b instanceof Map)) {
1865
1861
  if (isInstanceOfMap(a) && isInstanceOfMap(b)) {
1866
- if (a.size !== b.size)
1862
+ if (a.size !== b.size) {
1867
1863
  return false;
1864
+ }
1868
1865
  try {
1869
1866
  for (var _d = __values(a.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
1870
1867
  i = _e.value;
1871
- if (!b.has(i[0]))
1868
+ if (!b.has(i[0])) {
1872
1869
  return false;
1870
+ }
1873
1871
  }
1874
1872
  }
1875
1873
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -1882,8 +1880,9 @@ function deepEqual(a, b) {
1882
1880
  try {
1883
1881
  for (var _f = __values(a.entries()), _g = _f.next(); !_g.done; _g = _f.next()) {
1884
1882
  i = _g.value;
1885
- if (!deepEqual(i[1], b.get(i[0])))
1883
+ if (!deepEqual(i[1], b.get(i[0]))) {
1886
1884
  return false;
1885
+ }
1887
1886
  }
1888
1887
  }
1889
1888
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -1897,13 +1896,15 @@ function deepEqual(a, b) {
1897
1896
  }
1898
1897
  // if ((a instanceof Set) && (b instanceof Set)) {
1899
1898
  if (isInstanceOfSet(a) && isInstanceOfSet(b)) {
1900
- if (a.size !== b.size)
1899
+ if (a.size !== b.size) {
1901
1900
  return false;
1901
+ }
1902
1902
  try {
1903
1903
  for (var _h = __values(a.entries()), _j = _h.next(); !_j.done; _j = _h.next()) {
1904
1904
  i = _j.value;
1905
- if (!b.has(i[0]))
1905
+ if (!b.has(i[0])) {
1906
1906
  return false;
1907
+ }
1907
1908
  }
1908
1909
  }
1909
1910
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
@@ -1916,20 +1917,24 @@ function deepEqual(a, b) {
1916
1917
  return true;
1917
1918
  }
1918
1919
  // if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
1919
- if (isRegExp(a) && isRegExp(b))
1920
+ if (isRegExp(a) && isRegExp(b)) {
1920
1921
  return a.source === b.source && a.flags === b.flags;
1922
+ }
1921
1923
  // if (a.valueOf !== Object.prototype.valueOf)
1922
1924
  // return a.valueOf() === b.valueOf();
1923
1925
  // if (a.toString !== Object.prototype.toString)
1924
1926
  // return a.toString() === b.toString();
1925
1927
  keys = Object.keys(a);
1926
- length = keys.length;
1927
- if (length !== Object.keys(b).length)
1928
+ length_1 = keys.length;
1929
+ if (length_1 !== Object.keys(b).length) {
1928
1930
  return false;
1929
- for (i = length; i-- !== 0;)
1930
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
1931
+ }
1932
+ for (i = length_1; i-- !== 0;) {
1933
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
1931
1934
  return false;
1932
- for (i = length; i-- !== 0;) {
1935
+ }
1936
+ }
1937
+ for (i = length_1; i-- !== 0;) {
1933
1938
  var key = keys[i];
1934
1939
  if (key === "_owner" && a.$$typeof) {
1935
1940
  // React-specific: avoid traversing React elements' _owner.
@@ -1937,8 +1942,9 @@ function deepEqual(a, b) {
1937
1942
  // and is not needed when comparing the actual elements (and not their owners)
1938
1943
  continue;
1939
1944
  }
1940
- if (!deepEqual(a[key], b[key]))
1945
+ if (!deepEqual(a[key], b[key])) {
1941
1946
  return false;
1947
+ }
1942
1948
  }
1943
1949
  return true;
1944
1950
  }