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,366 @@
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: 6uuAAE1jiCew
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 { Fetcher } from "@plasmicapp/react-web/lib/data-sources";
66
+ import { _useGlobalVariants } from "./plasmic"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectModule
67
+ import { _useStyleTokens } from "./PlasmicStyleTokensProvider"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/styleTokensProvider
68
+
69
+ import "@plasmicapp/react-web/lib/plasmic.css";
70
+
71
+ import projectcss from "./plasmic.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
72
+ import sty from "./PlasmicHomepage.module.css"; // plasmic-import: 6uuAAE1jiCew/css
73
+
74
+ const emptyProxy: any = new Proxy(() => "", {
75
+ get(_, prop) {
76
+ return prop === Symbol.toPrimitive ? () => "" : emptyProxy;
77
+ }
78
+ });
79
+
80
+ function wrapQueriesWithLoadingProxy($q: any): any {
81
+ return new Proxy($q, {
82
+ get(target, queryName) {
83
+ const query = target[queryName];
84
+ return !query || query.isLoading || !query.data ? emptyProxy : query;
85
+ }
86
+ });
87
+ }
88
+
89
+ export function generateDynamicMetadata($q: any, $ctx: any) {
90
+ return {
91
+ openGraph: {},
92
+ twitter: {
93
+ card: "summary"
94
+ }
95
+ };
96
+ }
97
+
98
+ createPlasmicElementProxy;
99
+
100
+ export type PlasmicHomepage__VariantMembers = {};
101
+ export type PlasmicHomepage__VariantsArgs = {};
102
+ type VariantPropType = keyof PlasmicHomepage__VariantsArgs;
103
+ export const PlasmicHomepage__VariantProps = new Array<VariantPropType>();
104
+
105
+ export type PlasmicHomepage__ArgsType = {};
106
+ type ArgPropType = keyof PlasmicHomepage__ArgsType;
107
+ export const PlasmicHomepage__ArgProps = new Array<ArgPropType>();
108
+
109
+ export type PlasmicHomepage__OverridesType = {
110
+ root?: Flex__<"div">;
111
+ section?: Flex__<"section">;
112
+ h1?: Flex__<"h1">;
113
+ text?: Flex__<"div">;
114
+ randomDynamicPageButton?: Flex__<typeof RandomDynamicPageButton>;
115
+ };
116
+
117
+ export interface DefaultHomepageProps {}
118
+
119
+ const $$ = {};
120
+
121
+ function useNextRouter() {
122
+ try {
123
+ return useRouter();
124
+ } catch {}
125
+ return undefined;
126
+ }
127
+
128
+ function PlasmicHomepage__RenderFunc(props: {
129
+ variants: PlasmicHomepage__VariantsArgs;
130
+ args: PlasmicHomepage__ArgsType;
131
+ overrides: PlasmicHomepage__OverridesType;
132
+ forNode?: string;
133
+ }) {
134
+ const { variants, overrides, forNode } = props;
135
+
136
+ const args = React.useMemo(
137
+ () =>
138
+ Object.assign(
139
+ {},
140
+ Object.fromEntries(
141
+ Object.entries(props.args).filter(([_, v]) => v !== undefined)
142
+ )
143
+ ),
144
+ [props.args]
145
+ );
146
+
147
+ const $props = {
148
+ ...args,
149
+ ...variants
150
+ };
151
+
152
+ const __nextRouter = useNextRouter();
153
+
154
+ const $ctx = useDataEnv?.() || {};
155
+ const refsRef = React.useRef({});
156
+ const $refs = refsRef.current;
157
+
158
+ const globalVariants = _useGlobalVariants();
159
+
160
+ const pageMetadata = generateDynamicMetadata(
161
+ wrapQueriesWithLoadingProxy({}),
162
+ $ctx
163
+ );
164
+
165
+ const styleTokensClassNames = _useStyleTokens();
166
+
167
+ return (
168
+ <React.Fragment>
169
+ <Head></Head>
170
+
171
+ <style>{`
172
+ body {
173
+ margin: 0;
174
+ }
175
+ `}</style>
176
+
177
+ <div className={projectcss.plasmic_page_wrapper}>
178
+ <div
179
+ data-plasmic-name={"root"}
180
+ data-plasmic-override={overrides.root}
181
+ data-plasmic-root={true}
182
+ data-plasmic-for-node={forNode}
183
+ className={classNames(
184
+ projectcss.all,
185
+ projectcss.root_reset,
186
+ projectcss.plasmic_default_styles,
187
+ projectcss.plasmic_mixins,
188
+ styleTokensClassNames,
189
+ sty.root
190
+ )}
191
+ >
192
+ <section
193
+ data-plasmic-name={"section"}
194
+ data-plasmic-override={overrides.section}
195
+ className={classNames(projectcss.all, sty.section)}
196
+ >
197
+ <h1
198
+ data-plasmic-name={"h1"}
199
+ data-plasmic-override={overrides.h1}
200
+ className={classNames(
201
+ projectcss.all,
202
+ projectcss.h1,
203
+ projectcss.__wab_text,
204
+ sty.h1
205
+ )}
206
+ >
207
+ {"create-plasmic-app"}
208
+ </h1>
209
+ <div
210
+ data-plasmic-name={"text"}
211
+ data-plasmic-override={overrides.text}
212
+ className={classNames(
213
+ projectcss.all,
214
+ projectcss.__wab_text,
215
+ sty.text
216
+ )}
217
+ >
218
+ {hasVariant(globalVariants, "screen", "desktopOnly") ? (
219
+ <React.Fragment>
220
+ <React.Fragment>
221
+ {
222
+ "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. "
223
+ }
224
+ </React.Fragment>
225
+ <span
226
+ className={"plasmic_default__all plasmic_default__span"}
227
+ style={{ fontWeight: 700 }}
228
+ >
229
+ {"Therefore, please avoid changing this project."}
230
+ </span>
231
+ </React.Fragment>
232
+ ) : (
233
+ <React.Fragment>
234
+ <React.Fragment>
235
+ {
236
+ "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 "
237
+ }
238
+ </React.Fragment>
239
+ <span
240
+ className={"plasmic_default__all plasmic_default__span"}
241
+ style={{ fontWeight: 700 }}
242
+ >
243
+ {"Code"}
244
+ </span>
245
+ <React.Fragment>
246
+ {
247
+ " button in the top right and follow the quickstart instructions.\n\nJoin our Slack community (icon in bottom left) for help any time."
248
+ }
249
+ </React.Fragment>
250
+ </React.Fragment>
251
+ )}
252
+ </div>
253
+ <RandomDynamicPageButton
254
+ data-plasmic-name={"randomDynamicPageButton"}
255
+ data-plasmic-override={overrides.randomDynamicPageButton}
256
+ className={classNames(
257
+ "__wab_instance",
258
+ sty.randomDynamicPageButton
259
+ )}
260
+ />
261
+ </section>
262
+ </div>
263
+ </div>
264
+ </React.Fragment>
265
+ ) as React.ReactElement | null;
266
+ }
267
+
268
+ const PlasmicDescendants = {
269
+ root: ["root", "section", "h1", "text", "randomDynamicPageButton"],
270
+ section: ["section", "h1", "text", "randomDynamicPageButton"],
271
+ h1: ["h1"],
272
+ text: ["text"],
273
+ randomDynamicPageButton: ["randomDynamicPageButton"]
274
+ } as const;
275
+ type NodeNameType = keyof typeof PlasmicDescendants;
276
+ type DescendantsType<T extends NodeNameType> =
277
+ (typeof PlasmicDescendants)[T][number];
278
+ type NodeDefaultElementType = {
279
+ root: "div";
280
+ section: "section";
281
+ h1: "h1";
282
+ text: "div";
283
+ randomDynamicPageButton: typeof RandomDynamicPageButton;
284
+ };
285
+
286
+ type ReservedPropsType = "variants" | "args" | "overrides";
287
+ type NodeOverridesType<T extends NodeNameType> = Pick<
288
+ PlasmicHomepage__OverridesType,
289
+ DescendantsType<T>
290
+ >;
291
+ type NodeComponentProps<T extends NodeNameType> =
292
+ // Explicitly specify variants, args, and overrides as objects
293
+ {
294
+ variants?: PlasmicHomepage__VariantsArgs;
295
+ args?: PlasmicHomepage__ArgsType;
296
+ overrides?: NodeOverridesType<T>;
297
+ } &
298
+ // Specify variants directly as props
299
+ Omit<PlasmicHomepage__VariantsArgs, ReservedPropsType> &
300
+ // Specify args directly as props
301
+ Omit<PlasmicHomepage__ArgsType, ReservedPropsType> &
302
+ // Specify overrides for each element directly as props
303
+ Omit<
304
+ NodeOverridesType<T>,
305
+ ReservedPropsType | VariantPropType | ArgPropType
306
+ > &
307
+ // Specify props for the root element
308
+ Omit<
309
+ Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
310
+ ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
311
+ >;
312
+
313
+ function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
314
+ type PropsType = NodeComponentProps<NodeName> & { key?: React.Key };
315
+ const func = function <T extends PropsType>(
316
+ props: T & StrictProps<T, PropsType>
317
+ ) {
318
+ const { variants, args, overrides } = React.useMemo(
319
+ () =>
320
+ deriveRenderOpts(props, {
321
+ name: nodeName,
322
+ descendantNames: PlasmicDescendants[nodeName],
323
+ internalArgPropNames: PlasmicHomepage__ArgProps,
324
+ internalVariantPropNames: PlasmicHomepage__VariantProps
325
+ }),
326
+ [props, nodeName]
327
+ );
328
+ return PlasmicHomepage__RenderFunc({
329
+ variants,
330
+ args,
331
+ overrides,
332
+ forNode: nodeName
333
+ });
334
+ };
335
+ if (nodeName === "root") {
336
+ func.displayName = "PlasmicHomepage";
337
+ } else {
338
+ func.displayName = `PlasmicHomepage.${nodeName}`;
339
+ }
340
+ return func;
341
+ }
342
+
343
+ export const PlasmicHomepage = Object.assign(
344
+ // Top-level PlasmicHomepage renders the root element
345
+ makeNodeComponent("root"),
346
+ {
347
+ // Helper components rendering sub-elements
348
+ section: makeNodeComponent("section"),
349
+ h1: makeNodeComponent("h1"),
350
+ text: makeNodeComponent("text"),
351
+ randomDynamicPageButton: makeNodeComponent("randomDynamicPageButton"),
352
+
353
+ // Metadata about props expected for PlasmicHomepage
354
+ internalVariantProps: PlasmicHomepage__VariantProps,
355
+ internalArgProps: PlasmicHomepage__ArgProps,
356
+
357
+ pageMetadata: generateDynamicMetadata(wrapQueriesWithLoadingProxy({}), {
358
+ pagePath: "/",
359
+ searchParams: {},
360
+ params: {}
361
+ })
362
+ }
363
+ );
364
+
365
+ export default PlasmicHomepage;
366
+ /* prettier-ignore-end */
@@ -0,0 +1,75 @@
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: 6uuAAE1jiCew
9
+
10
+ import * as React from "react";
11
+ import { DefaultHomepageProps } from "./PlasmicHomepage"; // plasmic-import: 6uuAAE1jiCew/render
12
+
13
+ import { ClientHomepage } from "../../../app/page-client"; // plasmic-import: 6uuAAE1jiCew/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 HomepageServerSkeletonProps {
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
+ }: HomepageServerSkeletonProps) {
57
+ const pageRoute = "/";
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 PlasmicHomepageServerProps = DefaultHomepageProps &
71
+ HomepageServerSkeletonProps;
72
+
73
+ export async function PlasmicHomepageServer(props: PlasmicHomepageServerProps) {
74
+ return <ClientHomepage {...props} />;
75
+ }
@@ -0,0 +1,274 @@
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: Q23H1_1M_P
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 Button from "../../Button"; // plasmic-import: TQcvW_pSKi3/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 "./PlasmicRandomDynamicPageButton.module.css"; // plasmic-import: Q23H1_1M_P/css
72
+
73
+ import CheckSvgIcon from "./icons/PlasmicIcon__CheckSvg"; // plasmic-import: gj-_D7n31Ho/icon
74
+ import IconIcon from "./icons/PlasmicIcon__Icon"; // plasmic-import: 6PNxx3YMyDQ/icon
75
+
76
+ createPlasmicElementProxy;
77
+
78
+ export type PlasmicRandomDynamicPageButton__VariantMembers = {};
79
+ export type PlasmicRandomDynamicPageButton__VariantsArgs = {};
80
+ type VariantPropType = keyof PlasmicRandomDynamicPageButton__VariantsArgs;
81
+ export const PlasmicRandomDynamicPageButton__VariantProps =
82
+ new Array<VariantPropType>();
83
+
84
+ export type PlasmicRandomDynamicPageButton__ArgsType = {};
85
+ type ArgPropType = keyof PlasmicRandomDynamicPageButton__ArgsType;
86
+ export const PlasmicRandomDynamicPageButton__ArgProps =
87
+ new Array<ArgPropType>();
88
+
89
+ export type PlasmicRandomDynamicPageButton__OverridesType = {
90
+ root?: Flex__<typeof Button>;
91
+ };
92
+
93
+ export interface DefaultRandomDynamicPageButtonProps {
94
+ className?: string;
95
+ }
96
+
97
+ const $$ = {};
98
+
99
+ function useNextRouter() {
100
+ try {
101
+ return useRouter();
102
+ } catch {}
103
+ return undefined;
104
+ }
105
+
106
+ function PlasmicRandomDynamicPageButton__RenderFunc(props: {
107
+ variants: PlasmicRandomDynamicPageButton__VariantsArgs;
108
+ args: PlasmicRandomDynamicPageButton__ArgsType;
109
+ overrides: PlasmicRandomDynamicPageButton__OverridesType;
110
+ forNode?: string;
111
+ }) {
112
+ const { variants, overrides, forNode } = props;
113
+
114
+ const args = React.useMemo(
115
+ () =>
116
+ Object.assign(
117
+ {},
118
+ Object.fromEntries(
119
+ Object.entries(props.args).filter(([_, v]) => v !== undefined)
120
+ )
121
+ ),
122
+ [props.args]
123
+ );
124
+
125
+ const $props = {
126
+ ...args,
127
+ ...variants
128
+ };
129
+
130
+ const __nextRouter = useNextRouter();
131
+
132
+ const $ctx = useDataEnv?.() || {};
133
+ const refsRef = React.useRef({});
134
+ const $refs = refsRef.current;
135
+
136
+ const styleTokensClassNames = _useStyleTokens();
137
+
138
+ return (
139
+ <Button
140
+ data-plasmic-name={"root"}
141
+ data-plasmic-override={overrides.root}
142
+ data-plasmic-root={true}
143
+ data-plasmic-for-node={forNode}
144
+ className={classNames("__wab_instance", sty.root)}
145
+ onClick={async event => {
146
+ const $steps = {};
147
+
148
+ $steps["goToDynamicPage"] = true
149
+ ? (() => {
150
+ const actionArgs = {
151
+ destination: `/dynamic/${(() => {
152
+ try {
153
+ return Math.random().toString(36).slice(2);
154
+ } catch (e) {
155
+ if (
156
+ e instanceof TypeError ||
157
+ e?.plasmicType === "PlasmicUndefinedDataError"
158
+ ) {
159
+ return "value";
160
+ }
161
+ throw e;
162
+ }
163
+ })()}`
164
+ };
165
+ return (({ destination }) => {
166
+ if (
167
+ typeof destination === "string" &&
168
+ destination.startsWith("#")
169
+ ) {
170
+ document
171
+ .getElementById(destination.substr(1))
172
+ .scrollIntoView({ behavior: "smooth" });
173
+ } else {
174
+ __nextRouter?.push(destination);
175
+ }
176
+ })?.apply(null, [actionArgs]);
177
+ })()
178
+ : undefined;
179
+ if (
180
+ $steps["goToDynamicPage"] != null &&
181
+ typeof $steps["goToDynamicPage"] === "object" &&
182
+ typeof $steps["goToDynamicPage"].then === "function"
183
+ ) {
184
+ $steps["goToDynamicPage"] = await $steps["goToDynamicPage"];
185
+ }
186
+ }}
187
+ submitsForm={true}
188
+ >
189
+ {"Random Dynamic Page"}
190
+ </Button>
191
+ ) as React.ReactElement | null;
192
+ }
193
+
194
+ const PlasmicDescendants = {
195
+ root: ["root"]
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: typeof Button;
202
+ };
203
+
204
+ type ReservedPropsType = "variants" | "args" | "overrides";
205
+ type NodeOverridesType<T extends NodeNameType> = Pick<
206
+ PlasmicRandomDynamicPageButton__OverridesType,
207
+ DescendantsType<T>
208
+ >;
209
+ type NodeComponentProps<T extends NodeNameType> =
210
+ // Explicitly specify variants, args, and overrides as objects
211
+ {
212
+ variants?: PlasmicRandomDynamicPageButton__VariantsArgs;
213
+ args?: PlasmicRandomDynamicPageButton__ArgsType;
214
+ overrides?: NodeOverridesType<T>;
215
+ } &
216
+ // Specify variants directly as props
217
+ Omit<PlasmicRandomDynamicPageButton__VariantsArgs, ReservedPropsType> &
218
+ // Specify args directly as props
219
+ Omit<PlasmicRandomDynamicPageButton__ArgsType, ReservedPropsType> &
220
+ // Specify overrides for each element directly as props
221
+ Omit<
222
+ NodeOverridesType<T>,
223
+ ReservedPropsType | VariantPropType | ArgPropType
224
+ > &
225
+ // Specify props for the root element
226
+ Omit<
227
+ Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
228
+ ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
229
+ >;
230
+
231
+ function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
232
+ type PropsType = NodeComponentProps<NodeName> & { key?: React.Key };
233
+ const func = function <T extends PropsType>(
234
+ props: T & StrictProps<T, PropsType>
235
+ ) {
236
+ const { variants, args, overrides } = React.useMemo(
237
+ () =>
238
+ deriveRenderOpts(props, {
239
+ name: nodeName,
240
+ descendantNames: PlasmicDescendants[nodeName],
241
+ internalArgPropNames: PlasmicRandomDynamicPageButton__ArgProps,
242
+ internalVariantPropNames: PlasmicRandomDynamicPageButton__VariantProps
243
+ }),
244
+ [props, nodeName]
245
+ );
246
+ return PlasmicRandomDynamicPageButton__RenderFunc({
247
+ variants,
248
+ args,
249
+ overrides,
250
+ forNode: nodeName
251
+ });
252
+ };
253
+ if (nodeName === "root") {
254
+ func.displayName = "PlasmicRandomDynamicPageButton";
255
+ } else {
256
+ func.displayName = `PlasmicRandomDynamicPageButton.${nodeName}`;
257
+ }
258
+ return func;
259
+ }
260
+
261
+ export const PlasmicRandomDynamicPageButton = Object.assign(
262
+ // Top-level PlasmicRandomDynamicPageButton renders the root element
263
+ makeNodeComponent("root"),
264
+ {
265
+ // Helper components rendering sub-elements
266
+
267
+ // Metadata about props expected for PlasmicRandomDynamicPageButton
268
+ internalVariantProps: PlasmicRandomDynamicPageButton__VariantProps,
269
+ internalArgProps: PlasmicRandomDynamicPageButton__ArgProps
270
+ }
271
+ );
272
+
273
+ export default PlasmicRandomDynamicPageButton;
274
+ /* prettier-ignore-end */