mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-13 08:13:30 +09:00
Fix radix imports generation (#2287)
Used wrong import name. Added accordion fixture to see issues in the future
This commit is contained in:
1 parent
f0c866aa99
commit
7d7c56e73a
6 files changed
+2503
-6
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -166,6 +166,14 @@ export const pageData: PageData = {
|
||||
rootInstanceId: "On9cvWCxr5rdZtY9O1Bv0",
|
||||
path: "",
|
||||
},
|
||||
{
|
||||
id: "xfvB4UThQXmQ_OubPYrkg",
|
||||
name: "radix",
|
||||
title: "radix",
|
||||
meta: { description: "" },
|
||||
rootInstanceId: "uKWGyE9JY3cPwY-xI9vk6",
|
||||
path: "/radix",
|
||||
},
|
||||
],
|
||||
page: {
|
||||
id: "7Db64ZXgYiRqKSQNR-qTQ",
|
||||
|
||||
@@ -1015,4 +1015,127 @@ html {
|
||||
padding-left: 16px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
[data-ws-id="zJ927zk9txwUbYycKB7QA"] {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: rgba(226, 232, 240, 1);
|
||||
}
|
||||
[data-ws-id="sMxg7xT1hwYt05hbOvoPL"] {
|
||||
display: flex;
|
||||
}
|
||||
[data-ws-id="qQSA4NoyKC88O68mBiQe2"] {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 0%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
font-weight: 500;
|
||||
--accordion-trigger-icon-transform: 0deg;
|
||||
}
|
||||
[data-ws-id="qQSA4NoyKC88O68mBiQe2"]:hover {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
[data-ws-id="qQSA4NoyKC88O68mBiQe2"][data-state="open"] {
|
||||
--accordion-trigger-icon-transform: 180deg;
|
||||
}
|
||||
[data-ws-id="RSk81lLj2IGXgchTuXF7V"] {
|
||||
rotate: var(--accordion-trigger-icon-transform);
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
flex-grow: 0;
|
||||
transition-property: all;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 200ms;
|
||||
}
|
||||
[data-ws-id="IUftdfjK-ilSzfOTdIx1u"] {
|
||||
overflow: hidden;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
[data-ws-id="C838wkvIcA1BQu30Xu2G8"] {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: rgba(226, 232, 240, 1);
|
||||
}
|
||||
[data-ws-id="fYUOB_brm6s0Ky68lzMfU"] {
|
||||
display: flex;
|
||||
}
|
||||
[data-ws-id="dfd4gonev_AX6BpuCsxjb"] {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 0%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
font-weight: 500;
|
||||
--accordion-trigger-icon-transform: 0deg;
|
||||
}
|
||||
[data-ws-id="dfd4gonev_AX6BpuCsxjb"]:hover {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
[data-ws-id="dfd4gonev_AX6BpuCsxjb"][data-state="open"] {
|
||||
--accordion-trigger-icon-transform: 180deg;
|
||||
}
|
||||
[data-ws-id="wRw75kuvFzl5NWD8IGJoI"] {
|
||||
rotate: var(--accordion-trigger-icon-transform);
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
flex-grow: 0;
|
||||
transition-property: all;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 200ms;
|
||||
}
|
||||
[data-ws-id="wNRVuu0L5E8TVufKdswp1"] {
|
||||
overflow: hidden;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
[data-ws-id="65djoTmSBGemZ2L5izQ5M"] {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: rgba(226, 232, 240, 1);
|
||||
}
|
||||
[data-ws-id="UJYfe6kH7HqhH0YYeJwe7"] {
|
||||
display: flex;
|
||||
}
|
||||
[data-ws-id="600nGddaNxGGdsuGgpxJR"] {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 0%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
font-weight: 500;
|
||||
--accordion-trigger-icon-transform: 0deg;
|
||||
}
|
||||
[data-ws-id="600nGddaNxGGdsuGgpxJR"]:hover {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
[data-ws-id="600nGddaNxGGdsuGgpxJR"][data-state="open"] {
|
||||
--accordion-trigger-icon-transform: 180deg;
|
||||
}
|
||||
[data-ws-id="Ta70VqUb_fGJXBT_zsnxQ"] {
|
||||
rotate: var(--accordion-trigger-icon-transform);
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
flex-grow: 0;
|
||||
transition-property: all;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 200ms;
|
||||
}
|
||||
[data-ws-id="mOVPnIrlt6IwVAzI_i2Fc"] {
|
||||
overflow: hidden;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,500 @@
|
||||
/* eslint-disable */
|
||||
/* This is a auto generated file for building the project */
|
||||
|
||||
import * as sdk from "@webstudio-is/react-sdk";
|
||||
import type { PageData } from "~/routes/_index";
|
||||
import type { Components } from "@webstudio-is/react-sdk";
|
||||
import type { Asset } from "@webstudio-is/sdk";
|
||||
import {
|
||||
Body as Body,
|
||||
Text as Text,
|
||||
Box as Box,
|
||||
HtmlEmbed as HtmlEmbed,
|
||||
} from "@webstudio-is/sdk-components-react";
|
||||
import {
|
||||
Accordion as Accordion,
|
||||
AccordionItem as AccordionItem,
|
||||
AccordionHeader as AccordionHeader,
|
||||
AccordionTrigger as AccordionTrigger,
|
||||
AccordionContent as AccordionContent,
|
||||
} from "@webstudio-is/sdk-components-react-radix";
|
||||
|
||||
export const components = new Map(
|
||||
Object.entries({
|
||||
Body: Body,
|
||||
Text: Text,
|
||||
Box: Box,
|
||||
HtmlEmbed: HtmlEmbed,
|
||||
"@webstudio-is/sdk-components-react-radix:Accordion": Accordion,
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionItem": AccordionItem,
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionHeader": AccordionHeader,
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionTrigger":
|
||||
AccordionTrigger,
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionContent":
|
||||
AccordionContent,
|
||||
})
|
||||
) as Components;
|
||||
export const fontAssets: Asset[] = [];
|
||||
export const pageData: PageData = {
|
||||
build: {
|
||||
props: [
|
||||
[
|
||||
"_x-dxwbTQ-XBLRuYQE9Pm",
|
||||
{
|
||||
id: "_x-dxwbTQ-XBLRuYQE9Pm",
|
||||
instanceId: "AM9fD6dv2Ftc3Xjcsd7Uc",
|
||||
name: "collapsible",
|
||||
type: "boolean",
|
||||
value: true,
|
||||
},
|
||||
],
|
||||
[
|
||||
"XDeoQFsXw3NhVjns6I5HM",
|
||||
{
|
||||
id: "XDeoQFsXw3NhVjns6I5HM",
|
||||
instanceId: "AM9fD6dv2Ftc3Xjcsd7Uc",
|
||||
name: "value",
|
||||
type: "dataSource",
|
||||
value: "RR_FthRebEUcAKUJIXl0j",
|
||||
},
|
||||
],
|
||||
[
|
||||
"UZg-1PcrNODgUo94IvnGC",
|
||||
{
|
||||
id: "UZg-1PcrNODgUo94IvnGC",
|
||||
instanceId: "AM9fD6dv2Ftc3Xjcsd7Uc",
|
||||
name: "onValueChange",
|
||||
type: "action",
|
||||
value: [
|
||||
{
|
||||
type: "execute",
|
||||
args: ["value"],
|
||||
code: "$ws$dataSource$RR_FthRebEUcAKUJIXl0j = value",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"XxpufvbtZ9iuhkPDDigde",
|
||||
{
|
||||
id: "XxpufvbtZ9iuhkPDDigde",
|
||||
instanceId: "d0sd_G-kHirxgjq6s6Uq1",
|
||||
name: "code",
|
||||
type: "string",
|
||||
value:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z"/></svg>',
|
||||
},
|
||||
],
|
||||
[
|
||||
"d26zsuAR2XZt1RRN6oJXk",
|
||||
{
|
||||
id: "d26zsuAR2XZt1RRN6oJXk",
|
||||
instanceId: "StPslEr81nfBISqBE2R-Y",
|
||||
name: "code",
|
||||
type: "string",
|
||||
value:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z"/></svg>',
|
||||
},
|
||||
],
|
||||
[
|
||||
"8Ar0H_oY5LOeyp2mMksps",
|
||||
{
|
||||
id: "8Ar0H_oY5LOeyp2mMksps",
|
||||
instanceId: "sO80m5u4f87jVGG91t6u8",
|
||||
name: "code",
|
||||
type: "string",
|
||||
value:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z"/></svg>',
|
||||
},
|
||||
],
|
||||
],
|
||||
instances: [
|
||||
[
|
||||
"uKWGyE9JY3cPwY-xI9vk6",
|
||||
{
|
||||
type: "instance",
|
||||
id: "uKWGyE9JY3cPwY-xI9vk6",
|
||||
component: "Body",
|
||||
children: [{ type: "id", value: "AM9fD6dv2Ftc3Xjcsd7Uc" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"AM9fD6dv2Ftc3Xjcsd7Uc",
|
||||
{
|
||||
type: "instance",
|
||||
id: "AM9fD6dv2Ftc3Xjcsd7Uc",
|
||||
component: "@webstudio-is/sdk-components-react-radix:Accordion",
|
||||
children: [
|
||||
{ type: "id", value: "zJ927zk9txwUbYycKB7QA" },
|
||||
{ type: "id", value: "C838wkvIcA1BQu30Xu2G8" },
|
||||
{ type: "id", value: "65djoTmSBGemZ2L5izQ5M" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"zJ927zk9txwUbYycKB7QA",
|
||||
{
|
||||
type: "instance",
|
||||
id: "zJ927zk9txwUbYycKB7QA",
|
||||
component: "@webstudio-is/sdk-components-react-radix:AccordionItem",
|
||||
children: [
|
||||
{ type: "id", value: "sMxg7xT1hwYt05hbOvoPL" },
|
||||
{ type: "id", value: "IUftdfjK-ilSzfOTdIx1u" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"sMxg7xT1hwYt05hbOvoPL",
|
||||
{
|
||||
type: "instance",
|
||||
id: "sMxg7xT1hwYt05hbOvoPL",
|
||||
component: "@webstudio-is/sdk-components-react-radix:AccordionHeader",
|
||||
children: [{ type: "id", value: "qQSA4NoyKC88O68mBiQe2" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"qQSA4NoyKC88O68mBiQe2",
|
||||
{
|
||||
type: "instance",
|
||||
id: "qQSA4NoyKC88O68mBiQe2",
|
||||
component:
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionTrigger",
|
||||
children: [
|
||||
{ type: "id", value: "q-DVI4YTNrQ1LizmEyJHI" },
|
||||
{ type: "id", value: "RSk81lLj2IGXgchTuXF7V" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"q-DVI4YTNrQ1LizmEyJHI",
|
||||
{
|
||||
type: "instance",
|
||||
id: "q-DVI4YTNrQ1LizmEyJHI",
|
||||
component: "Text",
|
||||
children: [{ type: "text", value: "Is it accessible?" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"RSk81lLj2IGXgchTuXF7V",
|
||||
{
|
||||
type: "instance",
|
||||
id: "RSk81lLj2IGXgchTuXF7V",
|
||||
component: "Box",
|
||||
label: "Icon Container",
|
||||
children: [{ type: "id", value: "d0sd_G-kHirxgjq6s6Uq1" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"d0sd_G-kHirxgjq6s6Uq1",
|
||||
{
|
||||
type: "instance",
|
||||
id: "d0sd_G-kHirxgjq6s6Uq1",
|
||||
component: "HtmlEmbed",
|
||||
label: "Chevron Icon",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
[
|
||||
"IUftdfjK-ilSzfOTdIx1u",
|
||||
{
|
||||
type: "instance",
|
||||
id: "IUftdfjK-ilSzfOTdIx1u",
|
||||
component:
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionContent",
|
||||
children: [
|
||||
{
|
||||
type: "text",
|
||||
value: "Yes. It adheres to the WAI-ARIA design pattern.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"C838wkvIcA1BQu30Xu2G8",
|
||||
{
|
||||
type: "instance",
|
||||
id: "C838wkvIcA1BQu30Xu2G8",
|
||||
component: "@webstudio-is/sdk-components-react-radix:AccordionItem",
|
||||
children: [
|
||||
{ type: "id", value: "fYUOB_brm6s0Ky68lzMfU" },
|
||||
{ type: "id", value: "wNRVuu0L5E8TVufKdswp1" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"fYUOB_brm6s0Ky68lzMfU",
|
||||
{
|
||||
type: "instance",
|
||||
id: "fYUOB_brm6s0Ky68lzMfU",
|
||||
component: "@webstudio-is/sdk-components-react-radix:AccordionHeader",
|
||||
children: [{ type: "id", value: "dfd4gonev_AX6BpuCsxjb" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"dfd4gonev_AX6BpuCsxjb",
|
||||
{
|
||||
type: "instance",
|
||||
id: "dfd4gonev_AX6BpuCsxjb",
|
||||
component:
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionTrigger",
|
||||
children: [
|
||||
{ type: "id", value: "lZ7sI6Kw_0VZkURriKscB" },
|
||||
{ type: "id", value: "wRw75kuvFzl5NWD8IGJoI" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"lZ7sI6Kw_0VZkURriKscB",
|
||||
{
|
||||
type: "instance",
|
||||
id: "lZ7sI6Kw_0VZkURriKscB",
|
||||
component: "Text",
|
||||
children: [{ type: "text", value: "Is it styled?" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"wRw75kuvFzl5NWD8IGJoI",
|
||||
{
|
||||
type: "instance",
|
||||
id: "wRw75kuvFzl5NWD8IGJoI",
|
||||
component: "Box",
|
||||
label: "Icon Container",
|
||||
children: [{ type: "id", value: "StPslEr81nfBISqBE2R-Y" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"StPslEr81nfBISqBE2R-Y",
|
||||
{
|
||||
type: "instance",
|
||||
id: "StPslEr81nfBISqBE2R-Y",
|
||||
component: "HtmlEmbed",
|
||||
label: "Chevron Icon",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
[
|
||||
"wNRVuu0L5E8TVufKdswp1",
|
||||
{
|
||||
type: "instance",
|
||||
id: "wNRVuu0L5E8TVufKdswp1",
|
||||
component:
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionContent",
|
||||
children: [
|
||||
{
|
||||
type: "text",
|
||||
value:
|
||||
"Yes. It comes with default styles that matches the other components' aesthetic.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"65djoTmSBGemZ2L5izQ5M",
|
||||
{
|
||||
type: "instance",
|
||||
id: "65djoTmSBGemZ2L5izQ5M",
|
||||
component: "@webstudio-is/sdk-components-react-radix:AccordionItem",
|
||||
children: [
|
||||
{ type: "id", value: "UJYfe6kH7HqhH0YYeJwe7" },
|
||||
{ type: "id", value: "mOVPnIrlt6IwVAzI_i2Fc" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"UJYfe6kH7HqhH0YYeJwe7",
|
||||
{
|
||||
type: "instance",
|
||||
id: "UJYfe6kH7HqhH0YYeJwe7",
|
||||
component: "@webstudio-is/sdk-components-react-radix:AccordionHeader",
|
||||
children: [{ type: "id", value: "600nGddaNxGGdsuGgpxJR" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"600nGddaNxGGdsuGgpxJR",
|
||||
{
|
||||
type: "instance",
|
||||
id: "600nGddaNxGGdsuGgpxJR",
|
||||
component:
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionTrigger",
|
||||
children: [
|
||||
{ type: "id", value: "1iNKIMG91n83PzJnEdxq9" },
|
||||
{ type: "id", value: "Ta70VqUb_fGJXBT_zsnxQ" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
"1iNKIMG91n83PzJnEdxq9",
|
||||
{
|
||||
type: "instance",
|
||||
id: "1iNKIMG91n83PzJnEdxq9",
|
||||
component: "Text",
|
||||
children: [{ type: "text", value: "Is it animated?" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"Ta70VqUb_fGJXBT_zsnxQ",
|
||||
{
|
||||
type: "instance",
|
||||
id: "Ta70VqUb_fGJXBT_zsnxQ",
|
||||
component: "Box",
|
||||
label: "Icon Container",
|
||||
children: [{ type: "id", value: "sO80m5u4f87jVGG91t6u8" }],
|
||||
},
|
||||
],
|
||||
[
|
||||
"sO80m5u4f87jVGG91t6u8",
|
||||
{
|
||||
type: "instance",
|
||||
id: "sO80m5u4f87jVGG91t6u8",
|
||||
component: "HtmlEmbed",
|
||||
label: "Chevron Icon",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
[
|
||||
"mOVPnIrlt6IwVAzI_i2Fc",
|
||||
{
|
||||
type: "instance",
|
||||
id: "mOVPnIrlt6IwVAzI_i2Fc",
|
||||
component:
|
||||
"@webstudio-is/sdk-components-react-radix:AccordionContent",
|
||||
children: [
|
||||
{
|
||||
type: "text",
|
||||
value:
|
||||
"Yes. It's animated by default, but you can disable it if you prefer.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
dataSources: [
|
||||
[
|
||||
"RR_FthRebEUcAKUJIXl0j",
|
||||
{
|
||||
type: "variable",
|
||||
id: "RR_FthRebEUcAKUJIXl0j",
|
||||
scopeInstanceId: "AM9fD6dv2Ftc3Xjcsd7Uc",
|
||||
name: "accordionValue",
|
||||
value: { type: "string", value: "0" },
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
pages: [
|
||||
{
|
||||
id: "7Db64ZXgYiRqKSQNR-qTQ",
|
||||
name: "Home",
|
||||
title: "Home",
|
||||
meta: {},
|
||||
rootInstanceId: "On9cvWCxr5rdZtY9O1Bv0",
|
||||
path: "",
|
||||
},
|
||||
{
|
||||
id: "xfvB4UThQXmQ_OubPYrkg",
|
||||
name: "radix",
|
||||
title: "radix",
|
||||
meta: { description: "" },
|
||||
rootInstanceId: "uKWGyE9JY3cPwY-xI9vk6",
|
||||
path: "/radix",
|
||||
},
|
||||
],
|
||||
page: {
|
||||
id: "xfvB4UThQXmQ_OubPYrkg",
|
||||
name: "radix",
|
||||
title: "radix",
|
||||
meta: { description: "" },
|
||||
rootInstanceId: "uKWGyE9JY3cPwY-xI9vk6",
|
||||
path: "/radix",
|
||||
},
|
||||
assets: [
|
||||
{
|
||||
id: "cd939c56-bcdd-4e64-bd9c-567a9bccd3da",
|
||||
name: "_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg",
|
||||
description: null,
|
||||
projectId: "cddc1d44-af37-4cb6-a430-d300cf6f932d",
|
||||
size: 210614,
|
||||
type: "image",
|
||||
format: "jpeg",
|
||||
createdAt: "2023-09-06T11:28:43.031Z",
|
||||
meta: { width: 1024, height: 1024 },
|
||||
},
|
||||
],
|
||||
};
|
||||
export const user: { email: string | null } | undefined = {
|
||||
email: "hello@webstudio.is",
|
||||
};
|
||||
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
const indexesWithinAncestors = new Map<string, number>([
|
||||
["zJ927zk9txwUbYycKB7QA", 0],
|
||||
["C838wkvIcA1BQu30Xu2G8", 1],
|
||||
["65djoTmSBGemZ2L5izQ5M", 2],
|
||||
]);
|
||||
|
||||
const rawExecuteComputingExpressions = (
|
||||
_variables: Map<string, unknown>
|
||||
): Map<string, unknown> => {
|
||||
return new Map([]);
|
||||
};
|
||||
const executeComputingExpressions = (variables: Map<string, unknown>) => {
|
||||
const encodedvariables = sdk.encodeVariablesMap(variables);
|
||||
const encodedResult = rawExecuteComputingExpressions(encodedvariables);
|
||||
return sdk.decodeVariablesMap(encodedResult);
|
||||
};
|
||||
|
||||
const generatedEffectfulExpressions = new Map<
|
||||
string,
|
||||
(args: Map<string, any>, variables: Map<string, any>) => Map<string, unknown>
|
||||
>([
|
||||
[
|
||||
"$ws$dataSource$RR_FthRebEUcAKUJIXl0j = value",
|
||||
(_args: Map<string, any>, _variables: Map<string, any>) => {
|
||||
let value = _args.get("value");
|
||||
let $ws$dataSource$RR_FthRebEUcAKUJIXl0j;
|
||||
$ws$dataSource$RR_FthRebEUcAKUJIXl0j = value;
|
||||
return new Map([
|
||||
[
|
||||
"$ws$dataSource$RR_FthRebEUcAKUJIXl0j",
|
||||
$ws$dataSource$RR_FthRebEUcAKUJIXl0j,
|
||||
],
|
||||
]);
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
const rawExecuteEffectfulExpression = (
|
||||
code: string,
|
||||
args: Map<string, unknown>,
|
||||
variables: Map<string, unknown>
|
||||
): Map<string, unknown> => {
|
||||
if (generatedEffectfulExpressions.has(code)) {
|
||||
return generatedEffectfulExpressions.get(code)!(args, variables);
|
||||
}
|
||||
console.error("Effectful expression not found", code);
|
||||
throw new Error("Effectful expression not found");
|
||||
};
|
||||
|
||||
const executeEffectfulExpression = (
|
||||
code: string,
|
||||
args: Map<string, unknown>,
|
||||
variables: Map<string, unknown>
|
||||
) => {
|
||||
const encodedvariables = sdk.encodeVariablesMap(variables);
|
||||
const encodedResult = rawExecuteEffectfulExpression(
|
||||
code,
|
||||
args,
|
||||
encodedvariables
|
||||
);
|
||||
return sdk.decodeVariablesMap(encodedResult);
|
||||
};
|
||||
|
||||
export const utils = {
|
||||
indexesWithinAncestors,
|
||||
executeComputingExpressions,
|
||||
executeEffectfulExpression,
|
||||
};
|
||||
|
||||
/* eslint-enable */
|
||||
@@ -0,0 +1,181 @@
|
||||
/* eslint-disable camelcase */
|
||||
import {
|
||||
V2_MetaFunction,
|
||||
LinksFunction,
|
||||
LinkDescriptor,
|
||||
ActionArgs,
|
||||
json,
|
||||
} from "@remix-run/node";
|
||||
|
||||
import {
|
||||
InstanceRoot,
|
||||
type RootPropsData,
|
||||
type Params,
|
||||
} from "@webstudio-is/react-sdk";
|
||||
import { n8nHandler, getFormProperties } from "@webstudio-is/form-handlers";
|
||||
import { Scripts, ScrollRestoration } from "@remix-run/react";
|
||||
import {
|
||||
fontAssets,
|
||||
components,
|
||||
pageData,
|
||||
user,
|
||||
projectId,
|
||||
utils,
|
||||
} from "../__generated__/radix._index.tsx";
|
||||
import css from "../__generated__/index.css";
|
||||
import type { Data } from "@webstudio-is/http-client";
|
||||
|
||||
export type PageData = Omit<Data, "build"> & {
|
||||
build: Pick<Data["build"], "props" | "instances" | "dataSources">;
|
||||
};
|
||||
|
||||
export const meta: V2_MetaFunction = () => {
|
||||
const { page } = pageData;
|
||||
return [{ title: page?.title || "Webstudio", ...page?.meta }];
|
||||
};
|
||||
|
||||
export const links: LinksFunction = () => {
|
||||
const result: LinkDescriptor[] = [];
|
||||
|
||||
result.push({
|
||||
rel: "stylesheet",
|
||||
href: css,
|
||||
});
|
||||
|
||||
for (const asset of fontAssets) {
|
||||
if (asset.type === "font") {
|
||||
result.push({
|
||||
rel: "preload",
|
||||
href: "/assets/" + asset.name,
|
||||
as: "font",
|
||||
crossOrigin: "anonymous",
|
||||
// @todo add mimeType
|
||||
// type: asset.mimeType,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const getRequestHost = (request: Request): string =>
|
||||
request.headers.get("x-forwarded-host") || request.headers.get("host") || "";
|
||||
|
||||
const getMethod = (value: string | undefined) => {
|
||||
if (value === undefined) {
|
||||
return "post";
|
||||
}
|
||||
|
||||
switch (value.toLowerCase()) {
|
||||
case "get":
|
||||
return "get";
|
||||
default:
|
||||
return "post";
|
||||
}
|
||||
};
|
||||
|
||||
export const action = async ({ request, context }: ActionArgs) => {
|
||||
const formData = await request.formData();
|
||||
|
||||
const formProperties = getFormProperties(formData, pageData.build.props);
|
||||
|
||||
if (formProperties === undefined) {
|
||||
// We're throwing rather than returning { success: false }
|
||||
// because this isn't supposed to happen normally: bug or malicious user
|
||||
throw json("Form not found", { status: 404 });
|
||||
}
|
||||
|
||||
const { action, method } = formProperties;
|
||||
|
||||
const email = user?.email;
|
||||
|
||||
if (email == null) {
|
||||
return { success: false };
|
||||
}
|
||||
|
||||
// wrapped in try/catch just in cases new URL() throws
|
||||
// (should not happen)
|
||||
let pageUrl: URL;
|
||||
try {
|
||||
pageUrl = new URL(request.url);
|
||||
pageUrl.host = getRequestHost(request);
|
||||
} catch {
|
||||
return { success: false };
|
||||
}
|
||||
|
||||
if (action !== undefined) {
|
||||
try {
|
||||
// Test that action is full URL
|
||||
new URL(action);
|
||||
} catch {
|
||||
return json(
|
||||
{
|
||||
success: false,
|
||||
error: "Invalid action URL, must be valid http/https protocol",
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const formInfo = {
|
||||
formData,
|
||||
projectId,
|
||||
action: action ?? null,
|
||||
method: getMethod(method),
|
||||
pageUrl: pageUrl.toString(),
|
||||
toEmail: email,
|
||||
fromEmail: pageUrl.hostname + "@webstudio.email",
|
||||
} as const;
|
||||
|
||||
const result = await n8nHandler({
|
||||
formInfo,
|
||||
hookUrl: context.N8N_FORM_EMAIL_HOOK as string,
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const Outlet = () => {
|
||||
const pagesCanvasData: PageData = pageData;
|
||||
|
||||
const page = pagesCanvasData.page;
|
||||
|
||||
if (page === undefined) {
|
||||
throw json("Page not found", {
|
||||
status: 404,
|
||||
});
|
||||
}
|
||||
|
||||
const assetBaseUrl = "/assets/";
|
||||
const imageBaseUrl = "/assets/";
|
||||
|
||||
const params: Params = {
|
||||
assetBaseUrl,
|
||||
imageBaseUrl,
|
||||
};
|
||||
|
||||
const data: RootPropsData = {
|
||||
build: pagesCanvasData.build,
|
||||
assets: pagesCanvasData.assets,
|
||||
page,
|
||||
pages: pagesCanvasData.pages,
|
||||
params,
|
||||
};
|
||||
|
||||
return (
|
||||
<InstanceRoot
|
||||
data={data}
|
||||
components={components}
|
||||
utils={utils}
|
||||
scripts={
|
||||
<>
|
||||
<Scripts />
|
||||
<ScrollRestoration />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Outlet;
|
||||
@@ -343,7 +343,7 @@ export const prebuild = async (options: {
|
||||
const specifiers = Array.from(componentsSet)
|
||||
.map(
|
||||
([shortName, component]) =>
|
||||
`${component} as ${scope.getName(component, shortName)}`
|
||||
`${shortName} as ${scope.getName(component, shortName)}`
|
||||
)
|
||||
.join(", ");
|
||||
componentImports += `import { ${specifiers} } from "${namespace}";\n`;
|
||||
|
||||
Reference in new issue
Block a user