create-plasmic-app 0.0.62 → 0.0.64

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 (209) hide show
  1. package/README.internal.md +6 -2
  2. package/cpa-out/.gitignore +15 -0
  3. package/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +11 -0
  4. package/cpa-out/gatsby-codegen-js/gatsby-config.js +9 -0
  5. package/cpa-out/gatsby-codegen-js/gatsby-node.js +0 -0
  6. package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +11 -0
  7. package/cpa-out/gatsby-codegen-js/package.json +26 -0
  8. package/cpa-out/gatsby-codegen-js/plasmic.json +79 -0
  9. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  10. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +206 -0
  11. package/cpa-out/gatsby-codegen-js/src/pages/404.js +4 -0
  12. package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +39 -0
  13. package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +11 -0
  14. package/cpa-out/gatsby-codegen-ts/gatsby-config.ts +14 -0
  15. package/cpa-out/gatsby-codegen-ts/gatsby-node.ts +0 -0
  16. package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +11 -0
  17. package/cpa-out/gatsby-codegen-ts/package.json +34 -0
  18. package/cpa-out/gatsby-codegen-ts/plasmic.json +79 -0
  19. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  20. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +290 -0
  21. package/cpa-out/gatsby-codegen-ts/src/pages/404.js +4 -0
  22. package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +41 -0
  23. package/cpa-out/gatsby-codegen-ts/tsconfig.json +102 -0
  24. package/cpa-out/gatsby-loader-js/gatsby-config.js +25 -0
  25. package/cpa-out/gatsby-loader-js/gatsby-node.js +0 -0
  26. package/cpa-out/gatsby-loader-js/gatsby-ssr.jsx +44 -0
  27. package/cpa-out/gatsby-loader-js/package.json +24 -0
  28. package/cpa-out/gatsby-loader-js/src/pages/404.js +4 -0
  29. package/cpa-out/gatsby-loader-js/src/pages/plasmic-host.jsx +19 -0
  30. package/cpa-out/gatsby-loader-js/src/plasmic-init.js +18 -0
  31. package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +44 -0
  32. package/cpa-out/gatsby-loader-ts/gatsby-config.ts +31 -0
  33. package/cpa-out/gatsby-loader-ts/gatsby-node.ts +0 -0
  34. package/cpa-out/gatsby-loader-ts/gatsby-ssr.tsx +44 -0
  35. package/cpa-out/gatsby-loader-ts/package.json +32 -0
  36. package/cpa-out/gatsby-loader-ts/src/pages/404.ts +4 -0
  37. package/cpa-out/gatsby-loader-ts/src/pages/plasmic-host.tsx +24 -0
  38. package/cpa-out/gatsby-loader-ts/src/plasmic-init.ts +19 -0
  39. package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +52 -0
  40. package/cpa-out/gatsby-loader-ts/tsconfig.json +102 -0
  41. package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +56 -0
  42. package/cpa-out/nextjs-app-loader-js/app/head.js +10 -0
  43. package/cpa-out/nextjs-app-loader-js/app/layout.js +14 -0
  44. package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +6 -0
  45. package/cpa-out/nextjs-app-loader-js/next.config.js +13 -0
  46. package/cpa-out/nextjs-app-loader-js/package.json +20 -0
  47. package/cpa-out/nextjs-app-loader-js/pages/api/hello.js +5 -0
  48. package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +65 -0
  49. package/cpa-out/nextjs-app-loader-js/plasmic-init.js +16 -0
  50. package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +59 -0
  51. package/cpa-out/nextjs-app-loader-ts/app/head.tsx +10 -0
  52. package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +18 -0
  53. package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +6 -0
  54. package/cpa-out/nextjs-app-loader-ts/next.config.js +13 -0
  55. package/cpa-out/nextjs-app-loader-ts/package.json +24 -0
  56. package/cpa-out/nextjs-app-loader-ts/pages/api/hello.ts +13 -0
  57. package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +65 -0
  58. package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +16 -0
  59. package/cpa-out/nextjs-app-loader-ts/tsconfig.json +29 -0
  60. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  61. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +205 -0
  62. package/cpa-out/nextjs-pages-codegen-js/next.config.js +10 -0
  63. package/cpa-out/nextjs-pages-codegen-js/package.json +22 -0
  64. package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +11 -0
  65. package/cpa-out/nextjs-pages-codegen-js/pages/api/hello.js +5 -0
  66. package/cpa-out/nextjs-pages-codegen-js/pages/index.jsx +35 -0
  67. package/cpa-out/nextjs-pages-codegen-js/pages/plasmic-host.jsx +15 -0
  68. package/cpa-out/nextjs-pages-codegen-js/plasmic.json +79 -0
  69. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  70. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +287 -0
  71. package/cpa-out/nextjs-pages-codegen-ts/next.config.js +10 -0
  72. package/cpa-out/nextjs-pages-codegen-ts/package.json +26 -0
  73. package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +12 -0
  74. package/cpa-out/nextjs-pages-codegen-ts/pages/api/hello.ts +13 -0
  75. package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +37 -0
  76. package/cpa-out/nextjs-pages-codegen-ts/pages/plasmic-host.tsx +15 -0
  77. package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +79 -0
  78. package/cpa-out/nextjs-pages-codegen-ts/tsconfig.json +24 -0
  79. package/cpa-out/nextjs-pages-loader-js/next.config.js +10 -0
  80. package/cpa-out/nextjs-pages-loader-js/package.json +20 -0
  81. package/cpa-out/nextjs-pages-loader-js/pages/[[...catchall]].jsx +66 -0
  82. package/cpa-out/nextjs-pages-loader-js/pages/api/hello.js +5 -0
  83. package/cpa-out/nextjs-pages-loader-js/pages/plasmic-host.jsx +7 -0
  84. package/cpa-out/nextjs-pages-loader-js/plasmic-init.js +25 -0
  85. package/cpa-out/nextjs-pages-loader-ts/next.config.js +10 -0
  86. package/cpa-out/nextjs-pages-loader-ts/package.json +24 -0
  87. package/cpa-out/nextjs-pages-loader-ts/pages/[[...catchall]].tsx +70 -0
  88. package/cpa-out/nextjs-pages-loader-ts/pages/api/hello.ts +13 -0
  89. package/cpa-out/nextjs-pages-loader-ts/pages/plasmic-host.tsx +7 -0
  90. package/cpa-out/nextjs-pages-loader-ts/plasmic-init.ts +25 -0
  91. package/cpa-out/nextjs-pages-loader-ts/tsconfig.json +24 -0
  92. package/cpa-out/react-codegen-js/package.json +41 -0
  93. package/cpa-out/react-codegen-js/plasmic.json +76 -0
  94. package/cpa-out/react-codegen-js/src/App.jsx +9 -0
  95. package/cpa-out/react-codegen-js/src/components/Homepage.jsx +26 -0
  96. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  97. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
  98. package/cpa-out/react-codegen-js/src/index.js +17 -0
  99. package/cpa-out/react-codegen-js/src/reportWebVitals.js +13 -0
  100. package/cpa-out/react-codegen-js/src/setupTests.js +5 -0
  101. package/cpa-out/react-codegen-ts/package.json +46 -0
  102. package/cpa-out/react-codegen-ts/plasmic.json +76 -0
  103. package/cpa-out/react-codegen-ts/src/App.tsx +9 -0
  104. package/cpa-out/react-codegen-ts/src/components/Homepage.tsx +45 -0
  105. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  106. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
  107. package/cpa-out/react-codegen-ts/src/index.tsx +19 -0
  108. package/cpa-out/react-codegen-ts/src/react-app-env.d.ts +1 -0
  109. package/cpa-out/react-codegen-ts/src/reportWebVitals.ts +15 -0
  110. package/cpa-out/react-codegen-ts/src/setupTests.ts +5 -0
  111. package/cpa-out/react-codegen-ts/tsconfig.json +26 -0
  112. package/cpa-out/react-loader-js/package.json +41 -0
  113. package/cpa-out/react-loader-js/plasmic.json +76 -0
  114. package/cpa-out/react-loader-js/src/App.jsx +9 -0
  115. package/cpa-out/react-loader-js/src/components/Homepage.jsx +26 -0
  116. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  117. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
  118. package/cpa-out/react-loader-js/src/index.js +17 -0
  119. package/cpa-out/react-loader-js/src/reportWebVitals.js +13 -0
  120. package/cpa-out/react-loader-js/src/setupTests.js +5 -0
  121. package/cpa-out/react-loader-ts/package.json +46 -0
  122. package/cpa-out/react-loader-ts/plasmic.json +76 -0
  123. package/cpa-out/react-loader-ts/src/App.tsx +9 -0
  124. package/cpa-out/react-loader-ts/src/components/Homepage.tsx +45 -0
  125. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  126. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
  127. package/cpa-out/react-loader-ts/src/index.tsx +19 -0
  128. package/cpa-out/react-loader-ts/src/react-app-env.d.ts +1 -0
  129. package/cpa-out/react-loader-ts/src/reportWebVitals.ts +15 -0
  130. package/cpa-out/react-loader-ts/src/setupTests.ts +5 -0
  131. package/cpa-out/react-loader-ts/tsconfig.json +26 -0
  132. package/dist/gatsby/gatsby.d.ts +6 -0
  133. package/dist/{strategies → gatsby}/gatsby.js +26 -29
  134. package/dist/gatsby/template.d.ts +11 -0
  135. package/dist/{templates/gatsby.js → gatsby/template.js} +34 -42
  136. package/dist/index.d.ts +1 -1
  137. package/dist/index.js +57 -27
  138. package/dist/lib.d.ts +3 -4
  139. package/dist/lib.js +22 -12
  140. package/dist/nextjs/nextjs.d.ts +2 -0
  141. package/dist/nextjs/nextjs.js +155 -0
  142. package/dist/nextjs/templates/app-loader/catchall-page.d.ts +2 -0
  143. package/dist/nextjs/templates/app-loader/catchall-page.js +67 -0
  144. package/dist/nextjs/templates/app-loader/plasmic-host.d.ts +1 -0
  145. package/dist/nextjs/templates/app-loader/plasmic-host.js +13 -0
  146. package/dist/nextjs/templates/app-loader/plasmic-init-client.d.ts +2 -0
  147. package/dist/nextjs/templates/app-loader/plasmic-init-client.js +73 -0
  148. package/dist/nextjs/templates/app-loader/plasmic-init.d.ts +1 -0
  149. package/dist/nextjs/templates/app-loader/plasmic-init.js +23 -0
  150. package/dist/nextjs/templates/pages-codegen/app.d.ts +2 -0
  151. package/dist/nextjs/templates/pages-codegen/app.js +20 -0
  152. package/dist/nextjs/templates/pages-codegen/plasmic-host.d.ts +1 -0
  153. package/dist/nextjs/templates/pages-codegen/plasmic-host.js +22 -0
  154. package/dist/nextjs/templates/pages-loader/catchall-page.d.ts +2 -0
  155. package/dist/nextjs/templates/pages-loader/catchall-page.js +77 -0
  156. package/dist/nextjs/templates/pages-loader/plasmic-host.d.ts +1 -0
  157. package/dist/nextjs/templates/pages-loader/plasmic-host.js +14 -0
  158. package/dist/nextjs/templates/pages-loader/plasmic-init.d.ts +1 -0
  159. package/dist/nextjs/templates/pages-loader/plasmic-init.js +32 -0
  160. package/dist/react/react.d.ts +2 -0
  161. package/dist/{strategies → react}/react.js +10 -10
  162. package/dist/templates/readme.d.ts +2 -2
  163. package/dist/templates/readme.js +5 -4
  164. package/dist/templates/welcomePage.d.ts +2 -2
  165. package/dist/templates/welcomePage.js +5 -5
  166. package/dist/{strategies/common.d.ts → utils/codegen.d.ts} +0 -0
  167. package/dist/{strategies/common.js → utils/codegen.js} +0 -0
  168. package/dist/utils/file-utils.d.ts +2 -2
  169. package/dist/utils/file-utils.js +3 -3
  170. package/dist/{strategies/types.d.ts → utils/strategy.d.ts} +16 -14
  171. package/dist/{strategies/types.js → utils/strategy.js} +0 -0
  172. package/dist/utils/types.d.ts +9 -0
  173. package/dist/utils/types.js +7 -0
  174. package/package.json +4 -3
  175. package/run-cpa.ts +151 -0
  176. package/src/{strategies → gatsby}/gatsby.ts +28 -46
  177. package/src/{templates/gatsby.ts → gatsby/template.ts} +41 -51
  178. package/src/index.ts +86 -56
  179. package/src/lib.ts +30 -15
  180. package/src/nextjs/nextjs.ts +180 -0
  181. package/src/nextjs/templates/app-loader/catchall-page.ts +71 -0
  182. package/src/nextjs/templates/app-loader/plasmic-host.ts +9 -0
  183. package/src/nextjs/templates/app-loader/plasmic-init-client.ts +74 -0
  184. package/src/nextjs/templates/app-loader/plasmic-init.ts +22 -0
  185. package/src/nextjs/templates/pages-codegen/app.ts +24 -0
  186. package/src/nextjs/templates/pages-codegen/plasmic-host.ts +18 -0
  187. package/src/nextjs/templates/pages-loader/catchall-page.ts +81 -0
  188. package/src/nextjs/templates/pages-loader/plasmic-host.ts +10 -0
  189. package/src/nextjs/templates/pages-loader/plasmic-init.ts +31 -0
  190. package/src/{strategies → react}/react.ts +8 -10
  191. package/src/templates/readme.ts +5 -5
  192. package/src/templates/welcomePage.ts +6 -7
  193. package/src/{strategies/common.ts → utils/codegen.ts} +0 -0
  194. package/src/utils/file-utils.ts +4 -4
  195. package/src/utils/strategy.ts +48 -0
  196. package/src/utils/types.ts +12 -0
  197. package/dist/strategies/gatsby.d.ts +0 -7
  198. package/dist/strategies/index.d.ts +0 -2
  199. package/dist/strategies/index.js +0 -22
  200. package/dist/strategies/nextjs.d.ts +0 -3
  201. package/dist/strategies/nextjs.js +0 -104
  202. package/dist/strategies/react.d.ts +0 -3
  203. package/dist/templates/gatsby.d.ts +0 -11
  204. package/dist/templates/nextjs.d.ts +0 -5
  205. package/dist/templates/nextjs.js +0 -162
  206. package/src/strategies/index.ts +0 -21
  207. package/src/strategies/nextjs.ts +0 -131
  208. package/src/strategies/types.ts +0 -42
  209. package/src/templates/nextjs.ts +0 -170
