import { FC } from "react";
import { FMCompDef, FNCompDef } from "../../../../../utils/types/meta-fn";
import { useGlobal, useLocal } from "web-utils";
import { TypedMap } from "yjs-types";
import { createEditScript } from "./edit-script";
import { EDGlobal } from "../../../logic/ed-global";
export const propPopover = {
name: "",
};
export const EdPropPopover: FC<{ mprop: FMCompDef; name: string }> = ({
mprop,
name,
}) => {
const p = useGlobal(EDGlobal, "EDITOR");
const mmeta = mprop.get("meta");
const local = useLocal({
name,
});
if (!mmeta) return null;
const type = mmeta.get("type");
return (
{[
{ label: "TXT", type: "text" },
{ label: "OPT", type: "option" },
{ label: "JSX", type: "content-element" },
].map((e) => {
return (
{
mmeta.set("type", e.type as any);
}}
>
{e.label}
);
})}
{type === "content-element" && (
)}
{type !== "content-element" && (
<>
.label {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
}
`
)}
>
Generator
EDIT CODE
Visible
EDIT CODE
>
)}
{type === "option" && (
MODE
{["button", "dropdown"].map((e) => (
{
const meta = mprop.get("meta");
if (meta) {
meta.set("option_mode", e as any);
}
}}
className={cx(
"m-1 px-1 capitalize text-center cursor-pointer font-mono border border-slate-300 text-[11px]",
e === mmeta.get("option_mode") ||
(e === "button" && !mmeta.get("option_mode"))
? "bg-blue-500 text-white"
: `hover:bg-blue-500 hover:text-white bg-white hover:border-blue-500`
)}
>
{e}
))}
)}
{type === "option" && (
)}
);
};
const keywords = [
"await",
"break",
"case",
"catch",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"enum",
"export",
"extends",
"false",
"finally",
"for",
"function",
"if",
"implements",
"import",
"in",
"instanceof",
"interface",
"let",
"new",
"null",
"package",
"private",
"protected",
"public",
"return",
"super",
"switch",
"static",
"this",
"throw",
"try",
"true",
"typeof",
"var",
"void",
"while",
"with",
"yield",
];