create-plasmic-app 0.0.96 → 0.0.98

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 (78) hide show
  1. package/cpa-out/react-codegen-js/eslint.config.js +38 -0
  2. package/cpa-out/react-codegen-js/package.json +22 -32
  3. package/cpa-out/react-codegen-js/plasmic.json +16 -10
  4. package/cpa-out/react-codegen-js/src/App.jsx +1 -1
  5. package/cpa-out/react-codegen-js/src/components/Button.jsx +1 -3
  6. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +47 -96
  7. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +35 -29
  8. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +2 -14
  9. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +24 -24
  10. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +44 -58
  11. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +2 -2
  12. package/cpa-out/react-codegen-js/src/main.jsx +10 -0
  13. package/cpa-out/react-codegen-js/vite.config.js +7 -0
  14. package/cpa-out/react-codegen-ts/eslint.config.js +28 -0
  15. package/cpa-out/react-codegen-ts/package.json +23 -37
  16. package/cpa-out/react-codegen-ts/plasmic.json +16 -10
  17. package/cpa-out/react-codegen-ts/src/App.tsx +1 -1
  18. package/cpa-out/react-codegen-ts/src/components/Button.tsx +4 -5
  19. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +84 -62
  20. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +73 -44
  21. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +2 -14
  22. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +62 -38
  23. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +83 -70
  24. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +3 -3
  25. package/cpa-out/react-codegen-ts/src/main.tsx +10 -0
  26. package/cpa-out/react-codegen-ts/src/vite-env.d.ts +1 -0
  27. package/cpa-out/react-codegen-ts/tsconfig.json +4 -23
  28. package/cpa-out/react-codegen-ts/vite.config.ts +7 -0
  29. package/dist/index.js +3 -3
  30. package/dist/lib.js +1 -1
  31. package/dist/react/react.js +36 -11
  32. package/package.json +2 -2
  33. package/src/index.ts +3 -3
  34. package/src/lib.ts +1 -1
  35. package/src/react/react.ts +47 -16
  36. package/cpa-out/react-codegen-js/src/index.js +0 -17
  37. package/cpa-out/react-codegen-js/src/reportWebVitals.js +0 -13
  38. package/cpa-out/react-codegen-js/src/setupTests.js +0 -5
  39. package/cpa-out/react-codegen-ts/src/index.tsx +0 -19
  40. package/cpa-out/react-codegen-ts/src/react-app-env.d.ts +0 -1
  41. package/cpa-out/react-codegen-ts/src/reportWebVitals.ts +0 -15
  42. package/cpa-out/react-codegen-ts/src/setupTests.ts +0 -5
  43. package/cpa-out/react-loader-js/package.json +0 -40
  44. package/cpa-out/react-loader-js/plasmic.json +0 -127
  45. package/cpa-out/react-loader-js/src/App.jsx +0 -9
  46. package/cpa-out/react-loader-js/src/components/Button.jsx +0 -13
  47. package/cpa-out/react-loader-js/src/components/DynamicPage.jsx +0 -26
  48. package/cpa-out/react-loader-js/src/components/Homepage.jsx +0 -26
  49. package/cpa-out/react-loader-js/src/components/RandomDynamicPageButton.jsx +0 -24
  50. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +0 -625
  51. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +0 -166
  52. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +0 -29
  53. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +0 -210
  54. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +0 -161
  55. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +0 -39
  56. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +0 -37
  57. package/cpa-out/react-loader-js/src/index.js +0 -17
  58. package/cpa-out/react-loader-js/src/reportWebVitals.js +0 -13
  59. package/cpa-out/react-loader-js/src/setupTests.js +0 -5
  60. package/cpa-out/react-loader-ts/package.json +0 -45
  61. package/cpa-out/react-loader-ts/plasmic.json +0 -127
  62. package/cpa-out/react-loader-ts/src/App.tsx +0 -9
  63. package/cpa-out/react-loader-ts/src/components/Button.tsx +0 -36
  64. package/cpa-out/react-loader-ts/src/components/DynamicPage.tsx +0 -45
  65. package/cpa-out/react-loader-ts/src/components/Homepage.tsx +0 -45
  66. package/cpa-out/react-loader-ts/src/components/RandomDynamicPageButton.tsx +0 -44
  67. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +0 -725
  68. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +0 -248
  69. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +0 -31
  70. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +0 -294
  71. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +0 -240
  72. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +0 -44
  73. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +0 -41
  74. package/cpa-out/react-loader-ts/src/index.tsx +0 -19
  75. package/cpa-out/react-loader-ts/src/react-app-env.d.ts +0 -1
  76. package/cpa-out/react-loader-ts/src/reportWebVitals.ts +0 -15
  77. package/cpa-out/react-loader-ts/src/setupTests.ts +0 -5
  78. package/cpa-out/react-loader-ts/tsconfig.json +0 -26
