create-plasmic-app 0.0.133 → 0.0.134

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 (53) hide show
  1. package/cpa-out/nextjs-app-codegen-js/app/dynamic/[slug]/page-client.jsx +7 -0
  2. package/cpa-out/nextjs-app-codegen-js/app/dynamic/[slug]/page.jsx +45 -0
  3. package/cpa-out/nextjs-app-codegen-js/app/layout.js +28 -0
  4. package/cpa-out/nextjs-app-codegen-js/app/layout.jsx +17 -0
  5. package/cpa-out/nextjs-app-codegen-js/app/page-client.jsx +7 -0
  6. package/cpa-out/nextjs-app-codegen-js/app/page.jsx +45 -0
  7. package/cpa-out/nextjs-app-codegen-js/app/plasmic-host/page.jsx +15 -0
  8. package/cpa-out/nextjs-app-codegen-js/components/Button.jsx +11 -0
  9. package/cpa-out/nextjs-app-codegen-js/components/RandomDynamicPageButton.jsx +24 -0
  10. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +595 -0
  11. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +216 -0
  12. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.jsx +56 -0
  13. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +26 -0
  14. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +251 -0
  15. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepageServer.jsx +56 -0
  16. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +159 -0
  17. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.jsx +15 -0
  18. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__CheckSvg.jsx +39 -0
  19. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +37 -0
  20. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/plasmic.jsx +11 -0
  21. package/cpa-out/nextjs-app-codegen-js/package.json +22 -0
  22. package/cpa-out/nextjs-app-codegen-js/plasmic.json +148 -0
  23. package/cpa-out/nextjs-app-codegen-ts/app/dynamic/[slug]/page-client.tsx +11 -0
  24. package/cpa-out/nextjs-app-codegen-ts/app/dynamic/[slug]/page.tsx +57 -0
  25. package/cpa-out/nextjs-app-codegen-ts/app/layout.tsx +19 -0
  26. package/cpa-out/nextjs-app-codegen-ts/app/page-client.tsx +11 -0
  27. package/cpa-out/nextjs-app-codegen-ts/app/page.tsx +54 -0
  28. package/cpa-out/nextjs-app-codegen-ts/app/plasmic-host/page.tsx +15 -0
  29. package/cpa-out/nextjs-app-codegen-ts/components/Button.tsx +35 -0
  30. package/cpa-out/nextjs-app-codegen-ts/components/RandomDynamicPageButton.tsx +44 -0
  31. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +776 -0
  32. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +329 -0
  33. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.tsx +77 -0
  34. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  35. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +366 -0
  36. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepageServer.tsx +75 -0
  37. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +274 -0
  38. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +19 -0
  39. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__CheckSvg.tsx +44 -0
  40. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +41 -0
  41. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/plasmic.tsx +14 -0
  42. package/cpa-out/nextjs-app-codegen-ts/package.json +26 -0
  43. package/cpa-out/nextjs-app-codegen-ts/plasmic.json +148 -0
  44. package/cpa-out/nextjs-app-codegen-ts/tsconfig.json +26 -0
  45. package/dist/index.js +31 -28
  46. package/dist/nextjs/nextjs.js +37 -11
  47. package/dist/nextjs/templates/app-codegen/layout.d.ts +2 -0
  48. package/dist/nextjs/templates/app-codegen/layout.js +27 -0
  49. package/package.json +2 -2
  50. package/run-cpa.ts +8 -9
  51. package/src/index.ts +31 -34
  52. package/src/nextjs/nextjs.ts +67 -28
  53. package/src/nextjs/templates/app-codegen/layout.ts +28 -0
