@chaibuilder/sdk 1.2.35 → 1.2.37
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/dist/{AddBlocks-i2OFXcGZ.cjs → AddBlocks-D6H1c91w.cjs} +1 -1
- package/dist/{AddBlocks-fpRgZNZT.js → AddBlocks-ah7ZuAiO.js} +2 -2
- package/dist/{BrandingOptions-BuV0XItY.cjs → BrandingOptions-4D94jluh.cjs} +1 -1
- package/dist/{BrandingOptions-RxIUds41.js → BrandingOptions-d0DbWp_N.js} +1 -1
- package/dist/{CanvasArea-a-I0uB7y.cjs → CanvasArea-7l8qSx52.cjs} +1 -1
- package/dist/{CanvasArea-C1VfoHjl.js → CanvasArea-h3Nu-SWT.js} +2 -2
- package/dist/{ChaiBuilderEditor-pWAMhLiq.cjs → ChaiBuilderEditor-6o0IOkBV.cjs} +3 -3
- package/dist/{ChaiBuilderEditor-ChKigulx.js → ChaiBuilderEditor-VOCsboQ9.js} +5 -5
- package/dist/{CurrentPage-JgJ2XITk.cjs → CurrentPage-NTowK7yE.cjs} +1 -1
- package/dist/{CurrentPage-tWXo7zPq.js → CurrentPage-p6Y9JO9p.js} +3 -3
- package/dist/ListTree-4wBD1QKc.cjs +1 -0
- package/dist/ListTree-tog0B3PA.js +396 -0
- package/dist/{PagesPanel-zd48fj10.cjs → PagesPanel-3pC0vx2q.cjs} +1 -1
- package/dist/{PagesPanel-bwRvd7HB.js → PagesPanel-NPSwC_QB.js} +4 -4
- package/dist/{ProjectPanel-S7X2GDYk.js → ProjectPanel-cTPurlHf.js} +4 -4
- package/dist/{ProjectPanel-sIURK9WR.cjs → ProjectPanel-tvtrXbyb.cjs} +1 -1
- package/dist/{Settings-59DRCnXh.js → Settings-P8Bbl06y.js} +2 -2
- package/dist/{Settings-Lw_UvEWj.cjs → Settings-s19XidRS.cjs} +1 -1
- package/dist/{SidePanels-FX3WxtRi.cjs → SidePanels-8NwJG0mo.cjs} +1 -1
- package/dist/{SidePanels-QwN_fVWJ.js → SidePanels-iqAbcqUv.js} +2 -2
- package/dist/{Topbar-_k5gwR_4.js → Topbar-8tMcFyw5.js} +1 -1
- package/dist/{Topbar-cRmIAzUg.cjs → Topbar-SaVYT87H.cjs} +1 -1
- package/dist/{UnsplashImages-texUmBiW.cjs → UnsplashImages-UJthlQqt.cjs} +1 -1
- package/dist/{UnsplashImages-hI0Zvl2t.js → UnsplashImages-qTNzA02V.js} +1 -1
- package/dist/{UploadImages-diXySdpc.js → UploadImages-PJyejbcA.js} +1 -1
- package/dist/{UploadImages-kRSLsKBv.cjs → UploadImages-zPJBckqp.cjs} +1 -1
- package/dist/{add-page-modal-Md_OotSU.js → add-page-modal-9SkVr8qi.js} +4 -4
- package/dist/{add-page-modal-R9nsF97c.cjs → add-page-modal-jzDXOPVp.cjs} +1 -1
- package/dist/{confirm-alert-gKJ-H8aH.cjs → confirm-alert-NECBDLLG.cjs} +1 -1
- package/dist/{confirm-alert-DS8nMVJP.js → confirm-alert-mPe-H0Yj.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-PVpCkC06.js → delete-page-modal-kHnMpsjv.js} +3 -3
- package/dist/{delete-page-modal-ez831xRV.cjs → delete-page-modal-pRepvBUK.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-6D7DLOsP.cjs → form-5-WyQ9J_.cjs} +1 -1
- package/dist/{form-BcCd02eY.js → form-prkciikc.js} +1 -1
- package/dist/html-to-json-VPWiWWGH.cjs +1 -0
- package/dist/{html-to-json-ZV4QjSww.js → html-to-json-Z6R2o_fA.js} +68 -76
- package/dist/{index-NmcmhDTV.js → index-X3veo7pJ.js} +3 -3
- package/dist/{index-F_-wLCKB.cjs → index-wnXwbbRk.cjs} +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/{page-viewer-MyIBh0H7.cjs → page-viewer-HGX57lyj.cjs} +1 -1
- package/dist/{page-viewer-1bDdfbfY.js → page-viewer-jsyCYHKL.js} +4 -4
- package/dist/{project-general-setting-1UvYceGY.cjs → project-general-setting-2yhhHbME.cjs} +1 -1
- package/dist/{project-general-setting-cAuIqXqs.js → project-general-setting-sVRpF1o-.js} +4 -4
- package/dist/{project-seo-setting-ePXNygH3.cjs → project-seo-setting-FMpb2qiM.cjs} +1 -1
- package/dist/{project-seo-setting-DIspBN3U.js → project-seo-setting-YTVfe0Hq.js} +2 -2
- package/dist/{single-page-detail-6M4by4GP.cjs → single-page-detail-Y4OBAZAL.cjs} +1 -1
- package/dist/{single-page-detail-VEdxOlo1.js → single-page-detail-o129SZnS.js} +5 -5
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/{useCanvasSettings-xq3gcMsb.cjs → useCanvasSettings-DVIzrXND.cjs} +1 -1
- package/dist/{useCanvasSettings-YdWIGhpI.js → useCanvasSettings-J3l6fcbV.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
- package/dist/ListTree-_JJ1Ka3e.js +0 -319
- package/dist/ListTree-rJ4eHyKn.cjs +0 -1
- package/dist/html-to-json-Xhu27KFD.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),f=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),f=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./ChaiBuilderEditor-6o0IOkBV.cjs"),d=require("./controls-jWJDao88.cjs"),w=require("sonner"),p=require("./form-5-WyQ9J_.cjs"),P=require("./index-wnXwbbRk.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./core.cjs");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const z=f.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-pRepvBUK.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-NECBDLLG.cjs"))),E=n=>{if(!c.isString(n)||!(n.includes("/[")&&n.includes("]")))return!1;const s=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,q=/^[a-zA-Z0-9_-]+$/;let e=!0;return n.split("/").forEach(u=>{e&&(u.includes("[[")&&u.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(u):u.includes("[")&&u.includes("]")?e=s.test(u):e=q.test(u))}),e},h=n=>n&&c.isEmpty(n.seoData)?{...n,seoData:{title:"",description:"",image:""}}:n,G=(n,o)=>{const s=!c.isEqual(c.omit(n,["seoData"]),c.omit(o,["seoData"])),q=!c.isEqual(h(o).seoData,h(n).seoData);return s||q},Y=({open:n,setOpen:o,pageData:s})=>{const q=P.useQueryClient(),{data:e}=P.useProject(),u=P.useUpdatePage(),m=P.useUpdateProject("Homepage updated successfully."),[i,b]=f.useState(h(s)),[a,A]=f.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=G(i,s);f.useEffect(()=>{const l=!c.isEqual(h(s),i),t=(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage;o(l||t?"PENDING":"OPEN")},[e,s,i,a,o]);const C=()=>{if(j){if(s.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")){n==="ALERT"&&o("PENDING");return}u.mutate(i,{onSuccess:()=>{q.invalidateQueries({refetchType:"active",queryKey:["pages",e==null?void 0:e.uuid]}),o("CLOSE"),w.toast.success("Page updated successfully.")}})}a.isHomePage&&(e==null?void 0:e.homepage)!==s.uuid&&m.mutate({...e,homepage:s==null?void 0:s.uuid},{onSuccess:()=>o("CLOSE")})},R=({formData:l},t)=>{b(g=>{var S,N;if(!t)return g;const x={[t]:l[t]};return t==="name"?x.slug=c.kebabCase((S=l[t])==null?void 0:S.replace(/\d/g,"")):t==="slug"?x.slug=(N=l[t])==null?void 0:N.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):t==="seoData"&&(x.seoData={title:l[t].title||"",description:l[t].description||"",image:l[t].image||""}),{...g,...x}})},I=({formData:l},t)=>{A(g=>{const x={[t]:l[t]};return{...g,...x}})},v={name:d.l({title:"Page Name",default:i.name}),slug:d.l({title:"Page Slug",default:i.slug})},T={seoData:d.b({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.l({title:"Meta Title",default:i.name}),description:d.g({title:"Meta Description",default:i.slug}),image:d.q({title:"Social Media Image",default:""})}})},M={isHomePage:d.r({title:"Set as homepage",default:a.isHomePage})};return r.jsxRuntimeExports.jsxs(y.ScrollArea,{className:"flex h-full select-none flex-col",children:[r.jsxRuntimeExports.jsx(L,{open:n==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:C,disabled:m.isPending||u.isPending}),r.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),r.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[r.jsxRuntimeExports.jsx(p.Form,{title:"Basic Details",formData:i,properties:v,onChange:R,disabled:u.isPending||m.isPending}),r.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),r.jsxRuntimeExports.jsx(p.Form,{title:"SEO Details",formData:i,properties:T,onChange:R,disabled:u.isPending||m.isPending}),(e==null?void 0:e.homepage)!==s.uuid&&s.type==="STATIC"?r.jsxRuntimeExports.jsx(p.Form,{formData:a,properties:M,onChange:I,disabled:u.isPending||m.isPending}):s.type==="STATIC"&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[r.jsxRuntimeExports.jsx(H.HomeIcon,{})," This is homepage"," "]}),i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")&&r.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",r.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),r.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[r.jsxRuntimeExports.jsx(y.Button,{className:"w-full",type:"submit",onClick:C,disabled:(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage?!1:c.isEmpty(i.name)||c.isEmpty(i.slug)||!j||u.isPending||m.isPending||i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||""),children:"Save"}),r.jsxRuntimeExports.jsx(z,{pageData:s,projectData:e})]})]})})]})};exports.default=Y;
|
|
@@ -2,11 +2,11 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import I, { useState as j, useEffect as z } from "react";
|
|
3
3
|
import { isString as L, isEmpty as x, isEqual as C, omit as y, kebabCase as q } from "lodash-es";
|
|
4
4
|
import { HomeIcon as B } from "@radix-ui/react-icons";
|
|
5
|
-
import { ba as G, B as Y } from "./ChaiBuilderEditor-
|
|
5
|
+
import { ba as G, B as Y } from "./ChaiBuilderEditor-VOCsboQ9.js";
|
|
6
6
|
import { l as g, b as Z, g as $, q as F, r as Q } from "./controls-VTdJhdSz.js";
|
|
7
7
|
import { toast as U } from "sonner";
|
|
8
|
-
import { F as P } from "./form-
|
|
9
|
-
import { f as V, a as X, g as _, b as K } from "./index-
|
|
8
|
+
import { F as P } from "./form-prkciikc.js";
|
|
9
|
+
import { f as V, a as X, g as _, b as K } from "./index-X3veo7pJ.js";
|
|
10
10
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "react-dom";
|
|
@@ -50,9 +50,9 @@ import "lucide-react";
|
|
|
50
50
|
import "@rjsf/core";
|
|
51
51
|
import "@rjsf/validator-ajv8";
|
|
52
52
|
import "./core.js";
|
|
53
|
-
import "./html-to-json-
|
|
53
|
+
import "./html-to-json-Z6R2o_fA.js";
|
|
54
54
|
import "himalaya";
|
|
55
|
-
const O = I.lazy(() => import("./delete-page-modal-
|
|
55
|
+
const O = I.lazy(() => import("./delete-page-modal-kHnMpsjv.js")), J = I.lazy(() => import("./confirm-alert-mPe-H0Yj.js")), h = (r) => {
|
|
56
56
|
if (!L(r) || !(r.includes("/[") && r.includes("]")))
|
|
57
57
|
return !1;
|
|
58
58
|
const s = /^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/, u = /^[a-zA-Z0-9_-]+$/;
|
package/dist/studio.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-Z_BpKhVy.cjs");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-Z_BpKhVy.cjs");const e=require("./index-wnXwbbRk.cjs");require("react");require("sonner");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./core.cjs");require("./ChaiBuilderEditor-6o0IOkBV.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("lodash-es");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;
|
package/dist/studio.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { C as Z } from "./index-
|
|
2
|
+
import { C as Z } from "./index-X3veo7pJ.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "sonner";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
6
|
import "./core.js";
|
|
7
|
-
import "./ChaiBuilderEditor-
|
|
7
|
+
import "./ChaiBuilderEditor-VOCsboQ9.js";
|
|
8
8
|
import "clsx";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "@radix-ui/react-scroll-area";
|
|
@@ -46,7 +46,7 @@ import "react-quill";
|
|
|
46
46
|
import "react-hotkeys-hook";
|
|
47
47
|
import "lodash";
|
|
48
48
|
import "lucide-react";
|
|
49
|
-
import "./html-to-json-
|
|
49
|
+
import "./html-to-json-Z6R2o_fA.js";
|
|
50
50
|
import "himalaya";
|
|
51
51
|
export {
|
|
52
52
|
Z as ChaiBuilderStudio
|
package/dist/ui.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ChaiBuilderEditor-6o0IOkBV.cjs");require("./jsx-runtime-Z_BpKhVy.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("lodash-es");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");exports.Accordion=e.Accordion;exports.AccordionContent=e.AccordionContent;exports.AccordionItem=e.AccordionItem;exports.AccordionTrigger=e.AccordionTrigger;exports.Alert=e.Alert;exports.AlertDescription=e.AlertDescription;exports.AlertDialog=e.AlertDialog;exports.AlertDialogAction=e.AlertDialogAction;exports.AlertDialogCancel=e.AlertDialogCancel;exports.AlertDialogContent=e.AlertDialogContent;exports.AlertDialogDescription=e.AlertDialogDescription;exports.AlertDialogFooter=e.AlertDialogFooter;exports.AlertDialogHeader=e.AlertDialogHeader;exports.AlertDialogTitle=e.AlertDialogTitle;exports.AlertDialogTrigger=e.AlertDialogTrigger;exports.AlertTitle=e.AlertTitle;exports.Badge=e.Badge;exports.Button=e.Button;exports.Card=e.Card;exports.CardContent=e.CardContent;exports.CardDescription=e.CardDescription;exports.CardFooter=e.CardFooter;exports.CardHeader=e.CardHeader;exports.CardTitle=e.CardTitle;exports.Command=e.Command;exports.CommandDialog=e.CommandDialog;exports.CommandEmpty=e.CommandEmpty;exports.CommandGroup=e.CommandGroup;exports.CommandInput=e.CommandInput;exports.CommandItem=e.CommandItem;exports.CommandList=e.CommandList;exports.CommandSeparator=e.CommandSeparator;exports.CommandShortcut=e.CommandShortcut;exports.ContextMenu=e.ContextMenu;exports.ContextMenuCheckboxItem=e.ContextMenuCheckboxItem;exports.ContextMenuContent=e.ContextMenuContent;exports.ContextMenuGroup=e.ContextMenuGroup;exports.ContextMenuItem=e.ContextMenuItem;exports.ContextMenuLabel=e.ContextMenuLabel;exports.ContextMenuPortal=e.ContextMenuPortal;exports.ContextMenuRadioGroup=e.ContextMenuRadioGroup;exports.ContextMenuRadioItem=e.ContextMenuRadioItem;exports.ContextMenuSeparator=e.ContextMenuSeparator;exports.ContextMenuShortcut=e.ContextMenuShortcut;exports.ContextMenuSub=e.ContextMenuSub;exports.ContextMenuSubContent=e.ContextMenuSubContent;exports.ContextMenuSubTrigger=e.ContextMenuSubTrigger;exports.ContextMenuTrigger=e.ContextMenuTrigger;exports.Dialog=e.Dialog;exports.DialogContent=e.DialogContent;exports.DialogDescription=e.DialogDescription;exports.DialogFooter=e.DialogFooter;exports.DialogHeader=e.DialogHeader;exports.DialogTitle=e.DialogTitle;exports.DialogTrigger=e.DialogTrigger;exports.DropdownMenu=e.DropdownMenu;exports.DropdownMenuCheckboxItem=e.DropdownMenuCheckboxItem;exports.DropdownMenuContent=e.DropdownMenuContent;exports.DropdownMenuGroup=e.DropdownMenuGroup;exports.DropdownMenuItem=e.DropdownMenuItem;exports.DropdownMenuLabel=e.DropdownMenuLabel;exports.DropdownMenuPortal=e.DropdownMenuPortal;exports.DropdownMenuRadioGroup=e.DropdownMenuRadioGroup;exports.DropdownMenuRadioItem=e.DropdownMenuRadioItem;exports.DropdownMenuSeparator=e.DropdownMenuSeparator;exports.DropdownMenuShortcut=e.DropdownMenuShortcut;exports.DropdownMenuSub=e.DropdownMenuSub;exports.DropdownMenuSubContent=e.DropdownMenuSubContent;exports.DropdownMenuSubTrigger=e.DropdownMenuSubTrigger;exports.DropdownMenuTrigger=e.DropdownMenuTrigger;exports.HoverCard=e.HoverCard;exports.HoverCardContent=e.HoverCardContent;exports.HoverCardTrigger=e.HoverCardTrigger;exports.IconPickerField=e.IconPickerField;exports.ImagePickerField=e.ImagePickerField;exports.Input=e.Input;exports.Label=e.Label;exports.LinkField=e.LinkField;exports.Menubar=e.Menubar;exports.MenubarCheckboxItem=e.MenubarCheckboxItem;exports.MenubarContent=e.MenubarContent;exports.MenubarGroup=e.MenubarGroup;exports.MenubarItem=e.MenubarItem;exports.MenubarLabel=e.MenubarLabel;exports.MenubarMenu=e.MenubarMenu;exports.MenubarPortal=e.MenubarPortal;exports.MenubarRadioGroup=e.MenubarRadioGroup;exports.MenubarRadioItem=e.MenubarRadioItem;exports.MenubarSeparator=e.MenubarSeparator;exports.MenubarShortcut=e.MenubarShortcut;exports.MenubarSub=e.MenubarSub;exports.MenubarSubContent=e.MenubarSubContent;exports.MenubarSubTrigger=e.MenubarSubTrigger;exports.MenubarTrigger=e.MenubarTrigger;exports.Popover=e.Popover;exports.PopoverContent=e.PopoverContent;exports.PopoverTrigger=e.PopoverTrigger;exports.RTEField=e.RichTextEditorField;exports.ScrollArea=e.ScrollArea;exports.ScrollBar=e.ScrollBar;exports.Select=e.Select;exports.SelectContent=e.SelectContent;exports.SelectGroup=e.SelectGroup;exports.SelectItem=e.SelectItem;exports.SelectLabel=e.SelectLabel;exports.SelectSeparator=e.SelectSeparator;exports.SelectTrigger=e.SelectTrigger;exports.SelectValue=e.SelectValue;exports.Separator=e.Separator;exports.Sheet=e.Sheet;exports.SheetClose=e.SheetClose;exports.SheetContent=e.SheetContent;exports.SheetDescription=e.SheetDescription;exports.SheetFooter=e.SheetFooter;exports.SheetHeader=e.SheetHeader;exports.SheetTitle=e.SheetTitle;exports.SheetTrigger=e.SheetTrigger;exports.Skeleton=e.Skeleton;exports.Switch=e.Switch;exports.Tabs=e.Tabs;exports.TabsContent=e.TabsContent;exports.TabsList=e.TabsList;exports.TabsTrigger=e.TabsTrigger;exports.Textarea=e.Textarea;exports.Toaster=e.Toaster;exports.Toggle=e.Toggle;exports.Tooltip=e.Tooltip;exports.TooltipContent=e.TooltipContent;exports.TooltipPortal=e.TooltipPortal;exports.TooltipProvider=e.TooltipProvider;exports.TooltipTrigger=e.TooltipTrigger;exports.badgeVariants=e.badgeVariants;exports.buttonVariants=e.buttonVariants;exports.reducer=e.reducer;exports.toast=e.toast;exports.toggleVariants=e.toggleVariants;exports.useToast=e.useToast;
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b3 as U, b6 as W, b4 as X, b5 as Z, bm as J, bz as K, A as N, a3 as Y, g as aa, b as ea, e as oa, f as ta, c as ra, d as sa, a as na, bn as ia, af as ba, B as pa, bg as ma, bj as ua, bi as la, bl as ca, bh as da, bB as ga, aR as Ca, ca as Ma, aU as Sa, aV as Da, aS as Ta, aW as xa, aT as Aa, cc as ha, cb as wa, br as Ia, cd as Pa, bq as ka, ci as Fa, bp as Ga, cf as La, cj as Ra, cn as va, ce as Ha, cg as Va, ch as Ba, ck as fa, cl as ja, cm as ya, bs as Ea, Z as _a, _ as $a, a1 as qa, aX as za, $ as Oa, a0 as Qa, ab as Ua, av as Wa, aA as Xa, ax as Za, bb as Ja, bc as Ka, ay as Na, c2 as Ya, c6 as ae, c1 as ee, az as oe, bd as te, c3 as re, c4 as se, c5 as ne, aw as ie, as as be, au as pe, at as me, a$ as ue, b0 as le, b8 as ce, aq as de, b1 as ge, bE as Ce, bL as Me, bH as Se, bR as De, bI as Te, bK as xe, bF as Ae, bO as he, bM as we, bN as Ie, bJ as Pe, bT as ke, bS as Fe, bP as Ge, bQ as Le, bG as Re, aO as ve, aQ as He, aP as Ve, a_ as Be, ba as fe, bC as je, a6 as ye, a9 as Ee, am as _e, aa as $e, an as qe, bU as ze, a7 as Oe, a8 as Qe, ap as Ue, bV as We, bX as Xe, bY as Ze, c0 as Je, b_ as Ke, bZ as Ne, b$ as Ye, bW as ao, ah as eo, ar as oo, ai as to, al as ro, aj as so, ak as no, bk as io, c9 as bo, bw as po, ac as mo, ae as uo, b9 as lo, bD as co, ad as go, bA as Co, by as Mo, c7 as So, c8 as Do, bx as To, b7 as xo } from "./ChaiBuilderEditor-
|
|
1
|
+
import { b3 as U, b6 as W, b4 as X, b5 as Z, bm as J, bz as K, A as N, a3 as Y, g as aa, b as ea, e as oa, f as ta, c as ra, d as sa, a as na, bn as ia, af as ba, B as pa, bg as ma, bj as ua, bi as la, bl as ca, bh as da, bB as ga, aR as Ca, ca as Ma, aU as Sa, aV as Da, aS as Ta, aW as xa, aT as Aa, cc as ha, cb as wa, br as Ia, cd as Pa, bq as ka, ci as Fa, bp as Ga, cf as La, cj as Ra, cn as va, ce as Ha, cg as Va, ch as Ba, ck as fa, cl as ja, cm as ya, bs as Ea, Z as _a, _ as $a, a1 as qa, aX as za, $ as Oa, a0 as Qa, ab as Ua, av as Wa, aA as Xa, ax as Za, bb as Ja, bc as Ka, ay as Na, c2 as Ya, c6 as ae, c1 as ee, az as oe, bd as te, c3 as re, c4 as se, c5 as ne, aw as ie, as as be, au as pe, at as me, a$ as ue, b0 as le, b8 as ce, aq as de, b1 as ge, bE as Ce, bL as Me, bH as Se, bR as De, bI as Te, bK as xe, bF as Ae, bO as he, bM as we, bN as Ie, bJ as Pe, bT as ke, bS as Fe, bP as Ge, bQ as Le, bG as Re, aO as ve, aQ as He, aP as Ve, a_ as Be, ba as fe, bC as je, a6 as ye, a9 as Ee, am as _e, aa as $e, an as qe, bU as ze, a7 as Oe, a8 as Qe, ap as Ue, bV as We, bX as Xe, bY as Ze, c0 as Je, b_ as Ke, bZ as Ne, b$ as Ye, bW as ao, ah as eo, ar as oo, ai as to, al as ro, aj as so, ak as no, bk as io, c9 as bo, bw as po, ac as mo, ae as uo, b9 as lo, bD as co, ad as go, bA as Co, by as Mo, c7 as So, c8 as Do, bx as To, b7 as xo } from "./ChaiBuilderEditor-VOCsboQ9.js";
|
|
2
2
|
import "./jsx-runtime-WbnYoNE9.js";
|
|
3
3
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
4
4
|
import "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("jotai"),s=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";const t=require("jotai"),s=require("./ChaiBuilderEditor-6o0IOkBV.cjs"),e=()=>t.useAtom(s.canvasSettingsAtom);exports.useCanvasSettings=e;
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),o=require("./controls-jWJDao88.cjs"),d=require("@chaibuilder/runtime"),b=require("./empty-slot-nzYOgZuS.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),E=require("./html-to-json-Xhu27KFD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");function R(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,s.get?s:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const u=R(w),T=u.memo(e=>{const{blockProps:t,inBuilder:l,backgroundImage:s,children:r,tag:a="div",styles:i}=e;let c=r;r||(c=n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:{},styles:{},inBuilder:l}));let p={};return s&&(p={backgroundImage:`url(${s})`}),u.createElement(a,{...t,...i,style:p},c)});d.registerChaiBlock(T,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.y({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:o.q({title:"Background Image"})},canAcceptBlock:()=>!0});const C=u.memo(e=>{const{blockProps:t,styles:l}=e;return u.createElement("div",{...t,...l})});d.registerChaiBlock(C,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:o.S({default:""})},canAcceptBlock:()=>!1});const L=e=>{const{blockProps:t,styles:l,content:s,level:r="h1",children:a=null}=e;return a?u.createElement(r,{...l,...t},a):u.createElement(r,{...l,...t,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(L,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:o.y({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:o.S({default:"text-3xl"}),content:o.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const _=e=>{const{blockProps:t,styles:l,content:s}=e;return y.isNull(e.children)?u.createElement("p",{...l,...t,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):u.createElement("p",{...l,...t},e.children)};d.registerChaiBlock(_,{type:"Paragraph",label:"Paragraph",category:"core",icon:h.TextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:e=>e==="Span"||e==="Link"});const P=e=>{const{blockProps:t,styles:l,content:s,children:r=null,tag:a}=e;return r?u.createElement("span",{...l,...t},r):u.createElement(a||"span",{...l,...t,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(P,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Enter your content"})},canAcceptBlock:()=>!0});const A=e=>{const{blockProps:t,content:l,styles:s}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...t,...s,dangerouslySetInnerHTML:{__html:l}})})};d.registerChaiBlock(A,{type:"RichText",label:"Rich Text",category:"core",icon:h.CursorTextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const M=e=>{const{blockProps:t,iconSize:l,icon:s,content:r,iconPos:a,styles:i,children:c}=e,p=s,m=c||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),p&&n.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return u.createElement("button",{...t,...i,type:"button"},m)};d.registerChaiBlock(M,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:o.l({title:"Label",default:"Button"}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.o({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.y({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const N=e=>{const{blockProps:t,link:l,children:s,styles:r,inBuilder:a,content:i}=e;return!s&&y.isEmpty(r==null?void 0:r.className)&&y.isEmpty(i)?n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...r,children:s}):u.createElement("span",{...t,...r,dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):s?n.jsxRuntimeExports.jsx("a",{href:l.href||"#/",target:l.target,...t,...r,children:s}):u.createElement("a",{...t,...r,"data-ai-key":"content",href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(N,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.l({title:"Content",default:""}),link:o.T({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const H=e=>{const{blockProps:t,children:l,listType:s,styles:r,tag:a,inBuilder:i}=e,c=f.cn(y.get(r,"className",""),s);return!l&&y.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:i,blockProps:t,text:"LIST ITEM"}):u.createElement(a||(s==="list-decimal"?"ol":"ul"),{...t,...r,className:c},l)};d.registerChaiBlock(H,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.y({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const D=e=>{const{blockProps:t,content:l,styles:s,children:r,tag:a}=e;return r?u.createElement(a||"li",{...s,...t},r):u.createElement(a||"li",{...s,...t,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(D,{type:"ListItem",label:"List Item",icon:h.ColumnsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0,canBeNested:e=>e==="List"});const k=(e,...t)=>({...e,className:f.cn(e.className,...t)}),U=e=>{const{blockProps:t,icon:l,styles:s,width:r,inBuilder:a,height:i}=e,c=k(s,f.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(l))return n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"",inBuilder:a,className:"h-8 w-14"});const p=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return u.createElement("span",{...t,...c,dangerouslySetInnerHTML:{__html:p}})};d.registerChaiBlock(U,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:o.S({default:"text-black"}),icon:o.o({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:o.c({title:"Width",default:""}),height:o.c({title:"Height",default:""})}});const q=e=>{const{blockProps:t,image:l,styles:s,alt:r,height:a,width:i}=e;return y.isEmpty(l)?n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"IMAGE URL",className:"h-36"}):u.createElement("img",{...t,...s,src:l,alt:r,height:a,width:i})};d.registerChaiBlock(q,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:o.S({default:""}),image:o.q({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.l({title:"Alt",default:""}),width:o.l({title:"Width",default:""}),height:o.l({title:"Height",default:""})}});const F=e=>{var i;const{blockProps:t,inBuilder:l,styles:s,children:r}=e;let a=null;return!r&&l&&(a=n.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...s,...t,droppable:"yes"},r||a)};d.registerChaiBlock(F,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,S=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,O=e=>{if(j.test(e)){const t=e.match(j);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(S.test(e)){const t=e.match(S);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},z=u.memo(e=>{const{blockProps:t,inBuilder:l,styles:s,url:r,controls:a}=e,i=y.get(a,"autoPlay",!1),c=y.get(a,"controls",!1),p=i||y.get(a,"muted",!0),m=y.get(a,"loop",!1);if(y.isEmpty(r))return n.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:l,blockProps:t,text:"VIDEO URL",className:"h-36"});let x=O(r),g=null;if(x){if(!y.isEmpty(x)){const v=[];v.push(`autoplay=${i?1:0}`),v.push(`controls=${a?1:0}`),v.push(`mute=${p?1:0}&muted=${p?1:0}`),v.push(`loop=${m?1:0}`),x=`${x}?${v.join("&")}`}g=u.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:x,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=u.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:p,autoPlay:l?!1:i,loop:m});return n.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?n.jsxRuntimeExports.jsx("div",{...t,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock(z,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:o.S({default:""}),url:o.l({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:o.b({title:"Controls",properties:{autoPlay:o.r({title:"Autoplay",default:!0}),controls:o.r({title:"Show controls",default:!1}),loop:o.r({title:"Loop",default:!1}),muted:o.r({title:"Muted",default:!0})}})}});const $=u.memo(e=>{const{blockProps:t,styles:l,content:s,inBuilder:r}=e;return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...t,...l,className:"absolute z-20 h-full w-full"}):null,u.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s}})]})});d.registerChaiBlock($,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:h.CodeIcon,group:"advanced",props:{styles:o.S({default:""}),content:o.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const V=e=>{const{blockProps:t,styles:l}=e;return u.createElement("hr",{...l,...t})};d.registerChaiBlock(V,{type:"Divider",label:"Divider",category:"core",icon:h.DividerHorizontalIcon,group:"basic",props:{styles:o.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const G=e=>e.inBuilder||e.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(G,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const W=({children:e,blockProps:t,styles:l})=>{const s=k(l,"hs-accordion-group");return n.jsxRuntimeExports.jsx("div",{...t,...s,children:e})};d.registerChaiBlock(W,{type:"AccordionGroup",label:"Accordion Group",category:"core",group:"advanced",props:{styles:o.S({default:""})},blocks:()=>{const e="dnd-accordion-"+f.generateUUID();return E.getBlocksFromHTML(`<div class="hs-accordion-group">
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),o=require("./controls-jWJDao88.cjs"),d=require("@chaibuilder/runtime"),b=require("./empty-slot-nzYOgZuS.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),E=require("./html-to-json-VPWiWWGH.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");function R(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,s.get?s:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const u=R(w),T=u.memo(e=>{const{blockProps:t,inBuilder:l,backgroundImage:s,children:r,tag:a="div",styles:i}=e;let c=r;r||(c=n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:{},styles:{},inBuilder:l}));let p={};return s&&(p={backgroundImage:`url(${s})`}),u.createElement(a,{...t,...i,style:p},c)});d.registerChaiBlock(T,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.y({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:o.q({title:"Background Image"})},canAcceptBlock:()=>!0});const C=u.memo(e=>{const{blockProps:t,styles:l}=e;return u.createElement("div",{...t,...l})});d.registerChaiBlock(C,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:o.S({default:""})},canAcceptBlock:()=>!1});const L=e=>{const{blockProps:t,styles:l,content:s,level:r="h1",children:a=null}=e;return a?u.createElement(r,{...l,...t},a):u.createElement(r,{...l,...t,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(L,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:o.y({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:o.S({default:"text-3xl"}),content:o.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const _=e=>{const{blockProps:t,styles:l,content:s}=e;return y.isNull(e.children)?u.createElement("p",{...l,...t,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):u.createElement("p",{...l,...t},e.children)};d.registerChaiBlock(_,{type:"Paragraph",label:"Paragraph",category:"core",icon:h.TextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:e=>e==="Span"||e==="Link"});const P=e=>{const{blockProps:t,styles:l,content:s,children:r=null,tag:a}=e;return r?u.createElement("span",{...l,...t},r):u.createElement(a||"span",{...l,...t,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(P,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Enter your content"})},canAcceptBlock:()=>!0});const A=e=>{const{blockProps:t,content:l,styles:s}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...t,...s,dangerouslySetInnerHTML:{__html:l}})})};d.registerChaiBlock(A,{type:"RichText",label:"Rich Text",category:"core",icon:h.CursorTextIcon,group:"typography",props:{styles:o.S({default:""}),content:o.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const M=e=>{const{blockProps:t,iconSize:l,icon:s,content:r,iconPos:a,styles:i,children:c}=e,p=s,m=c||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),p&&n.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return u.createElement("button",{...t,...i,type:"button"},m)};d.registerChaiBlock(M,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:o.l({title:"Label",default:"Button"}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.o({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.y({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const N=e=>{const{blockProps:t,link:l,children:s,styles:r,inBuilder:a,content:i}=e;return!s&&y.isEmpty(r==null?void 0:r.className)&&y.isEmpty(i)?n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...r,children:s}):u.createElement("span",{...t,...r,dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):s?n.jsxRuntimeExports.jsx("a",{href:l.href||"#/",target:l.target,...t,...r,children:s}):u.createElement("a",{...t,...r,"data-ai-key":"content",href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(N,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.l({title:"Content",default:""}),link:o.T({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const H=e=>{const{blockProps:t,children:l,listType:s,styles:r,tag:a,inBuilder:i}=e,c=f.cn(y.get(r,"className",""),s);return!l&&y.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:i,blockProps:t,text:"LIST ITEM"}):u.createElement(a||(s==="list-decimal"?"ol":"ul"),{...t,...r,className:c},l)};d.registerChaiBlock(H,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.y({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const D=e=>{const{blockProps:t,content:l,styles:s,children:r,tag:a}=e;return r?u.createElement(a||"li",{...s,...t},r):u.createElement(a||"li",{...s,...t,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(D,{type:"ListItem",label:"List Item",icon:h.ColumnsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0,canBeNested:e=>e==="List"});const k=(e,...t)=>({...e,className:f.cn(e.className,...t)}),U=e=>{const{blockProps:t,icon:l,styles:s,width:r,inBuilder:a,height:i}=e,c=k(s,f.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(l))return n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"",inBuilder:a,className:"h-8 w-14"});const p=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return u.createElement("span",{...t,...c,dangerouslySetInnerHTML:{__html:p}})};d.registerChaiBlock(U,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:o.S({default:"text-black"}),icon:o.o({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:o.c({title:"Width",default:""}),height:o.c({title:"Height",default:""})}});const q=e=>{const{blockProps:t,image:l,styles:s,alt:r,height:a,width:i}=e;return y.isEmpty(l)?n.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"IMAGE URL",className:"h-36"}):u.createElement("img",{...t,...s,src:l,alt:r,height:a,width:i})};d.registerChaiBlock(q,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:o.S({default:""}),image:o.q({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.l({title:"Alt",default:""}),width:o.l({title:"Width",default:""}),height:o.l({title:"Height",default:""})}});const F=e=>{var i;const{blockProps:t,inBuilder:l,styles:s,children:r}=e;let a=null;return!r&&l&&(a=n.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...s,...t,droppable:"yes"},r||a)};d.registerChaiBlock(F,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,S=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,O=e=>{if(j.test(e)){const t=e.match(j);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(S.test(e)){const t=e.match(S);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},z=u.memo(e=>{const{blockProps:t,inBuilder:l,styles:s,url:r,controls:a}=e,i=y.get(a,"autoPlay",!1),c=y.get(a,"controls",!1),p=i||y.get(a,"muted",!0),m=y.get(a,"loop",!1);if(y.isEmpty(r))return n.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:l,blockProps:t,text:"VIDEO URL",className:"h-36"});let x=O(r),g=null;if(x){if(!y.isEmpty(x)){const v=[];v.push(`autoplay=${i?1:0}`),v.push(`controls=${a?1:0}`),v.push(`mute=${p?1:0}&muted=${p?1:0}`),v.push(`loop=${m?1:0}`),x=`${x}?${v.join("&")}`}g=u.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:x,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=u.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:p,autoPlay:l?!1:i,loop:m});return n.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?n.jsxRuntimeExports.jsx("div",{...t,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock(z,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:o.S({default:""}),url:o.l({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:o.b({title:"Controls",properties:{autoPlay:o.r({title:"Autoplay",default:!0}),controls:o.r({title:"Show controls",default:!1}),loop:o.r({title:"Loop",default:!1}),muted:o.r({title:"Muted",default:!0})}})}});const $=u.memo(e=>{const{blockProps:t,styles:l,content:s,inBuilder:r}=e;return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...t,...l,className:"absolute z-20 h-full w-full"}):null,u.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s}})]})});d.registerChaiBlock($,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:h.CodeIcon,group:"advanced",props:{styles:o.S({default:""}),content:o.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const V=e=>{const{blockProps:t,styles:l}=e;return u.createElement("hr",{...l,...t})};d.registerChaiBlock(V,{type:"Divider",label:"Divider",category:"core",icon:h.DividerHorizontalIcon,group:"basic",props:{styles:o.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const G=e=>e.inBuilder||e.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(G,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const W=({children:e,blockProps:t,styles:l})=>{const s=k(l,"hs-accordion-group");return n.jsxRuntimeExports.jsx("div",{...t,...s,children:e})};d.registerChaiBlock(W,{type:"AccordionGroup",label:"Accordion Group",category:"core",group:"advanced",props:{styles:o.S({default:""})},blocks:()=>{const e="dnd-accordion-"+f.generateUUID();return E.getBlocksFromHTML(`<div class="hs-accordion-group">
|
|
2
2
|
<div class="hs-accordion active" id="hs-unstyled-heading-one">
|
|
3
3
|
<button class="hs-accordion-toggle" aria-controls="hs-unstyled-collapse-one">
|
|
4
4
|
Accordion #1
|
package/dist/web-blocks.js
CHANGED
|
@@ -6,7 +6,7 @@ import { registerChaiBlock as d } from "@chaibuilder/runtime";
|
|
|
6
6
|
import { E as v } from "./empty-slot-ZBlsQi6m.js";
|
|
7
7
|
import { HeadingIcon as Y, TextIcon as X, CursorTextIcon as Z, ButtonIcon as R, Link1Icon as J, RowsIcon as K, ColumnsIcon as Q, SketchLogoIcon as ee, ImageIcon as te, VideoIcon as le, CodeIcon as oe, DividerHorizontalIcon as ae, SpaceBetweenVerticallyIcon as F, TableIcon as se, BorderTopIcon as ne, BorderAllIcon as re, ViewHorizontalIcon as ce, DragHandleHorizontalIcon as ie, GroupIcon as de, LetterCaseToggleIcon as ue, CheckboxIcon as pe, InputIcon as D, RadiobuttonIcon as he, DropdownMenuIcon as ye } from "@radix-ui/react-icons";
|
|
8
8
|
import { c as S, g } from "./Functions-7jnEwJyw.js";
|
|
9
|
-
import { g as A } from "./html-to-json-
|
|
9
|
+
import { g as A } from "./html-to-json-Z6R2o_fA.js";
|
|
10
10
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "tailwind-merge";
|
package/package.json
CHANGED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import _, { memo as b, useMemo as k, useCallback as z, useEffect as N, useRef as L } from "react";
|
|
3
|
-
import { useAtom as B } from "jotai";
|
|
4
|
-
import { useDebouncedCallback as R } from "@react-hookz/web";
|
|
5
|
-
import { Tree as E } from "react-arborist";
|
|
6
|
-
import { i as M, L as y, H as F, M as S, bp as H, aJ as O, w as V, bq as $, aI as U, br as q, bs as G, h as J, z as K, bt as v, ac as Q, ad as W, ae as Y, bu as X, Q as Z, Y as ee, aB as te, aF as re } from "./ChaiBuilderEditor-ChKigulx.js";
|
|
7
|
-
import { c as P } from "./Functions-7jnEwJyw.js";
|
|
8
|
-
import { BoxModelIcon as se, BoxIcon as oe, DragHandleHorizontalIcon as ne, ViewHorizontalIcon as ce, BorderAllIcon as ae, BorderTopIcon as ie, TableIcon as le, DropdownMenuIcon as ue, RadiobuttonIcon as pe, InputIcon as de, ButtonIcon as C, CheckboxIcon as xe, GroupIcon as me, SpaceBetweenVerticallyIcon as he, ColumnsIcon as ge, RowsIcon as T, TextIcon as w, SketchLogoIcon as fe, DividerHorizontalIcon as je, CodeIcon as be, CursorTextIcon as ye, VideoIcon as ve, Link1Icon as Ie, HeadingIcon as ke, ImageIcon as Be, TrashIcon as Ce, CopyIcon as Te, TriangleRightIcon as we } from "@radix-ui/react-icons";
|
|
9
|
-
import { DatabaseIcon as De } from "lucide-react";
|
|
10
|
-
import { find as D, first as _e } from "lodash-es";
|
|
11
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
12
|
-
import "clsx";
|
|
13
|
-
import "react-dom";
|
|
14
|
-
import "@radix-ui/react-scroll-area";
|
|
15
|
-
import "@floating-ui/react-dom";
|
|
16
|
-
import "i18next";
|
|
17
|
-
import "react-i18next";
|
|
18
|
-
import "flagged";
|
|
19
|
-
import "./STRINGS--j49GZJP.js";
|
|
20
|
-
import "@chaibuilder/runtime";
|
|
21
|
-
import "./MODIFIERS-cBT31iqE.js";
|
|
22
|
-
import "@radix-ui/react-toggle";
|
|
23
|
-
import "class-variance-authority";
|
|
24
|
-
import "./Class-6Hz2KzYb.js";
|
|
25
|
-
import "tailwind-merge";
|
|
26
|
-
import "@radix-ui/react-switch";
|
|
27
|
-
import "@radix-ui/react-slot";
|
|
28
|
-
import "@radix-ui/react-accordion";
|
|
29
|
-
import "@radix-ui/react-alert-dialog";
|
|
30
|
-
import "@radix-ui/react-dialog";
|
|
31
|
-
import "@radix-ui/react-label";
|
|
32
|
-
import "@radix-ui/react-tabs";
|
|
33
|
-
import "@radix-ui/react-tooltip";
|
|
34
|
-
import "@radix-ui/react-popover";
|
|
35
|
-
import "@radix-ui/react-menubar";
|
|
36
|
-
import "@radix-ui/react-hover-card";
|
|
37
|
-
import "@radix-ui/react-select";
|
|
38
|
-
import "@radix-ui/react-dropdown-menu";
|
|
39
|
-
import "@radix-ui/react-separator";
|
|
40
|
-
import "@radix-ui/react-toast";
|
|
41
|
-
import "cmdk";
|
|
42
|
-
import "@radix-ui/react-context-menu";
|
|
43
|
-
import "react-icons-picker";
|
|
44
|
-
import "react-quill";
|
|
45
|
-
import "react-hotkeys-hook";
|
|
46
|
-
import "lodash";
|
|
47
|
-
const A = (t) => {
|
|
48
|
-
switch (t.type) {
|
|
49
|
-
case "Image":
|
|
50
|
-
return /* @__PURE__ */ e.jsx(Be, {});
|
|
51
|
-
case "Heading":
|
|
52
|
-
return /* @__PURE__ */ e.jsx(ke, {});
|
|
53
|
-
case "Text":
|
|
54
|
-
return /* @__PURE__ */ e.jsx(w, {});
|
|
55
|
-
case "Link":
|
|
56
|
-
return /* @__PURE__ */ e.jsx(Ie, {});
|
|
57
|
-
case "Video":
|
|
58
|
-
return /* @__PURE__ */ e.jsx(ve, {});
|
|
59
|
-
case "RichText":
|
|
60
|
-
return /* @__PURE__ */ e.jsx(ye, {});
|
|
61
|
-
case "Button":
|
|
62
|
-
return /* @__PURE__ */ e.jsx(C, {});
|
|
63
|
-
case "CustomHTML":
|
|
64
|
-
return /* @__PURE__ */ e.jsx(be, {});
|
|
65
|
-
case "Divider":
|
|
66
|
-
return /* @__PURE__ */ e.jsx(je, {});
|
|
67
|
-
case "Icon":
|
|
68
|
-
return /* @__PURE__ */ e.jsx(fe, {});
|
|
69
|
-
case "List":
|
|
70
|
-
return /* @__PURE__ */ e.jsx(T, {});
|
|
71
|
-
case "Paragraph":
|
|
72
|
-
return /* @__PURE__ */ e.jsx(w, {});
|
|
73
|
-
case "Row":
|
|
74
|
-
return /* @__PURE__ */ e.jsx(T, {});
|
|
75
|
-
case "ListItem":
|
|
76
|
-
return /* @__PURE__ */ e.jsx(ge, {});
|
|
77
|
-
case "LineBreak":
|
|
78
|
-
return /* @__PURE__ */ e.jsx(he, {});
|
|
79
|
-
case "Form":
|
|
80
|
-
return /* @__PURE__ */ e.jsx(me, {});
|
|
81
|
-
case "Checkbox":
|
|
82
|
-
return /* @__PURE__ */ e.jsx(xe, {});
|
|
83
|
-
case "FormButton":
|
|
84
|
-
return /* @__PURE__ */ e.jsx(C, {});
|
|
85
|
-
case "Input":
|
|
86
|
-
case "TextArea":
|
|
87
|
-
return /* @__PURE__ */ e.jsx(de, {});
|
|
88
|
-
case "Radio":
|
|
89
|
-
return /* @__PURE__ */ e.jsx(pe, {});
|
|
90
|
-
case "Select":
|
|
91
|
-
return /* @__PURE__ */ e.jsx(ue, {});
|
|
92
|
-
case "Table":
|
|
93
|
-
return /* @__PURE__ */ e.jsx(le, {});
|
|
94
|
-
case "TableHead":
|
|
95
|
-
return /* @__PURE__ */ e.jsx(ie, {});
|
|
96
|
-
case "TableBody":
|
|
97
|
-
return /* @__PURE__ */ e.jsx(ae, {});
|
|
98
|
-
case "TableRow":
|
|
99
|
-
return /* @__PURE__ */ e.jsx(ce, {});
|
|
100
|
-
case "TableCell":
|
|
101
|
-
return /* @__PURE__ */ e.jsx(ne, {});
|
|
102
|
-
case "DataProvider":
|
|
103
|
-
return /* @__PURE__ */ e.jsx(De, { size: 16 });
|
|
104
|
-
case "Box":
|
|
105
|
-
return /* @__PURE__ */ e.jsx(oe, {});
|
|
106
|
-
default:
|
|
107
|
-
return /* @__PURE__ */ e.jsx(se, {});
|
|
108
|
-
}
|
|
109
|
-
}, Ne = {
|
|
110
|
-
display: "flex",
|
|
111
|
-
alignItems: "center",
|
|
112
|
-
zIndex: 1
|
|
113
|
-
}, Re = _.memo(function({ top: o, left: r }) {
|
|
114
|
-
const i = {
|
|
115
|
-
position: "absolute",
|
|
116
|
-
pointerEvents: "none",
|
|
117
|
-
top: o + "px",
|
|
118
|
-
left: r + "px",
|
|
119
|
-
right: 0
|
|
120
|
-
};
|
|
121
|
-
return /* @__PURE__ */ e.jsx("div", { style: { ...Ne, ...i }, children: /* @__PURE__ */ e.jsx("div", { className: "h-0.5 flex-1 rounded-[1px] bg-green-500" }) });
|
|
122
|
-
}), Me = b(function({ children: o, isDragging: r }) {
|
|
123
|
-
return r ? /* @__PURE__ */ e.jsx("div", { className: "pointer-events-none fixed left-0 top-0 z-[100] h-full w-full", children: o }) : null;
|
|
124
|
-
}), Se = b(({ id: t, isDragging: o, mouse: r }) => {
|
|
125
|
-
const [i] = M(), n = k(() => i.find((l) => l._id === t), [i, t]), p = k(
|
|
126
|
-
() => ({
|
|
127
|
-
transform: `translate(${(r == null ? void 0 : r.x) - 10}px, ${(r == null ? void 0 : r.y) - 10}px)`
|
|
128
|
-
}),
|
|
129
|
-
[r]
|
|
130
|
-
);
|
|
131
|
-
return r ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(Me, { isDragging: o, children: /* @__PURE__ */ e.jsx(
|
|
132
|
-
"div",
|
|
133
|
-
{
|
|
134
|
-
className: "pointer-events-none absolute z-50 rounded border border-gray-200 bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",
|
|
135
|
-
style: p,
|
|
136
|
-
children: /* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex !cursor-grab items-center p-0.5", "aria-label": `Type: ${n == null ? void 0 : n._type}`, children: [
|
|
137
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ e.jsx(A, { type: n == null ? void 0 : n._type }) }),
|
|
138
|
-
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: (n == null ? void 0 : n._name) || (n == null ? void 0 : n._type) })
|
|
139
|
-
] })
|
|
140
|
-
}
|
|
141
|
-
) }) }) : /* @__PURE__ */ e.jsx("div", { className: "hidden" });
|
|
142
|
-
}), He = () => {
|
|
143
|
-
const [t] = y(), o = F(), r = S();
|
|
144
|
-
return /* @__PURE__ */ e.jsxs(
|
|
145
|
-
H,
|
|
146
|
-
{
|
|
147
|
-
disabled: !O(r == null ? void 0 : r._type),
|
|
148
|
-
className: "flex items-center gap-x-4 text-xs",
|
|
149
|
-
onClick: () => o(t),
|
|
150
|
-
children: [
|
|
151
|
-
/* @__PURE__ */ e.jsx(Ce, {}),
|
|
152
|
-
" Remove"
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}, Pe = () => {
|
|
157
|
-
const [t] = y(), o = V(), r = S(), i = z(() => {
|
|
158
|
-
o(t);
|
|
159
|
-
}, [t, o]);
|
|
160
|
-
return /* @__PURE__ */ e.jsxs($, { className: "text-xs", children: [
|
|
161
|
-
/* @__PURE__ */ e.jsxs(
|
|
162
|
-
H,
|
|
163
|
-
{
|
|
164
|
-
disabled: !U(r == null ? void 0 : r._type),
|
|
165
|
-
className: "flex items-center gap-x-4 text-xs",
|
|
166
|
-
onClick: i,
|
|
167
|
-
children: [
|
|
168
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
169
|
-
" Duplicate"
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
/* @__PURE__ */ e.jsx(He, {})
|
|
174
|
-
] });
|
|
175
|
-
}, Ae = ({ children: t }) => /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(q, { children: [
|
|
176
|
-
/* @__PURE__ */ e.jsx(G, { children: t }),
|
|
177
|
-
/* @__PURE__ */ e.jsx(Pe, {})
|
|
178
|
-
] }) }), ze = b(({ node: t, style: o, dragHandle: r }) => {
|
|
179
|
-
const i = J("outlineMenuItems", []), [, n] = K(), p = t.children.length > 0, { id: l, data: a, isSelected: x, willReceiveDrop: d, isDragging: m, isEditing: h, handleClick: g } = t, f = R((s) => n(s), [], 300), j = (s) => {
|
|
180
|
-
s.stopPropagation(), t.toggle();
|
|
181
|
-
}, c = (s) => {
|
|
182
|
-
s.stopPropagation(), t.isOpen || t.toggle(), g(s);
|
|
183
|
-
};
|
|
184
|
-
return N(() => {
|
|
185
|
-
const s = setTimeout(() => {
|
|
186
|
-
d && !t.isOpen && t.toggle();
|
|
187
|
-
}, 500);
|
|
188
|
-
return () => clearTimeout(s);
|
|
189
|
-
}, [d, t]), /* @__PURE__ */ e.jsx(Ae, { id: l, children: /* @__PURE__ */ e.jsxs(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
onClick: c,
|
|
193
|
-
onMouseEnter: () => f(l),
|
|
194
|
-
style: o,
|
|
195
|
-
"data-node-id": l,
|
|
196
|
-
ref: r,
|
|
197
|
-
className: P(
|
|
198
|
-
"group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",
|
|
199
|
-
x ? "bg-blue-500 text-white" : "text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
200
|
-
d && v(a._type, "Icon") ? "bg-green-200" : "",
|
|
201
|
-
m && "opacity-20"
|
|
202
|
-
),
|
|
203
|
-
children: [
|
|
204
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
205
|
-
/* @__PURE__ */ e.jsx(
|
|
206
|
-
"div",
|
|
207
|
-
{
|
|
208
|
-
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen ? "rotate-90" : ""}`,
|
|
209
|
-
children: p && /* @__PURE__ */ e.jsx("button", { onClick: j, type: "button", children: /* @__PURE__ */ e.jsx(we, {}) })
|
|
210
|
-
}
|
|
211
|
-
),
|
|
212
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
213
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ e.jsx(A, { type: a == null ? void 0 : a._type }) }),
|
|
214
|
-
h ? /* @__PURE__ */ e.jsx(Le, { node: t }) : /* @__PURE__ */ e.jsx(
|
|
215
|
-
"div",
|
|
216
|
-
{
|
|
217
|
-
className: "ml-2 truncate text-[11px]",
|
|
218
|
-
onDoubleClick: (s) => {
|
|
219
|
-
s.stopPropagation(), t.edit(), t.deselect();
|
|
220
|
-
},
|
|
221
|
-
children: (a == null ? void 0 : a._name) || (a == null ? void 0 : a._type.split("/").pop())
|
|
222
|
-
}
|
|
223
|
-
)
|
|
224
|
-
] })
|
|
225
|
-
] }),
|
|
226
|
-
/* @__PURE__ */ e.jsx("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: i.map((s) => /* @__PURE__ */ e.jsxs(Q, { children: [
|
|
227
|
-
/* @__PURE__ */ e.jsx(
|
|
228
|
-
W,
|
|
229
|
-
{
|
|
230
|
-
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
231
|
-
asChild: !0,
|
|
232
|
-
children: _.createElement(s.item, { blockId: l })
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
/* @__PURE__ */ e.jsx(Y, { className: "z-[9999]", children: s.tooltip })
|
|
236
|
-
] })) })
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
) });
|
|
240
|
-
}), Le = ({ node: t }) => /* @__PURE__ */ e.jsx(
|
|
241
|
-
"input",
|
|
242
|
-
{
|
|
243
|
-
autoFocus: !0,
|
|
244
|
-
className: "ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",
|
|
245
|
-
type: "text",
|
|
246
|
-
defaultValue: t.data.name,
|
|
247
|
-
onFocus: (o) => o.currentTarget.select(),
|
|
248
|
-
onBlur: (o) => t.submit(o.currentTarget.value),
|
|
249
|
-
onKeyDown: (o) => {
|
|
250
|
-
o.key === "Enter" && t.submit(o.currentTarget.value);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
), Ee = () => {
|
|
254
|
-
const [t] = M();
|
|
255
|
-
return (o, r) => {
|
|
256
|
-
var p;
|
|
257
|
-
const i = (p = D(t, { _id: r })) == null ? void 0 : p._type, n = _e(o.map((l) => {
|
|
258
|
-
var a;
|
|
259
|
-
return (a = D(t, { _id: l })) == null ? void 0 : a._type;
|
|
260
|
-
}));
|
|
261
|
-
return v(i, n);
|
|
262
|
-
};
|
|
263
|
-
}, Mt = () => {
|
|
264
|
-
const [t] = B(X), [o, r] = y(), i = Z(), [, n] = ee(), { moveBlocks: p } = te(), l = Ee(), a = L(null), [, x] = B(re), d = () => {
|
|
265
|
-
r([]), n([]);
|
|
266
|
-
};
|
|
267
|
-
N(() => {
|
|
268
|
-
x(a.current);
|
|
269
|
-
}, [a.current]);
|
|
270
|
-
const m = ({ id: c, name: s, node: u }) => {
|
|
271
|
-
i([c], { _name: s }, u.data._name);
|
|
272
|
-
}, h = ({ dragIds: c, parentId: s, index: u }) => {
|
|
273
|
-
l(c, s) && p(c, s, u);
|
|
274
|
-
}, g = (c) => {
|
|
275
|
-
if (c.length === 0)
|
|
276
|
-
return;
|
|
277
|
-
const s = c[0] ? c[0].id : "";
|
|
278
|
-
n([]), r([s]);
|
|
279
|
-
}, f = (c) => {
|
|
280
|
-
var I;
|
|
281
|
-
c.preventDefault();
|
|
282
|
-
const s = c.target, u = s.getAttribute("data-node-id") || ((I = s.closest("[data-node-id]")) == null ? void 0 : I.getAttribute("data-node-id"));
|
|
283
|
-
u && (n([]), r([u]));
|
|
284
|
-
}, j = R(
|
|
285
|
-
({ parentNode: c, dragNodes: s }) => {
|
|
286
|
-
var u;
|
|
287
|
-
return !v(c == null ? void 0 : c.data._type, (u = s[0]) == null ? void 0 : u.data._type);
|
|
288
|
-
},
|
|
289
|
-
[],
|
|
290
|
-
300
|
|
291
|
-
);
|
|
292
|
-
return /* @__PURE__ */ e.jsx("div", { className: P("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"), onClick: () => d(), children: /* @__PURE__ */ e.jsx("div", { id: "outline-view", className: "no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs", children: /* @__PURE__ */ e.jsx(
|
|
293
|
-
E,
|
|
294
|
-
{
|
|
295
|
-
ref: a,
|
|
296
|
-
height: 800,
|
|
297
|
-
className: "no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",
|
|
298
|
-
selection: o[0] || "",
|
|
299
|
-
onRename: m,
|
|
300
|
-
openByDefault: !1,
|
|
301
|
-
onMove: h,
|
|
302
|
-
rowHeight: 20,
|
|
303
|
-
data: t,
|
|
304
|
-
renderCursor: Re,
|
|
305
|
-
onSelect: g,
|
|
306
|
-
childrenAccessor: (c) => c.children,
|
|
307
|
-
width: "100%",
|
|
308
|
-
renderDragPreview: Se,
|
|
309
|
-
indent: 10,
|
|
310
|
-
onContextMenu: f,
|
|
311
|
-
disableDrop: j,
|
|
312
|
-
idAccessor: "_id",
|
|
313
|
-
children: ze
|
|
314
|
-
}
|
|
315
|
-
) }) });
|
|
316
|
-
};
|
|
317
|
-
export {
|
|
318
|
-
Mt as default
|
|
319
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),a=require("react"),v=require("jotai"),q=require("@react-hookz/web"),C=require("react-arborist"),r=require("./ChaiBuilderEditor-pWAMhLiq.cjs"),k=require("./Functions-N3yhPYKY.cjs"),s=require("@radix-ui/react-icons"),T=require("lucide-react"),I=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("@chaibuilder/runtime");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");const B=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(T.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}},w={display:"flex",alignItems:"center",zIndex:1},D=a.memo(function({top:i,left:n}){const l={position:"absolute",pointerEvents:"none",top:i+"px",left:n+"px",right:0};return e.jsxRuntimeExports.jsx("div",{style:{...w,...l},children:e.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),S=a.memo(function({children:i,isDragging:n}){return n?e.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:i}):null}),N=a.memo(({id:t,isDragging:i,mouse:n})=>{const[l]=r.useBlocksStore(),c=a.useMemo(()=>l.find(p=>p._id===t),[l,t]),m=a.useMemo(()=>({transform:`translate(${(n==null?void 0:n.x)-10}px, ${(n==null?void 0:n.y)-10}px)`}),[n]);return n?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(S,{isDragging:i,children:e.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute z-50 rounded border border-gray-200 bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",style:m,children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${c==null?void 0:c._type}`,children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:e.jsxRuntimeExports.jsx(B,{type:c==null?void 0:c._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(c==null?void 0:c._name)||(c==null?void 0:c._type)})]})})})}):e.jsxRuntimeExports.jsx("div",{className:"hidden"})}),_=()=>{const[t]=r.useSelectedBlockIds(),i=r.useRemoveBlocks(),n=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:!r.canDeleteBlock(n==null?void 0:n._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>i(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},M=()=>{const[t]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),n=r.useSelectedBlock(),l=a.useCallback(()=>{i(t)},[t,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:!r.canDuplicateBlock(n==null?void 0:n._type),className:"flex items-center gap-x-4 text-xs",onClick:l,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(_,{})]})},A=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(M,{})]})}),P=a.memo(({node:t,style:i,dragHandle:n})=>{const l=r.useBuilderProp("outlineMenuItems",[]),[,c]=r.useHighlightBlockId(),m=t.children.length>0,{id:p,data:x,isSelected:R,willReceiveDrop:j,isDragging:h,isEditing:g,handleClick:E}=t,f=q.useDebouncedCallback(o=>c(o),[],300),b=o=>{o.stopPropagation(),t.toggle()},u=o=>{o.stopPropagation(),t.isOpen||t.toggle(),E(o)};return a.useEffect(()=>{const o=setTimeout(()=>{j&&!t.isOpen&&t.toggle()},500);return()=>clearTimeout(o)},[j,t]),e.jsxRuntimeExports.jsx(A,{id:p,children:e.jsxRuntimeExports.jsxs("div",{onClick:u,onMouseEnter:()=>f(p),style:i,"data-node-id":p,ref:n,className:k.cn("group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",R?"bg-blue-500 text-white":"text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",j&&r.canAcceptChildBlock(x._type,"Icon")?"bg-green-200":"",h&&"opacity-20"),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen?"rotate-90":""}`,children:m&&e.jsxRuntimeExports.jsx("button",{onClick:b,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:e.jsxRuntimeExports.jsx(B,{type:x==null?void 0:x._type})}),g?e.jsxRuntimeExports.jsx(H,{node:t}):e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",onDoubleClick:o=>{o.stopPropagation(),t.edit(),t.deselect()},children:(x==null?void 0:x._name)||(x==null?void 0:x._type.split("/").pop())})]})]}),e.jsxRuntimeExports.jsx("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:l.map(o=>e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:a.createElement(o.item,{blockId:p})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{className:"z-[9999]",children:o.tooltip})]}))})]})})}),H=({node:t})=>e.jsxRuntimeExports.jsx("input",{autoFocus:!0,className:"ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",type:"text",defaultValue:t.data.name,onFocus:i=>i.currentTarget.select(),onBlur:i=>t.submit(i.currentTarget.value),onKeyDown:i=>{i.key==="Enter"&&t.submit(i.currentTarget.value)}}),z=()=>{const[t]=r.useBlocksStore();return(i,n)=>{var m;const l=(m=I.find(t,{_id:n}))==null?void 0:m._type,c=I.first(i.map(p=>{var x;return(x=I.find(t,{_id:p}))==null?void 0:x._type}));return r.canAcceptChildBlock(l,c)}},L=()=>{const[t]=v.useAtom(r.treeDSBlocks),[i,n]=r.useSelectedBlockIds(),l=r.useUpdateBlocksProps(),[,c]=r.useSelectedStylingBlocks(),{moveBlocks:m}=r.useBlocksStoreUndoableActions(),p=z(),x=a.useRef(null),[,R]=v.useAtom(r.treeRefAtom),j=()=>{n([]),c([])};a.useEffect(()=>{R(x.current)},[x.current]);const h=({id:u,name:o,node:d})=>{l([u],{_name:o},d.data._name)},g=({dragIds:u,parentId:o,index:d})=>{p(u,o)&&m(u,o,d)},E=u=>{if(u.length===0)return;const o=u[0]?u[0].id:"";c([]),n([o])},f=u=>{var y;u.preventDefault();const o=u.target,d=o.getAttribute("data-node-id")||((y=o.closest("[data-node-id]"))==null?void 0:y.getAttribute("data-node-id"));d&&(c([]),n([d]))},b=q.useDebouncedCallback(({parentNode:u,dragNodes:o})=>{var d;return!r.canAcceptChildBlock(u==null?void 0:u.data._type,(d=o[0])==null?void 0:d.data._type)},[],300);return e.jsxRuntimeExports.jsx("div",{className:k.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"),onClick:()=>j(),children:e.jsxRuntimeExports.jsx("div",{id:"outline-view",className:"no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs",children:e.jsxRuntimeExports.jsx(C.Tree,{ref:x,height:800,className:"no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",selection:i[0]||"",onRename:h,openByDefault:!1,onMove:g,rowHeight:20,data:t,renderCursor:D,onSelect:E,childrenAccessor:u=>u.children,width:"100%",renderDragPreview:N,indent:10,onContextMenu:f,disableDrop:b,idAccessor:"_id",children:P})})})};exports.default=L;
|