@chaibuilder/sdk 0.1.16 → 0.1.18
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-5cb44efb.cjs +3 -0
- package/dist/{AddBlocks-6f4db22d.js → AddBlocks-c47af38f.js} +49 -45
- package/dist/BrandingOptions-4f3e3a8d.cjs +1 -0
- package/dist/{BrandingOptions-d6351932.js → BrandingOptions-52b2de6f.js} +11 -7
- package/dist/CanvasArea-90a395c1.js +1311 -0
- package/dist/CanvasArea-aef3fa5e.cjs +46 -0
- package/dist/{CurrentPage-e8f8ff05.js → CurrentPage-2721bc7b.js} +18 -14
- package/dist/CurrentPage-d1ec06db.cjs +1 -0
- package/dist/{ImagesPanel-68a11293.cjs → ImagesPanel-0db5c72f.cjs} +1 -1
- package/dist/{ImagesPanel-996761b1.js → ImagesPanel-38c44785.js} +1 -1
- package/dist/{Layers-6fc21e86.js → Layers-a9cf4d7c.js} +144 -142
- package/dist/Layers-d0edf1a8.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-cf7e8b31.js → MarkAsGlobalBlock-0cf6e5a2.js} +15 -11
- package/dist/MarkAsGlobalBlock-c43c3b2c.cjs +1 -0
- package/dist/PagesPanel-22050a98.cjs +1 -0
- package/dist/{PagesPanel-7db807df.js → PagesPanel-589544c2.js} +12 -8
- package/dist/ProjectPanel-215ba7f1.cjs +1 -0
- package/dist/{ProjectPanel-a7c78e1f.js → ProjectPanel-dbea8af1.js} +12 -8
- package/dist/Settings-71c0312b.cjs +1 -0
- package/dist/{Settings-1e6e0534.js → Settings-c347533e.js} +909 -640
- package/dist/SidePanels-214fef72.js +2999 -0
- package/dist/SidePanels-3844d8b5.cjs +13 -0
- package/dist/{Topbar-4f1aca98.js → Topbar-1dd5c34e.js} +23 -19
- package/dist/Topbar-4fa3ab61.cjs +1 -0
- package/dist/{UnsplashImages-f761ad96.cjs → UnsplashImages-0d091e33.cjs} +1 -1
- package/dist/{UnsplashImages-47374e0c.js → UnsplashImages-10c95b63.js} +1 -1
- package/dist/{UploadImages-33c1507a.cjs → UploadImages-10439fde.cjs} +1 -1
- package/dist/{UploadImages-f0ba3215.js → UploadImages-b14bd152.js} +1 -1
- package/dist/_commonjsHelpers-10dfc225.js +8 -0
- package/dist/_commonjsHelpers-87b0abe8.cjs +1 -0
- package/dist/add-page-modal-05c947fb.cjs +1 -0
- package/dist/{add-page-modal-d4f5ba20.js → add-page-modal-5cc1393d.js} +14 -11
- package/dist/card-14e1d020.cjs +1 -0
- package/dist/card-f8f4f985.js +33 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.js +63 -59
- package/dist/delete-page-modal-859c3a09.cjs +1 -0
- package/dist/{delete-page-modal-00d5fbab.js → delete-page-modal-a79bfc45.js} +15 -11
- package/dist/{form-bf09d392.js → form-725e3191.js} +3 -3
- package/dist/{form-5d04c9b3.cjs → form-99b51245.cjs} +1 -1
- package/dist/index-dfeadcce.cjs +164 -0
- package/dist/index-f8a2f8ef.js +31068 -0
- package/dist/{link-6467eda6.js → link-2af5de8b.js} +1 -1
- package/dist/{link-4585b2d6.cjs → link-86ac8848.cjs} +1 -1
- package/dist/page-viewer-aac7b439.cjs +1 -0
- package/dist/{page-viewer-c494031b.js → page-viewer-c6421156.js} +22 -18
- package/dist/project-general-setting-ce814ecf.cjs +1 -0
- package/dist/{project-general-setting-fca12629.js → project-general-setting-f9fd21cc.js} +9 -7
- package/dist/{project-seo-setting-3f645a02.cjs → project-seo-setting-a9403f1d.cjs} +1 -1
- package/dist/{project-seo-setting-e9587467.js → project-seo-setting-c1980ec3.js} +3 -3
- package/dist/render.cjs +1 -1
- package/dist/render.js +1 -1
- package/dist/{scroll-area-9f64a082.js → scroll-area-83bd9e8f.js} +7 -7
- package/dist/{scroll-area-088530b9.cjs → scroll-area-bb343b86.cjs} +1 -1
- package/dist/{single-page-detail-ff7fceb1.js → single-page-detail-2ac00c2e.js} +32 -30
- package/dist/single-page-detail-dcbb3cab.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/textarea-20b2f6b2.cjs +1 -0
- package/dist/textarea-9dfb6a32.js +45 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +74 -73
- package/dist/useChaiExternalData-192c7896.js +5 -0
- package/dist/useChaiExternalData-a90e8aac.cjs +1 -0
- package/package.json +5 -3
- package/dist/AddBlocks-59a68fc9.cjs +0 -3
- package/dist/BrandingOptions-8e7a159f.cjs +0 -1
- package/dist/CanvasArea-08537c6e.cjs +0 -60
- package/dist/CanvasArea-a585620d.js +0 -1459
- package/dist/CurrentPage-cbbfdbf4.cjs +0 -1
- package/dist/Layers-636e0bc6.cjs +0 -1
- package/dist/MarkAsGlobalBlock-23dd24b9.cjs +0 -1
- package/dist/PagesPanel-bf13d0a5.cjs +0 -1
- package/dist/ProjectPanel-d98d3585.cjs +0 -1
- package/dist/Settings-1b76c006.cjs +0 -1
- package/dist/SidePanels-55124e18.cjs +0 -1
- package/dist/SidePanels-af4f2c45.js +0 -149
- package/dist/Topbar-5df341d7.cjs +0 -1
- package/dist/_commonjsHelpers-5a53b418.cjs +0 -1
- package/dist/_commonjsHelpers-d4512b9c.js +0 -6
- package/dist/add-page-modal-b685709e.cjs +0 -1
- package/dist/delete-page-modal-bbd3ffa2.cjs +0 -1
- package/dist/index-8a7a37ce.js +0 -5028
- package/dist/index-bf44bc93.cjs +0 -2
- package/dist/page-viewer-f0a54a92.cjs +0 -1
- package/dist/project-general-setting-a3e99d1e.cjs +0 -1
- package/dist/single-page-detail-84c67e67.cjs +0 -1
- package/dist/textarea-0750bcd2.js +0 -73
- package/dist/textarea-a338ede6.cjs +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),g=require("jotai"),w=require("./accordion-0afd8143.cjs"),I=require("./scroll-area-bb343b86.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),N=require("@radix-ui/react-icons"),l=require("./index-dfeadcce.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),L=require("lucide-react"),P=require("./utils-3c452dd0.cjs"),C=require("./textarea-20b2f6b2.cjs"),R=require("./card-14e1d020.cjs"),S=require("./label-167415e5.cjs"),M=require("./html-to-json-78bfa1f3.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./_commonjsHelpers-87b0abe8.cjs");require("clsx");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("./MODIFIERS-70fef873.cjs");require("sonner");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const F=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:u,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,x]=g.useAtom(l.activePanelAtom),[,i]=g.useAtom(l.addBlocksModalAtom),b=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):u(t,s.first(p)),i(!1),x("layers")},[,f,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:b,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(o||N.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},H=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),u=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[x]=l.useSelectedBlockIds(),[,i,b]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),f=n.useCallback(async E=>{if(E.stopPropagation(),s.has(t,"component")){m(t,s.first(x)),r();return}c(!0);const a=await u(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(x)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:b,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}: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:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(L.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},D=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),u=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>s.mergeWith(u,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[u,m]),[,b]=g.useAtom(l.addBlocksModalAtom),[f,j]=n.useState("Navbar"),E=s.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:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);x(B)},onClick:()=>j(h),className:P.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(E.map(a=>e.jsxRuntimeExports.jsx(H,{block:a,closePopover:()=>b(!1)})))})]})},O=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,u]=g.useAtom(l.addBlockOffCanvasAtom),[,m]=g.useAtom(l.activePanelAtom),[,p]=g.useAtom(l.addBlocksModalAtom),x=()=>{const i=M.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),u(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(R.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(R.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(R.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(R.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(R.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(C.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(i.target.value),rows:12,placeholder:`<div>
|
|
2
|
+
<h1>Enter code here</h1>
|
|
3
|
+
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(R.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(C.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(N.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(C.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."})]})]})]})},U=O,q=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],z=(t,r)=>{if(!t)return!s.includes(q,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(q,r)},G=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),u=T.useChaiBlocks(),[,m]=g.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=g.useAtom(l.addBlocksModalAtom),[x]=l.useSelectedBlockIds(),i=l.useAllBlocks(),b=s.find(i,{_id:s.first(x)}),{data:f,isLoading:j}=l.useUILibraryBlocks(),E=s.groupBy(s.filter(u,d=>z(b,d.type)),"category"),a=s.uniq(s.map(E.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(f)||s.find(s.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(N.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(I.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(E.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(E.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(F,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(D,{})}),t==="html"&&e.jsxRuntimeExports.jsx(U,{})]})};exports.default=G;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import
|
|
3
|
-
import { has as
|
|
2
|
+
import v, { createElement as K, useState as j, useMemo as W, useCallback as q, useEffect as V, Suspense as $ } from "react";
|
|
3
|
+
import { has as _, first as b, filter as w, values as k, groupBy as I, mergeWith as Z, isArray as H, get as J, map as L, isEmpty as B, find as M, uniq as Q, includes as P, reject as E } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { A as
|
|
6
|
-
import { S as re } from "./scroll-area-
|
|
5
|
+
import { A as X, a as Y, b as ee, c as se } from "./accordion-c0176dc5.js";
|
|
6
|
+
import { S as re } from "./scroll-area-83bd9e8f.js";
|
|
7
7
|
import { T as oe, a as te, b as A } from "./tabs-85caa1e8.js";
|
|
8
|
-
import { d as le, e as ae, f as ce, u as
|
|
9
|
-
import { useDrag as
|
|
8
|
+
import { d as le, e as ae, f as ce, u as ie, B as ne, S as de } from "./useBuilderProp-81a14920.js";
|
|
9
|
+
import { useDrag as R, DragPreviewImage as O } from "react-dnd";
|
|
10
10
|
import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
|
|
11
|
-
import {
|
|
11
|
+
import { W as F, i as C, a as z, b as T, Z as D, _ as xe, $ as he, B as fe } from "./index-f8a2f8ef.js";
|
|
12
12
|
import "react-i18next";
|
|
13
13
|
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/blocks";
|
|
14
14
|
import { Loader as ge } from "lucide-react";
|
|
15
15
|
import { c as be } from "./utils-ac68b2c8.js";
|
|
16
|
-
import {
|
|
16
|
+
import { T as je, A as ye, a as we } from "./textarea-9dfb6a32.js";
|
|
17
|
+
import { C as ke, a as Be, c as ve, d as Ce, e as Te, b as Ne } from "./card-f8f4f985.js";
|
|
17
18
|
import { L as Ae } from "./label-e770a087.js";
|
|
18
19
|
import { b as Ie } from "./html-to-json-8397fab5.js";
|
|
19
20
|
import "@radix-ui/react-accordion";
|
|
@@ -23,6 +24,10 @@ import "@radix-ui/react-slot";
|
|
|
23
24
|
import "class-variance-authority";
|
|
24
25
|
import "@radix-ui/react-tooltip";
|
|
25
26
|
import "@radix-ui/react-toast";
|
|
27
|
+
import "./_commonjsHelpers-10dfc225.js";
|
|
28
|
+
import "clsx";
|
|
29
|
+
import "react-dom";
|
|
30
|
+
import "@floating-ui/react-dom";
|
|
26
31
|
import "i18next";
|
|
27
32
|
import "flagged";
|
|
28
33
|
import "@minoru/react-dnd-treeview";
|
|
@@ -32,14 +37,13 @@ import "redux-undo";
|
|
|
32
37
|
import "@react-hookz/web";
|
|
33
38
|
import "./MODIFIERS-c2e02614.js";
|
|
34
39
|
import "sonner";
|
|
35
|
-
import "clsx";
|
|
36
40
|
import "tailwind-merge";
|
|
37
41
|
import "@radix-ui/react-label";
|
|
38
42
|
import "himalaya";
|
|
39
43
|
const Le = ({ block: s }) => {
|
|
40
|
-
const { type: r, icon: o, label: a } = s, { addCoreBlock:
|
|
41
|
-
|
|
42
|
-
}, [, x, u] =
|
|
44
|
+
const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(z), [, t] = h(T), f = () => {
|
|
45
|
+
_(s, "blocks") ? d(G(s.blocks), b(m)) : i(s, b(m)), t(!1), n("layers");
|
|
46
|
+
}, [, x, u] = R(() => ({
|
|
43
47
|
type: "CHAI_BLOCK",
|
|
44
48
|
item: s
|
|
45
49
|
}));
|
|
@@ -70,7 +74,7 @@ const Le = ({ block: s }) => {
|
|
|
70
74
|
] });
|
|
71
75
|
}, Pe = ({ block: s, closePopover: r }) => {
|
|
72
76
|
var u;
|
|
73
|
-
const [o, a] = j(!1),
|
|
77
|
+
const [o, a] = j(!1), i = ie("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, t, f] = R(
|
|
74
78
|
() => ({
|
|
75
79
|
type: "CHAI_BLOCK",
|
|
76
80
|
item: s
|
|
@@ -78,13 +82,13 @@ const Le = ({ block: s }) => {
|
|
|
78
82
|
[s]
|
|
79
83
|
), x = q(
|
|
80
84
|
async (g) => {
|
|
81
|
-
if (g.stopPropagation(),
|
|
82
|
-
d(s, b(
|
|
85
|
+
if (g.stopPropagation(), _(s, "component")) {
|
|
86
|
+
d(s, b(n)), r();
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
a(!0);
|
|
86
|
-
const l = await
|
|
87
|
-
B(l) || m(G(l), b(
|
|
90
|
+
const l = await i(s);
|
|
91
|
+
B(l) || m(G(l), b(n)), r();
|
|
88
92
|
},
|
|
89
93
|
[s]
|
|
90
94
|
);
|
|
@@ -115,10 +119,10 @@ const Le = ({ block: s }) => {
|
|
|
115
119
|
)
|
|
116
120
|
] });
|
|
117
121
|
}, Fe = () => {
|
|
118
|
-
const { data: s, isLoading: r } = D(), o = U(), a = w(k(o), { category: "custom" }),
|
|
122
|
+
const { data: s, isLoading: r } = D(), o = U(), a = w(k(o), { category: "custom" }), i = I(a, "group"), d = I(s, "group"), [m, n] = j(null), t = W(() => Z(i, d, (l, p) => {
|
|
119
123
|
if (H(l) && H(p))
|
|
120
124
|
return [...l, ...p];
|
|
121
|
-
}), [
|
|
125
|
+
}), [i, d]), [, f] = h(T), [x, u] = j("Navbar"), g = J(t, x, []);
|
|
122
126
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
|
|
123
127
|
/* @__PURE__ */ e.jsx("ul", { className: "sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2", children: r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
124
128
|
/* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
|
|
@@ -127,18 +131,18 @@ const Le = ({ block: s }) => {
|
|
|
127
131
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
128
132
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
129
133
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
|
|
130
|
-
] }) :
|
|
134
|
+
] }) : v.Children.toArray(
|
|
131
135
|
L(t, (l, p) => /* @__PURE__ */ e.jsx(
|
|
132
136
|
"li",
|
|
133
137
|
{
|
|
134
138
|
onMouseOut: () => {
|
|
135
|
-
clearTimeout(m),
|
|
139
|
+
clearTimeout(m), n(null);
|
|
136
140
|
},
|
|
137
141
|
onMouseEnter: () => {
|
|
138
142
|
const y = setTimeout(() => {
|
|
139
143
|
u(p);
|
|
140
144
|
}, 300);
|
|
141
|
-
|
|
145
|
+
n(y);
|
|
142
146
|
},
|
|
143
147
|
onClick: () => u(p),
|
|
144
148
|
className: be(
|
|
@@ -149,24 +153,24 @@ const Le = ({ block: s }) => {
|
|
|
149
153
|
}
|
|
150
154
|
))
|
|
151
155
|
) }),
|
|
152
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children:
|
|
156
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: v.Children.toArray(
|
|
153
157
|
g.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => f(!1) }))
|
|
154
158
|
) })
|
|
155
159
|
] });
|
|
156
160
|
}, He = () => {
|
|
157
|
-
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] =
|
|
161
|
+
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] = C(), [, i] = h(xe), [, d] = h(z), [, m] = h(T), n = () => {
|
|
158
162
|
const t = Ie(s);
|
|
159
|
-
o([...t], b(a) || null), r(""),
|
|
163
|
+
o([...t], b(a) || null), r(""), i(!1), d("layers"), m(!1);
|
|
160
164
|
};
|
|
161
|
-
return /* @__PURE__ */ e.jsxs(
|
|
162
|
-
/* @__PURE__ */ e.jsxs(
|
|
163
|
-
/* @__PURE__ */ e.jsx(
|
|
164
|
-
/* @__PURE__ */ e.jsx(
|
|
165
|
+
return /* @__PURE__ */ e.jsxs(ke, { className: "border-border/0 p-0 shadow-none", children: [
|
|
166
|
+
/* @__PURE__ */ e.jsxs(Be, { className: "p-3", children: [
|
|
167
|
+
/* @__PURE__ */ e.jsx(ve, { children: "Import HTML" }),
|
|
168
|
+
/* @__PURE__ */ e.jsx(Ce, { 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." })
|
|
165
169
|
] }),
|
|
166
|
-
/* @__PURE__ */ e.jsx(
|
|
170
|
+
/* @__PURE__ */ e.jsx(Te, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
167
171
|
/* @__PURE__ */ e.jsx(Ae, { htmlFor: "current", className: "text-sm", children: "Enter HTML Code:" }),
|
|
168
172
|
/* @__PURE__ */ e.jsx(
|
|
169
|
-
|
|
173
|
+
je,
|
|
170
174
|
{
|
|
171
175
|
autoFocus: !0,
|
|
172
176
|
tabIndex: 1,
|
|
@@ -181,11 +185,11 @@ const Le = ({ block: s }) => {
|
|
|
181
185
|
}
|
|
182
186
|
)
|
|
183
187
|
] }) }),
|
|
184
|
-
/* @__PURE__ */ e.jsxs(
|
|
185
|
-
/* @__PURE__ */ e.jsx(
|
|
186
|
-
/* @__PURE__ */ e.jsxs(
|
|
188
|
+
/* @__PURE__ */ e.jsxs(Ne, { className: "flex flex-col justify-end p-3", children: [
|
|
189
|
+
/* @__PURE__ */ e.jsx(ne, { disabled: s.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: "Import" }),
|
|
190
|
+
/* @__PURE__ */ e.jsxs(ye, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
|
|
187
191
|
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4" }),
|
|
188
|
-
/* @__PURE__ */ e.jsx(
|
|
192
|
+
/* @__PURE__ */ e.jsx(we, { 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." })
|
|
189
193
|
] })
|
|
190
194
|
] })
|
|
191
195
|
] });
|
|
@@ -194,15 +198,15 @@ const Le = ({ block: s }) => {
|
|
|
194
198
|
return !P(S, r);
|
|
195
199
|
const o = s._type;
|
|
196
200
|
return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(S, r);
|
|
197
|
-
},
|
|
198
|
-
const [s, r] = j("core"), [o, a] = j("basic"),
|
|
199
|
-
w(
|
|
201
|
+
}, vs = () => {
|
|
202
|
+
const [s, r] = j("core"), [o, a] = j("basic"), i = U(), [, d] = h(he), [, m] = h(T), [n] = C(), t = fe(), f = M(t, { _id: b(n) }), { data: x, isLoading: u } = D(), g = I(
|
|
203
|
+
w(i, (c) => Ee(f, c.type)),
|
|
200
204
|
"category"
|
|
201
|
-
), l =
|
|
205
|
+
), l = Q(L(g.core, "group"));
|
|
202
206
|
V(() => {
|
|
203
207
|
!P(l, o) && !B(l) && !B(o) && a(b(l));
|
|
204
208
|
}, [l, o]);
|
|
205
|
-
const p = (c) => a((N) => N === c ? "" : c), y = !u && !B(x) || M(k(
|
|
209
|
+
const p = (c) => a((N) => N === c ? "" : c), y = !u && !B(x) || M(k(i), { category: "custom" }) !== void 0;
|
|
206
210
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
207
211
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex justify-between rounded-md bg-background/30 p-1", children: [
|
|
208
212
|
/* @__PURE__ */ e.jsxs("h1", { className: "flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row", children: [
|
|
@@ -236,23 +240,23 @@ const Le = ({ block: s }) => {
|
|
|
236
240
|
] })
|
|
237
241
|
}
|
|
238
242
|
),
|
|
239
|
-
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(
|
|
243
|
+
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(X, { type: "single", value: o, className: "w-full px-3", children: v.Children.toArray(
|
|
240
244
|
L(
|
|
241
245
|
l,
|
|
242
246
|
(c) => E(w(k(g.core), { group: c }), {
|
|
243
247
|
hidden: !0
|
|
244
|
-
}).length ? /* @__PURE__ */ e.jsxs(
|
|
248
|
+
}).length ? /* @__PURE__ */ e.jsxs(Y, { value: c, className: "border-border", children: [
|
|
245
249
|
/* @__PURE__ */ e.jsx(ee, { onClick: () => p(c), className: "py-2 capitalize", children: c }),
|
|
246
|
-
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children:
|
|
250
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: v.Children.toArray(
|
|
247
251
|
E(w(k(g.core), { group: c }), { hidden: !0 }).map((N) => /* @__PURE__ */ e.jsx(Le, { block: N }))
|
|
248
252
|
) }) })
|
|
249
253
|
] }) : null
|
|
250
254
|
)
|
|
251
255
|
) }) }),
|
|
252
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(
|
|
256
|
+
s === "ui-blocks" && /* @__PURE__ */ e.jsx($, { fallback: /* @__PURE__ */ e.jsx(de, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
253
257
|
s === "html" && /* @__PURE__ */ e.jsx(Me, {})
|
|
254
258
|
] });
|
|
255
259
|
};
|
|
256
260
|
export {
|
|
257
|
-
|
|
261
|
+
vs as default
|
|
258
262
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-dfeadcce.cjs");require("react-i18next");const R=require("./useBuilderProp-5e57d0c8.cjs"),e=require("@chaibuilder/blocks"),P=require("lodash");require("./_commonjsHelpers-87b0abe8.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function k(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const c=k(O),v=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],D=()=>{const r=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=j.useBrandingOptions(),a=c.useRef(t);c.useEffect(()=>()=>{P.isEqual(t,a.current)||r(a.current)},[]);const p=({formData:l},u)=>{u&&(i(l),a.current=l)},{bodyFont:g,headingFont:f,primaryColor:b,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:q,secondaryColor:x,bodyBgLightColor:h,roundedCorners:S}=t,s={headingFont:e.SelectOption({title:"Heading font",default:f,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(S||5,10)}),primaryColor:e.Color({title:"Primary",default:b}),secondaryColor:e.Color({title:"Secondary",default:x}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:h}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:q}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:t,validator:C,onChange:p})})]})};exports.default=D;
|
|
@@ -2,18 +2,22 @@ import { j as a } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import B from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import {
|
|
5
|
+
import { z as N } from "./index-f8a2f8ef.js";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import { u as D } from "./useBuilderProp-81a14920.js";
|
|
8
8
|
import { SelectOption as p, Numeric as P, Color as e } from "@chaibuilder/blocks";
|
|
9
|
-
import { isEqual as
|
|
9
|
+
import { isEqual as R } from "lodash";
|
|
10
|
+
import "./_commonjsHelpers-10dfc225.js";
|
|
11
|
+
import "clsx";
|
|
12
|
+
import "@radix-ui/react-scroll-area";
|
|
13
|
+
import "react-dom";
|
|
14
|
+
import "@floating-ui/react-dom";
|
|
15
|
+
import "jotai";
|
|
10
16
|
import "i18next";
|
|
11
17
|
import "flagged";
|
|
12
18
|
import "react-dnd";
|
|
13
19
|
import "@minoru/react-dnd-treeview";
|
|
14
|
-
import "jotai";
|
|
15
20
|
import "./utils-ac68b2c8.js";
|
|
16
|
-
import "clsx";
|
|
17
21
|
import "tailwind-merge";
|
|
18
22
|
import "react-hotkeys-hook";
|
|
19
23
|
import "flat-to-nested";
|
|
@@ -79,11 +83,11 @@ const d = [
|
|
|
79
83
|
{ title: "Lustria", value: "Lustria" },
|
|
80
84
|
{ title: "Ovo", value: "Ovo" },
|
|
81
85
|
{ title: "Suranna", value: "Suranna" }
|
|
82
|
-
],
|
|
86
|
+
], pt = () => {
|
|
83
87
|
const m = D("onSaveBrandingOptions", async () => {
|
|
84
88
|
}), [o, v] = N(), r = s.useRef(o);
|
|
85
89
|
s.useEffect(() => () => {
|
|
86
|
-
|
|
90
|
+
R(o, r.current) || m(r.current);
|
|
87
91
|
}, []);
|
|
88
92
|
const c = ({ formData: t }, l) => {
|
|
89
93
|
l && (v(t), r.current = t);
|
|
@@ -158,5 +162,5 @@ const d = [
|
|
|
158
162
|
] });
|
|
159
163
|
};
|
|
160
164
|
export {
|
|
161
|
-
|
|
165
|
+
pt as default
|
|
162
166
|
};
|