@chaibuilder/sdk 0.1.7 → 0.1.9
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-8bcba532.cjs +3 -0
- package/dist/{AddBlocks-0d80d14e.js → AddBlocks-a9d3b6c0.js} +26 -27
- package/dist/BrandingOptions-c4c8676e.cjs +1 -0
- package/dist/{BrandingOptions-2eb3a20f.js → BrandingOptions-c8dba155.js} +19 -16
- package/dist/{CanvasArea-366fc7f5.js → CanvasArea-77c280f6.js} +92 -91
- package/dist/{CanvasArea-35fe4de9.cjs → CanvasArea-c8892280.cjs} +7 -7
- package/dist/CurrentPage-6ca95592.js +85 -0
- package/dist/CurrentPage-ebe20c9e.cjs +1 -0
- package/dist/Layers-c1be574f.cjs +1 -0
- package/dist/{Layers-c375ab6b.js → Layers-d3c8eea6.js} +14 -13
- package/dist/{MarkAsGlobalBlock-3ecff4e8.js → MarkAsGlobalBlock-04b2d169.js} +8 -7
- package/dist/MarkAsGlobalBlock-d40a9947.cjs +1 -0
- package/dist/PagesPanel-27f7a791.cjs +1 -0
- package/dist/{PagesPanel-28b02d06.js → PagesPanel-78e3bbb9.js} +6 -5
- package/dist/{ProjectPanel-e6e95d71.js → ProjectPanel-22ec7598.js} +7 -6
- package/dist/ProjectPanel-8cec3a82.cjs +1 -0
- package/dist/Settings-675c7a84.cjs +1 -0
- package/dist/{Settings-4c13f136.js → Settings-e49b1212.js} +7 -6
- package/dist/SidePanels-35ad2f5f.cjs +1 -0
- package/dist/{SidePanels-0f011b5d.js → SidePanels-7371a5c6.js} +7 -6
- package/dist/Topbar-3bda931b.cjs +1 -0
- package/dist/{Topbar-d609b15e.js → Topbar-da90da83.js} +6 -5
- package/dist/add-page-modal-15f377cc.cjs +1 -0
- package/dist/{add-page-modal-fb1e7f3d.js → add-page-modal-6b37b90c.js} +21 -20
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -8
- package/dist/core.js +52 -53
- package/dist/{delete-page-modal-1e7c44c4.js → delete-page-modal-3b1edeb1.js} +6 -5
- package/dist/delete-page-modal-92a70848.cjs +1 -0
- package/dist/{form-6eac0287.cjs → form-431f0141.cjs} +1 -1
- package/dist/{form-5d5c5c9e.js → form-526188f9.js} +1 -1
- package/dist/html-to-json-78bfa1f3.cjs +1 -0
- package/dist/{Class-1fb4c0c4.js → html-to-json-8397fab5.js} +363 -190
- package/dist/{index-0f2acc34.js → index-67c3fc28.js} +1906 -1859
- package/dist/index-d214d8c8.cjs +2 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +8 -0
- package/dist/lib.js +34 -33
- package/dist/link-8b201d2c.cjs +1 -0
- package/dist/{link-f80a947d.js → link-ebe8a751.js} +60 -51
- package/dist/page-viewer-584e4c45.cjs +1 -0
- package/dist/{page-viewer-791fb7c7.js → page-viewer-dcd98e40.js} +10 -9
- package/dist/project-general-setting-09427e43.cjs +1 -0
- package/dist/{project-general-setting-ba6333d9.js → project-general-setting-f4614eb4.js} +8 -7
- package/dist/{project-seo-setting-e3924578.cjs → project-seo-setting-157acce4.cjs} +1 -1
- package/dist/{project-seo-setting-01536592.js → project-seo-setting-f31a84f5.js} +2 -2
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +12 -14
- package/dist/render.js +74 -71
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +38 -24
- package/dist/server.js +23 -16
- package/dist/{single-page-detail-69dd268b.js → single-page-detail-20bf1b52.js} +8 -7
- package/dist/single-page-detail-e9713757.cjs +1 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/package.json +2 -1
- package/dist/AddBlocks-263e048b.cjs +0 -3
- package/dist/BrandingOptions-fe2c729f.cjs +0 -1
- package/dist/Class-6c695ccb.cjs +0 -1
- package/dist/Layers-ec26b885.cjs +0 -1
- package/dist/MarkAsGlobalBlock-b60aa4a5.cjs +0 -1
- package/dist/PagesPanel-27e831e4.cjs +0 -1
- package/dist/ProjectPanel-d77ca4b1.cjs +0 -1
- package/dist/Settings-f533682d.cjs +0 -1
- package/dist/SidePanels-8a461fbd.cjs +0 -1
- package/dist/Topbar-e3b28705.cjs +0 -1
- package/dist/add-page-modal-345f02a4.cjs +0 -1
- package/dist/delete-page-modal-83b69ad2.cjs +0 -1
- package/dist/html-to-json-01cc5fe0.cjs +0 -1
- package/dist/html-to-json-d20aafdd.js +0 -178
- package/dist/index-334beafe.cjs +0 -2
- package/dist/link-86c532b5.cjs +0 -1
- package/dist/page-viewer-83157368.cjs +0 -1
- package/dist/project-general-setting-b8508aa1.cjs +0 -1
- package/dist/single-page-detail-a186cd56.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"),b=require("jotai"),w=require("./accordion-0afd8143.cjs"),q=require("./scroll-area-088530b9.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),l=require("./index-d214d8c8.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),I=require("lucide-react"),L=require("./utils-3c452dd0.cjs"),f=require("./textarea-a338ede6.cjs"),P=require("./label-167415e5.cjs"),S=require("./html-to-json-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("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("clsx");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const M=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:x,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,u]=b.useAtom(l.activePanelAtom),[,i]=b.useAtom(l.addBlocksModalAtom),E=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):x(t,s.first(p)),i(!1),u("layers")},[,g,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:g,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(o||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},F=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),x=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[u]=l.useSelectedBlockIds(),[,i,E]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),g=n.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){m(t,s.first(u)),r();return}c(!0);const a=await x(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(u)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}:g,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(I.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},H=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),x=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,u]=n.useState(null),i=n.useMemo(()=>s.mergeWith(x,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[x,m]),[,E]=b.useAtom(l.addBlocksModalAtom),[g,j]=n.useState("Navbar"),R=s.get(i,g,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),u(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);u(B)},onClick:()=>j(h),className:L.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",g===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(R.map(a=>e.jsxRuntimeExports.jsx(F,{block:a,closePopover:()=>E(!1)})))})]})},D=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,x]=b.useAtom(l.addBlockOffCanvasAtom),[,m]=b.useAtom(l.activePanelAtom),[,p]=b.useAtom(l.addBlocksModalAtom),u=()=>{const i=S.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),x(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(P.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(i.target.value),rows:12,placeholder:`<div>
|
|
2
|
+
<h1>Enter code here</h1>
|
|
3
|
+
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>u(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(C.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},O=D,N=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],U=(t,r)=>{if(!t)return!s.includes(N,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(N,r)},z=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),x=T.useChaiBlocks(),[,m]=b.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=b.useAtom(l.addBlocksModalAtom),[u]=l.useSelectedBlockIds(),i=l.useAllBlocks(),E=s.find(i,{_id:s.first(u)}),{data:g,isLoading:j}=l.useUILibraryBlocks(),R=s.groupBy(s.filter(x,d=>U(E,d.type)),"category"),a=s.uniq(s.map(R.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(g);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(C.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(q.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(M,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(H,{})}),t==="html"&&e.jsxRuntimeExports.jsx(O,{})]})};exports.default=z;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import B, { createElement as
|
|
3
|
-
import { has as S, first as b, filter as w, values as A, groupBy as I, mergeWith as
|
|
2
|
+
import B, { createElement as U, useState as j, useMemo as K, useCallback as W, useEffect as q, Suspense as V } from "react";
|
|
3
|
+
import { has as S, first as b, filter as w, values as A, groupBy as I, mergeWith as X, isArray as H, get as Y, map as L, isEmpty as k, find as $, uniq as J, includes as P, reject as M } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { A as
|
|
5
|
+
import { A as Q, a as Z, b as ee, c as se } from "./accordion-c0176dc5.js";
|
|
6
6
|
import { S as re } from "./scroll-area-9f64a082.js";
|
|
7
7
|
import { T as oe, a as te, b as N } from "./tabs-85caa1e8.js";
|
|
8
8
|
import { d as le, e as ae, f as ce, u as ne, B as ie, S as de } from "./useBuilderProp-81a14920.js";
|
|
9
9
|
import { useDrag as R, DragPreviewImage as _ } from "react-dnd";
|
|
10
10
|
import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
|
|
11
|
-
import {
|
|
11
|
+
import { T as F, h as T, a as O, b as C, W as z, X as xe, Y as he, y as fe } from "./index-67c3fc28.js";
|
|
12
12
|
import "react-i18next";
|
|
13
|
-
import { syncBlocksWithDefaults as
|
|
13
|
+
import { syncBlocksWithDefaults as D, useChaiBlocks as G } from "@chaibuilder/blocks";
|
|
14
14
|
import { Loader as ge } from "lucide-react";
|
|
15
15
|
import { c as be } from "./utils-ac68b2c8.js";
|
|
16
|
-
import { C as je, c as ye, e as we, f as ke, g as Be, T as
|
|
16
|
+
import { C as je, c as ye, e as we, f as ke, g as Be, T as Te, d as Ce, A as ve, a as Ne } from "./textarea-0750bcd2.js";
|
|
17
17
|
import { L as Ae } from "./label-e770a087.js";
|
|
18
|
-
import {
|
|
18
|
+
import { b as Ie } from "./html-to-json-8397fab5.js";
|
|
19
19
|
import "@radix-ui/react-accordion";
|
|
20
20
|
import "@radix-ui/react-scroll-area";
|
|
21
21
|
import "@radix-ui/react-tabs";
|
|
@@ -28,18 +28,17 @@ import "flagged";
|
|
|
28
28
|
import "@minoru/react-dnd-treeview";
|
|
29
29
|
import "react-hotkeys-hook";
|
|
30
30
|
import "flat-to-nested";
|
|
31
|
-
import "./Class-1fb4c0c4.js";
|
|
32
|
-
import "./MODIFIERS-c2e02614.js";
|
|
33
31
|
import "redux-undo";
|
|
34
32
|
import "@react-hookz/web";
|
|
33
|
+
import "./MODIFIERS-c2e02614.js";
|
|
35
34
|
import "sonner";
|
|
36
35
|
import "clsx";
|
|
37
36
|
import "tailwind-merge";
|
|
38
37
|
import "@radix-ui/react-label";
|
|
39
38
|
import "himalaya";
|
|
40
39
|
const Le = ({ block: s }) => {
|
|
41
|
-
const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] =
|
|
42
|
-
S(s, "blocks") ? d(
|
|
40
|
+
const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] = T(), [, n] = h(O), [, t] = h(C), f = () => {
|
|
41
|
+
S(s, "blocks") ? d(D(s.blocks), b(m)) : i(s, b(m)), t(!1), n("layers");
|
|
43
42
|
}, [, x, u] = R(() => ({
|
|
44
43
|
type: "CHAI_BLOCK",
|
|
45
44
|
item: s
|
|
@@ -61,7 +60,7 @@ const Le = ({ block: s }) => {
|
|
|
61
60
|
ref: x,
|
|
62
61
|
className: "cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
|
|
63
62
|
children: [
|
|
64
|
-
|
|
63
|
+
U(o || me, { className: "w-4 h-4 mx-auto" }),
|
|
65
64
|
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || r })
|
|
66
65
|
]
|
|
67
66
|
}
|
|
@@ -71,13 +70,13 @@ const Le = ({ block: s }) => {
|
|
|
71
70
|
] });
|
|
72
71
|
}, Pe = ({ block: s, closePopover: r }) => {
|
|
73
72
|
var u;
|
|
74
|
-
const [o, a] = j(!1), i = ne("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] =
|
|
73
|
+
const [o, a] = j(!1), i = ne("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = T(), [, t, f] = R(
|
|
75
74
|
() => ({
|
|
76
75
|
type: "CHAI_BLOCK",
|
|
77
76
|
item: s
|
|
78
77
|
}),
|
|
79
78
|
[s]
|
|
80
|
-
), x =
|
|
79
|
+
), x = W(
|
|
81
80
|
async (g) => {
|
|
82
81
|
if (g.stopPropagation(), S(s, "component")) {
|
|
83
82
|
d(s, b(n)), r();
|
|
@@ -85,7 +84,7 @@ const Le = ({ block: s }) => {
|
|
|
85
84
|
}
|
|
86
85
|
a(!0);
|
|
87
86
|
const l = await i(s);
|
|
88
|
-
k(l) || m(
|
|
87
|
+
k(l) || m(D(l), b(n)), r();
|
|
89
88
|
},
|
|
90
89
|
[s]
|
|
91
90
|
);
|
|
@@ -116,10 +115,10 @@ const Le = ({ block: s }) => {
|
|
|
116
115
|
)
|
|
117
116
|
] });
|
|
118
117
|
}, Fe = () => {
|
|
119
|
-
const { data: s, isLoading: r } =
|
|
118
|
+
const { data: s, isLoading: r } = z(), o = G(), a = w(A(o), { category: "custom" }), i = I(a, "group"), d = I(s, "group"), [m, n] = j(null), t = K(() => X(i, d, (l, p) => {
|
|
120
119
|
if (H(l) && H(p))
|
|
121
120
|
return [...l, ...p];
|
|
122
|
-
}), [i, d]), [, f] = h(
|
|
121
|
+
}), [i, d]), [, f] = h(C), [x, u] = j("Navbar"), g = Y(t, x, []);
|
|
123
122
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
|
|
124
123
|
/* @__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: [
|
|
125
124
|
/* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
|
|
@@ -155,7 +154,7 @@ const Le = ({ block: s }) => {
|
|
|
155
154
|
) })
|
|
156
155
|
] });
|
|
157
156
|
}, He = () => {
|
|
158
|
-
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] =
|
|
157
|
+
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] = T(), [, i] = h(xe), [, d] = h(O), [, m] = h(C), n = () => {
|
|
159
158
|
const t = Ie(s);
|
|
160
159
|
o([...t], b(a) || null), r(""), i(!1), d("layers"), m(!1);
|
|
161
160
|
};
|
|
@@ -167,7 +166,7 @@ const Le = ({ block: s }) => {
|
|
|
167
166
|
/* @__PURE__ */ e.jsx(Be, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
168
167
|
/* @__PURE__ */ e.jsx(Ae, { htmlFor: "current", className: "text-sm", children: "Enter HTML Code:" }),
|
|
169
168
|
/* @__PURE__ */ e.jsx(
|
|
170
|
-
|
|
169
|
+
Te,
|
|
171
170
|
{
|
|
172
171
|
autoFocus: !0,
|
|
173
172
|
tabIndex: 1,
|
|
@@ -182,7 +181,7 @@ const Le = ({ block: s }) => {
|
|
|
182
181
|
}
|
|
183
182
|
)
|
|
184
183
|
] }) }),
|
|
185
|
-
/* @__PURE__ */ e.jsxs(
|
|
184
|
+
/* @__PURE__ */ e.jsxs(Ce, { className: "flex flex-col justify-end p-3", children: [
|
|
186
185
|
/* @__PURE__ */ e.jsx(ie, { disabled: s.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: "Import" }),
|
|
187
186
|
/* @__PURE__ */ e.jsxs(ve, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
|
|
188
187
|
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4" }),
|
|
@@ -195,12 +194,12 @@ const Le = ({ block: s }) => {
|
|
|
195
194
|
return !P(E, r);
|
|
196
195
|
const o = s._type;
|
|
197
196
|
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(E, r);
|
|
198
|
-
},
|
|
199
|
-
const [s, r] = j("core"), [o, a] = j("basic"), i =
|
|
197
|
+
}, ys = () => {
|
|
198
|
+
const [s, r] = j("core"), [o, a] = j("basic"), i = G(), [, d] = h(he), [, m] = h(C), [n] = T(), t = fe(), f = $(t, { _id: b(n) }), { data: x, isLoading: u } = z(), g = I(
|
|
200
199
|
w(i, (c) => Ee(f, c.type)),
|
|
201
200
|
"category"
|
|
202
|
-
), l =
|
|
203
|
-
|
|
201
|
+
), l = J(L(g.core, "group"));
|
|
202
|
+
q(() => {
|
|
204
203
|
!P(l, o) && !k(l) && !k(o) && a(b(l));
|
|
205
204
|
}, [l, o]);
|
|
206
205
|
const p = (c) => a((v) => v === c ? "" : c), y = !u && !k(x);
|
|
@@ -237,7 +236,7 @@ const Le = ({ block: s }) => {
|
|
|
237
236
|
] })
|
|
238
237
|
}
|
|
239
238
|
),
|
|
240
|
-
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(
|
|
239
|
+
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(Q, { type: "single", value: o, className: "w-full px-3", children: B.Children.toArray(
|
|
241
240
|
L(
|
|
242
241
|
l,
|
|
243
242
|
(c) => M(w(A(g.core), { group: c }), {
|
|
@@ -250,10 +249,10 @@ const Le = ({ block: s }) => {
|
|
|
250
249
|
] }) : null
|
|
251
250
|
)
|
|
252
251
|
) }) }),
|
|
253
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(
|
|
252
|
+
s === "ui-blocks" && /* @__PURE__ */ e.jsx(V, { fallback: /* @__PURE__ */ e.jsx(de, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
254
253
|
s === "html" && /* @__PURE__ */ e.jsx(Me, {})
|
|
255
254
|
] });
|
|
256
255
|
};
|
|
257
256
|
export {
|
|
258
|
-
|
|
257
|
+
ys as default
|
|
259
258
|
};
|
|
@@ -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-d214d8c8.cjs");require("react-i18next");const R=require("./useBuilderProp-5e57d0c8.cjs"),e=require("@chaibuilder/blocks"),P=require("lodash");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");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:x,secondaryColor:h,bodyBgLightColor:q,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:h}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:q}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:x}),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,14 +2,14 @@ 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 { w as N } from "./index-
|
|
5
|
+
import { w as N } from "./index-67c3fc28.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 L } from "lodash";
|
|
9
10
|
import "i18next";
|
|
10
11
|
import "flagged";
|
|
11
12
|
import "react-dnd";
|
|
12
|
-
import "lodash";
|
|
13
13
|
import "@minoru/react-dnd-treeview";
|
|
14
14
|
import "jotai";
|
|
15
15
|
import "./utils-ac68b2c8.js";
|
|
@@ -17,13 +17,14 @@ import "clsx";
|
|
|
17
17
|
import "tailwind-merge";
|
|
18
18
|
import "react-hotkeys-hook";
|
|
19
19
|
import "flat-to-nested";
|
|
20
|
-
import "./
|
|
20
|
+
import "./html-to-json-8397fab5.js";
|
|
21
21
|
import "./MODIFIERS-c2e02614.js";
|
|
22
|
+
import "himalaya";
|
|
22
23
|
import "redux-undo";
|
|
23
24
|
import "@react-hookz/web";
|
|
24
|
-
import "sonner";
|
|
25
25
|
import "@radix-ui/react-icons";
|
|
26
26
|
import "lucide-react";
|
|
27
|
+
import "sonner";
|
|
27
28
|
import "@radix-ui/react-slot";
|
|
28
29
|
import "class-variance-authority";
|
|
29
30
|
import "@radix-ui/react-tooltip";
|
|
@@ -78,12 +79,14 @@ const d = [
|
|
|
78
79
|
{ title: "Lustria", value: "Lustria" },
|
|
79
80
|
{ title: "Ovo", value: "Ovo" },
|
|
80
81
|
{ title: "Suranna", value: "Suranna" }
|
|
81
|
-
],
|
|
82
|
+
], rt = () => {
|
|
82
83
|
const m = D("onSaveBrandingOptions", async () => {
|
|
83
|
-
}), [
|
|
84
|
-
s.useEffect(() => () =>
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
}), [o, v] = N(), r = s.useRef(o);
|
|
85
|
+
s.useEffect(() => () => {
|
|
86
|
+
L(o, r.current) || m(r.current);
|
|
87
|
+
}, []);
|
|
88
|
+
const c = ({ formData: t }, l) => {
|
|
89
|
+
l && (v(t), r.current = t);
|
|
87
90
|
}, {
|
|
88
91
|
bodyFont: f,
|
|
89
92
|
headingFont: g,
|
|
@@ -94,7 +97,7 @@ const d = [
|
|
|
94
97
|
secondaryColor: x,
|
|
95
98
|
bodyBgLightColor: C,
|
|
96
99
|
roundedCorners: O
|
|
97
|
-
} =
|
|
100
|
+
} = o, n = {
|
|
98
101
|
headingFont: p({
|
|
99
102
|
title: "Heading font",
|
|
100
103
|
default: g,
|
|
@@ -128,13 +131,13 @@ const d = [
|
|
|
128
131
|
default: b
|
|
129
132
|
})
|
|
130
133
|
// TODO: exteend more options from user
|
|
131
|
-
},
|
|
134
|
+
}, i = {
|
|
132
135
|
type: "object",
|
|
133
136
|
properties: {}
|
|
134
137
|
}, u = {};
|
|
135
138
|
return Object.keys(n).forEach((t) => {
|
|
136
|
-
const
|
|
137
|
-
return
|
|
139
|
+
const l = n[t];
|
|
140
|
+
return i.properties || (i.properties = {}), i.properties[t] = l.schema, u[t] = l.uiSchema, !0;
|
|
138
141
|
}), /* @__PURE__ */ a.jsxs("div", { className: "flex h-full select-none flex-col", children: [
|
|
139
142
|
/* @__PURE__ */ a.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ a.jsx("h1", { className: "px-1 font-semibold", children: "Branding Options" }) }),
|
|
140
143
|
/* @__PURE__ */ a.jsx("div", { className: "-mx-2", children: /* @__PURE__ */ a.jsx(
|
|
@@ -146,8 +149,8 @@ const d = [
|
|
|
146
149
|
liveOmit: !0,
|
|
147
150
|
liveValidate: !0,
|
|
148
151
|
uiSchema: u,
|
|
149
|
-
schema:
|
|
150
|
-
formData:
|
|
152
|
+
schema: i,
|
|
153
|
+
formData: o,
|
|
151
154
|
validator: B,
|
|
152
155
|
onChange: c
|
|
153
156
|
}
|
|
@@ -155,5 +158,5 @@ const d = [
|
|
|
155
158
|
] });
|
|
156
159
|
};
|
|
157
160
|
export {
|
|
158
|
-
|
|
161
|
+
rt as default
|
|
159
162
|
};
|