@@ -0,0 +1,287 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ /* tslint:disable */
4
+ /* prettier-ignore-start */
5
+
6
+ /** @jsxRuntime classic */
7
+ /** @jsx createPlasmicElementProxy */
8
+ /** @jsxFrag React.Fragment */
9
+
10
+ // This class is auto-generated by Plasmic; please do not edit!
11
+ // Plasmic Project: 47tFXWjN2C4NyHFGGpaYQ3
12
+ // Component: 6uuAAE1jiCew
13
+ import * as React from "react";
14
+
15
+ import Head from "next/head";
16
+ import Link, { LinkProps } from "next/link";
17
+
18
+ import * as p from "@plasmicapp/react-web";
19
+ import * as ph from "@plasmicapp/host";
20
+
21
+ import {
22
+ hasVariant,
23
+ classNames,
24
+ wrapWithClassName,
25
+ createPlasmicElementProxy,
26
+ makeFragment,
27
+ MultiChoiceArg,
28
+ SingleBooleanChoiceArg,
29
+ SingleChoiceArg,
30
+ pick,
31
+ omit,
32
+ useTrigger,
33
+ StrictProps,
34
+ deriveRenderOpts,
35
+ ensureGlobalVariants
36
+ } from "@plasmicapp/react-web";
37
+
38
+ import { useScreenVariants as useScreenVariantsscBjPxgdxdzbv } from "./PlasmicGlobalVariant__Screen"; // plasmic-import: SCBjPXGDXDZBV/globalVariant
39
+
40
+ import "@plasmicapp/react-web/lib/plasmic.css";
41
+
42
+ import projectcss from "./plasmic_create_plasmic_app.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
43
+ import sty from "./PlasmicHomepage.module.css"; // plasmic-import: 6uuAAE1jiCew/css
44
+
45
+ export type PlasmicHomepage__VariantMembers = {};
46
+ export type PlasmicHomepage__VariantsArgs = {};
47
+ type VariantPropType = keyof PlasmicHomepage__VariantsArgs;
48
+ export const PlasmicHomepage__VariantProps = new Array<VariantPropType>();
49
+
50
+ export type PlasmicHomepage__ArgsType = {};
51
+ type ArgPropType = keyof PlasmicHomepage__ArgsType;
52
+ export const PlasmicHomepage__ArgProps = new Array<ArgPropType>();
53
+
54
+ export type PlasmicHomepage__OverridesType = {
55
+ root?: p.Flex<"div">;
56
+ section?: p.Flex<"section">;
57
+ h1?: p.Flex<"h1">;
58
+ text?: p.Flex<"div">;
59
+ };
60
+
61
+ export interface DefaultHomepageProps {}
62
+
63
+ const __wrapUserFunction =
64
+ globalThis.__PlasmicWrapUserFunction ?? ((loc, fn) => fn());
65
+ const __wrapUserPromise =
66
+ globalThis.__PlasmicWrapUserPromise ??
67
+ (async (loc, promise) => {
68
+ return await promise;
69
+ });
70
+
71
+ function PlasmicHomepage__RenderFunc(props: {
72
+ variants: PlasmicHomepage__VariantsArgs;
73
+ args: PlasmicHomepage__ArgsType;
74
+ overrides: PlasmicHomepage__OverridesType;
75
+
76
+ forNode?: string;
77
+ }) {
78
+ const { variants, overrides, forNode } = props;
79
+
80
+ const $ctx = ph.useDataEnv?.() || {};
81
+ const args = React.useMemo(() => Object.assign({}, props.args), [props.args]);
82
+
83
+ const $props = {
84
+ ...args,
85
+ ...variants
86
+ };
87
+
88
+ const currentUser = p.useCurrentUser?.() || {};
89
+
90
+ const [$queries, setDollarQueries] = React.useState({});
91
+
92
+ const globalVariants = ensureGlobalVariants({
93
+ screen: useScreenVariantsscBjPxgdxdzbv()
94
+ });
95
+
96
+ return (
97
+ <React.Fragment>
98
+ <Head></Head>
99
+
100
+ <style>{`
101
+ body {
102
+ margin: 0;
103
+ }
104
+ `}</style>
105
+
106
+ <div className={projectcss.plasmic_page_wrapper}>
107
+ <div
108
+ data-plasmic-name={"root"}
109
+ data-plasmic-override={overrides.root}
110
+ data-plasmic-root={true}
111
+ data-plasmic-for-node={forNode}
112
+ className={classNames(
113
+ projectcss.all,
114
+ projectcss.root_reset,
115
+ projectcss.plasmic_default_styles,
116
+ projectcss.plasmic_mixins,
117
+ sty.root
118
+ )}
119
+ >
120
+ <p.Stack
121
+ as={"section"}
122
+ data-plasmic-name={"section"}
123
+ data-plasmic-override={overrides.section}
124
+ hasGap={true}
125
+ className={classNames(projectcss.all, sty.section)}
126
+ >
127
+ <h1
128
+ data-plasmic-name={"h1"}
129
+ data-plasmic-override={overrides.h1}
130
+ className={classNames(
131
+ projectcss.all,
132
+ projectcss.h1,
133
+ projectcss.__wab_text,
134
+ sty.h1
135
+ )}
136
+ >
137
+ {"create-plasmic-app"}
138
+ </h1>
139
+
140
+ <div
141
+ data-plasmic-name={"text"}
142
+ data-plasmic-override={overrides.text}
143
+ className={classNames(
144
+ projectcss.all,
145
+ projectcss.__wab_text,
146
+ sty.text
147
+ )}
148
+ >
149
+ {hasVariant(globalVariants, "screen", "desktopOnly") ? (
150
+ <React.Fragment>
151
+ <React.Fragment>
152
+ {
153
+ "This project is used by run-cpa.ts in the create-plasmic-app repo.\n\nrun-cpa.ts runs create-plasmic-app for many combinations of args (e.g. nextjs + appDir + loader + typescript) to check for changes in generated files. Any changes to this project will result in lots of changes to the generated files. "
154
+ }
155
+ </React.Fragment>
156
+ <span
157
+ className={"plasmic_default__all plasmic_default__span"}
158
+ style={{ fontWeight: 700 }}
159
+ >
160
+ {"Therefore, please avoid changing this project."}
161
+ </span>
162
+ </React.Fragment>
163
+ ) : (
164
+ <React.Fragment>
165
+ <React.Fragment>
166
+ {
167
+ "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 "
168
+ }
169
+ </React.Fragment>
170
+ <span
171
+ className={"plasmic_default__all plasmic_default__span"}
172
+ style={{ fontWeight: 700 }}
173
+ >
174
+ {"Code"}
175
+ </span>
176
+ <React.Fragment>
177
+ {
178
+ " button in the top right and follow the quickstart instructions.\n\nJoin our Slack community (icon in bottom left) for help any time."
179
+ }
180
+ </React.Fragment>
181
+ </React.Fragment>
182
+ )}
183
+ </div>
184
+ </p.Stack>
185
+ </div>
186
+ </div>
187
+ </React.Fragment>
188
+ ) as React.ReactElement | null;
189
+ }
190
+
191
+ const PlasmicDescendants = {
192
+ root: ["root", "section", "h1", "text"],
193
+ section: ["section", "h1", "text"],
194
+ h1: ["h1"],
195
+ text: ["text"]
196
+ } as const;
197
+ type NodeNameType = keyof typeof PlasmicDescendants;
198
+ type DescendantsType<T extends NodeNameType> =
199
+ (typeof PlasmicDescendants)[T][number];
200
+ type NodeDefaultElementType = {
201
+ root: "div";
202
+ section: "section";
203
+ h1: "h1";
204
+ text: "div";
205
+ };
206
+
207
+ type ReservedPropsType = "variants" | "args" | "overrides";
208
+ type NodeOverridesType<T extends NodeNameType> = Pick<
209
+ PlasmicHomepage__OverridesType,
210
+ DescendantsType<T>
211
+ >;
212
+ type NodeComponentProps<T extends NodeNameType> =
213
+ // Explicitly specify variants, args, and overrides as objects
214
+ {
215
+ variants?: PlasmicHomepage__VariantsArgs;
216
+ args?: PlasmicHomepage__ArgsType;
217
+ overrides?: NodeOverridesType<T>;
218
+ } & Omit<PlasmicHomepage__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
219
+ /* Specify args directly as props*/ Omit<
220
+ PlasmicHomepage__ArgsType,
221
+ ReservedPropsType
222
+ > &
223
+ /* Specify overrides for each element directly as props*/ Omit<
224
+ NodeOverridesType<T>,
225
+ ReservedPropsType | VariantPropType | ArgPropType
226
+ > &
227
+ /* Specify props for the root element*/ Omit<
228
+ Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
229
+ ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
230
+ >;
231
+
232
+ function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
233
+ type PropsType = NodeComponentProps<NodeName> & { key?: React.Key };
234
+ const func = function <T extends PropsType>(
235
+ props: T & StrictProps<T, PropsType>
236
+ ) {
237
+ const { variants, args, overrides } = React.useMemo(
238
+ () =>
239
+ deriveRenderOpts(props, {
240
+ name: nodeName,
241
+ descendantNames: [...PlasmicDescendants[nodeName]],
242
+ internalArgPropNames: PlasmicHomepage__ArgProps,
243
+ internalVariantPropNames: PlasmicHomepage__VariantProps
244
+ }),
245
+ [props, nodeName]
246
+ );
247
+
248
+ return PlasmicHomepage__RenderFunc({
249
+ variants,
250
+ args,
251
+ overrides,
252
+ forNode: nodeName
253
+ });
254
+ };
255
+ if (nodeName === "root") {
256
+ func.displayName = "PlasmicHomepage";
257
+ } else {
258
+ func.displayName = `PlasmicHomepage.${nodeName}`;
259
+ }
260
+ return func;
261
+ }
262
+
263
+ export const PlasmicHomepage = Object.assign(
264
+ // Top-level PlasmicHomepage renders the root element
265
+ makeNodeComponent("root"),
266
+ {
267
+ // Helper components rendering sub-elements
268
+ section: makeNodeComponent("section"),
269
+ h1: makeNodeComponent("h1"),
270
+ text: makeNodeComponent("text"),
271
+
272
+ // Metadata about props expected for PlasmicHomepage
273
+ internalVariantProps: PlasmicHomepage__VariantProps,
274
+ internalArgProps: PlasmicHomepage__ArgProps,
275
+
276
+ // Page metadata
277
+ pageMetadata: {
278
+ title: "",
279
+ description: "",
280
+ ogImageSrc: "",
281
+ canonical: ""
282
+ }
283
+ }
284
+ );
285
+
286
+ export default PlasmicHomepage;
287
+ /* prettier-ignore-end */
@@ -0,0 +1,10 @@
1
+
2
+ /** @type {import('next').NextConfig} */
3
+ const nextConfig = {
4
+ eslint: {
5
+ ignoreDuringBuilds: true,
6
+ },
7
+ trailingSlash: true,
8
+ };
9
+
10
+ module.exports = nextConfig;
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "nextjs-pages-codegen-ts",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "@next/font": "13.1.6",
13
+ "@plasmicapp/cli": "^0.1.205",
14
+ "@plasmicapp/host": "^1.0.100",
15
+ "@plasmicapp/react-web": "^0.2.150",
16
+ "@types/node": "18.11.18",
17
+ "@types/react": "18.0.27",
18
+ "@types/react-dom": "18.0.10",
19
+ "eslint": "8.33.0",
20
+ "eslint-config-next": "13.1.6",
21
+ "next": "13.1.6",
22
+ "react": "18.2.0",
23
+ "react-dom": "18.2.0",
24
+ "typescript": "4.9.5"
25
+ }
26
+ }
@@ -0,0 +1,12 @@
1
+ import 'styles/globals.css'
2
+ import { PlasmicRootProvider } from "@plasmicapp/react-web";
3
+ import type { AppProps } from "next/app";
4
+ import Head from "next/head";
5
+
6
+ export default function MyApp({ Component, pageProps }: AppProps) {
7
+ return (
8
+ <PlasmicRootProvider Head={Head}>
9
+ <Component {...pageProps} />
10
+ </PlasmicRootProvider>
11
+ );
12
+ }
@@ -0,0 +1,13 @@
1
+ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2
+ import type { NextApiRequest, NextApiResponse } from 'next'
3
+
4
+ type Data = {
5
+ name: string
6
+ }
7
+
8
+ export default function handler(
9
+ req: NextApiRequest,
10
+ res: NextApiResponse<Data>
11
+ ) {
12
+ res.status(200).json({ name: 'John Doe' })
13
+ }
@@ -0,0 +1,37 @@
1
+ // This is a skeleton starter React page generated by Plasmic.
2
+ // This file is owned by you, feel free to edit as you see fit.
3
+ import * as React from "react";
4
+ import * as ph from "@plasmicapp/host";
5
+
6
+ import { ScreenVariantProvider } from "../components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen";
7
+ import { PlasmicHomepage } from "../components/plasmic/create_plasmic_app/PlasmicHomepage";
8
+ import { useRouter } from "next/router";
9
+
10
+ function Homepage() {
11
+ // Use PlasmicHomepage to render this component as it was
12
+ // designed in Plasmic, by activating the appropriate variants,
13
+ // attaching the appropriate event handlers, etc. You
14
+ // can also install whatever React hooks you need here to manage state or
15
+ // fetch data.
16
+ //
17
+ // Props you can pass into PlasmicHomepage are:
18
+ // 1. Variants you want to activate,
19
+ // 2. Contents for slots you want to fill,
20
+ // 3. Overrides for any named node in the component to attach behavior and data,
21
+ // 4. Props to set on the root node.
22
+ //
23
+ // By default, PlasmicHomepage is wrapped by your project's global
24
+ // variant context providers. These wrappers may be moved to
25
+ // Next.js Custom App component
26
+ // (https://nextjs.org/docs/advanced-features/custom-app).
27
+ return (
28
+ <ph.PageParamsProvider
29
+ params={useRouter()?.query}
30
+ query={useRouter()?.query}
31
+ >
32
+ <PlasmicHomepage />
33
+ </ph.PageParamsProvider>
34
+ );
35
+ }
36
+
37
+ export default Homepage;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { PlasmicCanvasHost, registerComponent } from '@plasmicapp/host';
3
+
4
+ // You can register any code components that you want to use here; see
5
+ // https://docs.plasmic.app/learn/code-components-ref/
6
+ // And configure your Plasmic project to use the host url pointing at
7
+ // the /plasmic-host page of your nextjs app (for example,
8
+ // http://localhost:3000/plasmic-host). See
9
+ // https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
10
+
11
+ // registerComponent(...)
12
+
13
+ export default function PlasmicHost() {
14
+ return <PlasmicCanvasHost />;
15
+ }
@@ -0,0 +1,79 @@
1
+ {
2
+ "platform": "nextjs",
3
+ "code": {
4
+ "lang": "ts",
5
+ "scheme": "blackbox",
6
+ "reactRuntime": "classic"
7
+ },
8
+ "style": {
9
+ "scheme": "css-modules",
10
+ "defaultStyleCssFilePath": "plasmic/plasmic__default_style.css"
11
+ },
12
+ "images": {
13
+ "scheme": "public-files",
14
+ "publicDir": "../public",
15
+ "publicUrlPrefix": "/"
16
+ },
17
+ "tokens": {
18
+ "scheme": "theo",
19
+ "tokensFilePath": "plasmic-tokens.theo.json"
20
+ },
21
+ "srcDir": "components",
22
+ "defaultPlasmicDir": "./plasmic",
23
+ "projects": [
24
+ {
25
+ "projectId": "47tFXWjN2C4NyHFGGpaYQ3",
26
+ "projectApiToken": "7BRFratDxPLMGZHnd2grV5QP6mlHcZ1AK3BJSIeh7xzUlHgWh25XpgXvUaKAqHXFMXQQuzpADqboibF6nqNWQ",
27
+ "projectName": "create-plasmic-app",
28
+ "version": "latest",
29
+ "cssFilePath": "plasmic/create_plasmic_app/plasmic_create_plasmic_app.module.css",
30
+ "components": [
31
+ {
32
+ "id": "6uuAAE1jiCew",
33
+ "name": "Homepage",
34
+ "type": "managed",
35
+ "projectId": "47tFXWjN2C4NyHFGGpaYQ3",
36
+ "renderModuleFilePath": "plasmic/create_plasmic_app/PlasmicHomepage.tsx",
37
+ "importSpec": {
38
+ "modulePath": "../pages/index.tsx"
39
+ },
40
+ "cssFilePath": "plasmic/create_plasmic_app/PlasmicHomepage.module.css",
41
+ "scheme": "blackbox",
42
+ "componentType": "page"
43
+ }
44
+ ],
45
+ "icons": [],
46
+ "images": [],
47
+ "indirect": false,
48
+ "globalContextsFilePath": "",
49
+ "codeComponents": [
50
+ {
51
+ "id": "P6aGdYWZ2R",
52
+ "name": "PlasmicHead",
53
+ "componentImportPath": "@plasmicapp/react-web"
54
+ },
55
+ {
56
+ "id": "8G2A-uTjGa",
57
+ "name": "Fetcher",
58
+ "componentImportPath": "@plasmicapp/react-web/lib/data-sources"
59
+ }
60
+ ]
61
+ }
62
+ ],
63
+ "globalVariants": {
64
+ "variantGroups": [
65
+ {
66
+ "id": "SCBjPXGDXDZBV",
67
+ "name": "Screen",
68
+ "projectId": "47tFXWjN2C4NyHFGGpaYQ3",
69
+ "contextFilePath": "plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx"
70
+ }
71
+ ]
72
+ },
73
+ "wrapPagesWithGlobalContexts": true,
74
+ "nextjsConfig": {
75
+ "pagesDir": "../pages"
76
+ },
77
+ "cliVersion": "0.1.205",
78
+ "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.205/dist/plasmic.schema.json"
79
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "noEmit": true,
10
+ "esModuleInterop": true,
11
+ "module": "esnext",
12
+ "moduleResolution": "node",
13
+ "resolveJsonModule": true,
14
+ "isolatedModules": true,
15
+ "jsx": "preserve",
16
+ "incremental": true,
17
+ "baseUrl": ".",
18
+ "paths": {
19
+ "@/*": ["./*"]
20
+ }
21
+ },
22
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
23
+ "exclude": ["node_modules"]
24
+ }
@@ -0,0 +1,10 @@
1
+
2
+ /** @type {import('next').NextConfig} */
3
+ const nextConfig = {
4
+ // Turn off React StrictMode for now, as react-aria (used by Plasmic)
5
+ // has some troubles with it. See
6
+ // https://github.com/adobe/react-spectrum/labels/strict%20mode
7
+ reactStrictMode: false,
8
+ };
9
+
10
+ module.exports = nextConfig;
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "nextjs-pages-loader-js",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "@next/font": "13.1.6",
13
+ "@plasmicapp/loader-nextjs": "^1.0.224",
14
+ "eslint": "8.33.0",
15
+ "eslint-config-next": "13.1.6",
16
+ "next": "13.1.6",
17
+ "react": "18.2.0",
18
+ "react-dom": "18.2.0"
19
+ }
20
+ }
@@ -0,0 +1,66 @@
1
+ import * as React from "react";
2
+ import {
3
+ PlasmicComponent,
4
+ extractPlasmicQueryData,
5
+ ComponentRenderData,
6
+ PlasmicRootProvider,
7
+ } from "@plasmicapp/loader-nextjs";
8
+
9
+ import Error from "next/error";
10
+ import { useRouter } from "next/router";
11
+ import { PLASMIC } from "plasmic-init";
12
+
13
+ export default function PlasmicLoaderPage(props) {
14
+ const { plasmicData, queryCache } = props;
15
+ const router = useRouter();
16
+ if (!plasmicData || plasmicData.entryCompMetas.length === 0) {
17
+ return <Error statusCode={404} />;
18
+ }
19
+ const pageMeta = plasmicData.entryCompMetas[0];
20
+ return (
21
+ <PlasmicRootProvider
22
+ loader={PLASMIC}
23
+ prefetchedData={plasmicData}
24
+ prefetchedQueryData={queryCache}
25
+ pageParams={pageMeta.params}
26
+ pageQuery={router.query}
27
+ >
28
+ <PlasmicComponent component={pageMeta.displayName} />
29
+ </PlasmicRootProvider>
30
+ );
31
+ }
32
+
33
+ export const getStaticProps = async (context) => {
34
+ const { catchall } = context.params ?? {};
35
+ const plasmicPath = typeof catchall === 'string' ? catchall : Array.isArray(catchall) ? `/${catchall.join('/')}` : '/';
36
+ const plasmicData = await PLASMIC.maybeFetchComponentData(plasmicPath);
37
+ if (!plasmicData) {
38
+ // non-Plasmic catch-all
39
+ return { props: {} };
40
+ }
41
+ const pageMeta = plasmicData.entryCompMetas[0];
42
+ // Cache the necessary data fetched for the page
43
+ const queryCache = await extractPlasmicQueryData(
44
+ <PlasmicRootProvider
45
+ loader={PLASMIC}
46
+ prefetchedData={plasmicData}
47
+ pageParams={pageMeta.params}
48
+ >
49
+ <PlasmicComponent component={pageMeta.displayName} />
50
+ </PlasmicRootProvider>
51
+ );
52
+ // Use revalidate if you want incremental static regeneration
53
+ return { props: { plasmicData, queryCache }, revalidate: 60 };
54
+ }
55
+
56
+ export const getStaticPaths = async () => {
57
+ const pageModules = await PLASMIC.fetchPages();
58
+ return {
59
+ paths: pageModules.map((mod) => ({
60
+ params: {
61
+ catchall: mod.path.substring(1).split("/"),
62
+ },
63
+ })),
64
+ fallback: "blocking",
65
+ };
66
+ }
@@ -0,0 +1,5 @@
1
+ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2
+
3
+ export default function handler(req, res) {
4
+ res.status(200).json({ name: 'John Doe' })
5
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { PlasmicCanvasHost } from '@plasmicapp/loader-nextjs';
3
+ import { PLASMIC } from 'plasmic-init';
4
+
5
+ export default function PlasmicHost() {
6
+ return PLASMIC && <PlasmicCanvasHost />;
7
+ }
@@ -0,0 +1,25 @@
1
+ import { initPlasmicLoader } from "@plasmicapp/loader-nextjs";
2
+
3
+ export const PLASMIC = initPlasmicLoader({
4
+ projects: [
5
+ {
6
+ id: "47tFXWjN2C4NyHFGGpaYQ3",
7
+ token: "7BRFratDxPLMGZHnd2grV5QP6mlHcZ1AK3BJSIeh7xzUlHgWh25XpgXvUaKAqHXFMXQQuzpADqboibF6nqNWQ",
8
+ },
9
+ ],
10
+
11
+ // By default Plasmic will use the last published version of your project.
12
+ // For development, you can set preview to true, which will use the unpublished
13
+ // project, allowing you to see your designs without publishing. Please
14
+ // only use this for development, as this is significantly slower.
15
+ preview: false,
16
+ });
17
+
18
+ // You can register any code components that you want to use here; see
19
+ // https://docs.plasmic.app/learn/code-components-ref/
20
+ // And configure your Plasmic project to use the host url pointing at
21
+ // the /plasmic-host page of your nextjs app (for example,
22
+ // http://localhost:3000/plasmic-host). See
23
+ // https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
24
+
25
+ // PLASMIC.registerComponent(...);
@@ -0,0 +1,10 @@
1
+
2
+ /** @type {import('next').NextConfig} */
3
+ const nextConfig = {
4
+ // Turn off React StrictMode for now, as react-aria (used by Plasmic)
5
+ // has some troubles with it. See
6
+ // https://github.com/adobe/react-spectrum/labels/strict%20mode
7
+ reactStrictMode: false,
8
+ };
9
+
10
+ module.exports = nextConfig;