webstudio 0.270.0 → 0.272.0

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.
@@ -0,0 +1,88 @@
1
+ import { join } from "node:path";
2
+ import { readFile, rm } from "node:fs/promises";
3
+ import { b as baseComponentMetas, r as radixComponentMetas, a as animationComponentMetas } from "./metas-BerOcifF.js";
4
+ import { g as generateRemixRoute } from "./cli-BUDhVJgP.js";
5
+ const createFramework = async () => {
6
+ const routeTemplatesDir = join("app", "route-templates");
7
+ const htmlTemplate = await readFile(
8
+ join(routeTemplatesDir, "html.tsx"),
9
+ "utf8"
10
+ );
11
+ const xmlTemplate = await readFile(
12
+ join(routeTemplatesDir, "xml.tsx"),
13
+ "utf8"
14
+ );
15
+ const textTemplate = await readFile(
16
+ join(routeTemplatesDir, "text.tsx"),
17
+ "utf8"
18
+ );
19
+ const defaultSitemapTemplate = await readFile(
20
+ join(routeTemplatesDir, "default-sitemap.tsx"),
21
+ "utf8"
22
+ );
23
+ await rm(routeTemplatesDir, { recursive: true, force: true });
24
+ const base = "@webstudio-is/sdk-components-react/components";
25
+ const reactRouter = "@webstudio-is/sdk-components-react-router";
26
+ const reactRadix = "@webstudio-is/sdk-components-react-radix";
27
+ const animation = "@webstudio-is/sdk-components-animation";
28
+ const components = {};
29
+ const metas = {};
30
+ for (const [name, meta] of Object.entries(baseComponentMetas)) {
31
+ components[name] = `${base}:${name}`;
32
+ metas[name] = meta;
33
+ }
34
+ for (const name of ["Body", "Link", "RichTextLink", "Form", "RemixForm"]) {
35
+ components[name] = `${reactRouter}:${name}`;
36
+ }
37
+ for (const [name, meta] of Object.entries(radixComponentMetas)) {
38
+ components[`${reactRadix}:${name}`] = `${reactRadix}:${name}`;
39
+ metas[`${reactRadix}:${name}`] = meta;
40
+ }
41
+ for (const [name, meta] of Object.entries(animationComponentMetas)) {
42
+ components[`${animation}:${name}`] = `${animation}:${name}`;
43
+ metas[`${animation}:${name}`] = meta;
44
+ }
45
+ return {
46
+ metas,
47
+ components,
48
+ tags: {
49
+ textarea: `${base}:Textarea`,
50
+ input: `${base}:Input`,
51
+ select: `${base}:Select`,
52
+ body: `${reactRouter}:Body`,
53
+ a: `${reactRouter}:Link`,
54
+ form: `${reactRouter}:RemixForm`
55
+ },
56
+ html: ({ pagePath }) => [
57
+ {
58
+ file: join("app", "routes", `${generateRemixRoute(pagePath)}.tsx`),
59
+ template: htmlTemplate
60
+ }
61
+ ],
62
+ xml: ({ pagePath }) => [
63
+ {
64
+ file: join("app", "routes", `${generateRemixRoute(pagePath)}.tsx`),
65
+ template: xmlTemplate
66
+ }
67
+ ],
68
+ text: ({ pagePath }) => [
69
+ {
70
+ file: join("app", "routes", `${generateRemixRoute(pagePath)}.tsx`),
71
+ template: textTemplate
72
+ }
73
+ ],
74
+ defaultSitemap: () => [
75
+ {
76
+ file: join(
77
+ "app",
78
+ "routes",
79
+ `${generateRemixRoute("/sitemap.xml")}.tsx`
80
+ ),
81
+ template: defaultSitemapTemplate
82
+ }
83
+ ]
84
+ };
85
+ };
86
+ export {
87
+ createFramework
88
+ };
@@ -0,0 +1,88 @@
1
+ import { join } from "node:path";
2
+ import { readFile, rm } from "node:fs/promises";
3
+ import { b as baseComponentMetas, r as radixComponentMetas, a as animationComponentMetas } from "./metas-BerOcifF.js";
4
+ import { g as generateRemixRoute } from "./cli-BUDhVJgP.js";
5
+ const createFramework = async () => {
6
+ const routeTemplatesDir = join("app", "route-templates");
7
+ const htmlTemplate = await readFile(
8
+ join(routeTemplatesDir, "html.tsx"),
9
+ "utf8"
10
+ );
11
+ const xmlTemplate = await readFile(
12
+ join(routeTemplatesDir, "xml.tsx"),
13
+ "utf8"
14
+ );
15
+ const textTemplate = await readFile(
16
+ join(routeTemplatesDir, "text.tsx"),
17
+ "utf8"
18
+ );
19
+ const defaultSitemapTemplate = await readFile(
20
+ join(routeTemplatesDir, "default-sitemap.tsx"),
21
+ "utf8"
22
+ );
23
+ await rm(routeTemplatesDir, { recursive: true, force: true });
24
+ const base = "@webstudio-is/sdk-components-react/components";
25
+ const remix = "@webstudio-is/sdk-components-react-remix";
26
+ const reactRadix = "@webstudio-is/sdk-components-react-radix";
27
+ const animation = "@webstudio-is/sdk-components-animation";
28
+ const components = {};
29
+ const metas = {};
30
+ for (const [name, meta] of Object.entries(baseComponentMetas)) {
31
+ components[name] = `${base}:${name}`;
32
+ metas[name] = meta;
33
+ }
34
+ for (const name of ["Body", "Link", "RichTextLink", "Form", "RemixForm"]) {
35
+ components[name] = `${remix}:${name}`;
36
+ }
37
+ for (const [name, meta] of Object.entries(radixComponentMetas)) {
38
+ components[`${reactRadix}:${name}`] = `${reactRadix}:${name}`;
39
+ metas[`${reactRadix}:${name}`] = meta;
40
+ }
41
+ for (const [name, meta] of Object.entries(animationComponentMetas)) {
42
+ components[`${animation}:${name}`] = `${animation}:${name}`;
43
+ metas[`${animation}:${name}`] = meta;
44
+ }
45
+ return {
46
+ metas,
47
+ components,
48
+ tags: {
49
+ textarea: `${base}:Textarea`,
50
+ input: `${base}:Input`,
51
+ select: `${base}:Select`,
52
+ body: `${remix}:Body`,
53
+ a: `${remix}:Link`,
54
+ form: `${remix}:RemixForm`
55
+ },
56
+ html: ({ pagePath }) => [
57
+ {
58
+ file: join("app", "routes", `${generateRemixRoute(pagePath)}.tsx`),
59
+ template: htmlTemplate
60
+ }
61
+ ],
62
+ xml: ({ pagePath }) => [
63
+ {
64
+ file: join("app", "routes", `${generateRemixRoute(pagePath)}.tsx`),
65
+ template: xmlTemplate
66
+ }
67
+ ],
68
+ text: ({ pagePath }) => [
69
+ {
70
+ file: join("app", "routes", `${generateRemixRoute(pagePath)}.tsx`),
71
+ template: textTemplate
72
+ }
73
+ ],
74
+ defaultSitemap: () => [
75
+ {
76
+ file: join(
77
+ "app",
78
+ "routes",
79
+ `${generateRemixRoute("/sitemap.xml")}.tsx`
80
+ ),
81
+ template: defaultSitemapTemplate
82
+ }
83
+ ]
84
+ };
85
+ };
86
+ export {
87
+ createFramework
88
+ };
@@ -0,0 +1,78 @@
1
+ import { join } from "node:path";
2
+ import { readFile, rm } from "node:fs/promises";
3
+ import { b as baseComponentMetas, r as radixComponentMetas, a as animationComponentMetas } from "./metas-BerOcifF.js";
4
+ import { i as isPathnamePattern } from "./cli-BUDhVJgP.js";
5
+ const generateVikeRoute = (pagePath) => {
6
+ if (pagePath === "/") {
7
+ return "index";
8
+ }
9
+ return pagePath;
10
+ };
11
+ const createFramework = async () => {
12
+ const routeTemplatesDir = join("app", "route-templates");
13
+ const htmlPageTemplate = await readFile(
14
+ join(routeTemplatesDir, "html", "+Page.tsx"),
15
+ "utf8"
16
+ );
17
+ const htmlHeadTemplate = await readFile(
18
+ join(routeTemplatesDir, "html", "+Head.tsx"),
19
+ "utf8"
20
+ );
21
+ const htmlDataTemplate = await readFile(
22
+ join(routeTemplatesDir, "html", "+data.ts"),
23
+ "utf8"
24
+ );
25
+ await rm(routeTemplatesDir, { recursive: true, force: true });
26
+ const base = "@webstudio-is/sdk-components-react/components";
27
+ const reactRadix = "@webstudio-is/sdk-components-react-radix";
28
+ const animation = "@webstudio-is/sdk-components-animation";
29
+ const components = {};
30
+ const metas = {};
31
+ for (const [name, meta] of Object.entries(baseComponentMetas)) {
32
+ components[name] = `${base}:${name}`;
33
+ metas[name] = meta;
34
+ }
35
+ for (const [name, meta] of Object.entries(radixComponentMetas)) {
36
+ components[`${reactRadix}:${name}`] = `${reactRadix}:${name}`;
37
+ metas[`${reactRadix}:${name}`] = meta;
38
+ }
39
+ for (const [name, meta] of Object.entries(animationComponentMetas)) {
40
+ components[`${animation}:${name}`] = `${animation}:${name}`;
41
+ metas[`${animation}:${name}`] = meta;
42
+ }
43
+ return {
44
+ metas,
45
+ components,
46
+ tags: {
47
+ textarea: `${base}:Textarea`,
48
+ input: `${base}:Input`,
49
+ select: `${base}:Select`,
50
+ a: `${base}:Link`
51
+ },
52
+ html: ({ pagePath }) => {
53
+ if (isPathnamePattern(pagePath)) {
54
+ return [];
55
+ }
56
+ return [
57
+ {
58
+ file: join("pages", generateVikeRoute(pagePath), "+Page.tsx"),
59
+ template: htmlPageTemplate
60
+ },
61
+ {
62
+ file: join("pages", generateVikeRoute(pagePath), "+Head.tsx"),
63
+ template: htmlHeadTemplate
64
+ },
65
+ {
66
+ file: join("pages", generateVikeRoute(pagePath), "+data.ts"),
67
+ template: htmlDataTemplate
68
+ }
69
+ ];
70
+ },
71
+ xml: () => [],
72
+ text: () => [],
73
+ defaultSitemap: () => []
74
+ };
75
+ };
76
+ export {
77
+ createFramework
78
+ };