create-plasmic-app 0.0.95 → 0.0.97
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.
- package/cpa-out/react-codegen-js/eslint.config.js +38 -0
- package/cpa-out/react-codegen-js/package.json +22 -32
- package/cpa-out/react-codegen-js/plasmic.json +16 -10
- package/cpa-out/react-codegen-js/src/App.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/Button.jsx +1 -3
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +47 -96
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +35 -29
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +2 -14
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +24 -24
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +44 -58
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +2 -2
- package/cpa-out/react-codegen-js/src/main.jsx +10 -0
- package/cpa-out/react-codegen-js/vite.config.js +7 -0
- package/cpa-out/react-codegen-ts/eslint.config.js +28 -0
- package/cpa-out/react-codegen-ts/package.json +23 -37
- package/cpa-out/react-codegen-ts/plasmic.json +16 -10
- package/cpa-out/react-codegen-ts/src/App.tsx +1 -1
- package/cpa-out/react-codegen-ts/src/components/Button.tsx +4 -5
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +84 -62
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +73 -44
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +2 -14
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +62 -38
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +83 -70
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +3 -3
- package/cpa-out/react-codegen-ts/src/main.tsx +10 -0
- package/cpa-out/react-codegen-ts/src/vite-env.d.ts +1 -0
- package/cpa-out/react-codegen-ts/tsconfig.json +4 -23
- package/cpa-out/react-codegen-ts/vite.config.ts +7 -0
- package/dist/gatsby/template.js +2 -1
- package/dist/lib.js +1 -1
- package/dist/nextjs/templates/pages-codegen/app.js +2 -1
- package/dist/react/react.js +36 -11
- package/package.json +2 -2
- package/src/gatsby/template.ts +2 -1
- package/src/lib.ts +1 -1
- package/src/nextjs/templates/pages-codegen/app.ts +2 -1
- package/src/react/react.ts +47 -16
- package/cpa-out/react-codegen-js/src/index.js +0 -17
- package/cpa-out/react-codegen-js/src/reportWebVitals.js +0 -13
- package/cpa-out/react-codegen-js/src/setupTests.js +0 -5
- package/cpa-out/react-codegen-ts/src/index.tsx +0 -19
- package/cpa-out/react-codegen-ts/src/react-app-env.d.ts +0 -1
- package/cpa-out/react-codegen-ts/src/reportWebVitals.ts +0 -15
- package/cpa-out/react-codegen-ts/src/setupTests.ts +0 -5
- package/cpa-out/react-loader-js/package.json +0 -40
- package/cpa-out/react-loader-js/plasmic.json +0 -127
- package/cpa-out/react-loader-js/src/App.jsx +0 -9
- package/cpa-out/react-loader-js/src/components/Button.jsx +0 -13
- package/cpa-out/react-loader-js/src/components/DynamicPage.jsx +0 -26
- package/cpa-out/react-loader-js/src/components/Homepage.jsx +0 -26
- package/cpa-out/react-loader-js/src/components/RandomDynamicPageButton.jsx +0 -24
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +0 -625
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +0 -166
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +0 -29
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +0 -210
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +0 -161
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +0 -39
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +0 -37
- package/cpa-out/react-loader-js/src/index.js +0 -17
- package/cpa-out/react-loader-js/src/reportWebVitals.js +0 -13
- package/cpa-out/react-loader-js/src/setupTests.js +0 -5
- package/cpa-out/react-loader-ts/package.json +0 -45
- package/cpa-out/react-loader-ts/plasmic.json +0 -127
- package/cpa-out/react-loader-ts/src/App.tsx +0 -9
- package/cpa-out/react-loader-ts/src/components/Button.tsx +0 -36
- package/cpa-out/react-loader-ts/src/components/DynamicPage.tsx +0 -45
- package/cpa-out/react-loader-ts/src/components/Homepage.tsx +0 -45
- package/cpa-out/react-loader-ts/src/components/RandomDynamicPageButton.tsx +0 -44
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +0 -725
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +0 -248
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +0 -31
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +0 -294
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +0 -240
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +0 -44
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +0 -41
- package/cpa-out/react-loader-ts/src/index.tsx +0 -19
- package/cpa-out/react-loader-ts/src/react-app-env.d.ts +0 -1
- package/cpa-out/react-loader-ts/src/reportWebVitals.ts +0 -15
- package/cpa-out/react-loader-ts/src/setupTests.ts +0 -5
- package/cpa-out/react-loader-ts/tsconfig.json +0 -26
package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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 "./
|
|
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?:
|
|
55
|
-
section?:
|
|
56
|
-
h1?:
|
|
57
|
-
text?:
|
|
58
|
-
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
|
|
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
|
|
82
|
-
|
|
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
|
-
<
|
|
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
|
|
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
|
-
</
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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 "./
|
|
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
|
|
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?:
|
|
82
|
+
root?: Flex__<typeof Button>;
|
|
58
83
|
};
|
|
59
84
|
|
|
60
85
|
export interface DefaultRandomDynamicPageButtonProps {
|
|
61
86
|
className?: string;
|
|
62
87
|
}
|
|
63
88
|
|
|
64
|
-
const
|
|
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
|
|
81
|
-
|
|
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:
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
|
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:
|
|
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
|
|
8
|
+
export type CheckSvgIconProps = React.ComponentProps<"svg"> & {
|
|
9
9
|
title?: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export function
|
|
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
|
|
43
|
+
export default CheckSvgIcon;
|
|
44
44
|
/* prettier-ignore-end */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
|
|
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
|
}
|
package/dist/gatsby/template.js
CHANGED
|
@@ -206,11 +206,12 @@ exports.makeGatsbyPlasmicInit = makeGatsbyPlasmicInit;
|
|
|
206
206
|
function wrapAppRootForCodegen() {
|
|
207
207
|
return `import React from "react";
|
|
208
208
|
import { PlasmicRootProvider } from "@plasmicapp/react-web";
|
|
209
|
+
import { Link } from "gatsby";
|
|
209
210
|
import Helmet from "react-helmet";
|
|
210
211
|
|
|
211
212
|
export const wrapRootElement = ({ element }) => {
|
|
212
213
|
return (
|
|
213
|
-
<PlasmicRootProvider Head={Helmet}>
|
|
214
|
+
<PlasmicRootProvider Head={Helmet} Link={Link}>
|
|
214
215
|
{element}
|
|
215
216
|
</PlasmicRootProvider>
|
|
216
217
|
);
|
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}
|
|
150
|
+
? `${npmRunCmd} dev`
|
|
151
151
|
: "";
|
|
152
152
|
const relativeDir = path.relative(process.cwd(), resolvedProjectPath);
|
|
153
153
|
// Overwrite README
|
|
@@ -7,10 +7,11 @@ function makeCustomApp_pages_codegen(jsOrTs) {
|
|
|
7
7
|
import { PlasmicRootProvider } from "@plasmicapp/react-web";${(0, file_utils_1.ifTs)(jsOrTs, `
|
|
8
8
|
import type { AppProps } from "next/app";`)}
|
|
9
9
|
import Head from "next/head";
|
|
10
|
+
import Link from "next/link";
|
|
10
11
|
|
|
11
12
|
export default function MyApp({ Component, pageProps }${(0, file_utils_1.ifTs)(jsOrTs, `: AppProps`)}) {
|
|
12
13
|
return (
|
|
13
|
-
<PlasmicRootProvider Head={Head}>
|
|
14
|
+
<PlasmicRootProvider Head={Head} Link={Link}>
|
|
14
15
|
<Component {...pageProps} />
|
|
15
16
|
</PlasmicRootProvider>
|
|
16
17
|
);
|
package/dist/react/react.js
CHANGED
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.0.97",
|
|
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": "
|
|
57
|
+
"gitHead": "82ca8fa55dd9aa42ae599e2d519d3eac6d6ae06c"
|
|
58
58
|
}
|
package/src/gatsby/template.ts
CHANGED
|
@@ -233,11 +233,12 @@ export function initPlasmicLoaderWithRegistrations(plasmicOptions${ifTs(
|
|
|
233
233
|
export function wrapAppRootForCodegen(): string {
|
|
234
234
|
return `import React from "react";
|
|
235
235
|
import { PlasmicRootProvider } from "@plasmicapp/react-web";
|
|
236
|
+
import { Link } from "gatsby";
|
|
236
237
|
import Helmet from "react-helmet";
|
|
237
238
|
|
|
238
239
|
export const wrapRootElement = ({ element }) => {
|
|
239
240
|
return (
|
|
240
|
-
<PlasmicRootProvider Head={Helmet}>
|
|
241
|
+
<PlasmicRootProvider Head={Helmet} Link={Link}>
|
|
241
242
|
{element}
|
|
242
243
|
</PlasmicRootProvider>
|
|
243
244
|
);
|
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}
|
|
152
|
+
? `${npmRunCmd} dev`
|
|
153
153
|
: "";
|
|
154
154
|
const relativeDir = path.relative(process.cwd(), resolvedProjectPath);
|
|
155
155
|
|
|
@@ -9,13 +9,14 @@ import { PlasmicRootProvider } from "@plasmicapp/react-web";${ifTs(
|
|
|
9
9
|
import type { AppProps } from "next/app";`
|
|
10
10
|
)}
|
|
11
11
|
import Head from "next/head";
|
|
12
|
+
import Link from "next/link";
|
|
12
13
|
|
|
13
14
|
export default function MyApp({ Component, pageProps }${ifTs(
|
|
14
15
|
jsOrTs,
|
|
15
16
|
`: AppProps`
|
|
16
17
|
)}) {
|
|
17
18
|
return (
|
|
18
|
-
<PlasmicRootProvider Head={Head}>
|
|
19
|
+
<PlasmicRootProvider Head={Head} Link={Link}>
|
|
19
20
|
<Component {...pageProps} />
|
|
20
21
|
</PlasmicRootProvider>
|
|
21
22
|
);
|