@chaibuilder/sdk 0.1.32 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddBlocks-4f054351.cjs +3 -0
- package/dist/{AddBlocks-4b96d545.js → AddBlocks-f6836e71.js} +5 -4
- package/dist/{BrandingOptions-c91e9d44.js → BrandingOptions-33e6da26.js} +6 -5
- package/dist/BrandingOptions-cfa79ffe.cjs +1 -0
- package/dist/{CanvasArea-957f5f74.js → CanvasArea-1e5fa968.js} +42 -43
- package/dist/CanvasArea-971b3ff8.cjs +46 -0
- package/dist/{CurrentPage-fb4c55bc.js → CurrentPage-223cc3dd.js} +5 -4
- package/dist/CurrentPage-b2d12d83.cjs +1 -0
- package/dist/{ImagesPanel-3fb8087f.js → ImagesPanel-47ac13c3.js} +1 -1
- package/dist/{ImagesPanel-56ca0618.cjs → ImagesPanel-8b7a989d.cjs} +1 -1
- package/dist/Layers-860f5e42.cjs +1 -0
- package/dist/{Layers-6866cb0c.js → Layers-b2c5aa66.js} +48 -47
- package/dist/MarkAsGlobalBlock-1a3d5e53.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-f28148d9.js → MarkAsGlobalBlock-9b0135aa.js} +8 -7
- package/dist/{PagesPanel-003201ca.js → PagesPanel-034efd4c.js} +8 -7
- package/dist/PagesPanel-2a80f9b2.cjs +1 -0
- package/dist/{ProjectPanel-83321040.js → ProjectPanel-3827a349.js} +7 -6
- package/dist/ProjectPanel-5deae7f1.cjs +1 -0
- package/dist/Settings-9f61cc69.cjs +1 -0
- package/dist/{Settings-ad55d8cb.js → Settings-a2d4e9c2.js} +82 -79
- package/dist/SidePanels-0d276d29.cjs +1 -0
- package/dist/{SidePanels-96bf29c6.js → SidePanels-b881185b.js} +33 -34
- package/dist/Topbar-68a0d125.cjs +1 -0
- package/dist/{Topbar-1c4964e5.js → Topbar-fda7588e.js} +38 -37
- package/dist/{UnsplashImages-fe480747.js → UnsplashImages-4edb97e7.js} +6 -5
- package/dist/UnsplashImages-98c085c2.cjs +1 -0
- package/dist/{UploadImages-b14bd152.js → UploadImages-52181c3e.js} +9 -8
- package/dist/UploadImages-61ef83ad.cjs +1 -0
- package/dist/{add-page-modal-2ef8a63c.js → add-page-modal-38af4548.js} +11 -10
- package/dist/add-page-modal-fb51b45b.cjs +1 -0
- package/dist/confirm-alert-c1fdf1e4.js +35 -0
- package/dist/confirm-alert-e1ea5110.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +56 -55
- package/dist/delete-page-modal-305c49fd.cjs +1 -0
- package/dist/{delete-page-modal-961dcc5f.js → delete-page-modal-a226ed3a.js} +18 -19
- package/dist/{form-046bcdbc.js → form-25e1af37.js} +1 -1
- package/dist/{form-2dc05f35.cjs → form-ea21db6c.cjs} +1 -1
- package/dist/{index-86352d44.cjs → index-6fc652ec.cjs} +41 -41
- package/dist/{index-370ce00c.js → index-914d197c.js} +7239 -7070
- package/dist/{link-e71b94f1.cjs → link-24679521.cjs} +1 -1
- package/dist/{link-e3a788f7.js → link-57de608a.js} +2 -2
- package/dist/{page-viewer-0c45ce74.js → page-viewer-682940be.js} +17 -16
- package/dist/page-viewer-857a82f4.cjs +1 -0
- package/dist/{project-general-setting-c5d96f79.js → project-general-setting-0fa55bb9.js} +9 -8
- package/dist/project-general-setting-280ccd16.cjs +1 -0
- package/dist/project-seo-setting-6eef8387.cjs +1 -0
- package/dist/{project-seo-setting-639e4f33.js → project-seo-setting-d81fc1e3.js} +7 -6
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +4 -2
- package/dist/server.js +27 -23
- package/dist/{single-page-detail-22e7bc3b.js → single-page-detail-8b715650.js} +11 -10
- package/dist/single-page-detail-b9c4ac1e.cjs +1 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +105 -106
- package/dist/useBuilderProp-21feb2da.js +296 -0
- package/dist/useBuilderProp-adacf42f.cjs +1 -0
- package/package.json +1 -1
- package/dist/AddBlocks-e4f51b58.cjs +0 -3
- package/dist/BrandingOptions-52f9691c.cjs +0 -1
- package/dist/CanvasArea-b8c26858.cjs +0 -46
- package/dist/CurrentPage-715fe809.cjs +0 -1
- package/dist/Layers-a955d0bb.cjs +0 -1
- package/dist/MarkAsGlobalBlock-cbcb3003.cjs +0 -1
- package/dist/PagesPanel-7b8f54e1.cjs +0 -1
- package/dist/ProjectPanel-6c5f2470.cjs +0 -1
- package/dist/Settings-8f07a4b7.cjs +0 -1
- package/dist/SidePanels-446b93e7.cjs +0 -1
- package/dist/Topbar-5eeea40a.cjs +0 -1
- package/dist/UnsplashImages-ef3b6388.cjs +0 -1
- package/dist/UploadImages-10439fde.cjs +0 -1
- package/dist/add-page-modal-56dc3c56.cjs +0 -1
- package/dist/alert-dialog-4ce6ed22.cjs +0 -1
- package/dist/alert-dialog-ee98f47e.js +0 -64
- package/dist/confirm-alert-4f50caa7.cjs +0 -1
- package/dist/confirm-alert-f2a47cc7.js +0 -36
- package/dist/delete-page-modal-88aeacfd.cjs +0 -1
- package/dist/page-viewer-e0d9895d.cjs +0 -1
- package/dist/project-general-setting-d4d96611.cjs +0 -1
- package/dist/project-seo-setting-6356c72f.cjs +0 -1
- package/dist/single-page-detail-36430438.cjs +0 -1
- package/dist/useBuilderProp-5e57d0c8.cjs +0 -1
- package/dist/useBuilderProp-81a14920.js +0 -238
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),b=require("jotai"),w=require("./accordion-0afd8143.cjs"),q=require("./scroll-area-bb343b86.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-adacf42f.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),l=require("./index-6fc652ec.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),I=require("lucide-react"),L=require("./utils-3c452dd0.cjs"),f=require("./textarea-a338ede6.cjs"),P=require("./label-167415e5.cjs"),S=require("./html-to-json-aadcbf66.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./MODIFIERS-4716c669.cjs");require("clsx");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("sonner");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const M=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:u,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,x]=b.useAtom(l.activePanelAtom),[,i]=b.useAtom(l.addBlocksModalAtom),E=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):u(t,s.first(p)),i(!1),x("layers")},[,g,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:g,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(o||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},F=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),u=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[x]=l.useSelectedBlockIds(),[,i,E]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),g=n.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){m(t,s.first(x)),r();return}c(!0);const a=await u(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(x)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}:g,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(I.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},H=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),u=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>s.mergeWith(u,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[u,m]),[,E]=b.useAtom(l.addBlocksModalAtom),[g,j]=n.useState("Navbar"),R=s.get(i,g,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);x(B)},onClick:()=>j(h),className:L.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",g===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(R.map(a=>e.jsxRuntimeExports.jsx(F,{block:a,closePopover:()=>E(!1)})))})]})},D=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,u]=b.useAtom(l.addBlockOffCanvasAtom),[,m]=b.useAtom(l.activePanelAtom),[,p]=b.useAtom(l.addBlocksModalAtom),x=()=>{const i=S.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),u(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(P.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(i.target.value),rows:12,placeholder:`<div>
|
|
2
|
+
<h1>Enter code here</h1>
|
|
3
|
+
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(C.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},O=D,N=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],U=(t,r)=>{if(!t)return!s.includes(N,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(N,r)},z=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),u=T.useChaiBlocks(),[,m]=b.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=b.useAtom(l.addBlocksModalAtom),[x]=l.useSelectedBlockIds(),i=l.useAllBlocks(),E=s.find(i,{_id:s.first(x)}),{data:g,isLoading:j}=l.useUILibraryBlocks(),R=s.groupBy(s.filter(u,d=>U(E,d.type)),"category"),a=s.uniq(s.map(R.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(g)||s.find(s.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(C.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(q.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(M,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(H,{})}),t==="html"&&e.jsxRuntimeExports.jsx(O,{})]})};exports.default=z;
|
|
@@ -5,10 +5,10 @@ import { useAtom as h } from "jotai";
|
|
|
5
5
|
import { A as X, a as Y, b as ee, c as se } from "./accordion-c0176dc5.js";
|
|
6
6
|
import { S as re } from "./scroll-area-83bd9e8f.js";
|
|
7
7
|
import { T as oe, a as te, b as A } from "./tabs-85caa1e8.js";
|
|
8
|
-
import {
|
|
8
|
+
import { l as le, m as ae, n as ce, u as ie, B as ne, S as de } from "./useBuilderProp-21feb2da.js";
|
|
9
9
|
import { useDrag as R, DragPreviewImage as O } from "react-dnd";
|
|
10
10
|
import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
|
|
11
|
-
import { W as F, i as C, a as z, b as T, Z as D, _ as xe, $ as he, B as fe } from "./index-
|
|
11
|
+
import { W as F, i as C, a as z, b as T, Z as D, _ as xe, $ as he, B as fe } from "./index-914d197c.js";
|
|
12
12
|
import "react-i18next";
|
|
13
13
|
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/blocks";
|
|
14
14
|
import { Loader as ge } from "lucide-react";
|
|
@@ -19,6 +19,7 @@ import { b as Ie } from "./html-to-json-45e0e3b5.js";
|
|
|
19
19
|
import "@radix-ui/react-accordion";
|
|
20
20
|
import "@radix-ui/react-scroll-area";
|
|
21
21
|
import "@radix-ui/react-tabs";
|
|
22
|
+
import "@radix-ui/react-alert-dialog";
|
|
22
23
|
import "@radix-ui/react-slot";
|
|
23
24
|
import "class-variance-authority";
|
|
24
25
|
import "@radix-ui/react-tooltip";
|
|
@@ -196,7 +197,7 @@ const Le = ({ block: s }) => {
|
|
|
196
197
|
return !P(S, r);
|
|
197
198
|
const o = s._type;
|
|
198
199
|
return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(S, r);
|
|
199
|
-
},
|
|
200
|
+
}, Bs = () => {
|
|
200
201
|
const [s, r] = j("core"), [o, a] = j("basic"), i = U(), [, d] = h(he), [, m] = h(T), [n] = C(), t = fe(), f = M(t, { _id: b(n) }), { data: x, isLoading: u } = D(), g = I(
|
|
201
202
|
w(i, (c) => Ee(f, c.type)),
|
|
202
203
|
"category"
|
|
@@ -256,5 +257,5 @@ const Le = ({ block: s }) => {
|
|
|
256
257
|
] });
|
|
257
258
|
};
|
|
258
259
|
export {
|
|
259
|
-
|
|
260
|
+
Bs as default
|
|
260
261
|
};
|
|
@@ -2,9 +2,9 @@ import { j as a } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import B from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { z as N } from "./index-
|
|
5
|
+
import { z as N } from "./index-914d197c.js";
|
|
6
6
|
import "react-i18next";
|
|
7
|
-
import { u as D } from "./useBuilderProp-
|
|
7
|
+
import { u as D } from "./useBuilderProp-21feb2da.js";
|
|
8
8
|
import { SelectOption as p, Numeric as P, Color as e } from "@chaibuilder/blocks";
|
|
9
9
|
import { isEqual as R } from "lodash";
|
|
10
10
|
import "./MODIFIERS-2f19c314.js";
|
|
@@ -26,8 +26,9 @@ import "himalaya";
|
|
|
26
26
|
import "redux-undo";
|
|
27
27
|
import "@react-hookz/web";
|
|
28
28
|
import "@radix-ui/react-icons";
|
|
29
|
-
import "lucide-react";
|
|
30
29
|
import "sonner";
|
|
30
|
+
import "lucide-react";
|
|
31
|
+
import "@radix-ui/react-alert-dialog";
|
|
31
32
|
import "@radix-ui/react-slot";
|
|
32
33
|
import "class-variance-authority";
|
|
33
34
|
import "@radix-ui/react-tooltip";
|
|
@@ -82,7 +83,7 @@ const d = [
|
|
|
82
83
|
{ title: "Lustria", value: "Lustria" },
|
|
83
84
|
{ title: "Ovo", value: "Ovo" },
|
|
84
85
|
{ title: "Suranna", value: "Suranna" }
|
|
85
|
-
],
|
|
86
|
+
], pt = () => {
|
|
86
87
|
const m = D("onSaveBrandingOptions", async () => {
|
|
87
88
|
}), [o, v] = N(), r = s.useRef(o);
|
|
88
89
|
s.useEffect(() => () => {
|
|
@@ -161,5 +162,5 @@ const d = [
|
|
|
161
162
|
] });
|
|
162
163
|
};
|
|
163
164
|
export {
|
|
164
|
-
|
|
165
|
+
pt as default
|
|
165
166
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-6fc652ec.cjs");require("react-i18next");const R=require("./useBuilderProp-adacf42f.cjs"),e=require("@chaibuilder/blocks"),P=require("lodash");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-icons");require("sonner");require("lucide-react");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function k(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const c=k(O),v=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],D=()=>{const r=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=j.useBrandingOptions(),a=c.useRef(t);c.useEffect(()=>()=>{P.isEqual(t,a.current)||r(a.current)},[]);const p=({formData:l},u)=>{u&&(i(l),a.current=l)},{bodyFont:g,headingFont:f,primaryColor:b,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:q,secondaryColor:x,bodyBgLightColor:h,roundedCorners:S}=t,s={headingFont:e.SelectOption({title:"Heading font",default:f,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(S||5,10)}),primaryColor:e.Color({title:"Primary",default:b}),secondaryColor:e.Color({title:"Secondary",default:x}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:h}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:q}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:t,validator:C,onChange:p})})]})};exports.default=D;
|
|
@@ -5,13 +5,12 @@ import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
|
5
5
|
import H, { useMemo as Ne, useEffect as B, createElement as mt, useCallback as V, useState as $, Component as Le, Children as yt, Suspense as Fe, useRef as ke, lazy as gt } from "react";
|
|
6
6
|
import { each as pe, find as We, map as Q, includes as Te, toUpper as se, round as vt, isEmpty as q, first as ee, get as O, memoize as xt, filter as $e, isNull as bt, isString as ye } from "lodash";
|
|
7
7
|
import { ResetIcon as Ce, DotsVerticalIcon as jt, MobileIcon as Ee, LaptopIcon as wt, DesktopIcon as kt, EraserIcon as Tt, ZoomInIcon as Ct, ArrowUpIcon as Et, CopyIcon as St, TrashIcon as It, DragHandleDots2Icon as At } from "@radix-ui/react-icons";
|
|
8
|
-
import { B as te, u as qe, S as Ue } from "./useBuilderProp-
|
|
9
|
-
import { u as
|
|
8
|
+
import { B as te, A as Dt, b as Ot, d as Rt, e as Pt, f as Bt, g as Mt, h as _t, i as Nt, k as Lt, u as qe, S as Ue } from "./useBuilderProp-21feb2da.js";
|
|
9
|
+
import { u as Ft, d as ge, e as He, f as ve, g as Wt, h as $t, i as z, j as K, k as qt, l as ze, r as Ke, m as Ye, n as Ut, o as Ht, q as zt, s as Ve, t as Ge, c as Kt, v as Yt, w as Vt, x as Gt, y as Xt, z as Jt, A as xe, B as Xe, C as Zt, D as Qt, F as en, b as tn, E as nn } from "./index-914d197c.js";
|
|
10
10
|
import { useTranslation as Je } from "react-i18next";
|
|
11
11
|
import { S as Z } from "./separator-a80d065b.js";
|
|
12
|
-
import { S as
|
|
13
|
-
import { L as
|
|
14
|
-
import { A as on, a as an, b as ln, c as cn, e as dn, f as un, d as pn, h as fn, g as hn } from "./alert-dialog-ee98f47e.js";
|
|
12
|
+
import { S as rn, D as sn, c as on, d as an, h as ln, i as cn, f as dn, H as un, a as pn, b as fn } from "./dropdown-menu-ae3ed09b.js";
|
|
13
|
+
import { L as hn } from "./label-e770a087.js";
|
|
15
14
|
import { useAtom as X } from "jotai";
|
|
16
15
|
import { flip as mn } from "@floating-ui/dom";
|
|
17
16
|
import { useFloating as yn, shift as gn } from "@floating-ui/react-dom";
|
|
@@ -24,10 +23,11 @@ import { g as kn, S as Ze, a as Se } from "./MODIFIERS-2f19c314.js";
|
|
|
24
23
|
import { getChaiDataProviders as Tn, getBlockComponent as Cn } from "@chaibuilder/blocks";
|
|
25
24
|
import { u as Qe } from "./useChaiExternalData-192c7896.js";
|
|
26
25
|
import Ie from "react-dom";
|
|
27
|
-
import "@radix-ui/react-
|
|
28
|
-
import "class-variance-authority";
|
|
26
|
+
import "@radix-ui/react-alert-dialog";
|
|
29
27
|
import "./utils-ac68b2c8.js";
|
|
30
28
|
import "clsx";
|
|
29
|
+
import "@radix-ui/react-slot";
|
|
30
|
+
import "class-variance-authority";
|
|
31
31
|
import "@radix-ui/react-tooltip";
|
|
32
32
|
import "@radix-ui/react-toast";
|
|
33
33
|
import "@radix-ui/react-scroll-area";
|
|
@@ -39,16 +39,15 @@ import "flat-to-nested";
|
|
|
39
39
|
import "./html-to-json-45e0e3b5.js";
|
|
40
40
|
import "himalaya";
|
|
41
41
|
import "redux-undo";
|
|
42
|
-
import "lucide-react";
|
|
43
42
|
import "sonner";
|
|
43
|
+
import "lucide-react";
|
|
44
44
|
import "@radix-ui/react-separator";
|
|
45
45
|
import "@radix-ui/react-switch";
|
|
46
46
|
import "@radix-ui/react-hover-card";
|
|
47
47
|
import "@radix-ui/react-dropdown-menu";
|
|
48
48
|
import "@radix-ui/react-label";
|
|
49
|
-
import "@radix-ui/react-alert-dialog";
|
|
50
49
|
const En = () => Ne(() => Tn(), []), Sn = ({ children: n }) => {
|
|
51
|
-
const [, t] = Qe(), [r] =
|
|
50
|
+
const [, t] = Qe(), [r] = Ft(), i = En();
|
|
52
51
|
return B(() => (t({}), pe(r, (l) => {
|
|
53
52
|
const s = We(i, { providerKey: l.providerKey });
|
|
54
53
|
if (s) {
|
|
@@ -72,9 +71,9 @@ const En = () => Ne(() => Tn(), []), Sn = ({ children: n }) => {
|
|
|
72
71
|
function An() {
|
|
73
72
|
const [n, t] = He(), { t: r } = Je();
|
|
74
73
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
75
|
-
/* @__PURE__ */ e.jsx(
|
|
74
|
+
/* @__PURE__ */ e.jsx(hn, { htmlFor: "dark-mode-switch", children: r("dark_mode") }),
|
|
76
75
|
/* @__PURE__ */ e.jsxs(
|
|
77
|
-
|
|
76
|
+
rn,
|
|
78
77
|
{
|
|
79
78
|
id: "dark-mode-switch",
|
|
80
79
|
checked: n,
|
|
@@ -172,8 +171,8 @@ const Ae = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
|
|
|
172
171
|
width: l,
|
|
173
172
|
icon: s,
|
|
174
173
|
onClick: a
|
|
175
|
-
}) => /* @__PURE__ */ e.jsxs(
|
|
176
|
-
/* @__PURE__ */ e.jsx(
|
|
174
|
+
}) => /* @__PURE__ */ e.jsxs(un, { children: [
|
|
175
|
+
/* @__PURE__ */ e.jsx(pn, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
177
176
|
te,
|
|
178
177
|
{
|
|
179
178
|
onClick: () => a(l),
|
|
@@ -182,12 +181,12 @@ const Ae = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
|
|
|
182
181
|
children: s
|
|
183
182
|
}
|
|
184
183
|
) }),
|
|
185
|
-
/* @__PURE__ */ e.jsx(
|
|
184
|
+
/* @__PURE__ */ e.jsx(fn, { className: "w-52 border-border", children: /* @__PURE__ */ e.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
186
185
|
/* @__PURE__ */ e.jsx("h4", { className: "text-sm font-semibold", children: n }),
|
|
187
186
|
/* @__PURE__ */ e.jsx("p", { className: "text-xs", children: t })
|
|
188
187
|
] }) }) })
|
|
189
188
|
] }), On = () => {
|
|
190
|
-
const [, n, t] = ve(), [r, i] =
|
|
189
|
+
const [, n, t] = ve(), [r, i] = Wt(), l = (s) => {
|
|
191
190
|
r.includes(s) ? r.length > 2 && i(r.filter((a) => a !== s)) : i((a) => [...a, s]);
|
|
192
191
|
};
|
|
193
192
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center rounded-md", children: [
|
|
@@ -195,13 +194,13 @@ const Ae = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
|
|
|
195
194
|
De.filter((s) => Te(r, se(s.breakpoint))),
|
|
196
195
|
(s) => /* @__PURE__ */ mt(Dn, { ...s, onClick: t, key: s.breakpoint, currentBreakpoint: n })
|
|
197
196
|
),
|
|
198
|
-
/* @__PURE__ */ e.jsxs(
|
|
199
|
-
/* @__PURE__ */ e.jsx(
|
|
200
|
-
/* @__PURE__ */ e.jsxs(
|
|
201
|
-
/* @__PURE__ */ e.jsx(
|
|
202
|
-
/* @__PURE__ */ e.jsx(
|
|
197
|
+
/* @__PURE__ */ e.jsxs(sn, { children: [
|
|
198
|
+
/* @__PURE__ */ e.jsx(on, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ e.jsx(jt, { className: "scale-90 transform" }) }) }),
|
|
199
|
+
/* @__PURE__ */ e.jsxs(an, { className: "w-56 border-border text-xs", children: [
|
|
200
|
+
/* @__PURE__ */ e.jsx(ln, { children: "Breakpoints" }),
|
|
201
|
+
/* @__PURE__ */ e.jsx(cn, {}),
|
|
203
202
|
Q(De, (s) => /* @__PURE__ */ e.jsx(
|
|
204
|
-
|
|
203
|
+
dn,
|
|
205
204
|
{
|
|
206
205
|
disabled: s.breakpoint === "xs",
|
|
207
206
|
onCheckedChange: () => l(se(s.breakpoint)),
|
|
@@ -214,27 +213,27 @@ const Ae = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
|
|
|
214
213
|
] })
|
|
215
214
|
] });
|
|
216
215
|
}, Rn = () => {
|
|
217
|
-
const [n] =
|
|
216
|
+
const [n] = $t(), { createSnapshot: t } = ge(), [, r] = z(), [, i] = K(), l = V(() => {
|
|
218
217
|
n([]), r([]), i([]), t();
|
|
219
218
|
}, [n, t]);
|
|
220
|
-
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(
|
|
221
|
-
/* @__PURE__ */ e.jsx(
|
|
219
|
+
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(Dt, { children: [
|
|
220
|
+
/* @__PURE__ */ e.jsx(Ot, { asChild: !0, children: /* @__PURE__ */ e.jsxs(te, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1", children: [
|
|
222
221
|
/* @__PURE__ */ e.jsx(Tt, {}),
|
|
223
222
|
" Clear"
|
|
224
223
|
] }) }),
|
|
225
|
-
/* @__PURE__ */ e.jsxs(
|
|
226
|
-
/* @__PURE__ */ e.jsxs(
|
|
227
|
-
/* @__PURE__ */ e.jsx(
|
|
228
|
-
/* @__PURE__ */ e.jsx(
|
|
224
|
+
/* @__PURE__ */ e.jsxs(Rt, { className: "border-border", children: [
|
|
225
|
+
/* @__PURE__ */ e.jsxs(Pt, { children: [
|
|
226
|
+
/* @__PURE__ */ e.jsx(Bt, { children: "Clear whole canvas?" }),
|
|
227
|
+
/* @__PURE__ */ e.jsx(Mt, { children: "Are you sure you want to clear the whole canvas?" })
|
|
229
228
|
] }),
|
|
230
|
-
/* @__PURE__ */ e.jsxs(
|
|
231
|
-
/* @__PURE__ */ e.jsx(
|
|
232
|
-
/* @__PURE__ */ e.jsx(
|
|
229
|
+
/* @__PURE__ */ e.jsxs(_t, { children: [
|
|
230
|
+
/* @__PURE__ */ e.jsx(Nt, { children: "Cancel" }),
|
|
231
|
+
/* @__PURE__ */ e.jsx(Lt, { onClick: l, children: "Yes" })
|
|
233
232
|
] })
|
|
234
233
|
] })
|
|
235
234
|
] }) });
|
|
236
235
|
}, Pn = () => {
|
|
237
|
-
const n =
|
|
236
|
+
const n = qt("darkMode", !1), [t] = ze();
|
|
238
237
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
|
|
239
238
|
/* @__PURE__ */ e.jsxs("div", { className: "flex h-full space-x-2", children: [
|
|
240
239
|
n ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
@@ -814,7 +813,7 @@ const P = /* @__PURE__ */ kn(qn);
|
|
|
814
813
|
let tt, nt;
|
|
815
814
|
typeof document < "u" && (tt = document);
|
|
816
815
|
typeof window < "u" && (nt = window);
|
|
817
|
-
const rt = H.createContext({ document: tt, window: nt }), je = () => H.useContext(rt), { Provider: Un, Consumer:
|
|
816
|
+
const rt = H.createContext({ document: tt, window: nt }), je = () => H.useContext(rt), { Provider: Un, Consumer: Zr } = rt;
|
|
818
817
|
class st extends Le {
|
|
819
818
|
componentDidMount() {
|
|
820
819
|
this.props.contentDidMount();
|
|
@@ -922,7 +921,7 @@ const Hn = H.forwardRef((n, t) => /* @__PURE__ */ e.jsx(he, { ...n, forwardedRef
|
|
|
922
921
|
}, 100);
|
|
923
922
|
}, [t, r, l, i]), /* @__PURE__ */ e.jsx("div", { id: "canvas", className: "relative h-screen max-w-full outline-2", children: n });
|
|
924
923
|
}, ot = (n, t) => n.querySelector(`[data-block-id="${t}"]`), Kn = () => {
|
|
925
|
-
const { window: n } = je(), [t, r] = z(), [, i] = K(), { undo: l, redo: s } = ge(), a = Ye(), [, d] =
|
|
924
|
+
const { window: n } = je(), [t, r] = z(), [, i] = K(), { undo: l, redo: s } = ge(), a = Ye(), [, d] = Ut(), [, y] = Ht(), { pasteBlocks: b } = zt(), [, p] = Ve(), u = Ge(), { savePage: m } = Kt(), [k] = X(Yt), [, A] = X(Vt), w = (S) => {
|
|
926
925
|
S.key === "Enter" && (S.preventDefault(), t.length === 1 && A(ee(t)));
|
|
927
926
|
};
|
|
928
927
|
return B(() => {
|
|
@@ -1014,14 +1013,14 @@ const Hn = H.forwardRef((n, t) => /* @__PURE__ */ e.jsx(he, { ...n, forwardedRef
|
|
|
1014
1013
|
}
|
|
1015
1014
|
}
|
|
1016
1015
|
),
|
|
1017
|
-
|
|
1018
|
-
|
|
1016
|
+
Gt(O(t, "_type", "")) ? /* @__PURE__ */ e.jsx(St, { className: "hover:scale-105 ", onClick: () => i([t == null ? void 0 : t._id]) }) : null,
|
|
1017
|
+
Xt(O(t, "_type", "")) ? /* @__PURE__ */ e.jsx(It, { className: "hover:scale-105 ", onClick: () => r([t == null ? void 0 : t._id]) }) : null
|
|
1019
1018
|
] })
|
|
1020
1019
|
]
|
|
1021
1020
|
}
|
|
1022
1021
|
);
|
|
1023
1022
|
}, Gn = ({ model: n }) => {
|
|
1024
|
-
const [t] =
|
|
1023
|
+
const [t] = Jt(), [r] = z(), [i] = He(), [l] = xe(), [s] = K(), { document: a, window: d } = je(), [y] = $(a == null ? void 0 : a.getElementById("highlighted-block")), [b] = $(
|
|
1025
1024
|
a == null ? void 0 : a.getElementById("selected-block")
|
|
1026
1025
|
), [p] = $(
|
|
1027
1026
|
a == null ? void 0 : a.getElementById("selected-styling-block")
|
|
@@ -1208,7 +1207,7 @@ const nr = () => {
|
|
|
1208
1207
|
const n = Xe();
|
|
1209
1208
|
return /* @__PURE__ */ e.jsx(jn, { children: q(n) ? /* @__PURE__ */ e.jsx(Xn, {}) : /* @__PURE__ */ e.jsx(Sn, { children: /* @__PURE__ */ e.jsx(me, { blocks: $e(n, (t) => q(t._parent)) }) }) });
|
|
1210
1209
|
}, rr = (n, t) => n.querySelector(`[data-style-id="${t}"]`), sr = () => {
|
|
1211
|
-
const [n] = X(
|
|
1210
|
+
const [n] = X(Zt), [t] = Ve(), [r] = ve(), [, i] = z(), l = Qt(), [, s] = xe(), a = ke(null), d = ke(null), [y, b] = $({ width: 0, height: 0 }), p = Mn(y), [u, m] = $(0), [k, A] = $([]), [, w] = $([]), [, S] = X(en), [f, F] = K(), _ = qe("loadingCanvas", !1);
|
|
1212
1211
|
B(() => {
|
|
1213
1212
|
const { clientWidth: D, clientHeight: N } = d.current;
|
|
1214
1213
|
b({ width: D, height: N }), u === 0 && m(D);
|
|
@@ -1278,15 +1277,15 @@ const nr = () => {
|
|
|
1278
1277
|
)
|
|
1279
1278
|
}
|
|
1280
1279
|
);
|
|
1281
|
-
}, or = gt(() => import("./AddBlocks-
|
|
1282
|
-
const n = qe("mode", oe.STATIC), [t, r] = X(
|
|
1280
|
+
}, or = gt(() => import("./AddBlocks-f6836e71.js")), Qr = () => {
|
|
1281
|
+
const n = qe("mode", oe.STATIC), [t, r] = X(tn), i = {
|
|
1283
1282
|
[oe.STATIC]: /* @__PURE__ */ e.jsx(sr, {}),
|
|
1284
1283
|
[oe.FRAMEWORK]: null
|
|
1285
1284
|
}[n];
|
|
1286
1285
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
1287
1286
|
/* @__PURE__ */ e.jsx(Pn, {}),
|
|
1288
1287
|
/* @__PURE__ */ e.jsxs("div", { className: "relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]", children: [
|
|
1289
|
-
/* @__PURE__ */ e.jsx(Fe, { fallback: /* @__PURE__ */ e.jsx(Ue, { className: "h-full" }), children: /* @__PURE__ */ e.jsx(
|
|
1288
|
+
/* @__PURE__ */ e.jsx(Fe, { fallback: /* @__PURE__ */ e.jsx(Ue, { className: "h-full" }), children: /* @__PURE__ */ e.jsx(nn, { children: i }) }),
|
|
1290
1289
|
t ? /* @__PURE__ */ e.jsx(
|
|
1291
1290
|
"div",
|
|
1292
1291
|
{
|
|
@@ -1306,5 +1305,5 @@ const nr = () => {
|
|
|
1306
1305
|
] });
|
|
1307
1306
|
};
|
|
1308
1307
|
export {
|
|
1309
|
-
|
|
1308
|
+
Qr as default
|
|
1310
1309
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";var Le=Object.defineProperty;var Fe=(n,t,s)=>t in n?Le(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var z=(n,t,s)=>(Fe(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),h=require("react"),d=require("lodash"),_=require("@radix-ui/react-icons"),P=require("./useBuilderProp-adacf42f.cjs"),u=require("./index-6fc652ec.cjs"),Re=require("react-i18next"),Z=require("./separator-a597dba7.cjs"),F=require("./dropdown-menu-84b2439e.cjs"),We=require("./label-167415e5.cjs"),G=require("jotai"),$e=require("@floating-ui/dom"),fe=require("@floating-ui/react-dom"),Ue=require("react-dnd"),He=require("@react-hookz/web"),ze=require("@bobthered/tailwindcss-palette-generator"),Ke=require("react-wrap-balancer"),Ye=require("tailwind-merge"),V=require("./MODIFIERS-4716c669.cjs"),ke=require("@chaibuilder/blocks"),we=require("./useChaiExternalData-a90e8aac.cjs"),xe=require("react-dom");require("@radix-ui/react-alert-dialog");require("./utils-3c452dd0.cjs");require("clsx");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("sonner");require("lucide-react");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-label");const Ge=()=>h.useMemo(()=>ke.getChaiDataProviders(),[]),Ve=({children:n})=>{const[,t]=we.useChaiExternalData(),[s]=u.usePageDataProviders(),i=Ge();return h.useEffect(()=>(t({}),d.each(s,c=>{const r=d.find(i,{providerKey:c.providerKey});if(r){const a=(r==null?void 0:r.mockFn)||(r==null?void 0:r.dataFn);a&&a(c.args).then(p=>t(v=>({...v,[c.providerKey]:p})))}}),()=>{d.each(s,c=>{t(r=>(delete r[c.providerKey],r))})}),[i,s,t]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Xe=()=>{const{undoCount:n,redoCount:t,undo:s,redo:i}=u.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(P.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(_.ResetIcon,{})}),e.jsxRuntimeExports.jsx(P.Button,{disabled:!t,onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(_.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function Ze(){const[n,t]=u.useDarkMode(),{t:s}=Re.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(We.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(F.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"bg-violet-600":"bg-violet-300"}
|
|
2
|
+
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${n?"translate-x-5":"translate-x-0"}
|
|
3
|
+
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const he=({landscape:n=!1})=>e.jsxRuntimeExports.jsxs("svg",{className:n?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[e.jsxRuntimeExports.jsx("g",{strokeWidth:0}),e.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),e.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),me=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(_.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(_.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:e.jsxRuntimeExports.jsx(he,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:e.jsxRuntimeExports.jsx(he,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:e.jsxRuntimeExports.jsx(_.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(_.DesktopIcon,{}),width:1920}],Je=({title:n,content:t,currentBreakpoint:s,breakpoint:i,width:c,icon:r,onClick:a})=>e.jsxRuntimeExports.jsxs(F.HoverCard,{children:[e.jsxRuntimeExports.jsx(F.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(P.Button,{onClick:()=>a(c),size:"sm",variant:i===s?"secondary":"ghost",children:r})}),e.jsxRuntimeExports.jsx(F.HoverCardContent,{className:"w-52 border-border",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:n}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),Qe=()=>{const[,n,t]=u.useCanvasWidth(),[s,i]=u.useSelectedBreakpoints(),c=r=>{s.includes(r)?s.length>2&&i(s.filter(a=>a!==r)):i(a=>[...a,r])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[d.map(me.filter(r=>d.includes(s,d.toUpper(r.breakpoint))),r=>h.createElement(Je,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(F.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(F.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(_.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(F.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(F.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(F.DropdownMenuSeparator,{}),d.map(me,r=>e.jsxRuntimeExports.jsx(F.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>c(d.toUpper(r.breakpoint)),checked:d.includes(s,d.toUpper(r.breakpoint)),children:r.title},r.breakpoint))]})]})]})},et=()=>{const[n]=u.useSetAllBlocks(),{createSnapshot:t}=u.useCanvasHistory(),[,s]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),c=h.useCallback(()=>{n([]),s([]),i([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(P.AlertDialog,{children:[e.jsxRuntimeExports.jsx(P.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(P.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(_.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs(P.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs(P.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(P.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx(P.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs(P.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(P.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(P.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},tt=()=>{const n=u.useFeatureSupport("darkMode",!1),[t]=u.useCanvasZoom();return e.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Ze,{}),e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(Qe,{}),e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[e.jsxRuntimeExports.jsx(_.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[d.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Xe,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(et,{})]})]})},ee={FRAMEWORK:"FRAMEWORK",STATIC:"STATIC",EMAIL:"EMAIL",PRESENTATION:"PRESENTATION",GRAPHIC:"GRAPHIC"},nt=`<!doctype html>
|
|
4
|
+
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
|
|
9
|
+
<style>
|
|
10
|
+
html { height: 100%; overflow:auto; }
|
|
11
|
+
body { height: 100%; }
|
|
12
|
+
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
13
|
+
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
14
|
+
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
15
|
+
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
16
|
+
html{
|
|
17
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
18
|
+
scrollbar-width: none; /* Firefox */
|
|
19
|
+
}
|
|
20
|
+
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
21
|
+
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
22
|
+
|
|
23
|
+
html::-webkit-scrollbar { width: 0 !important }
|
|
24
|
+
.aspect-auto{aspect-ratio: auto;}
|
|
25
|
+
.aspect-square{aspect-ratio: 1/1;}
|
|
26
|
+
.aspect-video{aspect-ratio: 16/9;}
|
|
27
|
+
a{ pointer-events: none !important; }
|
|
28
|
+
</style>
|
|
29
|
+
<style id="hidden-blocks"></style>
|
|
30
|
+
<style id="selected-block"></style>
|
|
31
|
+
<style id="selected-styling-block"></style>
|
|
32
|
+
<style id="highlighted-block"></style>
|
|
33
|
+
</head>
|
|
34
|
+
<body class="font-body antialiased h-full">
|
|
35
|
+
<div class="frame-root"></div>
|
|
36
|
+
</body>
|
|
37
|
+
</html>`,st=n=>{const[t]=u.useCanvasWidth(),[,s]=u.useCanvasZoom(),[i,c]=h.useState({}),r=h.useCallback(()=>{const{width:a,height:p}=n;if(a<t){const v=parseFloat((a/t).toString());let R={};p&&(R={height:p+2*p*(1-v)}),c({transform:`scale(${v})`,transformOrigin:"top left",...R,maxWidth:"none"}),s(v*100)}else c({}),s(100)},[t,n,s]);return h.useEffect(()=>{r()},[t,n,s,r]),i};var ae={exports:{}};/*
|
|
38
|
+
object-assign
|
|
39
|
+
(c) Sindre Sorhus
|
|
40
|
+
@license MIT
|
|
41
|
+
*/var te,ye;function rt(){if(ye)return te;ye=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function i(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function c(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var a={},p=0;p<10;p++)a["_"+String.fromCharCode(p)]=p;var v=Object.getOwnPropertyNames(a).map(function(x){return a[x]});if(v.join("")!=="0123456789")return!1;var R={};return"abcdefghijklmnopqrst".split("").forEach(function(x){R[x]=x}),Object.keys(Object.assign({},R)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return te=c()?Object.assign:function(r,a){for(var p,v=i(r),R,x=1;x<arguments.length;x++){p=Object(arguments[x]);for(var f in p)t.call(p,f)&&(v[f]=p[f]);if(n){R=n(p);for(var g=0;g<R.length;g++)s.call(p,R[g])&&(v[R[g]]=p[R[g]])}}return v},te}var ne,ge;function ue(){if(ge)return ne;ge=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ne=n,ne}var se,ve;function Se(){return ve||(ve=1,se=Function.call.bind(Object.prototype.hasOwnProperty)),se}var re,je;function ot(){if(je)return re;je=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=ue(),s={},i=Se();n=function(r){var a="Warning: "+r;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function c(r,a,p,v,R){if(process.env.NODE_ENV!=="production"){for(var x in r)if(i(r,x)){var f;try{if(typeof r[x]!="function"){var g=Error((v||"React class")+": "+p+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}f=r[x](a,x,v,p,null,t)}catch(B){f=B}if(f&&!(f instanceof Error)&&n((v||"React class")+": type specification of "+p+" `"+x+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in s)){s[f.message]=!0;var S=R?R():"";n("Failed "+p+" type: "+f.message+(S??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},re=c,re}var oe,Ee;function it(){if(Ee)return oe;Ee=1;var n=u.reactIsExports,t=rt(),s=ue(),i=Se(),c=ot(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(p){var v="Warning: "+p;typeof console<"u"&&console.error(v);try{throw new Error(v)}catch{}});function a(){return null}return oe=function(p,v){var R=typeof Symbol=="function"&&Symbol.iterator,x="@@iterator";function f(o){var l=o&&(R&&o[R]||o[x]);if(typeof l=="function")return l}var g="<<anonymous>>",S={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:U(),arrayOf:L,element:J(),elementType:Q(),instanceOf:O,node:Oe(),objectOf:$,oneOf:W,oneOfType:Be,shape:Pe,exact:Me};function B(o,l){return o===l?o!==0||1/o===1/l:o!==o&&l!==l}function w(o,l){this.message=o,this.data=l&&typeof l=="object"?l:{},this.stack=""}w.prototype=Error.prototype;function D(o){if(process.env.NODE_ENV!=="production")var l={},k=0;function E(C,j,b,T,A,I,N){if(T=T||g,I=I||b,N!==s){if(v){var M=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw M.name="Invariant Violation",M}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var K=T+":"+b;!l[K]&&k<3&&(r("You are manually calling a React.PropTypes validation function for the `"+I+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),l[K]=!0,k++)}}return j[b]==null?C?j[b]===null?new w("The "+A+" `"+I+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new w("The "+A+" `"+I+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:o(j,b,T,A,I)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function m(o){function l(k,E,y,C,j,b){var T=k[E],A=H(T);if(A!==o){var I=Y(T);return new w("Invalid "+C+" `"+j+"` of type "+("`"+I+"` supplied to `"+y+"`, expected ")+("`"+o+"`."),{expectedType:o})}return null}return D(l)}function U(){return D(a)}function L(o){function l(k,E,y,C,j){if(typeof o!="function")return new w("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=k[E];if(!Array.isArray(b)){var T=H(b);return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var A=0;A<b.length;A++){var I=o(b,A,y,C,j+"["+A+"]",s);if(I instanceof Error)return I}return null}return D(l)}function J(){function o(l,k,E,y,C){var j=l[k];if(!p(j)){var b=H(j);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return D(o)}function Q(){function o(l,k,E,y,C){var j=l[k];if(!n.isValidElementType(j)){var b=H(j);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return D(o)}function O(o){function l(k,E,y,C,j){if(!(k[E]instanceof o)){var b=o.name||g,T=Ne(k[E]);return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return D(l)}function W(o){if(!Array.isArray(o))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):r("Invalid argument supplied to oneOf, expected an array.")),a;function l(k,E,y,C,j){for(var b=k[E],T=0;T<o.length;T++)if(B(b,o[T]))return null;var A=JSON.stringify(o,function(N,M){var K=Y(M);return K==="symbol"?String(M):M});return new w("Invalid "+C+" `"+j+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+A+"."))}return D(l)}function $(o){function l(k,E,y,C,j){if(typeof o!="function")return new w("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var A in b)if(i(b,A)){var I=o(b,A,y,C,j+"."+A,s);if(I instanceof Error)return I}return null}return D(l)}function Be(o){if(!Array.isArray(o))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var l=0;l<o.length;l++){var k=o[l];if(typeof k!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+_e(k)+" at index "+l+"."),a}function E(y,C,j,b,T){for(var A=[],I=0;I<o.length;I++){var N=o[I],M=N(y,C,j,b,T,s);if(M==null)return null;M.data&&i(M.data,"expectedType")&&A.push(M.data.expectedType)}var K=A.length>0?", expected one of type ["+A.join(", ")+"]":"";return new w("Invalid "+b+" `"+T+"` supplied to "+("`"+j+"`"+K+"."))}return D(E)}function Oe(){function o(l,k,E,y,C){return X(l[k])?null:new w("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return D(o)}function pe(o,l,k,E,y){return new w((o||"React class")+": "+l+" type `"+k+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Pe(o){function l(k,E,y,C,j){var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var A in o){var I=o[A];if(typeof I!="function")return pe(y,C,j,A,Y(I));var N=I(b,A,y,C,j+"."+A,s);if(N)return N}return null}return D(l)}function Me(o){function l(k,E,y,C,j){var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var A=t({},k[E],o);for(var I in A){var N=o[I];if(i(o,I)&&typeof N!="function")return pe(y,C,j,I,Y(N));if(!N)return new w("Invalid "+C+" `"+j+"` key `"+I+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(k[E],null," ")+`
|
|
42
|
+
Valid keys: `+JSON.stringify(Object.keys(o),null," "));var M=N(b,I,y,C,j+"."+I,s);if(M)return M}return null}return D(l)}function X(o){switch(typeof o){case"number":case"string":case"undefined":return!0;case"boolean":return!o;case"object":if(Array.isArray(o))return o.every(X);if(o===null||p(o))return!0;var l=f(o);if(l){var k=l.call(o),E;if(l!==o.entries){for(;!(E=k.next()).done;)if(!X(E.value))return!1}else for(;!(E=k.next()).done;){var y=E.value;if(y&&!X(y[1]))return!1}}else return!1;return!0;default:return!1}}function qe(o,l){return o==="symbol"?!0:l?l["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&l instanceof Symbol:!1}function H(o){var l=typeof o;return Array.isArray(o)?"array":o instanceof RegExp?"object":qe(l,o)?"symbol":l}function Y(o){if(typeof o>"u"||o===null)return""+o;var l=H(o);if(l==="object"){if(o instanceof Date)return"date";if(o instanceof RegExp)return"regexp"}return l}function _e(o){var l=Y(o);switch(l){case"array":case"object":return"an "+l;case"boolean":case"date":case"regexp":return"a "+l;default:return l}}function Ne(o){return!o.constructor||!o.constructor.name?g:o.constructor.name}return S.checkPropTypes=c,S.resetWarningCache=c.resetWarningCache,S.PropTypes=S,S},oe}var ie,be;function at(){if(be)return ie;be=1;var n=ue();function t(){}function s(){}return s.resetWarningCache=t,ie=function(){function i(a,p,v,R,x,f){if(f!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}i.isRequired=i;function c(){return i}var r={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:c,element:i,elementType:i,instanceOf:c,node:i,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:s,resetWarningCache:t};return r.PropTypes=r,r},ie}if(process.env.NODE_ENV!=="production"){var ct=u.reactIsExports,lt=!0;ae.exports=it()(ct.isElement,lt)}else ae.exports=at()();var ut=ae.exports;const q=V.getDefaultExportFromCjs(ut);let Ce,Te;typeof document<"u"&&(Ce=document);typeof window<"u"&&(Te=window);const Ie=h.createContext({document:Ce,window:Te}),de=()=>h.useContext(Ie),{Provider:dt,Consumer:Dt}=Ie;class De extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}z(De,"propTypes",{children:q.element.isRequired,contentDidMount:q.func.isRequired,contentDidUpdate:q.func.isRequired});class ce extends h.Component{constructor(s,i){super(s,i);z(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:i}=this.props;typeof i=="function"?i(s):i&&(i.current=s)});z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const i=this.props.contentDidMount,c=this.props.contentDidUpdate,r=s.defaultView||s.parentView,a=e.jsxRuntimeExports.jsx(De,{contentDidMount:i,contentDidUpdate:c,children:e.jsxRuntimeExports.jsx(dt,{value:{document:s,window:r},children:e.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),p=this.getMountTarget();return[xe.createPortal(this.props.head,this.getDoc().head),xe.createPortal(a,p)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,e.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}z(ce,"propTypes",{style:q.object,head:q.node,initialContent:q.string,mountTarget:q.string,contentDidMount:q.func,contentDidUpdate:q.func,children:q.oneOfType([q.element,q.arrayOf(q.element)])}),z(ce,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const pt=h.forwardRef((n,t)=>e.jsxRuntimeExports.jsx(ce,{...n,forwardedRef:t})),ft=({children:n})=>{const{document:t}=de(),[s]=u.useSelectedBlockIds(),[i,c]=u.useSelectedStylingBlocks();return h.useEffect(()=>{setTimeout(()=>{if(!d.isEmpty(i))return;const r=Ae(t,d.first(s));if(r){const a=r.getAttribute("data-style-prop");if(a){const p=r.getAttribute("data-style-id"),v=r.getAttribute("data-block-parent");c([{id:p,prop:a,blockId:v}])}}},100)},[t,s,c,i]),e.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:n})},Ae=(n,t)=>n.querySelector(`[data-block-id="${t}"]`),xt=()=>{const{window:n}=de(),[t,s]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),{undo:c,redo:r}=u.useCanvasHistory(),a=u.useDuplicateBlocks(),[,p]=u.useCutBlockIds(),[,v]=u.useCopyBlockIds(),{pasteBlocks:R}=u.usePasteBlocks(),[,x]=u.usePreviewMode(),f=u.useRemoveBlocks(),{savePage:g}=u.useSavePage(),[S]=G.useAtom(u.inlineEditingActiveAtom),[,B]=G.useAtom(u.editLayerNameAtom),w=D=>{D.key==="Enter"&&(D.preventDefault(),t.length===1&&B(d.first(t)))};return h.useEffect(()=>{const D=m=>{if(m.key==="Escape"){s([]),i([]);return}if(w(m),!S&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),f(t)),m.ctrlKey||m.metaKey){if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(S&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),g()),m.key==="z"&&c(),m.key==="y"&&r(),m.key==="d"&&a(t),m.key==="x"&&p(t),m.key==="c"&&v(t),m.key==="v"&&t.length>0&&R(t[0])}};return n.removeEventListener("keydown",D),n.addEventListener("keydown",D),()=>{n.removeEventListener("keydown",D)}},[t,s,c,f,x,r,a,p,v,R,S,g,n]),null},ht=({block:n,label:t})=>{const[,s]=Ue.useDrag(()=>({type:"CANVAS_BLOCK",item:n}));return e.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:s,onDragStart:()=>{console.log("drag start")},children:[e.jsxRuntimeExports.jsx(_.DragHandleDots2Icon,{}),t]})},mt=({selectedBlockElement:n,block:t})=>{const s=u.useRemoveBlocks(),i=u.useDuplicateBlocks(),[,c]=u.useSelectedBlockIds(),[,r]=u.useSelectedStylingBlocks(),{floatingStyles:a,refs:p,update:v}=fe.useFloating({placement:"top-start",middleware:[fe.shift(),$e.flip()],elements:{reference:n}});He.useResizeObserver(n,()=>v(),n!==null);const R=d.get(t,"_parent",null),x=d.isEmpty(d.get(t,"_name",""))?d.get(t,"_type",""):d.get(t,"_name","");return!n||!t?null:e.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:a,onClick:f=>{f.stopPropagation(),f.preventDefault()},onKeyDown:f=>f.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[e.jsxRuntimeExports.jsx(ht,{label:x,block:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[R&&e.jsxRuntimeExports.jsx(_.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{r([]),c([R])}}),u.canDuplicateBlock(d.get(t,"_type",""))?e.jsxRuntimeExports.jsx(_.CopyIcon,{className:"hover:scale-105 ",onClick:()=>i([t==null?void 0:t._id])}):null,u.canDeleteBlock(d.get(t,"_type",""))?e.jsxRuntimeExports.jsx(_.TrashIcon,{className:"hover:scale-105 ",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},yt=({model:n})=>{const[t]=u.useBrandingOptions(),[s]=u.useSelectedBlockIds(),[i]=u.useDarkMode(),[c]=u.useHighlightBlockId(),[r]=u.useSelectedStylingBlocks(),{document:a,window:p}=de(),[v]=h.useState(a==null?void 0:a.getElementById("highlighted-block")),[R]=h.useState(a==null?void 0:a.getElementById("selected-block")),[x]=h.useState(a==null?void 0:a.getElementById("selected-styling-block"));h.useEffect(()=>{i?a==null||a.documentElement.classList.add("dark"):a==null||a.documentElement.classList.remove("dark")},[i,a]);const f=d.get(t,"headingFont","DM Sans"),g=d.get(t,"bodyFont","DM Sans");return h.useEffect(()=>{const S=d.get(t,"primaryColor","#000"),B=d.get(t,"secondaryColor","#FFF"),w=ze.tailwindcssPaletteGenerator({colors:[S,B],names:["primary","secondary"]});w.primary.DEFAULT=S,w.secondary.DEFAULT=B;const D=d.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[f],body:[g]},extend:{borderRadius:{global:`${D||"0"}px`},colors:w}},plugins:[p.tailwind.plugin.withOptions(({prefix:m="ui"}={})=>({addVariant:U})=>{for(const L of["open","checked","selected","active","disabled"])U(`${m}-${L}`,[`&[data-headlessui-state~="${L}"]`,`:where([data-headlessui-state~="${L}"]) &`]),U(`${m}-not-${L}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${L}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${L}"])) &:not([data-headlessui-state])`])})]})},[t,p,f,g]),h.useEffect(()=>{R&&(R.textContent=`${d.map(s,S=>`[data-block-id="${S}"]`).join(",")}{
|
|
43
|
+
outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
44
|
+
}`)},[s,R]),h.useEffect(()=>{v&&(v.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[c,s,v]),h.useEffect(()=>{x&&(x.textContent=`${d.map(r,({id:S})=>`[data-style-id="${S}"]`).join(",")}{
|
|
45
|
+
outline: 1px solid orange !important; outline-offset: -1px;
|
|
46
|
+
}`)},[r,x]),h.useEffect(()=>{if(n==="section")return;const S=d.get(t,"bodyTextLightColor","#64748b"),B=d.get(t,"bodyTextDarkColor","#94a3b8"),w=d.get(t,"bodyBgLightColor","#FFFFFF"),D=d.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${B}] dark:bg-[${D}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${f.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&f!==g&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${g.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),f&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${f}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},gt=()=>{const{t:n}=Re.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},vt=n=>{const t={};return Object.keys(n).forEach(s=>{d.isString(n[s])&&n[s].startsWith(V.SLOT_KEY)&&(t[s]=n[s].replace(V.SLOT_KEY,"").split(","))}),t},jt=d.memoize(n=>{const t=n.replace(V.STYLES_KEY,"").split(",");return Ye.twMerge(t[0],t[1])});function Et(n,t){return d.get(n,`${t}_attrs`,{})}function bt(n,t,s,i){const c={};return Object.keys(n).forEach(r=>{if(d.isString(n[r])&&n[r].startsWith(V.STYLES_KEY)){const a=jt(n[r]);c[r]={className:a,"data-style-prop":r,"data-block-parent":n._id,"data-style-id":`${r}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:i,...Et(n,r)}}}),c}function Rt(n,t){const s=d.get(n,"_bindings",{});return d.isEmpty(s)?{...n}:(d.each(s,(i,c)=>{d.isString(i)&&d.get(t,i,null)&&(n[c]=d.get(t,i,null))}),n)}function le({blocks:n}){const t=u.useAllBlocks(),[,s]=u.useHighlightBlockId(),[,i]=u.useSelectedStylingBlocks(),[,c]=u.useSelectedBlockIds(),r=h.useCallback(x=>{var g;const f=(g=x.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(f||""),x.stopPropagation()},[s]),a=h.useCallback(x=>{s(""),x.stopPropagation()},[s]),p=h.useCallback(x=>{x.stopPropagation();const f=x.currentTarget;if(f.getAttribute("data-block-parent")){const g=f.getAttribute("data-style-prop"),S=f.getAttribute("data-style-id"),B=f.getAttribute("data-block-parent");i([{id:S,prop:g,blockId:B}]),c([B])}else if(f.getAttribute("data-block-id")&&(c([f.getAttribute("data-block-id")]),f.getAttribute("data-block-parent"))){const g=f.getAttribute("data-style-prop"),S=f.getAttribute("data-style-id"),B=f.getAttribute("data-block-parent");i([{id:S,prop:g,blockId:B}])}},[i,c]),v=h.useCallback(x=>bt(x,r,a,p),[p,r,a]),[R]=we.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((x,f)=>{const g=vt(x),S={};d.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map(U=>e.jsxRuntimeExports.jsx(le,{blocks:[d.find(t,{_id:U})]})))});const B=d.filter(t,{_parent:x._id});S.children=B.length?e.jsxRuntimeExports.jsx(le,{blocks:B}):null;const w=ke.getBlockComponent(x._type),D=d.get(w,"component",null);return d.isNull(D)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${x==null?void 0:x._type} not registered -->`}):e.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(D,{blockProps:{onClick:p,"data-block-id":x._id,"data-block-type":x._type},inBuilder:!0,index:f,...Rt(x,R),...v(x),...S})})}))})}const kt=()=>{const n=u.useAllBlocks();return e.jsxRuntimeExports.jsx(Ke.Provider,{children:d.isEmpty(n)?e.jsxRuntimeExports.jsx(gt,{}):e.jsxRuntimeExports.jsx(Ve,{children:e.jsxRuntimeExports.jsx(le,{blocks:d.filter(n,t=>d.isEmpty(t._parent))})})})},wt=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),St=()=>{const[n]=G.useAtom(u.networkModeAtom),[t]=u.usePreviewMode(),[s]=u.useCanvasWidth(),[,i]=u.useSelectedBlockIds(),c=u.useSelectedBlock(),[,r]=u.useHighlightBlockId(),a=h.useRef(null),p=h.useRef(null),[v,R]=h.useState({width:0,height:0}),x=st(v),[f,g]=h.useState(0),[S,B]=h.useState([]),[,w]=h.useState([]),[,D]=G.useAtom(u.canvasIframeAtom),[m,U]=u.useSelectedStylingBlocks(),L=P.useBuilderProp("loadingCanvas",!1);h.useEffect(()=>{const{clientWidth:O,clientHeight:W}=p.current;R({width:O,height:W}),f===0&&g(O)},[p,s,f]);const J=(O,W=0)=>{const{top:$}=O.getBoundingClientRect();return $+W>=0&&$-W<=window.innerHeight};h.useEffect(()=>{var O,W;if(c&&c.type!=="Multiple"&&a.current){const $=Ae(a.current.contentDocument,c._id);$&&(J($)||(W=(O=a.current)==null?void 0:O.contentWindow)==null||W.scrollTo({top:$.offsetTop,behavior:"smooth"}),B([$]))}},[c]),h.useEffect(()=>{if(!d.isEmpty(m)&&a.current){const O=wt(a.current.contentDocument,d.first(m).id);w(O?[O]:[null])}else w([null])},[m]);const Q=h.useMemo(()=>{let O=nt;return n==="offline"&&(O=O.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),U([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:f>0&&!d.isEmpty(x)?{width:t?"100%":f}:{},ref:p,children:e.jsxRuntimeExports.jsxs(pt,{contentDidMount:()=>D(a.current),ref:a,id:"canvas-iframe",style:{width:`${s}px`,...x},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:Q,children:[e.jsxRuntimeExports.jsx(xt,{}),e.jsxRuntimeExports.jsx(mt,{block:c,selectedBlockElement:d.first(S)}),e.jsxRuntimeExports.jsx(yt,{model:"page"}),e.jsxRuntimeExports.jsxs(ft,{children:[L?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(P.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(kt,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},Ct=h.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-4f054351.cjs"))),Tt=()=>{const n=P.useBuilderProp("mode",ee.STATIC),[t,s]=G.useAtom(u.addBlocksModalAtom),i={[ee.STATIC]:e.jsxRuntimeExports.jsx(St,{}),[ee.FRAMEWORK]:null}[n];return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(tt,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[e.jsxRuntimeExports.jsx(h.Suspense,{fallback:e.jsxRuntimeExports.jsx(P.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(u.ErrorBoundary,{children:i})}),t?e.jsxRuntimeExports.jsx("div",{onClick:()=>s(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:c=>c.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:e.jsxRuntimeExports.jsx(Ct,{})})}):null]})]})};exports.default=Tt;
|
|
@@ -3,7 +3,7 @@ import { S as x, c as h, b as f, d as j, f as y } from "./select-7fddd7c3.js";
|
|
|
3
3
|
import { sortBy as P, filter as v, get as b, isEmpty as n, find as m, capitalize as S, map as w } from "lodash";
|
|
4
4
|
import { toast as C } from "sonner";
|
|
5
5
|
import { useEffect as l } from "react";
|
|
6
|
-
import { R as k, Q as N, c as B, T as E, U as T } from "./index-
|
|
6
|
+
import { R as k, Q as N, c as B, T as E, U as T } from "./index-914d197c.js";
|
|
7
7
|
import "react-i18next";
|
|
8
8
|
import { BriefcaseIcon as I } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-icons";
|
|
@@ -20,7 +20,8 @@ import "i18next";
|
|
|
20
20
|
import "flagged";
|
|
21
21
|
import "react-dnd";
|
|
22
22
|
import "@minoru/react-dnd-treeview";
|
|
23
|
-
import "./useBuilderProp-
|
|
23
|
+
import "./useBuilderProp-21feb2da.js";
|
|
24
|
+
import "@radix-ui/react-alert-dialog";
|
|
24
25
|
import "@radix-ui/react-slot";
|
|
25
26
|
import "class-variance-authority";
|
|
26
27
|
import "@radix-ui/react-tooltip";
|
|
@@ -32,7 +33,7 @@ import "himalaya";
|
|
|
32
33
|
import "redux-undo";
|
|
33
34
|
import "@react-hookz/web";
|
|
34
35
|
import "@chaibuilder/blocks";
|
|
35
|
-
const
|
|
36
|
+
const ue = () => {
|
|
36
37
|
const { data: t } = k(), { data: a, isLoading: c } = N(), { syncState: p } = B(), d = E(), [i, s] = T(), o = P(v(a, { type: "STATIC" }), (r) => b(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
|
|
37
38
|
l(() => {
|
|
38
39
|
!n(a) && t.homepage && !m(a, { uuid: i }) && s(t.homepage);
|
|
@@ -86,5 +87,5 @@ const de = () => {
|
|
|
86
87
|
);
|
|
87
88
|
};
|
|
88
89
|
export {
|
|
89
|
-
|
|
90
|
+
ue as default
|
|
90
91
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("./select-0e32300c.cjs"),t=require("lodash"),h=require("sonner"),l=require("react"),n=require("./index-6fc652ec.cjs");require("react-i18next");const j=require("lucide-react");require("@radix-ui/react-icons");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-adacf42f.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");const p=()=>{const{data:s}=n.useProject(),{data:u,isLoading:x}=n.usePages(),{syncState:d}=n.useSavePage(),m=n.useChangePage(),[a,o]=n.useCurrentPage(),c=t.sortBy(t.filter(u,{type:"STATIC"}),r=>t.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!t.isEmpty(u)&&s.homepage&&!t.find(u,{uuid:a})&&o(s.homepage)},[a,u,s,o]),l.useEffect(()=>()=>o(null),[o]);const g=r=>{if(d!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const q=t.find(c,{uuid:r});m(q)}};return x||t.isEmpty(a)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),t.capitalize(s.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(i.Select,{value:a||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(i.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(i.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(i.SelectContent,{children:t.map(c,r=>e.jsxRuntimeExports.jsx(i.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
|
|
@@ -5,7 +5,7 @@ import "@radix-ui/react-tabs";
|
|
|
5
5
|
import "./utils-ac68b2c8.js";
|
|
6
6
|
import "clsx";
|
|
7
7
|
import "tailwind-merge";
|
|
8
|
-
const f = r.lazy(() => import("./UnsplashImages-
|
|
8
|
+
const f = r.lazy(() => import("./UnsplashImages-4edb97e7.js")), p = r.lazy(() => import("./UploadImages-52181c3e.js")), x = ({
|
|
9
9
|
isModalView: s = !1,
|
|
10
10
|
onSelect: a = () => {
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-98c085c2.cjs"))),i=l.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-61ef83ad.cjs"))),o=({isModalView:a=!1,onSelect:t=()=>{}})=>{const[r,n]=l.useState("upload");return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:a?"Select or upload images":"Images"})}),e.jsxRuntimeExports.jsxs(s.Tabs,{value:r,onValueChange:u=>n(u),className:"flex h-full w-full flex-col py-2",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"w-full",children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"upload",className:"w-1/2",children:"Upload"}),e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"unsplash",className:"w-1/2",children:"Unsplash"})]}),r==="unsplash"?e.jsxRuntimeExports.jsx(s.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(x,{isModalView:a,onSelect:t})})}):e.jsxRuntimeExports.jsx(s.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(i,{isModalView:a,onSelect:t})})})]})]})},c=o;exports.default=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),s=require("@radix-ui/react-icons"),f=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),P=require("react-i18next"),x=require("./index-6fc652ec.cjs"),_=require("lucide-react"),v=require("./utils-3c452dd0.cjs"),m=require("react"),H=require("./MODIFIERS-4716c669.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),q=require("./useBuilderProp-adacf42f.cjs"),L=require("./scroll-area-bb343b86.cjs"),F=require("jotai");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const S=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(_.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function V(t=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(t))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))return"Visible on mobile";if(t.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const z=t=>{let n="";return Object.keys(t).forEach(r=>{a.startsWith(t[r],H.STYLES_KEY)&&(n=t[r])}),n},G=t=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=t,{id:i,data:l}=t.node,d=t.depth*10,j=p=>{p.stopPropagation(),t.onToggle(t.node.id)},I=y.useDragOver(i,t.isOpen,t.onToggle),g=m.useMemo(()=>{const p=z(t.node.data);return V(p)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&t.onSelect(i)},onContextMenu:()=>t.onSelect(i),style:{paddingInlineStart:d},...I,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:t.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(S,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=t.node.data)==null?void 0:R._name)||t.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},$=t=>{var r;const{item:n}=t.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(S,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},K=t=>{const n=t.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},Q=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-1a3d5e53.cjs"))),U=()=>{const[t]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},Y=()=>{const[t]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},W=()=>{const[t]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},J=({id:t=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=q.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(s.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsx(Y,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(W,{})]})},X=({children:t,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(Q,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(J,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},Z=()=>{const{addCoreBlock:t}=x.useAddBlock(),n=q.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return t({blocks:d},i===0?null:i,l)}return t(c,i===0?null:i,l)},[t])};function ee(t){return a.map(t,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const te=()=>{const t=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=P.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=Z(),[,R]=F.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:B,dropTargetId:N,monitor:O}=E,A=ee(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:B}),R(!1))},w=a.map(t,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(t,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=f.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:a.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(s.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(s.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(L.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:w,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(X,{id:o.id,children:e.jsxRuntimeExports.jsx(G,{onSelect:B=>{l([]),c([B])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx($,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx(K,{node:o,depth:E})})})})})};exports.default=te;
|