@chaibuilder/sdk 1.0.19 → 1.0.20
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-LvIqNyBE.cjs +3 -0
- package/dist/{AddBlocks-eoo1CzaK.js → AddBlocks-U6bHEqmk.js} +23 -23
- package/dist/{BrandingOptions-1zbCs5bl.js → BrandingOptions-qDgIOayU.js} +3 -3
- package/dist/{BrandingOptions-DXAH3zCN.cjs → BrandingOptions-viABH78W.cjs} +1 -1
- package/dist/{CanvasArea-Mpb5yTgf.js → CanvasArea-_poBbOON.js} +5 -5
- package/dist/{CanvasArea-AsL1cGRZ.cjs → CanvasArea-yXpQHB6x.cjs} +2 -2
- package/dist/{CurrentPage-ddbm_deC.js → CurrentPage-SrovfgGL.js} +4 -4
- package/dist/{CurrentPage-VYXjpKJ-.cjs → CurrentPage-XWSb_RZ8.cjs} +1 -1
- package/dist/{Layers-3UtlSah_.js → Layers-OKJ5nkTF.js} +5 -5
- package/dist/{Layers-cUeI3Uhq.cjs → Layers-oluQMEyo.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-lYL8cO9x.cjs → MarkAsGlobalBlock-PG9EQfno.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-ySc-D4SB.js → MarkAsGlobalBlock-Ynq-S6mW.js} +2 -2
- package/dist/{PagesPanel-nLcJD9CK.js → PagesPanel-5macGkBU.js} +5 -5
- package/dist/{PagesPanel-iFpq7X9a.cjs → PagesPanel-wYA8ksbF.cjs} +1 -1
- package/dist/{ProjectPanel-Nq_fot83.cjs → ProjectPanel-4hGK3CSo.cjs} +1 -1
- package/dist/{ProjectPanel-sFE2KDi-.js → ProjectPanel-HS_TJ2k0.js} +5 -5
- package/dist/{Settings-UOB68lg0.js → Settings-23ZBoDkz.js} +84 -84
- package/dist/Settings-KS4sVa5a.cjs +1 -0
- package/dist/{SidePanels-IFF2nXXZ.js → SidePanels-HzpyQU1x.js} +5 -5
- package/dist/SidePanels-IfwzrWxw.cjs +1 -0
- package/dist/{Topbar-lX9OMPwj.js → Topbar-tfg74vbT.js} +2 -2
- package/dist/{Topbar-qi5ab8rR.cjs → Topbar-zZtHp9g8.cjs} +1 -1
- package/dist/{UnsplashImages-a2r7b3kB.cjs → UnsplashImages-nA7MSE46.cjs} +1 -1
- package/dist/{UnsplashImages-u_QTABzi.js → UnsplashImages-tvUZGbHK.js} +2 -2
- package/dist/{UploadImages-jLQgLujd.cjs → UploadImages-Ne7knL-U.cjs} +1 -1
- package/dist/{UploadImages-gV5xDHIu.js → UploadImages-pKoVEsI7.js} +2 -2
- package/dist/{add-page-modal-1z_f7PxL.js → add-page-modal-217go3Eh.js} +5 -5
- package/dist/{add-page-modal-iRSIjkvI.cjs → add-page-modal-az5Y2__Z.cjs} +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{confirm-alert-ZQ-sxX0X.js → confirm-alert-AG96Fmck.js} +2 -2
- package/dist/{confirm-alert-z74-fGOT.cjs → confirm-alert-tADWj_Cs.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +4 -4
- package/dist/{delete-page-modal-OnKk3P5L.js → delete-page-modal-YYt_TVmB.js} +4 -4
- package/dist/{delete-page-modal-a3Tb8T6e.cjs → delete-page-modal-iits21u4.cjs} +1 -1
- package/dist/{form-Osm1AmO5.cjs → form-Ik57WNLs.cjs} +1 -1
- package/dist/{form-zZJyZuNH.js → form-gIapXg-W.js} +1 -1
- package/dist/{index-2-Cf7p7w.js → index-4DQm5fFW.js} +5 -5
- package/dist/{index-2EHcmZqL.js → index-PrUoEet_.js} +2 -2
- package/dist/{index-XvLiA8z7.js → index-SSmZipiF.js} +1 -1
- package/dist/index-UXNvQkHk.cjs +1 -0
- package/dist/index-plLNWLKk.cjs +9 -0
- package/dist/{index-vKSUqeQx.cjs → index-tTN-yd28.cjs} +2 -2
- package/dist/{page-viewer-9OzvKHZd.cjs → page-viewer-2SE5kCoO.cjs} +1 -1
- package/dist/{page-viewer-d2r9KEIw.js → page-viewer-LQSQxs98.js} +5 -5
- package/dist/{project-general-setting--Qu-QJlM.js → project-general-setting-04N25MvJ.js} +5 -5
- package/dist/{project-general-setting-15WMnfLc.cjs → project-general-setting-XunBDyuZ.cjs} +1 -1
- package/dist/{project-seo-setting-PvLLVhvk.cjs → project-seo-setting-_nu22LPz.cjs} +1 -1
- package/dist/{project-seo-setting-v6l-AbZS.js → project-seo-setting-zxnjvt3c.js} +4 -4
- package/dist/render.cjs +1 -1
- package/dist/render.js +12 -12
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/dist/{single-page-detail-jIi5lRLh.cjs → single-page-detail-TjWZvxFa.cjs} +1 -1
- package/dist/{single-page-detail-olLc2XXk.js → single-page-detail-lJHZSKqK.js} +6 -6
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +4 -4
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +2 -2
- package/package.json +1 -1
- package/dist/AddBlocks-jU0NwP_s.cjs +0 -3
- package/dist/Settings-jiWn1Oof.cjs +0 -1
- package/dist/SidePanels-JhPtKGnL.cjs +0 -1
- package/dist/index-c8zW_D2V.cjs +0 -1
- package/dist/index-fwo4wa7u.cjs +0 -1
- package/dist/index-gmZcUXyn.js +0 -25
- package/dist/index-l9moYwFE.cjs +0 -9
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),n=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-UXNvQkHk.cjs"),y=require("react-dnd"),w=require("@radix-ui/react-icons"),k=require("@chaibuilder/runtime"),q=require("lucide-react"),A=require("./lib.cjs"),T=require("./Class-RZuPYbUS.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("clsx");require("tailwind-merge");const C=({block:r})=>{const{type:o,icon:l,label:c}=r,{addCoreBlock:d,addPredefinedBlock:m}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.activePanelAtom),[,i]=g.useAtom(s.addBlocksModalAtom),E=()=>{t.has(r,"blocks")?m(k.syncBlocksWithDefaults(r.blocks),t.first(p)):d(r,t.first(p)),i(!1),x("layers")},[,f,j]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||o).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:f,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(l||w.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||o})})]})]})},N=({block:r,closePopover:o})=>{var j;const[l,c]=n.useState(!1),d=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=s.useAddBlock(),[x]=s.useSelectedBlockIds(),[,i,E]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),f=n.useCallback(async b=>{if(b.stopPropagation(),t.has(r,"component")){m(r,t.first(x)),o();return}c(!0);const a=await d(r);t.isEmpty(a)||p(k.syncBlocksWithDefaults(a),t.first(x)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=r.name||r.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:l?()=>{}:f,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:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(q.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.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:r.name})})]})]})},I=()=>{const{data:r,isLoading:o}=s.useUILibraryBlocks(),l=k.useChaiBlocks(),c=t.filter(t.values(l),{category:"custom"}),d=t.groupBy(c,"group"),m=t.groupBy(r,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>t.mergeWith(d,m,(a,h)=>{if(t.isArray(a)&&t.isArray(h))return[...a,...h]}),[d,m]),[,E]=g.useAtom(s.addBlocksModalAtom),[f,j]=n.useState("Navbar"),b=t.get(i,f,[]);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:o?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(t.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const R=setTimeout(()=>{j(h)},300);x(R)},onClick:()=>j(h),className:T.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",f===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(b.map(a=>e.jsxRuntimeExports.jsx(N,{block:a,closePopover:()=>E(!1)})))})]})},L=()=>{const[r,o]=n.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[c]=s.useSelectedBlockIds(),[,d]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,p]=g.useAtom(s.addBlocksModalAtom),x=()=>{const i=A.getBlocksFromHTML(r);l([...i],t.first(c)||null),o(""),d(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(s.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(s.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.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(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:r,onChange:i=>o(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(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:r.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(s.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(w.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(s.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."})]})]})]})},v=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],P=(r,o)=>{if(!r)return!t.includes(v,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(v,o)},S=()=>{const[r,o]=n.useState("core"),[l,c]=n.useState("basic"),d=k.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[,p]=g.useAtom(s.addBlocksModalAtom),[x]=s.useSelectedBlockIds(),i=s.useAllBlocks(),E=t.find(i,{_id:t.first(x)}),{data:f,isLoading:j}=s.useUILibraryBlocks(),b=t.groupBy(t.filter(d,u=>P(E,u.type)),"category"),a=t.uniq(t.map(b.core,"group"));n.useEffect(()=>{!t.includes(a,l)&&!t.isEmpty(a)&&!t.isEmpty(l)&&c(t.first(a))},[a,l]);const h=u=>c(B=>B===u?"":u),R=!j&&!t.isEmpty(f)||t.find(t.values(d),{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:r==="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(w.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:u=>{m(""),o(u)},value:r,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(R?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),R?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:"Import"})]})}),r==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:l,className:"w-full px-3",children:n.Children.toArray(t.map(a,u=>t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>h(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).map(B=>e.jsxRuntimeExports.jsx(C,{block:B})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(I,{})}),r==="html"&&e.jsxRuntimeExports.jsx(L,{})]})};exports.default=S;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-qAwJ85SY.js";
|
|
2
|
-
import
|
|
3
|
-
import { has as z, first as g, isEmpty as w, filter as k, values as
|
|
2
|
+
import v, { createElement as K, useState as j, useCallback as q, useMemo as V, useEffect as W, Suspense as J } from "react";
|
|
3
|
+
import { has as z, first as g, isEmpty as w, filter as k, values as B, groupBy as I, mergeWith as Q, isArray as H, get as X, map as L, includes as P, find as E, uniq as Y, reject as M } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { O as F, j as C, az as
|
|
6
|
-
import { useDrag as
|
|
7
|
-
import { BoxIcon as
|
|
8
|
-
import {
|
|
5
|
+
import { O as F, j as C, az as D, aA as N, aH as Z, aI as $, aK as ee, i as se, a8 as O, bv as re, bw as te, bx as oe, by as le, bz as ae, bA as ie, aM as ce, bB as ne, bC as de, B as me, bD as pe, bE as ue, bF as xe, ae as he, aB as fe, aC as be, aD as A, bp as ge, bi as je, bj as ye, bk as we, bl as ke, S as Be } from "./index-PrUoEet_.js";
|
|
6
|
+
import { useDrag as R, DragPreviewImage as _ } from "react-dnd";
|
|
7
|
+
import { BoxIcon as ve, ExclamationTriangleIcon as Ce, Cross1Icon as Ne } from "@radix-ui/react-icons";
|
|
8
|
+
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/runtime";
|
|
9
9
|
import { Loader as Te } from "lucide-react";
|
|
10
10
|
import { getBlocksFromHTML as Ae } from "./lib.js";
|
|
11
11
|
import { b as Ie } from "./Class-nQk08vqd.js";
|
|
@@ -46,15 +46,15 @@ import "@tailwindcss/line-clamp";
|
|
|
46
46
|
import "clsx";
|
|
47
47
|
import "tailwind-merge";
|
|
48
48
|
const Le = ({ block: s }) => {
|
|
49
|
-
const { type: r, icon: t, label: a } = s, { addCoreBlock: c, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(
|
|
49
|
+
const { type: r, icon: t, label: a } = s, { addCoreBlock: c, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(D), [, o] = h(N), f = () => {
|
|
50
50
|
z(s, "blocks") ? d(G(s.blocks), g(m)) : c(s, g(m)), o(!1), n("layers");
|
|
51
|
-
}, [, x, p] =
|
|
51
|
+
}, [, x, p] = R(() => ({
|
|
52
52
|
type: "CHAI_BLOCK",
|
|
53
53
|
item: s
|
|
54
54
|
}));
|
|
55
55
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
56
56
|
/* @__PURE__ */ e.jsx(
|
|
57
|
-
|
|
57
|
+
_,
|
|
58
58
|
{
|
|
59
59
|
connect: p,
|
|
60
60
|
src: "https://placehold.co/100x30/000000/FFF?text=" + (a || r).replace(/ /g, "+")
|
|
@@ -69,7 +69,7 @@ const Le = ({ block: s }) => {
|
|
|
69
69
|
ref: x,
|
|
70
70
|
className: "cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
|
|
71
71
|
children: [
|
|
72
|
-
K(t ||
|
|
72
|
+
K(t || ve, { className: "w-4 h-4 mx-auto" }),
|
|
73
73
|
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || r })
|
|
74
74
|
]
|
|
75
75
|
}
|
|
@@ -79,7 +79,7 @@ const Le = ({ block: s }) => {
|
|
|
79
79
|
] });
|
|
80
80
|
}, Pe = ({ block: s, closePopover: r }) => {
|
|
81
81
|
var p;
|
|
82
|
-
const [t, a] = j(!1), c = se("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, o, f] =
|
|
82
|
+
const [t, a] = j(!1), c = se("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, o, f] = R(
|
|
83
83
|
() => ({
|
|
84
84
|
type: "CHAI_BLOCK",
|
|
85
85
|
item: s
|
|
@@ -99,7 +99,7 @@ const Le = ({ block: s }) => {
|
|
|
99
99
|
);
|
|
100
100
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
101
101
|
/* @__PURE__ */ e.jsx(
|
|
102
|
-
|
|
102
|
+
_,
|
|
103
103
|
{
|
|
104
104
|
connect: f,
|
|
105
105
|
src: "https://placehold.co/100x30/000000/FFF?text=" + ((p = s.name || s.label) == null ? void 0 : p.replace(" ", "+"))
|
|
@@ -124,7 +124,7 @@ const Le = ({ block: s }) => {
|
|
|
124
124
|
)
|
|
125
125
|
] });
|
|
126
126
|
}, Fe = () => {
|
|
127
|
-
const { data: s, isLoading: r } =
|
|
127
|
+
const { data: s, isLoading: r } = O(), t = U(), a = k(B(t), { category: "custom" }), c = I(a, "group"), d = I(s, "group"), [m, n] = j(null), o = V(() => Q(c, d, (l, u) => {
|
|
128
128
|
if (H(l) && H(u))
|
|
129
129
|
return [...l, ...u];
|
|
130
130
|
}), [c, d]), [, f] = h(N), [x, p] = j("Navbar"), b = X(o, x, []);
|
|
@@ -136,7 +136,7 @@ const Le = ({ block: s }) => {
|
|
|
136
136
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
137
137
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
138
138
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
|
|
139
|
-
] }) :
|
|
139
|
+
] }) : v.Children.toArray(
|
|
140
140
|
L(o, (l, u) => /* @__PURE__ */ e.jsx(
|
|
141
141
|
"li",
|
|
142
142
|
{
|
|
@@ -158,12 +158,12 @@ const Le = ({ block: s }) => {
|
|
|
158
158
|
}
|
|
159
159
|
))
|
|
160
160
|
) }),
|
|
161
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children:
|
|
161
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: v.Children.toArray(
|
|
162
162
|
b.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => f(!1) }))
|
|
163
163
|
) })
|
|
164
164
|
] });
|
|
165
165
|
}, He = () => {
|
|
166
|
-
const [s, r] = j(""), { addPredefinedBlock: t } = F(), [a] = C(), [, c] = h(re), [, d] = h(
|
|
166
|
+
const [s, r] = j(""), { addPredefinedBlock: t } = F(), [a] = C(), [, c] = h(re), [, d] = h(D), [, m] = h(N), n = () => {
|
|
167
167
|
const o = Ae(s);
|
|
168
168
|
t([...o], g(a) || null), r(""), c(!1), d("layers"), m(!1);
|
|
169
169
|
};
|
|
@@ -204,14 +204,14 @@ const Le = ({ block: s }) => {
|
|
|
204
204
|
const t = s._type;
|
|
205
205
|
return t === "List" ? r === "ListItem" : t === "Table" ? r === "TableHead" || r === "TableBody" : t === "TableHead" || t === "TableBody" ? r === "TableRow" : t === "TableRow" ? r === "TableCell" : t === "Row" ? r === "Column" : !P(S, r);
|
|
206
206
|
}, As = () => {
|
|
207
|
-
const [s, r] = j("core"), [t, a] = j("basic"), c = U(), [, d] = h(xe), [, m] = h(N), [n] = C(), o = he(), f = E(o, { _id: g(n) }), { data: x, isLoading: p } =
|
|
207
|
+
const [s, r] = j("core"), [t, a] = j("basic"), c = U(), [, d] = h(xe), [, m] = h(N), [n] = C(), o = he(), f = E(o, { _id: g(n) }), { data: x, isLoading: p } = O(), b = I(
|
|
208
208
|
k(c, (i) => Ee(f, i.type)),
|
|
209
209
|
"category"
|
|
210
210
|
), l = Y(L(b.core, "group"));
|
|
211
211
|
W(() => {
|
|
212
212
|
!P(l, t) && !w(l) && !w(t) && a(g(l));
|
|
213
213
|
}, [l, t]);
|
|
214
|
-
const u = (i) => a((T) => T === i ? "" : i), y = !p && !w(x) || E(
|
|
214
|
+
const u = (i) => a((T) => T === i ? "" : i), y = !p && !w(x) || E(B(c), { category: "custom" }) !== void 0;
|
|
215
215
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
216
216
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex justify-between rounded-md bg-background/30 p-1", children: [
|
|
217
217
|
/* @__PURE__ */ e.jsxs("h1", { className: "flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row", children: [
|
|
@@ -245,20 +245,20 @@ const Le = ({ block: s }) => {
|
|
|
245
245
|
] })
|
|
246
246
|
}
|
|
247
247
|
),
|
|
248
|
-
s === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(je, { type: "single", value: t, className: "w-full px-3", children:
|
|
248
|
+
s === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(je, { type: "single", value: t, className: "w-full px-3", children: v.Children.toArray(
|
|
249
249
|
L(
|
|
250
250
|
l,
|
|
251
|
-
(i) => M(k(
|
|
251
|
+
(i) => M(k(B(b.core), { group: i }), {
|
|
252
252
|
hidden: !0
|
|
253
253
|
}).length ? /* @__PURE__ */ e.jsxs(ye, { value: i, className: "border-border", children: [
|
|
254
254
|
/* @__PURE__ */ e.jsx(we, { onClick: () => u(i), className: "py-2 capitalize", children: i }),
|
|
255
|
-
/* @__PURE__ */ e.jsx(ke, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children:
|
|
256
|
-
M(k(
|
|
255
|
+
/* @__PURE__ */ e.jsx(ke, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: v.Children.toArray(
|
|
256
|
+
M(k(B(b.core), { group: i }), { hidden: !0 }).map((T) => /* @__PURE__ */ e.jsx(Le, { block: T }))
|
|
257
257
|
) }) })
|
|
258
258
|
] }) : null
|
|
259
259
|
)
|
|
260
260
|
) }) }),
|
|
261
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(J, { fallback: /* @__PURE__ */ e.jsx(
|
|
261
|
+
s === "ui-blocks" && /* @__PURE__ */ e.jsx(J, { fallback: /* @__PURE__ */ e.jsx(Be, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
262
262
|
s === "html" && /* @__PURE__ */ e.jsx(He, {})
|
|
263
263
|
] });
|
|
264
264
|
};
|
|
@@ -2,8 +2,8 @@ import { j as i } from "./jsx-runtime-qAwJ85SY.js";
|
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import O from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { i as D, x as N } from "./index-
|
|
6
|
-
import { f as p, c as P, y as e } from "./index-
|
|
5
|
+
import { i as D, x as N } from "./index-PrUoEet_.js";
|
|
6
|
+
import { f as p, c as P, y as e } from "./index-SSmZipiF.js";
|
|
7
7
|
import { isEqual as R } from "lodash";
|
|
8
8
|
import "./Class-nQk08vqd.js";
|
|
9
9
|
import "clsx";
|
|
@@ -35,7 +35,7 @@ import "react-quill";
|
|
|
35
35
|
import "jotai";
|
|
36
36
|
import "flat-to-nested";
|
|
37
37
|
import "redux-undo";
|
|
38
|
-
import "
|
|
38
|
+
import "@chaibuilder/runtime";
|
|
39
39
|
import "@react-hookz/web";
|
|
40
40
|
import "react-i18next";
|
|
41
41
|
import "./lib.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WKRPbKtm.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WKRPbKtm.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-UXNvQkHk.cjs"),e=require("./index-plLNWLKk.cjs"),R=require("lodash");require("./Class-RZuPYbUS.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("./lib.cjs");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");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 v=k(C),p=[{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"}],P=()=>{const r=c.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=c.useBrandingOptions(),a=v.useRef(t);v.useEffect(()=>()=>{R.isEqual(t,a.current)||r(a.current)},[]);const q=({formData:l},n)=>{n&&(i(l),a.current=l)},{bodyFont:y,headingFont:f,primaryColor:g,bodyTextDarkColor:b,bodyTextLightColor:m,bodyBgDarkColor:x,secondaryColor:h,bodyBgLightColor:S,roundedCorners:O}=t,s={headingFont:e.f({title:"Heading font",default:f,options:p}),bodyFont:e.f({title:"Body font",default:y,options:p}),roundedCorners:e.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:e.y({title:"Primary",default:g}),secondaryColor:e.y({title:"Secondary",default:h}),bodyBgLightColor:e.y({title:"Body Background (Light)",default:S}),bodyBgDarkColor:e.y({title:"Body Background (Dark)",default:x}),bodyTextLightColor:e.y({title:"Body Text (Light)",default:b}),bodyTextDarkColor:e.y({title:"Body Text (Dark)",default:m})},u={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const n=s[l];return u.properties||(u.properties={}),u.properties[l]=n.schema,d[l]=n.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(j,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:u,formData:t,validator:B,onChange:q})})]})};exports.default=P;
|
|
@@ -5,12 +5,12 @@ import { j as e } from "./jsx-runtime-qAwJ85SY.js";
|
|
|
5
5
|
import z, { createElement as ct, useCallback as V, useState as F, useEffect as _, Component as _e, Children as dt, Suspense as Me, useRef as je, useMemo as ut, lazy as pt } from "react";
|
|
6
6
|
import { map as Q, includes as we, toUpper as oe, round as ft, isEmpty as U, first as ee, get as A, isString as he, memoize as ht, each as mt, find as yt, filter as Ne, isNull as gt } from "lodash";
|
|
7
7
|
import { ResetIcon as ke, MobileIcon as Ce, LaptopIcon as vt, DesktopIcon as xt, DotsVerticalIcon as bt, EraserIcon as jt, ZoomInIcon as wt, DragHandleDots2Icon as kt, ArrowUpIcon as Ct, CopyIcon as Tt, TrashIcon as Et } from "@radix-ui/react-icons";
|
|
8
|
-
import { p as me, B as te, W as Le, aM as St, aN as Ot, aO as Dt, aP as It, aQ as At, R as ye, ai as Bt, aR as Pt, aS as Rt, aT as _t, aU as Mt, aV as Nt, aW as Lt, w as Wt, j as H, aj as Y, D as $t, E as Ft, F as Ut, G as qt, H as zt, I as Ht, J as Yt, K as Kt, at as Vt, L as Xt, U as We, aL as G, m as $e, n as Jt, k as Zt, o as Gt, h as Fe, l as Ue, ag as Qt, aX as en, aY as tn, aZ as nn, a_ as rn, x as sn, _ as ge, ae as qe, a$ as on, a6 as an, b0 as ln, i as cn, S as ze, aA as dn } from "./index-
|
|
8
|
+
import { p as me, B as te, W as Le, aM as St, aN as Ot, aO as Dt, aP as It, aQ as At, R as ye, ai as Bt, aR as Pt, aS as Rt, aT as _t, aU as Mt, aV as Nt, aW as Lt, w as Wt, j as H, aj as Y, D as $t, E as Ft, F as Ut, G as qt, H as zt, I as Ht, J as Yt, K as Kt, at as Vt, L as Xt, U as We, aL as G, m as $e, n as Jt, k as Zt, o as Gt, h as Fe, l as Ue, ag as Qt, aX as en, aY as tn, aZ as nn, a_ as rn, x as sn, _ as ge, ae as qe, a$ as on, a6 as an, b0 as ln, i as cn, S as ze, aA as dn } from "./index-PrUoEet_.js";
|
|
9
9
|
import { useTranslation as He } from "react-i18next";
|
|
10
10
|
import { useAtom as J } from "jotai";
|
|
11
11
|
import Te from "react-dom";
|
|
12
12
|
import { g as un, S as Ee, a as Ye } from "./Class-nQk08vqd.js";
|
|
13
|
-
import { r as Ke, u as pn, B as fn, E as hn } from "./index-
|
|
13
|
+
import { r as Ke, u as pn, B as fn, E as hn } from "./index-4DQm5fFW.js";
|
|
14
14
|
import { flip as mn } from "@floating-ui/dom";
|
|
15
15
|
import { useFloating as yn, shift as gn } from "@floating-ui/react-dom";
|
|
16
16
|
import { useDrag as vn } from "react-dnd";
|
|
@@ -18,7 +18,7 @@ import { useResizeObserver as xn } from "@react-hookz/web";
|
|
|
18
18
|
import { tailwindcssPaletteGenerator as bn } from "@bobthered/tailwindcss-palette-generator";
|
|
19
19
|
import { Provider as jn } from "react-wrap-balancer";
|
|
20
20
|
import { twMerge as wn } from "tailwind-merge";
|
|
21
|
-
import {
|
|
21
|
+
import { getBlockComponent as kn } from "@chaibuilder/runtime";
|
|
22
22
|
import "@radix-ui/react-toggle";
|
|
23
23
|
import "class-variance-authority";
|
|
24
24
|
import "@radix-ui/react-switch";
|
|
@@ -45,7 +45,7 @@ import "flat-to-nested";
|
|
|
45
45
|
import "redux-undo";
|
|
46
46
|
import "clsx";
|
|
47
47
|
import "i18next";
|
|
48
|
-
import "./index-
|
|
48
|
+
import "./index-SSmZipiF.js";
|
|
49
49
|
import "./lib.js";
|
|
50
50
|
import "himalaya";
|
|
51
51
|
import "@mhsdesign/jit-browser-tailwindcss";
|
|
@@ -1267,7 +1267,7 @@ const Gn = () => {
|
|
|
1267
1267
|
)
|
|
1268
1268
|
}
|
|
1269
1269
|
);
|
|
1270
|
-
}, tr = pt(() => import("./AddBlocks-
|
|
1270
|
+
}, tr = pt(() => import("./AddBlocks-U6bHEqmk.js")), cs = () => {
|
|
1271
1271
|
const [n, t] = J(dn);
|
|
1272
1272
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
1273
1273
|
/* @__PURE__ */ e.jsx(Dn, {}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ae=Object.defineProperty;var Pe=(n,t,s)=>t in n?Ae(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var U=(n,t,s)=>(Pe(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),h=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),i=require("./index-
|
|
1
|
+
"use strict";var Ae=Object.defineProperty;var Pe=(n,t,s)=>t in n?Ae(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var U=(n,t,s)=>(Pe(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),h=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),i=require("./index-UXNvQkHk.cjs"),je=require("react-i18next"),Y=require("jotai"),ue=require("react-dom"),K=require("./Class-RZuPYbUS.cjs"),V=require("./index-tTN-yd28.cjs"),Me=require("@floating-ui/dom"),de=require("@floating-ui/react-dom"),_e=require("react-dnd"),Ne=require("@react-hookz/web"),Le=require("@bobthered/tailwindcss-palette-generator"),We=require("react-wrap-balancer"),$e=require("tailwind-merge"),Fe=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("flat-to-nested");require("redux-undo");require("clsx");require("i18next");require("./index-plLNWLKk.cjs");require("./lib.cjs");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("react-textarea-autosize");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Ue=()=>{const{undoCount:n,redoCount:t,undo:s,redo:c}=i.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(i.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{})}),e.jsxRuntimeExports.jsx(i.Button,{disabled:!t,onClick:c,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function He(){const[n,t]=i.useDarkMode(),{t:s}=je.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(i.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(i.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"bg-violet-600":"bg-violet-300"}
|
|
2
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
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 pe=({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"}})]}),fe=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(M.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(M.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(pe,{}),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(pe,{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(M.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(M.DesktopIcon,{}),width:1920}],ze=({title:n,content:t,currentBreakpoint:s,breakpoint:c,width:u,icon:o,onClick:a})=>e.jsxRuntimeExports.jsxs(i.HoverCard,{children:[e.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>a(u),size:"sm",variant:c===s?"secondary":"ghost",children:o})}),e.jsxRuntimeExports.jsx(i.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})]})})})]}),Ye=()=>{const[,n,t]=i.useCanvasWidth(),[s,c]=i.useSelectedBreakpoints(),u=o=>{s.includes(o)?s.length>2&&c(s.filter(a=>a!==o)):c(a=>[...a,o])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(fe.filter(o=>x.includes(s,x.toUpper(o.breakpoint))),o=>h.createElement(ze,{...o,onClick:t,key:o.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(M.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),x.map(fe,o=>e.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>u(x.toUpper(o.breakpoint)),checked:x.includes(s,x.toUpper(o.breakpoint)),children:o.title},o.breakpoint))]})]})]})},Ke=()=>{const[n]=i.useSetAllBlocks(),{createSnapshot:t}=i.useCanvasHistory(),[,s]=i.useSelectedBlockIds(),[,c]=i.useSelectedStylingBlocks(),u=h.useCallback(()=>{n([]),s([]),c([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(i.AlertDialog,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(M.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs(i.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs(i.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx(i.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs(i.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(i.AlertDialogAction,{onClick:u,children:"Yes"})]})]})]})})},Ve=()=>{const n=i.useFeatureSupport("darkMode",!1),[t]=i.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(He,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(Ye,{}),e.jsxRuntimeExports.jsx(i.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(M.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ue,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ke,{})]})]})},Xe=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
@@ -43,4 +43,4 @@ Valid keys: `+JSON.stringify(Object.keys(r),null," "));var A=_(b,I,y,C,v+"."+I,
|
|
|
43
43
|
outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
44
44
|
}`)},[s,R]),h.useEffect(()=>{j&&(j.textContent=u?`[data-style-id="${u}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[u,s,j]),h.useEffect(()=>{p&&(p.textContent=`${x.map(o,({id:S})=>`[data-style-id="${S}"]`).join(",")}{
|
|
45
45
|
outline: 1px solid orange !important; outline-offset: -1px;
|
|
46
|
-
}`)},[o,p]),h.useEffect(()=>{if(n==="section")return;const S=x.get(t,"bodyTextLightColor","#64748b"),O=x.get(t,"bodyTextDarkColor","#94a3b8"),w=x.get(t,"bodyBgLightColor","#FFFFFF"),B=x.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${O}] dark:bg-[${B}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${d.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&d!==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"}),d&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${d}",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},dt=()=>{const{t:n}=je.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")})})},pt=n=>{const t={};return Object.keys(n).forEach(s=>{x.isString(n[s])&&n[s].startsWith(K.SLOT_KEY)&&(t[s]=n[s].replace(K.SLOT_KEY,"").split(","))}),t},ft=x.memoize(n=>{const t=n.replace(K.STYLES_KEY,"").split(",");return $e.twMerge(t[0],t[1])});function xt(n,t){return x.get(n,`${t}_attrs`,{})}function ht(n,t,s,c){const u={};return Object.keys(n).forEach(o=>{if(x.isString(n[o])&&n[o].startsWith(K.STYLES_KEY)){const a=ft(n[o]);u[o]={className:a,"data-style-prop":o,"data-block-parent":n._id,"data-style-id":`${o}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:c,...xt(n,o)}}}),u}function mt(n,t){const s=x.get(n,"_bindings",{});return x.isEmpty(s)?{...n}:(x.each(s,(c,u)=>{x.isString(c)&&x.get(t,c,null)&&(n[u]=x.get(t,c,null))}),n)}function oe({blocks:n}){const t=i.useAllBlocks(),[,s]=i.useHighlightBlockId(),[,c]=i.useSelectedStylingBlocks(),[,u]=i.useSelectedBlockIds(),o=h.useCallback(p=>{var g;const d=(g=p.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(d||""),p.stopPropagation()},[s]),a=h.useCallback(p=>{s(""),p.stopPropagation()},[s]),f=h.useCallback(p=>{p.stopPropagation();const d=p.currentTarget;if(d.getAttribute("data-block-parent")){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}]),u([O])}else if(d.getAttribute("data-block-id")&&(u([d.getAttribute("data-block-id")]),d.getAttribute("data-block-parent"))){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}])}},[c,u]),j=h.useCallback(p=>ht(p,o,a,f),[f,o,a]),[R]=V.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((p,d)=>{const g=pt(p),S={};x.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map($=>e.jsxRuntimeExports.jsx(oe,{blocks:[x.find(t,{_id:$})]})))});const O=x.filter(t,{_parent:p._id});S.children=O.length?e.jsxRuntimeExports.jsx(oe,{blocks:O}):null;const w=Fe.
|
|
46
|
+
}`)},[o,p]),h.useEffect(()=>{if(n==="section")return;const S=x.get(t,"bodyTextLightColor","#64748b"),O=x.get(t,"bodyTextDarkColor","#94a3b8"),w=x.get(t,"bodyBgLightColor","#FFFFFF"),B=x.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${O}] dark:bg-[${B}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${d.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&d!==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"}),d&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${d}",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},dt=()=>{const{t:n}=je.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")})})},pt=n=>{const t={};return Object.keys(n).forEach(s=>{x.isString(n[s])&&n[s].startsWith(K.SLOT_KEY)&&(t[s]=n[s].replace(K.SLOT_KEY,"").split(","))}),t},ft=x.memoize(n=>{const t=n.replace(K.STYLES_KEY,"").split(",");return $e.twMerge(t[0],t[1])});function xt(n,t){return x.get(n,`${t}_attrs`,{})}function ht(n,t,s,c){const u={};return Object.keys(n).forEach(o=>{if(x.isString(n[o])&&n[o].startsWith(K.STYLES_KEY)){const a=ft(n[o]);u[o]={className:a,"data-style-prop":o,"data-block-parent":n._id,"data-style-id":`${o}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:c,...xt(n,o)}}}),u}function mt(n,t){const s=x.get(n,"_bindings",{});return x.isEmpty(s)?{...n}:(x.each(s,(c,u)=>{x.isString(c)&&x.get(t,c,null)&&(n[u]=x.get(t,c,null))}),n)}function oe({blocks:n}){const t=i.useAllBlocks(),[,s]=i.useHighlightBlockId(),[,c]=i.useSelectedStylingBlocks(),[,u]=i.useSelectedBlockIds(),o=h.useCallback(p=>{var g;const d=(g=p.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(d||""),p.stopPropagation()},[s]),a=h.useCallback(p=>{s(""),p.stopPropagation()},[s]),f=h.useCallback(p=>{p.stopPropagation();const d=p.currentTarget;if(d.getAttribute("data-block-parent")){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}]),u([O])}else if(d.getAttribute("data-block-id")&&(u([d.getAttribute("data-block-id")]),d.getAttribute("data-block-parent"))){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}])}},[c,u]),j=h.useCallback(p=>ht(p,o,a,f),[f,o,a]),[R]=V.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((p,d)=>{const g=pt(p),S={};x.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map($=>e.jsxRuntimeExports.jsx(oe,{blocks:[x.find(t,{_id:$})]})))});const O=x.filter(t,{_parent:p._id});S.children=O.length?e.jsxRuntimeExports.jsx(oe,{blocks:O}):null;const w=Fe.getBlockComponent(p._type),B=x.get(w,"component",null);return x.isNull(B)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${p==null?void 0:p._type} not registered -->`}):e.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(B,{blockProps:{onClick:f,"data-block-id":p._id,"data-block-type":p._type},inBuilder:!0,index:d,...mt(p,R),...j(p),...S})})}))})}const yt=()=>{const n=i.useAllBlocks();return e.jsxRuntimeExports.jsx(We.Provider,{children:x.isEmpty(n)?e.jsxRuntimeExports.jsx(dt,{}):e.jsxRuntimeExports.jsx(V.BlocksExternalDataProvider,{children:e.jsxRuntimeExports.jsx(oe,{blocks:x.filter(n,t=>x.isEmpty(t._parent))})})})},gt=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),vt=()=>{const[n]=Y.useAtom(i.networkModeAtom),[t]=i.usePreviewMode(),[s]=i.useCanvasWidth(),[,c]=i.useSelectedBlockIds(),u=i.useSelectedBlock(),[,o]=i.useHighlightBlockId(),a=h.useRef(null),f=h.useRef(null),[j,R]=h.useState({width:0,height:0}),p=Ze(j),[d,g]=h.useState(0),[S,O]=h.useState([]),[,w]=h.useState([]),[,B]=Y.useAtom(i.canvasIframeAtom),[m,$]=i.useSelectedStylingBlocks(),N=i.useBuilderProp("loadingCanvas",!1);h.useEffect(()=>{const{clientWidth:q,clientHeight:L}=f.current;R({width:q,height:L}),d===0&&g(q)},[f,s,d]);const G=(q,L=0)=>{const{top:W}=q.getBoundingClientRect();return W+L>=0&&W-L<=window.innerHeight};h.useEffect(()=>{var q,L;if(u&&u.type!=="Multiple"&&a.current){const W=Se(a.current.contentDocument,u._id);W&&(G(W)||(L=(q=a.current)==null?void 0:q.contentWindow)==null||L.scrollTo({top:W.offsetTop,behavior:"smooth"}),O([W]))}},[u]),h.useEffect(()=>{if(!x.isEmpty(m)&&a.current){const q=gt(a.current.contentDocument,x.first(m).id);w(q?[q]:[null])}else w([null])},[m]);const J=h.useMemo(()=>{let q=Xe;return n==="offline"&&(q=q.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),q=q.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),q=q.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),q},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{c([]),$([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full",style:d>0&&!x.isEmpty(p)?{width:t?"100%":d}:{},ref:f,children:e.jsxRuntimeExports.jsxs(it,{contentDidMount:()=>B(a.current),ref:a,id:"canvas-iframe",style:{width:`${s}px`,...p},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:J,children:[e.jsxRuntimeExports.jsx(at,{}),e.jsxRuntimeExports.jsx(lt,{block:u,selectedBlockElement:x.first(S)}),e.jsxRuntimeExports.jsx(ut,{model:"page"}),e.jsxRuntimeExports.jsxs(ot,{children:[N?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(yt,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},jt=h.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-LvIqNyBE.cjs"))),Et=()=>{const[n,t]=Y.useAtom(i.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(Ve,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/80 px-2 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(i.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(V.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(vt,{})})}),n?e.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:s=>s.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(jt,{})})}):null]})]})};exports.default=Et;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-qAwJ85SY.js";
|
|
2
|
-
import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-
|
|
2
|
+
import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-PrUoEet_.js";
|
|
3
3
|
import { sortBy as P, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
|
|
4
4
|
import { toast as S } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { b as k, a as B, d as E, e as I } from "./index-
|
|
6
|
+
import { b as k, a as B, d as E, e as I } from "./index-4DQm5fFW.js";
|
|
7
7
|
import { BriefcaseIcon as L } from "lucide-react";
|
|
8
8
|
import "./Class-nQk08vqd.js";
|
|
9
9
|
import "clsx";
|
|
@@ -35,11 +35,11 @@ import "react-quill";
|
|
|
35
35
|
import "jotai";
|
|
36
36
|
import "flat-to-nested";
|
|
37
37
|
import "redux-undo";
|
|
38
|
-
import "
|
|
38
|
+
import "@chaibuilder/runtime";
|
|
39
39
|
import "@react-hookz/web";
|
|
40
40
|
import "react-i18next";
|
|
41
41
|
import "i18next";
|
|
42
|
-
import "./index-
|
|
42
|
+
import "./index-SSmZipiF.js";
|
|
43
43
|
import "./lib.js";
|
|
44
44
|
import "himalaya";
|
|
45
45
|
import "@mhsdesign/jit-browser-tailwindcss";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),s=require("./index-UXNvQkHk.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-tTN-yd28.cjs"),j=require("lucide-react");require("./Class-RZuPYbUS.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("./index-plLNWLKk.cjs");require("./lib.cjs");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?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"}),i.capitalize(t.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(s.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(s.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(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
|
|
@@ -4,12 +4,12 @@ import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHor
|
|
|
4
4
|
import { useDrop as Ie, useDragLayer as ke } from "react-dnd";
|
|
5
5
|
import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
|
|
6
6
|
import { useTranslation as Ce } from "react-i18next";
|
|
7
|
-
import { _ as ve, Z as we, j as g, n as Se, bq as d, k as Te, l as De, a6 as Ne, m as Me, o as Oe, i as w, br as Re, ao as Ee, ap as Ae, bs as _e, bt as Pe, O as He, ae as Le, w as Ve, aj as ze, p as Fe, aA as Ge, bp as $e, bu as Ke } from "./index-
|
|
7
|
+
import { _ as ve, Z as we, j as g, n as Se, bq as d, k as Te, l as De, a6 as Ne, m as Me, o as Oe, i as w, br as Re, ao as Ee, ap as Ae, bs as _e, bt as Pe, O as He, ae as Le, w as Ve, aj as ze, p as Fe, aA as Ge, bp as $e, bu as Ke } from "./index-PrUoEet_.js";
|
|
8
8
|
import { DatabaseIcon as qe } from "lucide-react";
|
|
9
9
|
import "./lib.js";
|
|
10
10
|
import { useMemo as Qe, lazy as Ue, useCallback as S, useState as Ye, Suspense as We } from "react";
|
|
11
11
|
import { a as Ze, b as T } from "./Class-nQk08vqd.js";
|
|
12
|
-
import { f as Je } from "./index-
|
|
12
|
+
import { f as Je } from "./index-4DQm5fFW.js";
|
|
13
13
|
import { useAtom as Xe } from "jotai";
|
|
14
14
|
import "@radix-ui/react-toggle";
|
|
15
15
|
import "class-variance-authority";
|
|
@@ -36,7 +36,7 @@ import "react-dom";
|
|
|
36
36
|
import "react-quill";
|
|
37
37
|
import "flat-to-nested";
|
|
38
38
|
import "redux-undo";
|
|
39
|
-
import "
|
|
39
|
+
import "@chaibuilder/runtime";
|
|
40
40
|
import "@react-hookz/web";
|
|
41
41
|
import "himalaya";
|
|
42
42
|
import "@mhsdesign/jit-browser-tailwindcss";
|
|
@@ -48,7 +48,7 @@ import "@tailwindcss/line-clamp";
|
|
|
48
48
|
import "clsx";
|
|
49
49
|
import "tailwind-merge";
|
|
50
50
|
import "i18next";
|
|
51
|
-
import "./index-
|
|
51
|
+
import "./index-SSmZipiF.js";
|
|
52
52
|
import "@floating-ui/react-dom";
|
|
53
53
|
import "react-textarea-autosize";
|
|
54
54
|
import "flagged";
|
|
@@ -206,7 +206,7 @@ const tt = (t) => {
|
|
|
206
206
|
}, nt = (t) => {
|
|
207
207
|
const s = t.depth * 10 + 16;
|
|
208
208
|
return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: s } });
|
|
209
|
-
}, rt = Ue(() => import("./MarkAsGlobalBlock-
|
|
209
|
+
}, rt = Ue(() => import("./MarkAsGlobalBlock-Ynq-S6mW.js")), at = () => {
|
|
210
210
|
const [t] = g(), [, s] = Se();
|
|
211
211
|
return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
|
|
212
212
|
/* @__PURE__ */ e.jsx(me, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),u=require("lodash"),s=require("@radix-ui/react-icons"),B=require("react-dnd"),q=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-c8zW_D2V.cjs"),O=require("lucide-react");require("./lib.cjs");const p=require("react"),f=require("./Class-RZuPYbUS.cjs"),A=require("./index-vKSUqeQx.cjs"),_=require("jotai");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("./index-fwo4wa7u.cjs");require("@react-hookz/web");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("clsx");require("tailwind-merge");require("i18next");require("./index-l9moYwFE.cjs");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const C=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(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function P(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 c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const H=t=>{let n="";return Object.keys(t).forEach(o=>{u.startsWith(t[o],f.STYLES_KEY)&&(n=t[o])}),n},L=t=>{var g;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=t,{id:c,data:l}=t.node,a=t.depth*10,m=d=>{d.stopPropagation(),t.onToggle(t.node.id)},E=q.useDragOver(c,t.isOpen,t.onToggle),j=p.useMemo(()=>{const d=H(t.node.data);return P(d)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:f.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:d=>{d.stopPropagation(),!o.includes(c)&&t.onSelect(c)},onContextMenu:()=>t.onSelect(c),style:{paddingInlineStart:a},...E,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:m,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(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((g=t.node.data)==null?void 0:g._name)||t.node.text}),j?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",j,")"]}):null]})]})})},V=t=>{var o;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(C,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=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}})},F=p.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-lYL8cO9x.cjs"))),G=()=>{const[t]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},$=()=>{const[t]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},K=()=>{const[t]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},Q=({id:t=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),a=r.useBuilderProp("globalBlocksSupport",!1),m=p.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[a&&e.jsxRuntimeExports.jsx(r.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(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(G,{}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(K,{})]})},U=({children:t,id:n=null})=>{const[o,i]=p.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(p.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(F,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(Q,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})},Y=()=>{const{addCoreBlock:t}=r.useAddBlock(),n=r.useBuilderProp("getExternalPredefinedBlock");return p.useCallback(async o=>{const{block:i,dropTargetId:c,relativeIndex:l}=o;if(u.has(i,"format")){const a=await n(i);return t({blocks:a},c===0?null:c,l)}return t(i,c===0?null:c,l)},[t])};function W(t){return u.map(t,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const t=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:a}=N.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),j=Y(),[,g]=_.useAtom(r.addBlocksModalAtom),d=async(x,R)=>{const{dragSource:h,destinationIndex:b,relativeIndex:k,dropTargetId:T,monitor:D}=R,M=W(x);n(M),h?m():(await j({block:D.getItem(),dropTargetId:T,destinationIndex:b,relativeIndex:k}),g(!1))},y=u.map(t,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(t,{_parent:x._id})),data:x})),v=()=>{i([]),l([])},[{isOver:I},w]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await j({block:x,dropTargetId:"",destinationIndex:0,relativeIndex:0}),g(!1)))()}})),{isDragging:S}=B.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:f.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",S?"bg-green-50/80":"bg-background"),children:u.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?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:a(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(q.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:y,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(U,{id:x.id,children:e.jsxRuntimeExports.jsx(L,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{monitorProps:x}),onDrop:d,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),u=require("lodash"),s=require("@radix-ui/react-icons"),B=require("react-dnd"),q=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-UXNvQkHk.cjs"),O=require("lucide-react");require("./lib.cjs");const p=require("react"),f=require("./Class-RZuPYbUS.cjs"),A=require("./index-tTN-yd28.cjs"),_=require("jotai");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("clsx");require("tailwind-merge");require("i18next");require("./index-plLNWLKk.cjs");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const C=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(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function P(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 c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const H=t=>{let n="";return Object.keys(t).forEach(o=>{u.startsWith(t[o],f.STYLES_KEY)&&(n=t[o])}),n},L=t=>{var g;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=t,{id:c,data:l}=t.node,a=t.depth*10,m=d=>{d.stopPropagation(),t.onToggle(t.node.id)},E=q.useDragOver(c,t.isOpen,t.onToggle),j=p.useMemo(()=>{const d=H(t.node.data);return P(d)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:f.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:d=>{d.stopPropagation(),!o.includes(c)&&t.onSelect(c)},onContextMenu:()=>t.onSelect(c),style:{paddingInlineStart:a},...E,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:m,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(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((g=t.node.data)==null?void 0:g._name)||t.node.text}),j?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",j,")"]}):null]})]})})},V=t=>{var o;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(C,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=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}})},F=p.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-PG9EQfno.cjs"))),G=()=>{const[t]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},$=()=>{const[t]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},K=()=>{const[t]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},Q=({id:t=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),a=r.useBuilderProp("globalBlocksSupport",!1),m=p.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[a&&e.jsxRuntimeExports.jsx(r.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(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(G,{}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(K,{})]})},U=({children:t,id:n=null})=>{const[o,i]=p.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(p.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(F,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(Q,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})},Y=()=>{const{addCoreBlock:t}=r.useAddBlock(),n=r.useBuilderProp("getExternalPredefinedBlock");return p.useCallback(async o=>{const{block:i,dropTargetId:c,relativeIndex:l}=o;if(u.has(i,"format")){const a=await n(i);return t({blocks:a},c===0?null:c,l)}return t(i,c===0?null:c,l)},[t])};function W(t){return u.map(t,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const t=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:a}=N.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),j=Y(),[,g]=_.useAtom(r.addBlocksModalAtom),d=async(x,R)=>{const{dragSource:h,destinationIndex:b,relativeIndex:k,dropTargetId:T,monitor:D}=R,M=W(x);n(M),h?m():(await j({block:D.getItem(),dropTargetId:T,destinationIndex:b,relativeIndex:k}),g(!1))},y=u.map(t,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(t,{_parent:x._id})),data:x})),v=()=>{i([]),l([])},[{isOver:I},w]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await j({block:x,dropTargetId:"",destinationIndex:0,relativeIndex:0}),g(!1)))()}})),{isDragging:S}=B.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:f.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",S?"bg-green-50/80":"bg-background"),children:u.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?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:a(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(q.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:y,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(U,{id:x.id,children:e.jsxRuntimeExports.jsx(L,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{monitorProps:x}),onDrop:d,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-UXNvQkHk.cjs"),c=require("lodash");require("./Class-RZuPYbUS.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const x=({id:t=null,closeModal:i})=>{const l=s.useMarkAsGlobalBlock(),[r,a]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(n.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:u=>a(u.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{l(t,c.capitalize(r)),i()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(s.Button,{variant:"outline",onClick:i,children:"Cancel"})]})]})};exports.default=x;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-qAwJ85SY.js";
|
|
2
2
|
import { GlobeIcon as m } from "@radix-ui/react-icons";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
|
-
import { $ as p, B as o } from "./index-
|
|
4
|
+
import { $ as p, B as o } from "./index-PrUoEet_.js";
|
|
5
5
|
import { capitalize as c } from "lodash";
|
|
6
6
|
import "./Class-nQk08vqd.js";
|
|
7
7
|
import "clsx";
|
|
@@ -32,7 +32,7 @@ import "react-quill";
|
|
|
32
32
|
import "jotai";
|
|
33
33
|
import "flat-to-nested";
|
|
34
34
|
import "redux-undo";
|
|
35
|
-
import "
|
|
35
|
+
import "@chaibuilder/runtime";
|
|
36
36
|
import "@react-hookz/web";
|
|
37
37
|
import "react-i18next";
|
|
38
38
|
const W = ({ id: e = null, closeModal: l }) => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-qAwJ85SY.js";
|
|
2
2
|
import i, { Suspense as s } from "react";
|
|
3
3
|
import { sortBy as a, filter as d, get as n } from "lodash";
|
|
4
|
-
import { a as l, b as c } from "./index-
|
|
4
|
+
import { a as l, b as c } from "./index-4DQm5fFW.js";
|
|
5
5
|
import "./Class-nQk08vqd.js";
|
|
6
6
|
import "clsx";
|
|
7
7
|
import "tailwind-merge";
|
|
8
8
|
import "i18next";
|
|
9
9
|
import "react-i18next";
|
|
10
|
-
import "./index-
|
|
11
|
-
import "
|
|
10
|
+
import "./index-SSmZipiF.js";
|
|
11
|
+
import "@chaibuilder/runtime";
|
|
12
12
|
import "@radix-ui/react-icons";
|
|
13
13
|
import "./lib.js";
|
|
14
14
|
import "himalaya";
|
|
@@ -18,7 +18,7 @@ import "@tailwindcss/forms";
|
|
|
18
18
|
import "@tailwindcss/typography";
|
|
19
19
|
import "@tailwindcss/aspect-ratio";
|
|
20
20
|
import "@tailwindcss/line-clamp";
|
|
21
|
-
import "./index-
|
|
21
|
+
import "./index-PrUoEet_.js";
|
|
22
22
|
import "@radix-ui/react-toggle";
|
|
23
23
|
import "class-variance-authority";
|
|
24
24
|
import "@radix-ui/react-switch";
|
|
@@ -54,7 +54,7 @@ import "@minoru/react-dnd-treeview";
|
|
|
54
54
|
import "react-hotkeys-hook";
|
|
55
55
|
import "sonner";
|
|
56
56
|
import "lucide-react";
|
|
57
|
-
const x = i.lazy(() => import("./add-page-modal-
|
|
57
|
+
const x = i.lazy(() => import("./add-page-modal-217go3Eh.js")), g = i.lazy(() => import("./page-viewer-LQSQxs98.js")), ft = () => {
|
|
58
58
|
const { data: o = [], isLoading: m } = l(), { data: r } = c(), p = a(d(o, { type: "STATIC" }), (e) => n(e, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
|
|
59
59
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
60
60
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
|