@@ -13,34 +13,60 @@
13
13
 
14
14
  import * as React from "react";
15
15
 
16
- import * as p from "@plasmicapp/react-web";
17
- import * as ph from "@plasmicapp/react-web/lib/host";
18
-
19
16
  import {
20
- hasVariant,
21
- classNames,
22
- wrapWithClassName,
23
- createPlasmicElementProxy,
24
- makeFragment,
17
+ Flex as Flex__,
25
18
  MultiChoiceArg,
19
+ PlasmicDataSourceContextProvider as PlasmicDataSourceContextProvider__,
20
+ PlasmicIcon as PlasmicIcon__,
21
+ PlasmicImg as PlasmicImg__,
22
+ PlasmicLink as PlasmicLink__,
23
+ PlasmicPageGuard as PlasmicPageGuard__,
26
24
  SingleBooleanChoiceArg,
27
25
  SingleChoiceArg,
28
- pick,
29
- omit,
30
- useTrigger,
26
+ Stack as Stack__,
31
27
  StrictProps,
28
+ Trans as Trans__,
29
+ classNames,
30
+ createPlasmicElementProxy,
32
31
  deriveRenderOpts,
33
- ensureGlobalVariants
32
+ ensureGlobalVariants,
33
+ generateOnMutateForSpec,
34
+ generateStateOnChangeProp,
35
+ generateStateOnChangePropForCodeComponents,
36
+ generateStateValueProp,
37
+ get as $stateGet,
38
+ hasVariant,
39
+ initializeCodeComponentStates,
40
+ initializePlasmicStates,
41
+ makeFragment,
42
+ omit,
43
+ pick,
44
+ renderPlasmicSlot,
45
+ set as $stateSet,
46
+ useCurrentUser,
47
+ useDollarState,
48
+ usePlasmicTranslator,
49
+ useTrigger,
50
+ wrapWithClassName
34
51
  } from "@plasmicapp/react-web";
52
+ import {
53
+ DataCtxReader as DataCtxReader__,
54
+ useDataEnv,
55
+ useGlobalActions
56
+ } from "@plasmicapp/react-web/lib/host";
57
+
35
58
  import RandomDynamicPageButton from "../../RandomDynamicPageButton"; // plasmic-import: Q23H1_1M_P/component
59
+ import { Fetcher } from "@plasmicapp/react-web/lib/data-sources";
36
60
 
37
61
  import { useScreenVariants as useScreenVariantsscBjPxgdxdzbv } from "./PlasmicGlobalVariant__Screen"; // plasmic-import: SCBjPXGDXDZBV/globalVariant
38
62
 
39
63
  import "@plasmicapp/react-web/lib/plasmic.css";
40
64
 
41
- import projectcss from "./plasmic_create_plasmic_app.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
65
+ import projectcss from "./plasmic.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
42
66
  import sty from "./PlasmicHomepage.module.css"; // plasmic-import: 6uuAAE1jiCew/css
43
67
 
68
+ createPlasmicElementProxy;
69
+
44
70
  export type PlasmicHomepage__VariantMembers = {};
45
71
  export type PlasmicHomepage__VariantsArgs = {};
46
72
  type VariantPropType = keyof PlasmicHomepage__VariantsArgs;
@@ -51,24 +77,18 @@ type ArgPropType = keyof PlasmicHomepage__ArgsType;
51
77
  export const PlasmicHomepage__ArgProps = new Array<ArgPropType>();
