@chaibuilder/sdk 1.3.0-beta.1 → 1.3.0-beta.2
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/{CodeEditor-CA5okVeK.cjs → CodeEditor-B4IipLY8.cjs} +1 -1
- package/dist/{CodeEditor-B4OwhGBq.js → CodeEditor-B5Ev2ptF.js} +1 -1
- package/dist/{Topbar-Cc5SldaT.js → Topbar-2pW9skrh.js} +1 -1
- package/dist/{Topbar-6DGM2bQL.cjs → Topbar-dPGAncyu.cjs} +1 -1
- package/dist/{UnsplashImages-auMrsPgw.cjs → UnsplashImages-B4jr_iqs.cjs} +1 -1
- package/dist/{UnsplashImages-CYTY_ol5.js → UnsplashImages-CcS9s2ZG.js} +1 -1
- package/dist/{UploadImages-BzFsuzpW.cjs → UploadImages-DMIGC-d6.cjs} +1 -1
- package/dist/{UploadImages-DjGNkHdG.js → UploadImages-TG6CDSuI.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-muPhPsCS.js → index-BPytTS5w.js} +19 -10
- package/dist/{index-CkleseDS.cjs → index-BiZDoA-_.cjs} +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),k=require("@monaco-editor/react"),C=require("./context-menu-DfAXjmc8.cjs"),E=require("react-i18next"),i=require("react"),l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),k=require("@monaco-editor/react"),C=require("./context-menu-DfAXjmc8.cjs"),E=require("react-i18next"),i=require("react"),l=require("./index-BiZDoA-_.cjs"),R=require("@radix-ui/react-icons"),g=require("@react-hookz/web"),u=o=>{const n=document.createElement("div");return n.innerHTML=o,n.innerHTML};function v(){const{t:o}=E.useTranslation(),[n,d]=i.useState(!1),[c,x]=i.useState(""),[t,r]=l.useCodeEditor(),[a]=l.useSelectedBlockIds(),m=l.useUpdateBlocksProps(),p=l.useUpdateBlocksPropsRealtime(),j=g.useThrottledCallback(s=>{const b=u(s);p([t.blockId],{[t.blockProp]:b})},[],300),f=i.useCallback(()=>{if(n){const s=u(c);m([t.blockId],{[t.blockProp]:s})}},[n,c]);i.useEffect(()=>{a.includes(t==null?void 0:t.blockId)||(f(),r(null))},[a]);const h=()=>{r(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:h,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:o("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(C.Button,{onClick:()=>r(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(R.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(k,{onMount:s=>{s.setValue(t.initialCode)},onChange:s=>{d(!0),x(s),j(s)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=v;
|
|
@@ -3,7 +3,7 @@ import k from "@monaco-editor/react";
|
|
|
3
3
|
import { B as C } from "./context-menu-BbqLeYFX.js";
|
|
4
4
|
import { useTranslation as j } from "react-i18next";
|
|
5
5
|
import { useState as r, useCallback as v, useEffect as g } from "react";
|
|
6
|
-
import { u as y, a as N, b as T, c as E } from "./index-
|
|
6
|
+
import { u as y, a as N, b as T, c as E } from "./index-BPytTS5w.js";
|
|
7
7
|
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
8
8
|
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
9
9
|
const c = (l) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-DGlMoOmv.js";
|
|
2
2
|
import c, { useMemo as w, Suspense as x } from "react";
|
|
3
3
|
import { B as p, a6 as C, a7 as S, a8 as y, a9 as k, aq as m, al as g } from "./context-menu-BbqLeYFX.js";
|
|
4
|
-
import { e as A, F as D, d as i, f as P, g as B, L as d, h as f, i as E } from "./index-
|
|
4
|
+
import { e as A, F as D, d as i, f as P, g as B, L as d, h as f, i as E } from "./index-BPytTS5w.js";
|
|
5
5
|
import { useTranslation as v } from "react-i18next";
|
|
6
6
|
import { c as N } from "./iconBase-DHfFLkem.js";
|
|
7
7
|
import { EyeOpenIcon as L, ChevronDownIcon as M } from "@radix-ui/react-icons";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),u=require("react"),x=require("./context-menu-DfAXjmc8.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),u=require("react"),x=require("./context-menu-DfAXjmc8.cjs"),s=require("./index-BiZDoA-_.cjs"),p=require("react-i18next"),j=require("./iconBase-Cn2BsTrq.cjs"),d=require("@radix-ui/react-icons"),a=require("lodash-es");require("@chaibuilder/runtime");const E=()=>{const{savePage:i,saveState:n}=s.useSavePage(),{t:r}=p.useTranslation(),o=e.jsxRuntimeExports.jsxs(x.Button,{disabled:n==="SAVING",onClick:t=>{t.preventDefault(),i()},className:j.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":n==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":n==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:r(n==="SAVING"?"Saving":n==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},g=function(){const n=s.useBuilderProp("previewComponent"),[,r]=s.usePreviewMode(),{t:o}=p.useTranslation();return n?e.jsxRuntimeExports.jsxs(x.Button,{onClick:t=>{t.preventDefault(),r(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(d.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:o("Preview")})]}):null},v=()=>{const{fallbackLang:i,languages:n,selectedLang:r,setSelectedLang:o}=s.useLanguages(),t=(r==null?void 0:r.length)>0?r:i,h=u.useMemo(()=>{const l=[];return a.forEach(a.uniq([i,...n]),c=>{const m=a.get(s.LANGUAGES,c);m&&l.push({key:c,value:m,default:c===i})}),l},[i,n]);return a.isEmpty(n)&&t==="en"?null:a.isEmpty(n)&&t!=="en"?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600",children:[e.jsxRuntimeExports.jsx(s.FaLanguage,{className:"h-4 w-4"}),a.get(s.LANGUAGES,t)]}):e.jsxRuntimeExports.jsxs(x.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(x.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(x.Button,{size:"sm",variant:"outline",className:"flex items-center gap-x-1 text-blue-500 hover:text-blue-600",children:[e.jsxRuntimeExports.jsx(s.FaLanguage,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsxs("div",{children:[" ",a.get(s.LANGUAGES,t)]}),e.jsxRuntimeExports.jsx(d.ChevronDownIcon,{className:"h-4 w-4"})]})]})}),e.jsxRuntimeExports.jsx(x.DropdownMenuContent,{className:"border-border",children:a.map(h,l=>e.jsxRuntimeExports.jsxs(x.DropdownMenuItem,{className:j.cn("flex cursor-pointer items-center text-sm",l.key===t&&"!bg-blue-500 text-white hover:!text-white"),onClick:()=>o(l.key),children:[e.jsxRuntimeExports.jsx("div",{children:l.value}),l.key===i?e.jsxRuntimeExports.jsx(s.FaStar,{className:"ml-2 h-4 w-4 text-yellow-400"}):null]}))})]})},R=()=>{const i=s.useBuilderProp("topBarComponents.left",[]),n=s.useBuilderProp("topBarComponents.center",[]),r=s.useBuilderProp("topBarComponents.right",[]),o=s.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:u.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:u.Children.toArray(n.map(t=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(v,{}),e.jsxRuntimeExports.jsx(x.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(g,{}),e.jsxRuntimeExports.jsx(x.Separator,{orientation:"vertical"}),o?e.jsxRuntimeExports.jsx(E,{}):null,u.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),l=require("react"),p=require("lodash-es"),A=require("unsplash-js"),g=require("./context-menu-DfAXjmc8.cjs"),_=require("react-i18next"),v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),l=require("react"),p=require("lodash-es"),A=require("unsplash-js"),g=require("./context-menu-DfAXjmc8.cjs"),_=require("react-i18next"),v=require("./index-BiZDoA-_.cjs"),T=require("@react-hookz/web"),B=require("lucide-react"),b=async(h,f)=>new Promise((r,n)=>{A.createApi({accessKey:f}).search.getPhotos(h).then(o=>{r(o)}).catch(o=>n(o))}),L=({isModalView:h,onSelect:f})=>{const r=v.useBuilderProp("unsplashAccessKey",""),[n,j]=l.useState([]),[o,y]=l.useState(0),[i,w]=l.useState(),[c,k]=l.useState(),[C,E]=l.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,u]=l.useState(!1),{t:R}=_.useTranslation(),I=async s=>{if(p.isEmpty(d))return;let a=o+1;u(!0),y(a);const x={query:d,page:a};i&&(x.orientation=i),c&&(x.color=c),b(x,r).then(t=>{var N,q,S;j(a===1?((N=t==null?void 0:t.response)==null?void 0:N.results)||[]:[...n,...((q=t==null?void 0:t.response)==null?void 0:q.results)||[]]),E((S=t==null?void 0:t.response)==null?void 0:S.total_pages),u(!1)}).catch(()=>{u(!1)})};return l.useEffect(()=>{if(!p.isEmpty(d)&&r){u(!0);const s={query:d,page:1};i&&(s.orientation=i),c&&(s.color=c),y(1),b(s,r).then(a=>{var x,t;j(((x=a==null?void 0:a.response)==null?void 0:x.results)||[]),E((t=a==null?void 0:a.response)==null?void 0:t.total_pages),u(!1)}).catch(()=>{u(!1)})}},[i,c,d,r]),p.isEmpty(r)?e.jsxRuntimeExports.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"px-1 underline hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsxRuntimeExports.jsx(g.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:s=>P(s.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(v.ChaiSelect,{className:"w-40",placeholder:R("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:i,onValueChange:s=>w(s)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(v.ChaiSelect,{placeholder:R("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:c,onValueChange:s=>k(s)})})]}),e.jsxRuntimeExports.jsxs(g.ScrollArea,{className:`h-full ${h&&!p.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(n)&&!m&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),h?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>f(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):n.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!p.isEmpty(n)&&o<C&&!m&&e.jsxRuntimeExports.jsx(g.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(),disabled:m,children:m?"":"Load More"})]})]})};exports.default=L;exports.fetchImage=b;
|
|
@@ -4,7 +4,7 @@ import { isEmpty as p } from "lodash-es";
|
|
|
4
4
|
import { createApi as B } from "unsplash-js";
|
|
5
5
|
import { I as E, S as L, B as T } from "./context-menu-BbqLeYFX.js";
|
|
6
6
|
import { useTranslation as D } from "react-i18next";
|
|
7
|
-
import { d as F, C as k } from "./index-
|
|
7
|
+
import { d as F, C as k } from "./index-BPytTS5w.js";
|
|
8
8
|
import { useDebouncedState as K } from "@react-hookz/web";
|
|
9
9
|
import { Loader as U } from "lucide-react";
|
|
10
10
|
const C = async (x, g) => new Promise((t, o) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),r=require("react"),i=require("lodash-es"),R=require("jotai"),w=require("./context-menu-DfAXjmc8.cjs"),k=require("react-i18next"),b=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),r=require("react"),i=require("lodash-es"),R=require("jotai"),w=require("./context-menu-DfAXjmc8.cjs"),k=require("react-i18next"),b=require("./index-BiZDoA-_.cjs"),E=require("lucide-react"),S=R.atom([]),q=({isModalView:l,onSelect:x})=>{const{t}=k.useTranslation(),d=b.useBuilderProp("uploadMediaCallback"),c=b.useBuilderProp("fetchMediaCallback"),[n,m]=R.useAtom(S),[y,p]=r.useState(!1),[j,h]=r.useState(!1),[,N]=r.useState(),[f,u]=r.useState("");r.useEffect(()=>{(async()=>{if(!c)return;h(!0);const s=await c();m(s||[]),h(!1)})()},[]);const v=s=>{var a,o;if(u(""),s&&((o=(a=s==null?void 0:s.target)==null?void 0:a.files)==null?void 0:o.length)>0){const g=s.target.files[0];g.type.startsWith("image")?I(g):u(t("Please select an image"))}},I=async s=>{if(d){p(!0);try{const{url:a}=await d(s);x(a),N(void 0);const o=await c();m(o)}catch(a){m([]),u((a==null?void 0:a.message)||"Something went wrong.")}p(!1)}};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:l?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center rounded-lg",children:e.jsxRuntimeExports.jsxs("label",{htmlFor:"image-upload",className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsxRuntimeExports.jsx(E.Upload,{className:"mb-3 h-10 w-10 text-gray-400"}),e.jsxRuntimeExports.jsx("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:e.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:t("Click to upload")})}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("SVG, PNG, JPG or GIF (Max. 2mb)")})]}),y?e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsxRuntimeExports.jsx(E.Loader,{className:"h-6 w-6 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-sm text-gray-500",children:t("Uploading...")})]}):null,f&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:f||t("Something went wrong")})]})}),e.jsxRuntimeExports.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(w.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${l?"px-2":""} pt-2`,children:[i.isEmpty(n)&&j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:t("Fetching...")})}),i.isEmpty(n)&&!j&&e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsxRuntimeExports.jsx("h3",{className:"mb-2 text-sm font-semibold",children:t("No images found")}),e.jsxRuntimeExports.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:t("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),l?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:i.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>x(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):i.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>x(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=q;
|
|
@@ -4,7 +4,7 @@ import { isEmpty as j, map as b } from "lodash-es";
|
|
|
4
4
|
import { atom as F, useAtom as U } from "jotai";
|
|
5
5
|
import { S as C } from "./context-menu-BbqLeYFX.js";
|
|
6
6
|
import { useTranslation as S } from "react-i18next";
|
|
7
|
-
import { d as N } from "./index-
|
|
7
|
+
import { d as N } from "./index-BPytTS5w.js";
|
|
8
8
|
import { Upload as E, Loader as G } from "lucide-react";
|
|
9
9
|
const P = F([]), $ = ({ isModalView: l, onSelect: i }) => {
|
|
10
10
|
const { t } = S(), u = N("uploadMediaCallback"), d = N("fetchMediaCallback"), [r, c] = U(P), [y, x] = n(!1), [f, p] = n(!1), [, v] = n(), [h, m] = n("");
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BiZDoA-_.cjs"),s=require("./iconBase-Cn2BsTrq.cjs"),o=require("@chaibuilder/runtime"),l=require("react-i18next"),t=require("i18next");exports.AISetContext=e.AISetContext;exports.AIUserPrompt=e.AIUserPrompt;exports.AddBlocksDialog=e.AddBlocksDialog;exports.AddBlocksPanel=e.AddBlocksPanel;exports.BlockAttributesEditor=e.BlockAttributesEditor;exports.BlockPropsEditor=e.BlockSettings;exports.BlockStyleEditor=e.BlockStyling;exports.CHAI_BUILDER_EVENTS=e.CHAI_BUILDER_EVENTS;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.DarkModeSwitcher=e.DarkMode;exports.DefaultChaiBlocks=e.DefaultChaiBlocks;exports.ImportHTML=e.ImportHTML;exports.Outline=e.ListTree;exports.ScreenSizes=e.Breakpoints;exports.ThemeOptions=e.ThemeConfigPanel;exports.UILibraries=e.UILibrariesPanel;exports.UndoRedo=e.UndoRedo;exports.emitChaiBuilderMsg=e.emitChaiBuilderMsg;exports.getBlocksFromHTML=e.getBlocksFromHTML;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiBuilderMsgListener=e.useChaiBuilderMsgListener;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useGlobalBlocksList=e.useGlobalBlocksList;exports.useGlobalBlocksStore=e.useGlobalBlocksStore;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useLayoutVariant=e.useLayoutVariant;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;Object.defineProperty(exports,"registerChaiBlock",{enumerable:!0,get:()=>o.registerChaiBlock});Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>l.useTranslation});exports.i18n=t;
|
package/dist/core.d.ts
CHANGED
|
@@ -264,7 +264,7 @@ export declare const ChaiDraggableBlock: ({ block, html, blocks, children }: Cha
|
|
|
264
264
|
|
|
265
265
|
declare type ChaiDraggableBlockProps = {
|
|
266
266
|
html?: string | (() => Promise<any>);
|
|
267
|
-
block?: any;
|
|
267
|
+
block?: any | (() => Promise<any>);
|
|
268
268
|
blocks?: any | (() => Promise<any>);
|
|
269
269
|
children: default_2.ReactNode;
|
|
270
270
|
};
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as a, s as o, n as l, A as t, t as r, B as u, l as i, q as d, j as c, v as B, m as k, w as n, D as C, I as g, k as p, x as S, T as m, U as h, y as I, o as A, E as P, z as U, N as b, O as y, $ as D, J as E, ae as L, a1 as M, d as f, M as v, P as T, Q as x, p as H, u as R, R as O, S as V, V as w, W as G, X as _, Y as z, G as F, H as N, Z as W, _ as Z, g as j, ad as q, a0 as J, f as K, a2 as Q, a3 as X, e as Y, a6 as $, a5 as ss, a4 as es, a as as, aa as os, ab as ls, ac as ts, a7 as rs, a9 as us, a8 as is, K as ds, b as cs, c as Bs } from "./index-
|
|
1
|
+
import { r as a, s as o, n as l, A as t, t as r, B as u, l as i, q as d, j as c, v as B, m as k, w as n, D as C, I as g, k as p, x as S, T as m, U as h, y as I, o as A, E as P, z as U, N as b, O as y, $ as D, J as E, ae as L, a1 as M, d as f, M as v, P as T, Q as x, p as H, u as R, R as O, S as V, V as w, W as G, X as _, Y as z, G as F, H as N, Z as W, _ as Z, g as j, ad as q, a0 as J, f as K, a2 as Q, a3 as X, e as Y, a6 as $, a5 as ss, a4 as es, a as as, aa as os, ab as ls, ac as ts, a7 as rs, a9 as us, a8 as is, K as ds, b as cs, c as Bs } from "./index-BPytTS5w.js";
|
|
2
2
|
import { g as ns, c as Cs } from "./iconBase-DHfFLkem.js";
|
|
3
3
|
import { registerChaiBlock as ps } from "@chaibuilder/runtime";
|
|
4
4
|
import { useTranslation as ms } from "react-i18next";
|
|
@@ -3742,7 +3742,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3742
3742
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3743
3743
|
] }, l))
|
|
3744
3744
|
] }) });
|
|
3745
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3745
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-B5Ev2ptF.js")), CanvasArea = () => {
|
|
3746
3746
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3747
3747
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3748
3748
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas, {}) }) }),
|
|
@@ -5212,7 +5212,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5212
5212
|
}
|
|
5213
5213
|
)
|
|
5214
5214
|
] });
|
|
5215
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5215
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-CcS9s2ZG.js")), UploadImages = React__default.lazy(() => import("./UploadImages-TG6CDSuI.js")), ImagesPanel = ({
|
|
5216
5216
|
isModalView: o = !1,
|
|
5217
5217
|
onSelect: n = () => {
|
|
5218
5218
|
}
|
|
@@ -7821,18 +7821,27 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7821
7821
|
}, ChaiDraggableBlock = ({ block: o, html: n, blocks: r, children: a }) => {
|
|
7822
7822
|
const [, l] = useAtom$1(draggedBlockAtom), [, i] = useSelectedBlockIds(), { clearHighlight: c } = useBlockHighlight(), d = async (p) => {
|
|
7823
7823
|
try {
|
|
7824
|
-
if (isEmpty(n) && isEmpty(o) && isEmpty(r))
|
|
7825
|
-
return;
|
|
7826
7824
|
let u = null;
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
if (
|
|
7825
|
+
if (n) {
|
|
7826
|
+
const x = typeof n == "function" ? await n() : n, m = getBlocksFromHTML(x);
|
|
7827
|
+
if (isEmpty(m)) return;
|
|
7828
|
+
u = {
|
|
7829
|
+
uiLibrary: !0,
|
|
7830
|
+
blocks: m,
|
|
7831
|
+
parent: get(u, "0._parent", null) || null
|
|
7832
|
+
};
|
|
7833
|
+
} else if (r) {
|
|
7834
|
+
const x = typeof r == "function" ? await r() : r;
|
|
7835
|
+
if (isEmpty(x)) return;
|
|
7830
7836
|
u = {
|
|
7831
7837
|
uiLibrary: !0,
|
|
7832
|
-
blocks:
|
|
7838
|
+
blocks: x,
|
|
7833
7839
|
parent: get(u, "0._parent", null) || null
|
|
7834
7840
|
};
|
|
7835
|
-
} else
|
|
7841
|
+
} else if (o) {
|
|
7842
|
+
const x = typeof o == "function" ? await o() : o;
|
|
7843
|
+
u = typeof x == "object" ? omit(x, ["component", "icon"]) : x;
|
|
7844
|
+
}
|
|
7836
7845
|
if (!u) return;
|
|
7837
7846
|
p.dataTransfer.setData("text/plain", JSON.stringify(u)), l(u), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
|
|
7838
7847
|
i([]), c();
|
|
@@ -8948,7 +8957,7 @@ const PageDataProviders = () => {
|
|
|
8948
8957
|
function AiFillDatabase(o) {
|
|
8949
8958
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
|
|
8950
8959
|
}
|
|
8951
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8960
|
+
const TopBar = lazy(() => import("./Topbar-2pW9skrh.js"));
|
|
8952
8961
|
function useSidebarMenuItems(o) {
|
|
8953
8962
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8954
8963
|
return useMemo(() => {
|