@chaibuilder/sdk 1.0.24 → 1.1.1

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.
Files changed (63) hide show
  1. package/dist/AddBlocks-P3qHuE5J.cjs +1 -0
  2. package/dist/AddBlocks-imyQSCbI.js +230 -0
  3. package/dist/{BrandingOptions-2aNZT1u3.cjs → BrandingOptions-_2XBEPab.cjs} +1 -1
  4. package/dist/{BrandingOptions-GLVanp1T.js → BrandingOptions-tSNtQ1Kv.js} +1 -1
  5. package/dist/CanvasArea-JzBGfXSp.js +1412 -0
  6. package/dist/CanvasArea-rC2E_4eS.cjs +58 -0
  7. package/dist/{CurrentPage-fyWf5F84.js → CurrentPage-2Hqp8dwp.js} +2 -2
  8. package/dist/{CurrentPage-JJpZpFko.cjs → CurrentPage-v7RxefU-.cjs} +1 -1
  9. package/dist/Layers-1H-MUoKM.cjs +1 -0
  10. package/dist/{Layers-RGy6kyuR.js → Layers-K_1pMZK5.js} +119 -137
  11. package/dist/{MarkAsGlobalBlock-EsX3-clj.js → MarkAsGlobalBlock-aqik3ouc.js} +1 -1
  12. package/dist/{MarkAsGlobalBlock-1G5m_8t3.cjs → MarkAsGlobalBlock-p_wvHkQZ.cjs} +1 -1
  13. package/dist/{PagesPanel-J8uYp1Tp.cjs → PagesPanel-Qt66yy3K.cjs} +1 -1
  14. package/dist/{PagesPanel-LjiXL4rp.js → PagesPanel-uMZT46fo.js} +3 -3
  15. package/dist/{ProjectPanel-IXVY1LJ_.cjs → ProjectPanel-g92sgZ-g.cjs} +1 -1
  16. package/dist/{ProjectPanel-F435j6T2.js → ProjectPanel-nhhdOgSP.js} +3 -3
  17. package/dist/Settings-IcmgBZm9.cjs +1 -0
  18. package/dist/{Settings-b3lEaQ7w.js → Settings-pYbQsClt.js} +483 -475
  19. package/dist/{SidePanels-MnI_uhIo.js → SidePanels-9AjWdvVI.js} +62 -55
  20. package/dist/{SidePanels-1Ooc-KTb.cjs → SidePanels-CBkl8HgT.cjs} +1 -1
  21. package/dist/{Topbar-1ClabAix.js → Topbar-Jc74a6oE.js} +1 -1
  22. package/dist/{Topbar-e0hKiAm_.cjs → Topbar-ZjAs5fDc.cjs} +1 -1
  23. package/dist/{UnsplashImages-UejSDiRk.js → UnsplashImages-_PxEYx5c.js} +1 -1
  24. package/dist/{UnsplashImages-OJ5u1mVM.cjs → UnsplashImages-nXceZLmd.cjs} +1 -1
  25. package/dist/{UploadImages-2SqVkr1u.cjs → UploadImages-tcQb5NZu.cjs} +1 -1
  26. package/dist/{UploadImages-xBJTMBKX.js → UploadImages-zzSgKmP9.js} +10 -10
  27. package/dist/{add-page-modal-SdyjVxRW.js → add-page-modal-Ny4uAvWB.js} +3 -3
  28. package/dist/{add-page-modal-rkF5RqMj.cjs → add-page-modal-eahhWw2b.cjs} +1 -1
  29. package/dist/{confirm-alert-TCwoZBC3.js → confirm-alert-2JxcNf3T.js} +1 -1
  30. package/dist/{confirm-alert-uk39UILT.cjs → confirm-alert-mzlwOW9w.cjs} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.d.ts +1 -0
  33. package/dist/core.js +2 -2
  34. package/dist/{delete-page-modal-PKSlPOAB.cjs → delete-page-modal-07nDpZpj.cjs} +1 -1
  35. package/dist/{delete-page-modal-pjChqG0d.js → delete-page-modal-4qrgJQ0x.js} +2 -2
  36. package/dist/{form-aIN_qzKQ.js → form-TQ7vwDYO.js} +1 -1
  37. package/dist/{form-N6Izl5Ni.cjs → form-bSW-Pkw9.cjs} +1 -1
  38. package/dist/{index-aPk1Fuat.js → index-ORFlyrBx.js} +536 -534
  39. package/dist/{index-LL32f5q7.cjs → index-Ua5E0Syv.cjs} +11 -11
  40. package/dist/{index-0ZqKzbSx.js → index-aDqFUJ8v.js} +165 -160
  41. package/dist/index-zkc4SQCu.cjs +1 -0
  42. package/dist/{page-viewer-SMOg1l3b.js → page-viewer-1Eb7ypob.js} +3 -3
  43. package/dist/{page-viewer-wrYXvC-7.cjs → page-viewer-X8h3FMwb.cjs} +1 -1
  44. package/dist/{project-general-setting-wDjCo89M.cjs → project-general-setting-I4z0C7PE.cjs} +1 -1
  45. package/dist/{project-general-setting-CcnnvnwD.js → project-general-setting-TCl_JNdl.js} +3 -3
  46. package/dist/{project-seo-setting-RJMYUQxR.cjs → project-seo-setting-cERASO9j.cjs} +1 -1
  47. package/dist/{project-seo-setting-CPtrvtsw.js → project-seo-setting-k0HlefUD.js} +2 -2
  48. package/dist/{single-page-detail-7NRw-CLc.js → single-page-detail-W5sW6771.js} +4 -4
  49. package/dist/{single-page-detail-gnpyWcy7.cjs → single-page-detail-sdTzXA5i.cjs} +1 -1
  50. package/dist/studio.cjs +1 -1
  51. package/dist/studio.js +2 -2
  52. package/dist/ui.cjs +1 -1
  53. package/dist/ui.js +57 -57
  54. package/dist/useAddBlockByDrop-DPV32UHP.cjs +1 -0
  55. package/dist/useAddBlockByDrop-UA_Iw_4l.js +20 -0
  56. package/package.json +2 -2
  57. package/dist/AddBlocks-F05ZiQnz.cjs +0 -3
  58. package/dist/AddBlocks-kmAje7cV.js +0 -270
  59. package/dist/CanvasArea-AHGpIP2x.cjs +0 -56
  60. package/dist/CanvasArea-gJ_UifbO.js +0 -1349
  61. package/dist/Layers-YtfF6ty5.cjs +0 -1
  62. package/dist/Settings-xwTkQuKA.cjs +0 -1
  63. package/dist/index-4h4Ti2E4.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-zkc4SQCu.cjs"),q=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),v=require("flagged"),T=require("lucide-react"),B=require("react-dnd"),A=require("./lib.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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("./functions-KMQYiBHf.cjs");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("./tailwind-config-OxLD7oFU.cjs");const C=({block:r})=>{const{type:o,icon:l,label:d}=r,{addCoreBlock:x,addPredefinedBlock:m}=s.useAddBlock(),[j,p]=s.useSelectedBlockIds(),[,n]=s.useHighlightBlockId(),[,f]=g.useAtom(s.activePanelAtom),[,c]=g.useAtom(s.addBlocksModalAtom),i=()=>{t.has(r,"blocks")?m(b.syncBlocksWithDefaults(r.blocks),t.first(j)):x(r,t.first(j)),c(!1),f("layers")},h=v.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:i,type:"button",onDragStart:E=>{E.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{p([]),n(null),c(!1),f("layers")},200)},draggable:h?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(h?"cursor-grab":"cursor-pointer"),children:[a.createElement(l||q.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:d||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||o})})]})})},w=({block:r,closePopover:o})=>{var i;const[l,d]=a.useState(!1),x=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:j}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,n,f]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),c=a.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){m(r,t.first(p)),o();return}d(!0);const E=await x(r);t.isEmpty(E)||j(b.syncBlocksWithDefaults(E),t.first(p)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:f,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:n,onClick:l?()=>{}:c,className:"relative cursor-pointer 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(T.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.label}):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.label})})]})]})},N=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),l=t.filter(t.values(o),{category:"custom"}),d=t.groupBy(l,"group"),x=t.groupBy(r,"group"),m=a.useMemo(()=>t.mergeWith(d,x,(c,i)=>{if(t.isArray(c)&&t.isArray(i))return[...c,...i]}),[d,x]),[,j]=g.useAtom(s.addBlocksModalAtom),[p,n]=a.useState(t.first(t.keys(m))||""),f=t.get(m,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:c=>n(c),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),a.Children.toArray(t.map(m,(c,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:a.Children.toArray(f.map(c=>e.jsxRuntimeExports.jsx(w,{block:c,closePopover:()=>j(!1)})))})]})},S=()=>{const[r,o]=a.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,j]=g.useAtom(s.addBlocksModalAtom),p=()=>{const n=A.getBlocksFromHTML(r);l([...n],t.first(d)||null),o(""),x(!1),m("layers"),j(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:"Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code."})}),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:"Tailwind HTML snippet:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:n=>n&&n.focus(),defaultValue:r,onChange:n=>o(n.target.value),rows:12,placeholder:"Enter your code snippet here...",className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs 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:()=>p(),size:"sm",className:"w-full",children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:"NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],I=(r,o)=>{if(!r)return!t.includes(k,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(k,o)},L=()=>{const[r,o]=a.useState("core"),[l,d]=a.useState("basic"),x=b.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[j]=s.useSelectedBlockIds(),p=s.useAllBlocks(),n=t.find(p,{_id:t.first(j)}),{data:f,isLoading:c}=s.useUILibraryBlocks(),i=t.groupBy(t.filter(x,u=>I(n,u.type)),"category"),h=t.uniq(t.map(i.core,"group"));a.useEffect(()=>{!t.includes(h,l)&&!t.isEmpty(h)&&!t.isEmpty(l)&&d(t.first(h))},[h,l]);const E=u=>d(R=>R===u?"":u),y=!c&&!t.isEmpty(f)||t.find(t.values(x),{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 flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",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 TailwindCSS HTML snippet)":"(Click to add block to page)"})]}),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 "+(y?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),y?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"Custom 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:a.Children.toArray(t.map(h,u=>t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>E(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.Children.toArray(t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).map(R=>e.jsxRuntimeExports.jsx(C,{block:R})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(N,{})}),r==="html"&&e.jsxRuntimeExports.jsx(S,{})]})};exports.default=L;