52
78
 
53
79
  export type PlasmicHomepage__OverridesType = {
54
- root?: p.Flex<"div">;
55
- section?: p.Flex<"section">;
56
- h1?: p.Flex<"h1">;
57
- text?: p.Flex<"div">;
58
- randomDynamicPageButton?: p.Flex<typeof RandomDynamicPageButton>;
80
+ root?: Flex__<"div">;
81
+ section?: Flex__<"section">;
82
+ h1?: Flex__<"h1">;
83
+ text?: Flex__<"div">;
84
+ randomDynamicPageButton?: Flex__<typeof RandomDynamicPageButton>;
59
85
  };
60
86
 
61
87
  export interface DefaultHomepageProps {
62
88
  className?: string;
63
89
  }
64
90
 
65
- const __wrapUserFunction =
66
- globalThis.__PlasmicWrapUserFunction ?? ((loc, fn) => fn());
67
- const __wrapUserPromise =
68
- globalThis.__PlasmicWrapUserPromise ??
69
- (async (loc, promise) => {
70
- return await promise;
71
- });
91
+ const $$ = {};
72
92
 
73
93
  function PlasmicHomepage__RenderFunc(props: {
74
94
  variants: PlasmicHomepage__VariantsArgs;
@@ -78,27 +98,32 @@ function PlasmicHomepage__RenderFunc(props: {
78
98
  }) {
79
99
  const { variants, overrides, forNode } = props;
80
100
 
81
- const $ctx = ph.useDataEnv?.() || {};
82
- const args = React.useMemo(() => Object.assign({}, props.args), [props.args]);
101
+ const args = React.useMemo(
102
+ () =>
103
+ Object.assign(
104
+ {},
105
+ Object.fromEntries(
106
+ Object.entries(props.args).filter(([_, v]) => v !== undefined)
107
+ )
108
+ ),
109
+ [props.args]
110
+ );
83
111
 
84
112
  const $props = {
85
113
  ...args,
86
114
  ...variants
87
115
  };
116
+
117
+ const $ctx = useDataEnv?.() || {};
88
118
  const refsRef = React.useRef({});
89
119
  const $refs = refsRef.current;
90
120
 
91
- const currentUser = p.useCurrentUser?.() || {};
92
- const [$queries, setDollarQueries] = React.useState({});
93
-
94
121
  const globalVariants = ensureGlobalVariants({
95
122
  screen: useScreenVariantsscBjPxgdxdzbv()
96
123
  });
97
124
 
98
125
  return (
99
126
  <React.Fragment>
100
- {}
101
-
102
127
  <div className={projectcss.plasmic_page_wrapper}>
103
128
  <div
104
129
  data-plasmic-name={"root"}
@@ -110,10 +135,11 @@ function PlasmicHomepage__RenderFunc(props: {
110
135
  projectcss.root_reset,
111
136
  projectcss.plasmic_default_styles,
112
137
  projectcss.plasmic_mixins,
138
+ projectcss.plasmic_tokens,
113
139
  sty.root
114
140
  )}
115
141
  >
116
- <p.Stack
142
+ <Stack__
117
143
  as={"section"}
118
144
  data-plasmic-name={"section"}
119
145
  data-plasmic-override={overrides.section}
@@ -132,7 +158,6 @@ function PlasmicHomepage__RenderFunc(props: {
132
158
  >
133
159
  {"create-plasmic-app"}
134
160
  </h1>
135
-
136
161
  <div
137
162
  data-plasmic-name={"text"}
138
163
  data-plasmic-override={overrides.text}
@@ -160,7 +185,7 @@ function PlasmicHomepage__RenderFunc(props: {
160
185
  <React.Fragment>
161
186
  <React.Fragment>
162
187
  {
163
- "If you haven't already done so, go back and learn the basics by going through the Plasmic Levels tutorial.\n\nIt's always easier to start from examples! Add a new page using a template—do this from the list of pages in the top left (the gray + button).\n\nOr press the big blue + button to start dragging items into this page.\n\nIntegrate this project into your codebase—press the "
188
+ "If you haven't already done so, go back and learn the basics by going through the Plasmic Levels tutorial.\n\nIt's always easier to start from examples! Add a new page using a template\u2014do this from the list of pages in the top left (the gray + button).\n\nOr press the big blue + button to start dragging items into this page.\n\nIntegrate this project into your codebase\u2014press the "
164
189
  }
165
190
  </React.Fragment>
166
191
  <span
@@ -177,7 +202,6 @@ function PlasmicHomepage__RenderFunc(props: {
177
202
  </React.Fragment>
178
203
  )}
179
204
  </div>
180
-
181
205
  <RandomDynamicPageButton
182
206
  data-plasmic-name={"randomDynamicPageButton"}
183
207
  data-plasmic-override={overrides.randomDynamicPageButton}
@@ -186,7 +210,7 @@ function PlasmicHomepage__RenderFunc(props: {
186
210
  sty.randomDynamicPageButton
187
211
  )}
188
212
  />
189
- </p.Stack>
213
+ </Stack__>
190
214
  </div>
191
215
  </div>
192
216
  </React.Fragment>
@@ -245,7 +269,7 @@ function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
245
269
  () =>
246
270
  deriveRenderOpts(props, {
247
271
  name: nodeName,
248
- descendantNames: [...PlasmicDescendants[nodeName]],
272
+ descendantNames: PlasmicDescendants[nodeName],
249
273
  internalArgPropNames: PlasmicHomepage__ArgProps,
250
274
  internalVariantPropNames: PlasmicHomepage__VariantProps
251
275
  }),
@@ -13,35 +13,60 @@
13
13
 
14
14
  import * as React from "react";
15
15
 
16
- import * as p from "@plasmicapp/react-web";
17
- import * as ph from "@plasmicapp/react-web/lib/host";
18
-
19
16
  import {
20
- hasVariant,
21
- classNames,
22
- wrapWithClassName,
23
- createPlasmicElementProxy,
24
- makeFragment,
17
+ Flex as Flex__,
25
18
  MultiChoiceArg,
19
+ PlasmicDataSourceContextProvider as PlasmicDataSourceContextProvider__,
20
+ PlasmicIcon as PlasmicIcon__,
21
+ PlasmicImg as PlasmicImg__,
22
+ PlasmicLink as PlasmicLink__,
23
+ PlasmicPageGuard as PlasmicPageGuard__,
26
24
  SingleBooleanChoiceArg,
27
25
  SingleChoiceArg,
28
- pick,
29
- omit,
30
- useTrigger,
26
+ Stack as Stack__,
31
27
  StrictProps,
28
+ Trans as Trans__,
29
+ classNames,
30
+ createPlasmicElementProxy,
32
31
  deriveRenderOpts,
33
- ensureGlobalVariants
32
+ ensureGlobalVariants,
33
+ generateOnMutateForSpec,
34
+ generateStateOnChangeProp,
35
+ generateStateOnChangePropForCodeComponents,
36
+ generateStateValueProp,
37
+ get as $stateGet,
38
+ hasVariant,
39
+ initializeCodeComponentStates,
40
+ initializePlasmicStates,
41
+ makeFragment,
42
+ omit,
43
+ pick,
44
+ renderPlasmicSlot,
45
+ set as $stateSet,
46
+ useCurrentUser,
47
+ useDollarState,
48
+ usePlasmicTranslator,
49
+ useTrigger,
50
+ wrapWithClassName
34
51
  } from "@plasmicapp/react-web";
52
+ import {
53
+ DataCtxReader as DataCtxReader__,
54
+ useDataEnv,
55
+ useGlobalActions
56
+ } from "@plasmicapp/react-web/lib/host";
57
+
35
58
  import Button from "../../Button"; // plasmic-import: TQcvW_pSKi3/component
36
59
 
37
60
  import "@plasmicapp/react-web/lib/plasmic.css";
38
61
 
39
- import projectcss from "./plasmic_create_plasmic_app.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
62
+ import projectcss from "./plasmic.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
40
63
  import sty from "./PlasmicRandomDynamicPageButton.module.css"; // plasmic-import: Q23H1_1M_P/css
41
64
 
42
- import ChecksvgIcon from "./icons/PlasmicIcon__Checksvg"; // plasmic-import: gj-_D7n31Ho/icon
65
+ import CheckSvgIcon from "./icons/PlasmicIcon__CheckSvg"; // plasmic-import: gj-_D7n31Ho/icon
43
66
  import IconIcon from "./icons/PlasmicIcon__Icon"; // plasmic-import: 6PNxx3YMyDQ/icon
44
67
 
68
+ createPlasmicElementProxy;
69
+
45
70
  export type PlasmicRandomDynamicPageButton__VariantMembers = {};
46
71
  export type PlasmicRandomDynamicPageButton__VariantsArgs = {};
47
72
  type VariantPropType = keyof PlasmicRandomDynamicPageButton__VariantsArgs;
@@ -54,20 +79,14 @@ export const PlasmicRandomDynamicPageButton__ArgProps =
54
79
  new Array<ArgPropType>();
55
80
 
56
81
  export type PlasmicRandomDynamicPageButton__OverridesType = {
57
- root?: p.Flex<typeof Button>;
82
+ root?: Flex__<typeof Button>;
58
83
  };
59
84
 
60
85
  export interface DefaultRandomDynamicPageButtonProps {
61
86
  className?: string;
62
87
  }
63
88
 
64
- const __wrapUserFunction =
65
- globalThis.__PlasmicWrapUserFunction ?? ((loc, fn) => fn());
66
- const __wrapUserPromise =
67
- globalThis.__PlasmicWrapUserPromise ??
68
- (async (loc, promise) => {
69
- return await promise;
70
- });
89
+ const $$ = {};
71
90
 
72
91
  function PlasmicRandomDynamicPageButton__RenderFunc(props: {
73
92
  variants: PlasmicRandomDynamicPageButton__VariantsArgs;
@@ -77,19 +96,26 @@ function PlasmicRandomDynamicPageButton__RenderFunc(props: {
77
96
  }) {
78
97
  const { variants, overrides, forNode } = props;
79
98
 
80
- const $ctx = ph.useDataEnv?.() || {};
81
- const args = React.useMemo(() => Object.assign({}, props.args), [props.args]);
99
+ const args = React.useMemo(
100
+ () =>
101
+ Object.assign(
102
+ {},
103
+ Object.fromEntries(
104
+ Object.entries(props.args).filter(([_, v]) => v !== undefined)
105
+ )
106
+ ),
107
+ [props.args]
108
+ );
82
109
 
83
110
  const $props = {
84
111
  ...args,
85
112
  ...variants
86
113
  };
114
+
115
+ const $ctx = useDataEnv?.() || {};
87
116
  const refsRef = React.useRef({});
88
117
  const $refs = refsRef.current;
89
118
 
90
- const currentUser = p.useCurrentUser?.() || {};
91
- const [$queries, setDollarQueries] = React.useState({});
92
-
93
119
  return (
94
120
  <Button
95
121
  data-plasmic-name={"root"}
@@ -99,60 +125,47 @@ function PlasmicRandomDynamicPageButton__RenderFunc(props: {
99
125
  className={classNames("__wab_instance", sty.root)}
100
126
  onClick={async event => {
101
127
  const $steps = {};
128
+
102
129
  $steps["goToDynamicPage"] = true
103
130
  ? (() => {
104
131
  const actionArgs = {
105
- destination: __wrapUserFunction(
106
- {
107
- type: "InteractionArgLoc",
108
- actionName: "navigation",
109
- interactionUuid: "9Y3jL0zxjA",
110
- componentUuid: "Q23H1_1M_P",
111
- argName: "destination"
112
- },
113
- () =>
114
- `/dynamic/${(() => {
115
- try {
116
- return Math.random().toString(36).slice(2);
117
- } catch (e) {
118
- if (e instanceof TypeError) {
119
- return "value";
120
- }
121
- throw e;
122
- }
123
- })()}`
124
- )
132
+ destination: `/dynamic/${(() => {
133
+ try {
134
+ return Math.random().toString(36).slice(2);
135
+ } catch (e) {
136
+ if (
137
+ e instanceof TypeError ||
138
+ e?.plasmicType === "PlasmicUndefinedDataError"
139
+ ) {
140
+ return "value";
141
+ }
142
+ throw e;
143
+ }
144
+ })()}`
125
145
  };
126
- return __wrapUserFunction(
127
- {
128
- type: "InteractionLoc",
129
- actionName: "navigation",
130
- interactionUuid: "9Y3jL0zxjA",
131
- componentUuid: "Q23H1_1M_P"
132
- },
133
- () =>
134
- (({ destination }) => {
135
- location.assign(destination);
136
- })?.apply(null, [actionArgs]),
137
- actionArgs
138
- );
146
+ return (({ destination }) => {
147
+ if (
148
+ typeof destination === "string" &&
149
+ destination.startsWith("#")
150
+ ) {
151
+ document
152
+ .getElementById(destination.substr(1))
153
+ .scrollIntoView({ behavior: "smooth" });
154
+ } else {
155
+ location.assign(destination);
156
+ }
157
+ })?.apply(null, [actionArgs]);
139
158
  })()
140
159
  : undefined;
141
160
  if (
161
+ $steps["goToDynamicPage"] != null &&
142
162
  typeof $steps["goToDynamicPage"] === "object" &&
143
163
  typeof $steps["goToDynamicPage"].then === "function"
144
164
  ) {
145
- $steps["goToDynamicPage"] = await __wrapUserPromise(
146
- {
147
- type: "InteractionLoc",
148
- actionName: "navigation",
149
- interactionUuid: "9Y3jL0zxjA",
150
- componentUuid: "Q23H1_1M_P"
151
- },
152
- $steps["goToDynamicPage"]
153
- );
165
+ $steps["goToDynamicPage"] = await $steps["goToDynamicPage"];
154
166
  }
155
167
  }}
168
+ submitsForm={true}
156
169
  >
157
170
  {"Random Dynamic Page"}
158
171
  </Button>
@@ -203,7 +216,7 @@ function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
203
216
  () =>
204
217
  deriveRenderOpts(props, {
205
218
  name: nodeName,
206
- descendantNames: [...PlasmicDescendants[nodeName]],
219
+ descendantNames: PlasmicDescendants[nodeName],
207
220
  internalArgPropNames: PlasmicRandomDynamicPageButton__ArgProps,
208
221
  internalVariantPropNames: PlasmicRandomDynamicPageButton__VariantProps
209
222
  }),
@@ -5,11 +5,11 @@
5
5
  import React from "react";
6
6
  import { classNames } from "@plasmicapp/react-web";
7
7
 
8
- export type ChecksvgIconProps = React.ComponentProps<"svg"> & {
8
+ export type CheckSvgIconProps = React.ComponentProps<"svg"> & {
9
9
  title?: string;
10
10
  };
11
11
 
12
- export function ChecksvgIcon(props: ChecksvgIconProps) {
12
+ export function CheckSvgIcon(props: CheckSvgIconProps) {
13
13
  const { className, style, title, ...restProps } = props;
14
14
  return (
15
15
  <svg
@@ -40,5 +40,5 @@ export function ChecksvgIcon(props: ChecksvgIconProps) {
40
40
  );
41
41
  }
42
42
 
43
- export default ChecksvgIcon;
43
+ export default CheckSvgIcon;
44
44
  /* prettier-ignore-end */
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import './index.css'
4
+ import App from './App.tsx'
5
+
6
+ createRoot(document.getElementById('root')!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ )
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -1,26 +1,7 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "lib": [
5
- "dom",
6
- "dom.iterable",
7
- "esnext"
8
- ],
9
- "allowJs": true,
10
- "skipLibCheck": true,
11
- "esModuleInterop": true,
12
- "allowSyntheticDefaultImports": true,
13
- "strict": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "noFallthroughCasesInSwitch": true,
16
- "module": "esnext",
17
- "moduleResolution": "node",
18
- "resolveJsonModule": true,
19
- "isolatedModules": true,
20
- "noEmit": true,
21
- "jsx": "react-jsx"
22
- },
23
- "include": [
24
- "src"
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
25
6
  ]
26
7
  }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ // https://vite.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ })
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ if (process.env.CPA_DEBUG_CHDIR) {
52
52
  const createPlasmicAppVersion = (0, npm_utils_1.updateNotify)();
53
53
  // Specify command-line args
54
54
  const argv = yargs_1.default
55
- .command("$0 [projectName]", "Create a Plasmic app with Next.js, Gatsby, or Create React App", (yargs) => {
55
+ .command("$0 [projectName]", "Create a Plasmic app with Next.js, Gatsby, or React (Vite)", (yargs) => {
56
56
  yargs
57
57
  .usage("Usage: $0 [projectName] [options]")
58
58
  .positional("projectName", {
@@ -187,8 +187,8 @@ function run() {
187
187
  value: "gatsby",
188
188
  },
189
189
  {
190
- name: "Create React App (advanced)",
191
- short: "Create React App",
190
+ name: "React (Vite)",
191
+ short: "React (Vite)",
192
192
  value: "react",
193
193
  },
194
194
  ],
package/dist/lib.js CHANGED
@@ -147,7 +147,7 @@ function create(args) {
147
147
  : platform === "gatsby"
148
148
  ? `${npmRunCmd} develop`
149
149
  : platform === "react"
150
- ? `${npmRunCmd} start`
150
+ ? `${npmRunCmd} dev`
151
151
  : "";
152
152
  const relativeDir = path.relative(process.cwd(), resolvedProjectPath);
153
153
  // Overwrite README
@@ -24,9 +24,26 @@ exports.reactStrategy = {
24
24
  create: (args) => __awaiter(void 0, void 0, void 0, function* () {
25
25
  const { projectPath, jsOrTs } = args;
26
26
  let { template } = args;
27
- const createCommand = `npx create-react-app@latest ${projectPath}`;
28
- if (!template && jsOrTs === "ts") {
29
- template = "typescript";
27
+ /* create-vite package checks if the targetDir doesn't exist then it creates the targetDir in the
28
+ current directory instead of the targetDir path. For example,
29
+ 1. Let's say current directory is /tmp/cpa-out
30
+ 2. npm create vite@latest /private/tmp/cpa-out/react-codegen-ts will create
31
+ /tmp/cpa-out/private/tmp/cpa-out/react-codegen-ts directory instead of /private/tmp/cpa-out/react-codegen-ts
32
+
33
+ To avoid this behaviour, we will ensure the fullProjectPath exists
34
+ 1. we get the projectName (react-codegen-ts), and parentDir (/private/tmp/cpa-out)
35
+ 2. change directory to parentDir and execute the command with projectName
36
+ */
37
+ const fullProjectPath = path_1.default.isAbsolute(projectPath)
38
+ ? projectPath
39
+ : path_1.default.resolve(process.cwd(), projectPath);
40
+ yield fs_1.promises.mkdir(fullProjectPath, { recursive: true });
41
+ const projectName = path_1.default.basename(fullProjectPath);
42
+ const parentDir = path_1.default.dirname(fullProjectPath);
43
+ process.chdir(parentDir);
44
+ const createCommand = `npm create vite@latest ${projectName} --`;
45
+ if (!template) {
46
+ template = jsOrTs === "ts" ? "react-ts" : "react";
30
47
  }
31
48
  const templateArg = template ? ` --template ${template}` : "";
32
49
  yield (0, cmd_utils_1.spawnOrFail)(`${createCommand}${templateArg}`);
@@ -42,14 +59,28 @@ exports.reactStrategy = {
42
59
  }
43
60
  }),
44
61
  overwriteConfig: (args) => __awaiter(void 0, void 0, void 0, function* () {
45
- // No config to overwrite
62
+ const { projectPath, jsOrTs } = args;
63
+ if (jsOrTs === "ts") {
64
+ const tsConfigJsonPath = path_1.default.join(projectPath, "tsconfig.app.json");
65
+ let tsConfigJson = yield fs_1.promises.readFile(tsConfigJsonPath, "utf8");
66
+ /* tsconfig.app.json has comments such as /* Bundler mode */ /* Linting */
67
+ /* We need to remove them before parsing the json */
68
+ tsConfigJson = tsConfigJson.replace(/\/\*[\s\S]*?\*\//g, "");
69
+ tsConfigJson = tsConfigJson.replace(/\/\/.*$/gm, "");
70
+ const tsConfig = JSON.parse(tsConfigJson);
71
+ /* In our codegen, we have components where React is imported but not used, we need to
72
+ turn off the `noUnusedLocals` rule to ensure the project builds successfully.
73
+ */
74
+ tsConfig.compilerOptions = Object.assign(Object.assign({}, tsConfig.compilerOptions), { noUnusedLocals: false });
75
+ yield fs_1.promises.writeFile(tsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
76
+ }
46
77
  }),
47
78
  generateFiles: ({ scheme, projectApiToken, projectId, projectPath, jsOrTs, }) => __awaiter(void 0, void 0, void 0, function* () {
48
79
  if (scheme === "loader") {
49
80
  // Nothing to do
50
81
  }
51
82
  else {
52
- // Delete existing entry point App.tsx and related test
83
+ // Delete existing App.tsx and related test
53
84
  (0, file_utils_1.deleteGlob)(path_1.default.join(projectPath, "src", "App*"));
54
85
  yield (0, codegen_1.runCodegenSync)({
55
86
  projectId,
@@ -73,12 +104,6 @@ exports.reactStrategy = {
73
104
  : (0, file_utils_1.generateWelcomePage)(config, "react");
74
105
  yield fs_1.promises.writeFile(indexPath, content);
75
106
  }
76
- // Deactivate React.StrictMode from index.js or index.tsx
77
- const indexFileName = path_1.default.join(projectPath, "src", `index.${jsOrTs === "js" ? "js" : "tsx"}`);
78
- let indexFile = (yield fs_1.promises.readFile(indexFileName)).toString();
79
- indexFile = indexFile.replace("<React.StrictMode>", "");
80
- indexFile = indexFile.replace("</React.StrictMode>", "");
81
- yield fs_1.promises.writeFile(indexFileName, indexFile);
82
107
  return;
83
108
  }),
84
109
  build: (args) => __awaiter(void 0, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.96",
3
+ "version": "0.0.98",
4
4
  "description": "Create Plasmic-powered React apps",
5
5
  "main": "./dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
@@ -54,5 +54,5 @@
54
54
  "validate-npm-package-name": "^3.0.0",
55
55
  "yargs": "^16.2.0"
56
56
  },
57
- "gitHead": "72c4754ab2eb51cc331f1492b78adc383e942cae"
57
+ "gitHead": "b43bfc6e9e68b75cac25f9fee2fed8795b5d8518"
58
58
  }
package/src/index.ts CHANGED
@@ -21,7 +21,7 @@ const createPlasmicAppVersion = updateNotify();
21
21
  const argv = yargs
22
22
  .command(
23
23
  "$0 [projectName]",
24
- "Create a Plasmic app with Next.js, Gatsby, or Create React App",
24
+ "Create a Plasmic app with Next.js, Gatsby, or React (Vite)",
25
25
  (yargs) => {
26
26
  yargs
27
27
  .usage("Usage: $0 [projectName] [options]")
@@ -176,8 +176,8 @@ async function run(): Promise<void> {
176
176
  value: "gatsby",
177
177
  },
178
178
  {
179
- name: "Create React App (advanced)",
180
- short: "Create React App",
179
+ name: "React (Vite)",
180
+ short: "React (Vite)",
181
181
  value: "react",
182
182
  },
183
183
  ],
package/src/lib.ts CHANGED
@@ -149,7 +149,7 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
149
149
  : platform === "gatsby"
150
150
  ? `${npmRunCmd} develop`
151
151
  : platform === "react"
152
- ? `${npmRunCmd} start`
152
+ ? `${npmRunCmd} dev`
153
153
  : "";
154
154
  const relativeDir = path.relative(process.cwd(), resolvedProjectPath);
155
155