@@ -0,0 +1,329 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ // @ts-nocheck
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: AO44A-w7hh
13
+
14
+ "use client";
15
+
16
+ import * as React from "react";
17
+
18
+ import Head from "next/head";
19
+ import Link, { LinkProps } from "next/link";
20
+ import { useRouter } from "next/navigation";
21
+
22
+ import {
23
+ Flex as Flex__,
24
+ MultiChoiceArg,
25
+ PlasmicDataSourceContextProvider as PlasmicDataSourceContextProvider__,
26
+ PlasmicIcon as PlasmicIcon__,
27
+ PlasmicImg as PlasmicImg__,
28
+ PlasmicLink as PlasmicLink__,
29
+ PlasmicPageGuard as PlasmicPageGuard__,
30
+ SingleBooleanChoiceArg,
31
+ SingleChoiceArg,
32
+ Stack as Stack__,
33
+ StrictProps,
34
+ Trans as Trans__,
35
+ classNames,
36
+ createPlasmicElementProxy,
37
+ deriveRenderOpts,
38
+ ensureGlobalVariants,
39
+ generateOnMutateForSpec,
40
+ generateStateOnChangeProp,
41
+ generateStateOnChangePropForCodeComponents,
42
+ generateStateValueProp,
43
+ get as $stateGet,
44
+ hasVariant,
45
+ initializeCodeComponentStates,
46
+ initializePlasmicStates,
47
+ makeFragment,
48
+ omit,
49
+ pick,
50
+ renderPlasmicSlot,
51
+ set as $stateSet,
52
+ useCurrentUser,
53
+ useDollarState,
54
+ usePlasmicTranslator,
55
+ useTrigger,
56
+ wrapWithClassName
57
+ } from "@plasmicapp/react-web";
58
+ import {
59
+ DataCtxReader as DataCtxReader__,
60
+ useDataEnv,
61
+ useGlobalActions
62
+ } from "@plasmicapp/host";
63
+
64
+ import RandomDynamicPageButton from "../../RandomDynamicPageButton"; // plasmic-import: Q23H1_1M_P/component
65
+ import { _useGlobalVariants } from "./plasmic"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectModule
66
+ import { _useStyleTokens } from "./PlasmicStyleTokensProvider"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/styleTokensProvider
67
+
68
+ import "@plasmicapp/react-web/lib/plasmic.css";
69
+
70
+ import projectcss from "./plasmic.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
71
+ import sty from "./PlasmicDynamicPage.module.css"; // plasmic-import: AO44A-w7hh/css
72
+
73
+ const emptyProxy: any = new Proxy(() => "", {
74
+ get(_, prop) {
75
+ return prop === Symbol.toPrimitive ? () => "" : emptyProxy;
76
+ }
77
+ });
78
+
79
+ function wrapQueriesWithLoadingProxy($q: any): any {
80
+ return new Proxy($q, {
81
+ get(target, queryName) {
82
+ const query = target[queryName];
83
+ return !query || query.isLoading || !query.data ? emptyProxy : query;
84
+ }
85
+ });
86
+ }
87
+
88
+ export function generateDynamicMetadata($q: any, $ctx: any) {
89
+ return {
90
+ openGraph: {},
91
+ twitter: {
92
+ card: "summary"
93
+ }
94
+ };
95
+ }
96
+
97
+ createPlasmicElementProxy;
98
+
99
+ export type PlasmicDynamicPage__VariantMembers = {};
100
+ export type PlasmicDynamicPage__VariantsArgs = {};
101
+ type VariantPropType = keyof PlasmicDynamicPage__VariantsArgs;
102
+ export const PlasmicDynamicPage__VariantProps = new Array<VariantPropType>();
103
+
104
+ export type PlasmicDynamicPage__ArgsType = {};
105
+ type ArgPropType = keyof PlasmicDynamicPage__ArgsType;
106
+ export const PlasmicDynamicPage__ArgProps = new Array<ArgPropType>();
107
+
108
+ export type PlasmicDynamicPage__OverridesType = {
109
+ root?: Flex__<"div">;
110
+ section?: Flex__<"section">;
111
+ h1?: Flex__<"h1">;
112
+ randomDynamicPageButton?: Flex__<typeof RandomDynamicPageButton>;
113
+ };
114
+
115
+ export interface DefaultDynamicPageProps {}
116
+
117
+ const $$ = {};
118
+
119
+ function useNextRouter() {
120
+ try {
121
+ return useRouter();
122
+ } catch {}
123
+ return undefined;
124
+ }
125
+
126
+ function PlasmicDynamicPage__RenderFunc(props: {
127
+ variants: PlasmicDynamicPage__VariantsArgs;
128
+ args: PlasmicDynamicPage__ArgsType;
129
+ overrides: PlasmicDynamicPage__OverridesType;
130
+ forNode?: string;
131
+ }) {
132
+ const { variants, overrides, forNode } = props;
133
+
134
+ const args = React.useMemo(
135
+ () =>
136
+ Object.assign(
137
+ {},
138
+ Object.fromEntries(
139
+ Object.entries(props.args).filter(([_, v]) => v !== undefined)
140
+ )
141
+ ),
142
+ [props.args]
143
+ );
144
+
145
+ const $props = {
146
+ ...args,
147
+ ...variants
148
+ };
149
+
150
+ const __nextRouter = useNextRouter();
151
+
152
+ const $ctx = useDataEnv?.() || {};
153
+ const refsRef = React.useRef({});
154
+ const $refs = refsRef.current;
155
+
156
+ const pageMetadata = generateDynamicMetadata(
157
+ wrapQueriesWithLoadingProxy({}),
158
+ $ctx
159
+ );
160
+
161
+ const styleTokensClassNames = _useStyleTokens();
162
+
163
+ return (
164
+ <React.Fragment>
165
+ <Head></Head>
166
+
167
+ <style>{`
168
+ body {
169
+ margin: 0;
170
+ }
171
+ `}</style>
172
+
173
+ <div className={projectcss.plasmic_page_wrapper}>
174
+ <div
175
+ data-plasmic-name={"root"}
176
+ data-plasmic-override={overrides.root}
177
+ data-plasmic-root={true}
178
+ data-plasmic-for-node={forNode}
179
+ className={classNames(
180
+ projectcss.all,
181
+ projectcss.root_reset,
182
+ projectcss.plasmic_default_styles,
183
+ projectcss.plasmic_mixins,
184
+ styleTokensClassNames,
185
+ sty.root
186
+ )}
187
+ >
188
+ <section
189
+ data-plasmic-name={"section"}
190
+ data-plasmic-override={overrides.section}
191
+ className={classNames(projectcss.all, sty.section)}
192
+ >
193
+ <h1
194
+ data-plasmic-name={"h1"}
195
+ data-plasmic-override={overrides.h1}
196
+ className={classNames(
197
+ projectcss.all,
198
+ projectcss.h1,
199
+ projectcss.__wab_text,
200
+ sty.h1
201
+ )}
202
+ >
203
+ <React.Fragment>
204
+ {(() => {
205
+ try {
206
+ return $ctx.params.slug;
207
+ } catch (e) {
208
+ if (
209
+ e instanceof TypeError ||
210
+ e?.plasmicType === "PlasmicUndefinedDataError"
211
+ ) {
212
+ return "Page 1";
213
+ }
214
+ throw e;
215
+ }
216
+ })()}
217
+ </React.Fragment>
218
+ </h1>
219
+ <RandomDynamicPageButton
220
+ data-plasmic-name={"randomDynamicPageButton"}
221
+ data-plasmic-override={overrides.randomDynamicPageButton}
222
+ className={classNames(
223
+ "__wab_instance",
224
+ sty.randomDynamicPageButton
225
+ )}
226
+ />
227
+ </section>
228
+ </div>
229
+ </div>
230
+ </React.Fragment>
231
+ ) as React.ReactElement | null;
232
+ }
233
+
234
+ const PlasmicDescendants = {
235
+ root: ["root", "section", "h1", "randomDynamicPageButton"],
236
+ section: ["section", "h1", "randomDynamicPageButton"],
237
+ h1: ["h1"],
238
+ randomDynamicPageButton: ["randomDynamicPageButton"]
239
+ } as const;
240
+ type NodeNameType = keyof typeof PlasmicDescendants;
241
+ type DescendantsType<T extends NodeNameType> =
242
+ (typeof PlasmicDescendants)[T][number];
243
+ type NodeDefaultElementType = {
244
+ root: "div";
245
+ section: "section";
246
+ h1: "h1";
247
+ randomDynamicPageButton: typeof RandomDynamicPageButton;
248
+ };
249
+
250
+ type ReservedPropsType = "variants" | "args" | "overrides";
251
+ type NodeOverridesType<T extends NodeNameType> = Pick<
252
+ PlasmicDynamicPage__OverridesType,
253
+ DescendantsType<T>
254
+ >;
255
+ type NodeComponentProps<T extends NodeNameType> =
256
+ // Explicitly specify variants, args, and overrides as objects
257
+ {
258
+ variants?: PlasmicDynamicPage__VariantsArgs;
259
+ args?: PlasmicDynamicPage__ArgsType;
260
+ overrides?: NodeOverridesType<T>;
261
+ } &
262
+ // Specify variants directly as props
263
+ Omit<PlasmicDynamicPage__VariantsArgs, ReservedPropsType> &
264
+ // Specify args directly as props
265
+ Omit<PlasmicDynamicPage__ArgsType, ReservedPropsType> &
266
+ // Specify overrides for each element directly as props
267
+ Omit<
268
+ NodeOverridesType<T>,
269
+ ReservedPropsType | VariantPropType | ArgPropType
270
+ > &
271
+ // Specify props for the root element
272
+ Omit<
273
+ Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
274
+ ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
275
+ >;
276
+
277
+ function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
278
+ type PropsType = NodeComponentProps<NodeName> & { key?: React.Key };
279
+ const func = function <T extends PropsType>(
280
+ props: T & StrictProps<T, PropsType>
281
+ ) {
282
+ const { variants, args, overrides } = React.useMemo(
283
+ () =>
284
+ deriveRenderOpts(props, {
285
+ name: nodeName,
286
+ descendantNames: PlasmicDescendants[nodeName],
287
+ internalArgPropNames: PlasmicDynamicPage__ArgProps,
288
+ internalVariantPropNames: PlasmicDynamicPage__VariantProps
289
+ }),
290
+ [props, nodeName]
291
+ );
292
+ return PlasmicDynamicPage__RenderFunc({
293
+ variants,
294
+ args,
295
+ overrides,
296
+ forNode: nodeName
297
+ });
298
+ };
299
+ if (nodeName === "root") {
300
+ func.displayName = "PlasmicDynamicPage";
301
+ } else {
302
+ func.displayName = `PlasmicDynamicPage.${nodeName}`;
303
+ }
304
+ return func;
305
+ }
306
+
307
+ export const PlasmicDynamicPage = Object.assign(
308
+ // Top-level PlasmicDynamicPage renders the root element
309
+ makeNodeComponent("root"),
310
+ {
311
+ // Helper components rendering sub-elements
312
+ section: makeNodeComponent("section"),
313
+ h1: makeNodeComponent("h1"),
314
+ randomDynamicPageButton: makeNodeComponent("randomDynamicPageButton"),
315
+
316
+ // Metadata about props expected for PlasmicDynamicPage
317
+ internalVariantProps: PlasmicDynamicPage__VariantProps,
318
+ internalArgProps: PlasmicDynamicPage__ArgProps,
319
+
320
+ pageMetadata: generateDynamicMetadata(wrapQueriesWithLoadingProxy({}), {
321
+ pagePath: "/dynamic/[slug]",
322
+ searchParams: {},
323
+ params: {}
324
+ })
325
+ }
326
+ );
327
+
328
+ export default PlasmicDynamicPage;
329
+ /* prettier-ignore-end */
@@ -0,0 +1,77 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ // @ts-nocheck
4
+ /* prettier-ignore-start */
5
+
6
+ // This class is auto-generated by Plasmic; please do not edit!
7
+ // Plasmic Project: 47tFXWjN2C4NyHFGGpaYQ3
8
+ // Component: AO44A-w7hh
9
+
10
+ import * as React from "react";
11
+ import { DefaultDynamicPageProps } from "./PlasmicDynamicPage"; // plasmic-import: AO44A-w7hh/render
12
+
13
+ import { ClientDynamicPage } from "../../../app/dynamic/[slug]/page-client"; // plasmic-import: AO44A-w7hh/rscClient
14
+
15
+ const $$ = {};
16
+
17
+ export function generateDynamicMetadata($q: any, $ctx: any) {
18
+ return {
19
+ openGraph: {},
20
+ twitter: {
21
+ card: "summary"
22
+ }
23
+ };
24
+ }
25
+
26
+ function mkPathFromRouteAndParams(
27
+ route: string,
28
+ params: Record<string, string | string[] | undefined>
29
+ ) {
30
+ if (!params) {
31
+ return route;
32
+ }
33
+ let path = route;
34
+ for (const [key, value] of Object.entries(params)) {
35
+ if (typeof value === "string") {
36
+ path = path.replace(`[${key}]`, value);
37
+ } else if (Array.isArray(value)) {
38
+ if (path.includes(`[[...${key}]]`)) {
39
+ path = path.replace(`[[...${key}]]`, value.join("/"));
40
+ } else if (path.includes(`[...${key}]`)) {
41
+ path = path.replace(`[...${key}]`, value.join("/"));
42
+ }
43
+ }
44
+ }
45
+ return path;
46
+ }
47
+
48
+ export interface DynamicPageServerSkeletonProps {
49
+ params?: Promise<Record<string, string | string[] | undefined>>;
50
+ searchParams?: Promise<Record<string, string | string[] | undefined>>;
51
+ }
52
+
53
+ export async function makeAppRouterPageCtx({
54
+ params,
55
+ searchParams
56
+ }: DynamicPageServerSkeletonProps) {
57
+ const pageRoute = "/dynamic/[slug]";
58
+ const pageParams = (await params) ?? {};
59
+ const pagePath = mkPathFromRouteAndParams(pageRoute, pageParams);
60
+
61
+ const ctx = {
62
+ pageRoute,
63
+ pagePath,
64
+ params: pageParams,
65
+ query: (await searchParams) ?? {}
66
+ };
67
+ return ctx;
68
+ }
69
+
70
+ export type PlasmicDynamicPageServerProps = DefaultDynamicPageProps &
71
+ DynamicPageServerSkeletonProps;
72
+
73
+ export async function PlasmicDynamicPageServer(
74
+ props: PlasmicDynamicPageServerProps
75
+ ) {
76
+ return <ClientDynamicPage {...props} />;
77
+ }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ // @ts-nocheck
4
+ /* prettier-ignore-start */
5
+
6
+ "use client";
7
+
8
+ import * as React from "react";
9
+ import { createUseScreenVariants } from "@plasmicapp/react-web";
10
+
11
+ export type ScreenValue = "desktopOnly";
12
+ export const ScreenContext = React.createContext<ScreenValue[] | undefined>(
13
+ "PLEASE_RENDER_INSIDE_PROVIDER" as any
14
+ );
15
+ export function ScreenContextProvider(
16
+ props: React.PropsWithChildren<{ value: ScreenValue[] | undefined }>
17
+ ) {
18
+ return (
19
+ <ScreenContext.Provider value={props.value}>
20
+ {props.children}
21
+ </ScreenContext.Provider>
22
+ );
23
+ }
24
+
25
+ export const useScreenVariants = createUseScreenVariants(true, {
26
+ desktopOnly: "(min-width:768px)"
27
+ });
28
+
29
+ export default ScreenContext;
30
+ /* prettier-ignore-end */