@@ -0,0 +1,230 @@
1
+ import { j as e } from "./jsx-runtime-NV737rRe.js";
2
+ import k, { createElement as G, useState as g, useCallback as V, useMemo as U, useEffect as q, Suspense as K } from "react";
3
+ import { has as D, first as h, omit as W, isEmpty as j, filter as y, values as B, groupBy as T, mergeWith as J, isArray as P, keys as Q, get as X, map as N, includes as A, find as H, uniq as Y, reject as E } from "lodash";
4
+ import { useAtom as f } from "jotai";
5
+ import { O as I, j as v, _ as Z, az as R, aA as S, aH as $, aI as ee, aK as se, i as te, a8 as _, au as re, av as oe, aw as le, ax as ae, ay as F, bs as ce, bt as ie, bu as ne, bv as de, bw as me, aM as pe, bx as ue, by as xe, B as he, bz as fe, bA as be, bB as ge, ae as je, aB as ye, aC as Be, aD as w, br as ke, bk as ve, bl as Ce, bm as we, bn as Te, S as Ne } from "./index-ORFlyrBx.js";
6
+ import { BoxIcon as Ae } from "@radix-ui/react-icons";
7
+ import { syncBlocksWithDefaults as z, useChaiBlocks as O } from "@chaibuilder/runtime";
8
+ import { useFeature as Ie } from "flagged";
9
+ import { Loader as Se } from "lucide-react";
10
+ import { useDrag as Le, DragPreviewImage as Pe } from "react-dnd";
11
+ import { getBlocksFromHTML as He } from "./lib.js";
12
+ import "./MODIFIERS-MLfpKQY1.js";
13
+ import "@radix-ui/react-toggle";
14
+ import "class-variance-authority";
15
+ import "./utils-PPBbw5bk.js";
16
+ import "clsx";
17
+ import "tailwind-merge";
18
+ import "@radix-ui/react-switch";
19
+ import "@radix-ui/react-slot";
20
+ import "@radix-ui/react-accordion";
21
+ import "@radix-ui/react-alert-dialog";
22
+ import "@radix-ui/react-dialog";
23
+ import "@radix-ui/react-label";
24
+ import "@radix-ui/react-scroll-area";
25
+ import "@radix-ui/react-tabs";
26
+ import "@radix-ui/react-tooltip";
27
+ import "@radix-ui/react-popover";
28
+ import "@radix-ui/react-menubar";
29
+ import "@radix-ui/react-hover-card";
30
+ import "@radix-ui/react-select";
31
+ import "@radix-ui/react-dropdown-menu";
32
+ import "@radix-ui/react-separator";
33
+ import "@radix-ui/react-toast";
34
+ import "cmdk";
35
+ import "@radix-ui/react-context-menu";
36
+ import "react-icons-picker";
37
+ import "react-dom";
38
+ import "react-quill";
39
+ import "flat-to-nested";
40
+ import "redux-undo";
41
+ import "@react-hookz/web";
42
+ import "react-i18next";
43
+ import "himalaya";
44
+ import "./functions-JFP-oMsY.js";
45
+ import "@mhsdesign/jit-browser-tailwindcss";
46
+ import "@bobthered/tailwindcss-palette-generator";
47
+ import "@tailwindcss/forms";
48
+ import "@tailwindcss/typography";
49
+ import "@tailwindcss/aspect-ratio";
50
+ import "@tailwindcss/line-clamp";
51
+ import "./tailwind-config-d1VL1lzE.js";
52
+ const Ee = ({ block: s }) => {
53
+ const { type: t, icon: r, label: c } = s, { addCoreBlock: n, addPredefinedBlock: d } = I(), [p, m] = v(), [, l] = Z(), [, x] = f(R), [, a] = f(S), o = () => {
54
+ D(s, "blocks") ? d(z(s.blocks), h(p)) : n(s, h(p)), a(!1), x("layers");
55
+ }, u = Ie("dnd");
56
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs($, { children: [
57
+ /* @__PURE__ */ e.jsx(ee, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
58
+ "button",
59
+ {
60
+ onClick: o,
61
+ type: "button",
62
+ onDragStart: (b) => {
63
+ b.dataTransfer.setData("text/plain", JSON.stringify(W(s, ["component", "icon"]))), setTimeout(() => {
64
+ m([]), l(null), a(!1), x("layers");
65
+ }, 200);
66
+ },
67
+ draggable: u ? "true" : "false",
68
+ className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (u ? "cursor-grab" : "cursor-pointer"),
69
+ children: [
70
+ G(r || Ae, { className: "w-4 h-4 mx-auto" }),
71
+ /* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: c || t })
72
+ ]
73
+ }
74
+ ) }),
75
+ /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("p", { children: c || t }) })
76
+ ] }) });
77
+ }, Fe = ({ block: s, closePopover: t }) => {
78
+ var o;
79
+ const [r, c] = g(!1), n = te("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: p } = I(), [m] = v(), [, l, x] = Le(
80
+ () => ({
81
+ type: "CHAI_BLOCK",
82
+ item: s
83
+ }),
84
+ [s]
85
+ ), a = V(
86
+ async (u) => {
87
+ if (u.stopPropagation(), D(s, "component")) {
88
+ d(s, h(m)), t();
89
+ return;
90
+ }
91
+ c(!0);
92
+ const b = await n(s);
93
+ j(b) || p(z(b), h(m)), t();
94
+ },
95
+ [s]
96
+ );
97
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
98
+ /* @__PURE__ */ e.jsx(
99
+ Pe,
100
+ {
101
+ connect: x,
102
+ src: "https://placehold.co/100x30/000000/FFF?text=" + ((o = s.name || s.label) == null ? void 0 : o.replace(" ", "+"))
103
+ }
104
+ ),
105
+ /* @__PURE__ */ e.jsxs(
106
+ "div",
107
+ {
108
+ ref: l,
109
+ onClick: r ? () => {
110
+ } : a,
111
+ className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
112
+ children: [
113
+ r && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
114
+ /* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
115
+ " ",
116
+ /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
117
+ ] }),
118
+ s.preview ? /* @__PURE__ */ e.jsx(
119
+ "img",
120
+ {
121
+ src: s.preview,
122
+ className: "min-h-[50px] w-full rounded-md border border-gray-300",
123
+ alt: s.label
124
+ }
125
+ ) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
126
+ ]
127
+ }
128
+ )
129
+ ] });
130
+ }, Me = () => {
131
+ const { data: s } = _(), t = O(), r = y(B(t), { category: "custom" }), c = T(r, "group"), n = T(s, "group"), d = U(() => J(c, n, (a, o) => {
132
+ if (P(a) && P(o))
133
+ return [...a, ...o];
134
+ }), [c, n]), [, p] = f(S), [m, l] = g(h(Q(d)) || ""), x = X(d, m, []);
135
+ return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
136
+ /* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(re, { value: m, onValueChange: (a) => l(a), children: [
137
+ /* @__PURE__ */ e.jsx(oe, { className: "w-full", children: /* @__PURE__ */ e.jsx(le, { placeholder: "Select a provider" }) }),
138
+ /* @__PURE__ */ e.jsxs(ae, { children: [
139
+ /* @__PURE__ */ e.jsx(F, { value: "", children: "Choose" }),
140
+ k.Children.toArray(
141
+ N(d, (a, o) => /* @__PURE__ */ e.jsx(F, { value: o, children: o }, o))
142
+ )
143
+ ] })
144
+ ] }) }),
145
+ /* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: k.Children.toArray(
146
+ x.map((a) => /* @__PURE__ */ e.jsx(Fe, { block: a, closePopover: () => p(!1) }))
147
+ ) })
148
+ ] });
149
+ }, De = () => {
150
+ const [s, t] = g(""), { addPredefinedBlock: r } = I(), [c] = v(), [, n] = f(ce), [, d] = f(R), [, p] = f(S), m = () => {
151
+ const l = He(s);
152
+ r([...l], h(c) || null), t(""), n(!1), d("layers"), p(!1);
153
+ };
154
+ return /* @__PURE__ */ e.jsxs(ie, { className: "border-border/0 p-0 shadow-none", children: [
155
+ /* @__PURE__ */ e.jsx(ne, { className: "p-3", children: /* @__PURE__ */ e.jsx(de, { children: "Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code." }) }),
156
+ /* @__PURE__ */ e.jsx(me, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
157
+ /* @__PURE__ */ e.jsx(pe, { htmlFor: "current", className: "text-sm", children: "Tailwind HTML snippet:" }),
158
+ /* @__PURE__ */ e.jsx(
159
+ ue,
160
+ {
161
+ autoFocus: !0,
162
+ tabIndex: 1,
163
+ ref: (l) => l && l.focus(),
164
+ defaultValue: s,
165
+ onChange: (l) => t(l.target.value),
166
+ rows: 12,
167
+ placeholder: "Enter your code snippet here...",
168
+ className: "resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"
169
+ }
170
+ )
171
+ ] }) }),
172
+ /* @__PURE__ */ e.jsxs(xe, { className: "flex flex-col justify-end p-3", children: [
173
+ /* @__PURE__ */ e.jsx(he, { disabled: s.trim() === "", onClick: () => m(), size: "sm", className: "w-full", children: "Import HTML" }),
174
+ /* @__PURE__ */ e.jsx(fe, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(be, { className: "text-xs font-normal leading-4", children: "NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page." }) })
175
+ ] })
176
+ ] });
177
+ }, M = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], Re = (s, t) => {
178
+ if (!s)
179
+ return !A(M, t);
180
+ const r = s._type;
181
+ return r === "List" ? t === "ListItem" : r === "Table" ? t === "TableHead" || t === "TableBody" : r === "TableHead" || r === "TableBody" ? t === "TableRow" : r === "TableRow" ? t === "TableCell" : r === "Row" ? t === "Column" : !A(M, t);
182
+ }, Ms = () => {
183
+ const [s, t] = g("core"), [r, c] = g("basic"), n = O(), [, d] = f(ge), [p] = v(), m = je(), l = H(m, { _id: h(p) }), { data: x, isLoading: a } = _(), o = T(
184
+ y(n, (i) => Re(l, i.type)),
185
+ "category"
186
+ ), u = Y(N(o.core, "group"));
187
+ q(() => {
188
+ !A(u, r) && !j(u) && !j(r) && c(h(u));
189
+ }, [u, r]);
190
+ const b = (i) => c((C) => C === i ? "" : i), L = !a && !j(x) || H(B(n), { category: "custom" }) !== void 0;
191
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
192
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
193
+ /* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: "Add block" }),
194
+ /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s === "html" ? "(Enter or paste TailwindCSS HTML snippet)" : "(Click to add block to page)" })
195
+ ] }),
196
+ /* @__PURE__ */ e.jsx(
197
+ ye,
198
+ {
199
+ onValueChange: (i) => {
200
+ d(""), t(i);
201
+ },
202
+ value: s,
203
+ className: "h-max",
204
+ children: /* @__PURE__ */ e.jsxs(Be, { className: "grid w-full " + (L ? "grid-cols-3" : "grid-cols-2"), children: [
205
+ /* @__PURE__ */ e.jsx(w, { value: "core", children: "Core" }),
206
+ L ? /* @__PURE__ */ e.jsx(w, { value: "ui-blocks", children: "Custom Blocks" }) : null,
207
+ /* @__PURE__ */ e.jsx(w, { value: "html", children: "Import " })
208
+ ] })
209
+ }
210
+ ),
211
+ s === "core" && /* @__PURE__ */ e.jsx(ke, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(ve, { type: "single", value: r, className: "w-full px-3", children: k.Children.toArray(
212
+ N(
213
+ u,
214
+ (i) => E(y(B(o.core), { group: i }), {
215
+ hidden: !0
216
+ }).length ? /* @__PURE__ */ e.jsxs(Ce, { value: i, className: "border-border", children: [
217
+ /* @__PURE__ */ e.jsx(we, { onClick: () => b(i), className: "py-2 capitalize", children: i }),
218
+ /* @__PURE__ */ e.jsx(Te, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: k.Children.toArray(
219
+ E(y(B(o.core), { group: i }), { hidden: !0 }).map((C) => /* @__PURE__ */ e.jsx(Ee, { block: C }))
220
+ ) }) })
221
+ ] }) : null
222
+ )
223
+ ) }) }),
224
+ s === "ui-blocks" && /* @__PURE__ */ e.jsx(K, { fallback: /* @__PURE__ */ e.jsx(Ne, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Me, {}) }),
225
+ s === "html" && /* @__PURE__ */ e.jsx(De, {})
226
+ ] });
227
+ };
228
+ export {
229
+ Ms as default
230
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WUGKV8jN.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-4h4Ti2E4.cjs"),e=require("./controls-aHZq-q4b.cjs"),R=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");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");function P(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=P(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"}],k=()=>{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 y=({formData:l},n)=>{n&&(i(l),a.current=l)},{bodyFont:f,headingFont:g,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:m,bodyBgDarkColor:x,secondaryColor:h,bodyBgLightColor:S,roundedCorners:O}=t,s={headingFont:e.f({title:"Heading font",default:g,options:p}),bodyFont:e.f({title:"Body font",default:f,options:p}),roundedCorners:e.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:e.y({title:"Primary",default:q}),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:y})})]})};exports.default=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WUGKV8jN.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-zkc4SQCu.cjs"),e=require("./controls-aHZq-q4b.cjs"),R=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");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");function P(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=P(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"}],k=()=>{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 y=({formData:l},n)=>{n&&(i(l),a.current=l)},{bodyFont:f,headingFont:g,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:m,bodyBgDarkColor:x,secondaryColor:h,bodyBgLightColor:S,roundedCorners:O}=t,s={headingFont:e.f({title:"Heading font",default:g,options:p}),bodyFont:e.f({title:"Body font",default:f,options:p}),roundedCorners:e.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:e.y({title:"Primary",default:q}),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:y})})]})};exports.default=k;
@@ -2,7 +2,7 @@ import { j as i } from "./jsx-runtime-NV737rRe.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-aPk1Fuat.js";
5
+ import { i as D, x as N } from "./index-ORFlyrBx.js";
6
6
  import { f as p, c as P, y as e } from "./controls-G0puEH71.js";
7
7
  import { isEqual as R } from "lodash";
8
8
  import "./MODIFIERS-MLfpKQY1.js";