@chaibuilder/sdk 1.2.91 → 1.2.93-beta.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.
- package/dist/{CodeEditor-_Pim7pDO.js → CodeEditor-_pniWL9A.js} +20 -18
- package/dist/CodeEditor-hbpcHA6a.cjs +1 -0
- package/dist/GlobalBlockSettings-1Ix883dP.cjs +1 -0
- package/dist/GlobalBlockSettings-eytCBAHr.js +44 -0
- package/dist/Topbar-0dGbwmC_.cjs +1 -0
- package/dist/{Topbar-4ejjKoRn.js → Topbar-AzDg5F6n.js} +14 -12
- package/dist/{UnsplashImages-fpbR9Jbs.js → UnsplashImages-Gdm78EC5.js} +11 -9
- package/dist/UnsplashImages-etSQzJ6J.cjs +1 -0
- package/dist/{UploadImages-9hzL5Hu1.js → UploadImages-2XWy9JHd.js} +31 -56
- package/dist/UploadImages-lyC-Th50.cjs +1 -0
- package/dist/_commonjsHelpers-f3sTPFkQ.js +8 -0
- package/dist/_commonjsHelpers-f52AuuUj.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +34 -11
- package/dist/core.js +71 -67
- package/dist/{iconBase-zweRWSz0.js → iconBase-HBZkvN04.js} +29 -22
- package/dist/iconBase-kuD_VwQx.cjs +1 -0
- package/dist/index-lynOzeB3.cjs +223 -0
- package/dist/{index-ry3B_D93.js → index-zgy8mVKm.js} +9626 -10802
- package/dist/plugin-02QsHeBE.cjs +1 -0
- package/dist/{plugin-P0tpo_XZ.cjs → plugin-BXpjdQxx.cjs} +1 -1
- package/dist/{plugin-f5uJtdXY.js → plugin-DdKuAR7p.js} +1 -1
- package/dist/plugin-VDzc8jUO.js +52 -0
- package/dist/render.cjs +2 -2
- package/dist/render.js +7 -6
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +7 -6
- package/dist/useGlobalBlocksStore-1wJUEOl4.cjs +1 -0
- package/dist/useGlobalBlocksStore-HlGhDxuV.js +1258 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +257 -229
- package/package.json +2 -2
- package/dist/CodeEditor-Imjgt7mh.cjs +0 -1
- package/dist/Topbar-irIirqy7.cjs +0 -1
- package/dist/UnsplashImages-NfwOtGHo.cjs +0 -1
- package/dist/UploadImages-OVHnYeiL.cjs +0 -1
- package/dist/iconBase-vJD0OXxU.cjs +0 -1
- package/dist/index-VBJLJ6fO.cjs +0 -223
- package/dist/plugin-_F-KZp1i.cjs +0 -1
- package/dist/plugin-sJ3Hzvpv.js +0 -57
|
@@ -3,7 +3,8 @@ import k from "@monaco-editor/react";
|
|
|
3
3
|
import { B as C } from "./context-menu-9cWJcKdh.js";
|
|
4
4
|
import { useTranslation as j } from "react-i18next";
|
|
5
5
|
import { useState as l, useCallback as v, useEffect as g } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { a as y, l as N, x as T } from "./useGlobalBlocksStore-HlGhDxuV.js";
|
|
7
|
+
import { u as E } from "./index-zgy8mVKm.js";
|
|
7
8
|
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
8
9
|
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
9
10
|
import "@radix-ui/react-switch";
|
|
@@ -28,9 +29,9 @@ import "clsx";
|
|
|
28
29
|
import "tailwind-merge";
|
|
29
30
|
import "lodash-es";
|
|
30
31
|
import "jotai";
|
|
31
|
-
import "./iconBase-
|
|
32
|
+
import "./iconBase-HBZkvN04.js";
|
|
33
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
32
34
|
import "@chaibuilder/runtime";
|
|
33
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
34
35
|
import "tree-model";
|
|
35
36
|
import "react-quill";
|
|
36
37
|
import "./STRINGS-TDN5UhWi.js";
|
|
@@ -43,6 +44,7 @@ import "@tailwindcss/typography";
|
|
|
43
44
|
import "@tailwindcss/forms";
|
|
44
45
|
import "@tailwindcss/aspect-ratio";
|
|
45
46
|
import "tailwindcss-palette-generator";
|
|
47
|
+
import "./plugin-VDzc8jUO.js";
|
|
46
48
|
import "react-wrap-balancer";
|
|
47
49
|
import "react-dom";
|
|
48
50
|
import "prop-types";
|
|
@@ -59,23 +61,23 @@ import "fuse.js";
|
|
|
59
61
|
import "i18next";
|
|
60
62
|
import "framer-motion";
|
|
61
63
|
const a = (r) => {
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
+
const e = document.createElement("div");
|
|
65
|
+
return e.innerHTML = r, e.innerHTML;
|
|
64
66
|
};
|
|
65
|
-
function
|
|
66
|
-
const { t: r } = j(), [
|
|
67
|
-
(
|
|
68
|
-
const b = a(
|
|
67
|
+
function Ut() {
|
|
68
|
+
const { t: r } = j(), [e, n] = l(!1), [m, c] = l(""), [o, s] = E(), [p] = y(), d = N(), u = T(), f = B(
|
|
69
|
+
(i) => {
|
|
70
|
+
const b = a(i);
|
|
69
71
|
u([o.blockId], { [o.blockProp]: b });
|
|
70
72
|
},
|
|
71
73
|
[],
|
|
72
74
|
300
|
|
73
75
|
), x = v(() => {
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
d([o.blockId], { [o.blockProp]:
|
|
76
|
+
if (e) {
|
|
77
|
+
const i = a(m);
|
|
78
|
+
d([o.blockId], { [o.blockProp]: i });
|
|
77
79
|
}
|
|
78
|
-
}, [
|
|
80
|
+
}, [e, m]);
|
|
79
81
|
g(() => {
|
|
80
82
|
p.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
|
|
81
83
|
}, [p]);
|
|
@@ -104,11 +106,11 @@ function Rt() {
|
|
|
104
106
|
/* @__PURE__ */ t.jsx(
|
|
105
107
|
k,
|
|
106
108
|
{
|
|
107
|
-
onMount: (
|
|
108
|
-
|
|
109
|
+
onMount: (i) => {
|
|
110
|
+
i.setValue(o.initialCode);
|
|
109
111
|
},
|
|
110
|
-
onChange: (
|
|
111
|
-
n(!0), c(
|
|
112
|
+
onChange: (i) => {
|
|
113
|
+
n(!0), c(i), f(i);
|
|
112
114
|
},
|
|
113
115
|
height: "100%",
|
|
114
116
|
defaultLanguage: "html",
|
|
@@ -125,5 +127,5 @@ function Rt() {
|
|
|
125
127
|
] });
|
|
126
128
|
}
|
|
127
129
|
export {
|
|
128
|
-
|
|
130
|
+
Ut as default
|
|
129
131
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),h=require("@monaco-editor/react"),k=require("./context-menu-sQn7ryJ6.cjs"),C=require("react-i18next"),u=require("react"),n=require("./useGlobalBlocksStore-1wJUEOl4.cjs"),E=require("./index-lynOzeB3.cjs"),R=require("@radix-ui/react-icons"),g=require("@react-hookz/web");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-kuD_VwQx.cjs");require("./_commonjsHelpers-f52AuuUj.cjs");require("@chaibuilder/runtime");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const a=s=>{const i=document.createElement("div");return i.innerHTML=s,i.innerHTML};function v(){const{t:s}=C.useTranslation(),[i,q]=u.useState(!1),[l,d]=u.useState(""),[r,o]=E.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=g.useThrottledCallback(t=>{const f=a(t);m([r.blockId],{[r.blockProp]:f})},[],300),j=u.useCallback(()=>{if(i){const t=a(l);x([r.blockId],{[r.blockProp]:t})}},[i,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const b=()=>{o(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:b,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:s("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:s("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(k.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(R.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(h,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{q(!0),d(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),t=require("./useGlobalBlocksStore-1wJUEOl4.cjs");require("react-i18next");require("react");require("lodash-es");require("jotai");require("./iconBase-kuD_VwQx.cjs");require("clsx");require("tailwind-merge");require("./_commonjsHelpers-f52AuuUj.cjs");require("@react-hookz/web");require("@chaibuilder/runtime");require("tree-model");const u=()=>{const s=t.useSelectedBlock(),{data:o,refetch:l,isLoading:a}=t.useGlobalBlocksList(),i=t.useUpdateBlocksProps();return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("label",{className:"text-sm",children:"Choose a global block"}),e.jsxRuntimeExports.jsxs("select",{className:"h-8 w-full rounded-md border border-border bg-gray-50 p-0 px-2 text-xs dark:bg-gray-800",value:(s==null?void 0:s.globalBlock)||"",onChange:r=>{i([s._id],{globalBlock:r.target.value})},children:[e.jsxRuntimeExports.jsx("option",{value:"",children:"Select a global block"}),Object.keys(o).map(r=>e.jsxRuntimeExports.jsx("option",{value:r,children:o[r].name||r},r))]}),e.jsxRuntimeExports.jsx("div",{className:"mt-2 text-xs",children:e.jsxRuntimeExports.jsx("button",{onClick:l,className:"rounded-md bg-gray-100 p-1 px-2 text-xs hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700",children:a?"Loading...":"Refresh List"})})]})};exports.default=u;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { j as o } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
+
import { r as i, N as c, l as d } from "./useGlobalBlocksStore-HlGhDxuV.js";
|
|
3
|
+
import "react-i18next";
|
|
4
|
+
import "react";
|
|
5
|
+
import "lodash-es";
|
|
6
|
+
import "jotai";
|
|
7
|
+
import "./iconBase-HBZkvN04.js";
|
|
8
|
+
import "clsx";
|
|
9
|
+
import "tailwind-merge";
|
|
10
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
11
|
+
import "@react-hookz/web";
|
|
12
|
+
import "@chaibuilder/runtime";
|
|
13
|
+
import "tree-model";
|
|
14
|
+
const N = () => {
|
|
15
|
+
const t = i(), { data: e, refetch: s, isLoading: a } = c(), l = d();
|
|
16
|
+
return /* @__PURE__ */ o.jsxs("div", { children: [
|
|
17
|
+
/* @__PURE__ */ o.jsx("label", { className: "text-sm", children: "Choose a global block" }),
|
|
18
|
+
/* @__PURE__ */ o.jsxs(
|
|
19
|
+
"select",
|
|
20
|
+
{
|
|
21
|
+
className: "h-8 w-full rounded-md border border-border bg-gray-50 p-0 px-2 text-xs dark:bg-gray-800",
|
|
22
|
+
value: (t == null ? void 0 : t.globalBlock) || "",
|
|
23
|
+
onChange: (r) => {
|
|
24
|
+
l([t._id], { globalBlock: r.target.value });
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ o.jsx("option", { value: "", children: "Select a global block" }),
|
|
28
|
+
Object.keys(e).map((r) => /* @__PURE__ */ o.jsx("option", { value: r, children: e[r].name || r }, r))
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ o.jsx("div", { className: "mt-2 text-xs", children: /* @__PURE__ */ o.jsx(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
onClick: s,
|
|
36
|
+
className: "rounded-md bg-gray-100 p-1 px-2 text-xs hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700",
|
|
37
|
+
children: a ? "Loading..." : "Refresh List"
|
|
38
|
+
}
|
|
39
|
+
) })
|
|
40
|
+
] });
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
N as default
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),n=require("./context-menu-sQn7ryJ6.cjs"),u=require("./useGlobalBlocksStore-1wJUEOl4.cjs"),x=require("react-i18next"),c=require("./index-lynOzeB3.cjs"),l=require("./iconBase-kuD_VwQx.cjs"),p=require("@radix-ui/react-icons");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./_commonjsHelpers-f52AuuUj.cjs");require("@react-hookz/web");require("@chaibuilder/runtime");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const m=()=>{const{savePage:a,saveState:r}=u.useSavePage(),{t:s}=x.useTranslation(),o=e.jsxRuntimeExports.jsxs(n.Button,{disabled:r==="SAVING",onClick:t=>{t.preventDefault(),a()},className:l.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":r==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":r==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(c.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s(r==="SAVING"?"saving":r==="SAVED"?"saved":"unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},q=function(){const r=u.useBuilderProp("previewComponent"),[,s]=c.usePreviewMode(),{t:o}=x.useTranslation();return r?e.jsxRuntimeExports.jsxs(n.Button,{onClick:t=>{t.preventDefault(),s(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(p.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:o("preview")})]}):null},j=()=>{const a=u.useBuilderProp("topBarComponents.left",[]),r=u.useBuilderProp("topBarComponents.center",[]),s=u.useBuilderProp("topBarComponents.right",[]),o=u.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:i.Children.toArray(a.map(t=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(q,{}),e.jsxRuntimeExports.jsx(n.Separator,{orientation:"vertical"}),o?e.jsxRuntimeExports.jsx(m,{}):null,i.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=j;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import m, { Suspense as p } from "react";
|
|
3
3
|
import { B as c, S as n, ac as x } from "./context-menu-9cWJcKdh.js";
|
|
4
|
-
import {
|
|
4
|
+
import { L as d, k as s } from "./useGlobalBlocksStore-HlGhDxuV.js";
|
|
5
5
|
import { useTranslation as l } from "react-i18next";
|
|
6
|
-
import {
|
|
6
|
+
import { F as h, a as f } from "./index-zgy8mVKm.js";
|
|
7
|
+
import { c as u } from "./iconBase-HBZkvN04.js";
|
|
7
8
|
import { EyeOpenIcon as v } from "@radix-ui/react-icons";
|
|
8
9
|
import "@radix-ui/react-switch";
|
|
9
10
|
import "@radix-ui/react-accordion";
|
|
@@ -27,9 +28,9 @@ import "clsx";
|
|
|
27
28
|
import "tailwind-merge";
|
|
28
29
|
import "lodash-es";
|
|
29
30
|
import "jotai";
|
|
30
|
-
import "
|
|
31
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
31
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
32
32
|
import "@react-hookz/web";
|
|
33
|
+
import "@chaibuilder/runtime";
|
|
33
34
|
import "tree-model";
|
|
34
35
|
import "react-quill";
|
|
35
36
|
import "./STRINGS-TDN5UhWi.js";
|
|
@@ -42,6 +43,7 @@ import "@tailwindcss/typography";
|
|
|
42
43
|
import "@tailwindcss/forms";
|
|
43
44
|
import "@tailwindcss/aspect-ratio";
|
|
44
45
|
import "tailwindcss-palette-generator";
|
|
46
|
+
import "./plugin-VDzc8jUO.js";
|
|
45
47
|
import "react-wrap-balancer";
|
|
46
48
|
import "react-dom";
|
|
47
49
|
import "prop-types";
|
|
@@ -58,7 +60,7 @@ import "fuse.js";
|
|
|
58
60
|
import "i18next";
|
|
59
61
|
import "framer-motion";
|
|
60
62
|
const j = () => {
|
|
61
|
-
const { savePage: a, saveState: e } = d(), { t:
|
|
63
|
+
const { savePage: a, saveState: e } = d(), { t: o } = l(), i = /* @__PURE__ */ t.jsxs(
|
|
62
64
|
c,
|
|
63
65
|
{
|
|
64
66
|
disabled: e === "SAVING",
|
|
@@ -78,18 +80,18 @@ const j = () => {
|
|
|
78
80
|
variant: "outline",
|
|
79
81
|
children: [
|
|
80
82
|
/* @__PURE__ */ t.jsx(h, { className: "text-sm text-white" }),
|
|
81
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children:
|
|
83
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children: o(e === "SAVING" ? "saving" : e === "SAVED" ? "saved" : "unsaved") })
|
|
82
84
|
]
|
|
83
85
|
}
|
|
84
86
|
);
|
|
85
87
|
return /* @__PURE__ */ t.jsx("div", { className: "flex items-center", children: i });
|
|
86
88
|
}, g = function() {
|
|
87
|
-
const e =
|
|
89
|
+
const e = s("previewComponent"), [, o] = f(), { t: i } = l();
|
|
88
90
|
return e ? /* @__PURE__ */ t.jsxs(
|
|
89
91
|
c,
|
|
90
92
|
{
|
|
91
93
|
onClick: (r) => {
|
|
92
|
-
r.preventDefault(),
|
|
94
|
+
r.preventDefault(), o(!0);
|
|
93
95
|
},
|
|
94
96
|
className: "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
|
|
95
97
|
size: "sm",
|
|
@@ -100,8 +102,8 @@ const j = () => {
|
|
|
100
102
|
]
|
|
101
103
|
}
|
|
102
104
|
) : null;
|
|
103
|
-
},
|
|
104
|
-
const a =
|
|
105
|
+
}, At = () => {
|
|
106
|
+
const a = s("topBarComponents.left", []), e = s("topBarComponents.center", []), o = s("topBarComponents.right", []), i = s("editable", !0);
|
|
105
107
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
106
108
|
/* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2 font-bold", children: m.Children.toArray(
|
|
107
109
|
a.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
|
|
@@ -114,11 +116,11 @@ const j = () => {
|
|
|
114
116
|
/* @__PURE__ */ t.jsx(x, { orientation: "vertical" }),
|
|
115
117
|
i ? /* @__PURE__ */ t.jsx(j, {}) : null,
|
|
116
118
|
m.Children.toArray(
|
|
117
|
-
|
|
119
|
+
o.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
|
|
118
120
|
)
|
|
119
121
|
] })
|
|
120
122
|
] });
|
|
121
123
|
};
|
|
122
124
|
export {
|
|
123
|
-
|
|
125
|
+
At as default
|
|
124
126
|
};
|
|
@@ -4,9 +4,10 @@ import { isEmpty as d } from "lodash-es";
|
|
|
4
4
|
import { createApi as B } from "unsplash-js";
|
|
5
5
|
import { N as D, V as E, B as L } from "./context-menu-9cWJcKdh.js";
|
|
6
6
|
import { useTranslation as T } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { k as V } from "./useGlobalBlocksStore-HlGhDxuV.js";
|
|
8
8
|
import { useDebouncedState as F } from "@react-hookz/web";
|
|
9
9
|
import { Loader as K } from "lucide-react";
|
|
10
|
+
import { C as w } from "./index-zgy8mVKm.js";
|
|
10
11
|
import "@radix-ui/react-switch";
|
|
11
12
|
import "@radix-ui/react-accordion";
|
|
12
13
|
import "@radix-ui/react-icons";
|
|
@@ -29,9 +30,9 @@ import "@radix-ui/react-context-menu";
|
|
|
29
30
|
import "clsx";
|
|
30
31
|
import "tailwind-merge";
|
|
31
32
|
import "jotai";
|
|
32
|
-
import "./iconBase-
|
|
33
|
+
import "./iconBase-HBZkvN04.js";
|
|
34
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
33
35
|
import "@chaibuilder/runtime";
|
|
34
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
35
36
|
import "tree-model";
|
|
36
37
|
import "react-quill";
|
|
37
38
|
import "./STRINGS-TDN5UhWi.js";
|
|
@@ -44,6 +45,7 @@ import "@tailwindcss/typography";
|
|
|
44
45
|
import "@tailwindcss/forms";
|
|
45
46
|
import "@tailwindcss/aspect-ratio";
|
|
46
47
|
import "tailwindcss-palette-generator";
|
|
48
|
+
import "./plugin-VDzc8jUO.js";
|
|
47
49
|
import "react-wrap-balancer";
|
|
48
50
|
import "react-dom";
|
|
49
51
|
import "prop-types";
|
|
@@ -62,7 +64,7 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
62
64
|
B({ accessKey: g }).search.getPhotos(f).then((i) => {
|
|
63
65
|
s(i);
|
|
64
66
|
}).catch((i) => r(i));
|
|
65
|
-
}),
|
|
67
|
+
}), He = ({ isModalView: f, onSelect: g }) => {
|
|
66
68
|
const s = V("unsplashAccessKey", ""), [r, x] = c([]), [i, v] = c(0), [l, P] = c(), [n, A] = c(), [_, b] = c(0), [h, q] = F("", 1e3), [u, m] = c(!1), { t: j } = T(), I = async (a) => {
|
|
67
69
|
if (d(h))
|
|
68
70
|
return;
|
|
@@ -70,8 +72,8 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
70
72
|
a && (a.preventDefault(), t = 1), m(!0), v(t);
|
|
71
73
|
const p = { query: h, page: t };
|
|
72
74
|
l && (p.orientation = l), n && (p.color = n), C(p, s).then((o) => {
|
|
73
|
-
var y, N,
|
|
74
|
-
x(t === 1 ? ((y = o == null ? void 0 : o.response) == null ? void 0 : y.results) || [] : [...r, ...((N = o == null ? void 0 : o.response) == null ? void 0 : N.results) || []]), b((
|
|
75
|
+
var y, N, k;
|
|
76
|
+
x(t === 1 ? ((y = o == null ? void 0 : o.response) == null ? void 0 : y.results) || [] : [...r, ...((N = o == null ? void 0 : o.response) == null ? void 0 : N.results) || []]), b((k = o == null ? void 0 : o.response) == null ? void 0 : k.total_pages), m(!1);
|
|
75
77
|
}).catch(() => {
|
|
76
78
|
m(!1);
|
|
77
79
|
});
|
|
@@ -112,7 +114,7 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
112
114
|
}
|
|
113
115
|
),
|
|
114
116
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
115
|
-
|
|
117
|
+
w,
|
|
116
118
|
{
|
|
117
119
|
className: "w-40",
|
|
118
120
|
placeholder: j("Orientation"),
|
|
@@ -139,7 +141,7 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
139
141
|
}
|
|
140
142
|
) }),
|
|
141
143
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
142
|
-
|
|
144
|
+
w,
|
|
143
145
|
{
|
|
144
146
|
placeholder: j("Color"),
|
|
145
147
|
options: [
|
|
@@ -239,6 +241,6 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
239
241
|
] });
|
|
240
242
|
};
|
|
241
243
|
export {
|
|
242
|
-
|
|
244
|
+
He as default,
|
|
243
245
|
C as fetchImage
|
|
244
246
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),p=require("lodash-es"),A=require("unsplash-js"),f=require("./context-menu-sQn7ryJ6.cjs"),_=require("react-i18next"),B=require("./useGlobalBlocksStore-1wJUEOl4.cjs"),T=require("@react-hookz/web"),D=require("lucide-react"),S=require("./index-lynOzeB3.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("jotai");require("./iconBase-kuD_VwQx.cjs");require("./_commonjsHelpers-f52AuuUj.cjs");require("@chaibuilder/runtime");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const g=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(o=>{i(o)}).catch(o=>a(o))}),L=({isModalView:h,onSelect:j})=>{const i=B.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[o,b]=n.useState(0),[l,w]=n.useState(),[u,k]=n.useState(),[C,v]=n.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:y}=_.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=o+1;r&&(r.preventDefault(),t=1),c(!0),b(t);const x={query:d,page:t};l&&(x.orientation=l),u&&(x.color=u),g(x,i).then(s=>{var E,R,N;q(t===1?((E=s==null?void 0:s.response)==null?void 0:E.results)||[]:[...a,...((R=s==null?void 0:s.response)==null?void 0:R.results)||[]]),v((N=s==null?void 0:s.response)==null?void 0:N.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!p.isEmpty(d)&&i){c(!0);const r={query:d,page:1};l&&(r.orientation=l),u&&(r.color=u),b(1),g(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),v((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[l,u,d,i]),p.isEmpty(i)?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(f.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:r=>P(r.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(S.ChaiSelect,{className:"w-40",placeholder:y("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:l,onValueChange:r=>w(r)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(S.ChaiSelect,{placeholder:y("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:u,onValueChange:r=>k(r)})})]}),e.jsxRuntimeExports.jsxs(f.ScrollArea,{className:`h-full ${h&&!p.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(a)&&!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:a.map(r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>j(r.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:r.alt_description,src:r.urls.small})})},r.id))}):a.map(r=>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:r.alt_description,src:r.urls.small})})},r.id)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(D.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!p.isEmpty(a)&&o<C&&!m&&e.jsxRuntimeExports.jsx(f.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(void 0),disabled:m,children:m?"":"Load More"})]})]})};exports.default=L;exports.fetchImage=g;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as i, useEffect as k } from "react";
|
|
3
3
|
import { isEmpty as j, map as b } from "lodash-es";
|
|
4
4
|
import { atom as F, useAtom as U } from "jotai";
|
|
5
5
|
import { V as C } from "./context-menu-9cWJcKdh.js";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { k as N } from "./useGlobalBlocksStore-HlGhDxuV.js";
|
|
8
8
|
import { Upload as G, Loader as P } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-switch";
|
|
10
10
|
import "@radix-ui/react-accordion";
|
|
@@ -27,69 +27,44 @@ import "@radix-ui/react-dialog";
|
|
|
27
27
|
import "@radix-ui/react-context-menu";
|
|
28
28
|
import "clsx";
|
|
29
29
|
import "tailwind-merge";
|
|
30
|
-
import "./iconBase-
|
|
31
|
-
import "
|
|
32
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
30
|
+
import "./iconBase-HBZkvN04.js";
|
|
31
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
33
32
|
import "@react-hookz/web";
|
|
33
|
+
import "@chaibuilder/runtime";
|
|
34
34
|
import "tree-model";
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import "flagged";
|
|
38
|
-
import "react-hotkeys-hook";
|
|
39
|
-
import "@floating-ui/dom";
|
|
40
|
-
import "@floating-ui/react-dom";
|
|
41
|
-
import "react-event-hook";
|
|
42
|
-
import "@tailwindcss/typography";
|
|
43
|
-
import "@tailwindcss/forms";
|
|
44
|
-
import "@tailwindcss/aspect-ratio";
|
|
45
|
-
import "tailwindcss-palette-generator";
|
|
46
|
-
import "react-wrap-balancer";
|
|
47
|
-
import "react-dom";
|
|
48
|
-
import "prop-types";
|
|
49
|
-
import "react-error-boundary";
|
|
50
|
-
import "re-resizable";
|
|
51
|
-
import "@rjsf/validator-ajv8";
|
|
52
|
-
import "@rjsf/core";
|
|
53
|
-
import "react-arborist";
|
|
54
|
-
import "himalaya";
|
|
55
|
-
import "react-icons-picker";
|
|
56
|
-
import "react-autosuggest";
|
|
57
|
-
import "fuse.js";
|
|
58
|
-
import "i18next";
|
|
59
|
-
import "framer-motion";
|
|
60
|
-
const S = F([]), Re = ({ isModalView: s, onSelect: m }) => {
|
|
61
|
-
const { t: r } = E(), c = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [i, p] = U(S), [y, u] = l(!1), [x, f] = l(!1), [, v] = l(), [h, d] = l("");
|
|
35
|
+
const S = F([]), ue = ({ isModalView: r, onSelect: m }) => {
|
|
36
|
+
const { t: s } = E(), p = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [l, d] = U(S), [y, u] = i(!1), [x, f] = i(!1), [, v] = i(), [h, c] = i("");
|
|
62
37
|
k(() => {
|
|
63
38
|
(async () => {
|
|
64
39
|
if (!n)
|
|
65
40
|
return;
|
|
66
41
|
f(!0);
|
|
67
42
|
const t = await n();
|
|
68
|
-
|
|
43
|
+
d(t || []), f(!1);
|
|
69
44
|
})();
|
|
70
45
|
}, []);
|
|
71
46
|
const w = (t) => {
|
|
72
|
-
var
|
|
73
|
-
if (
|
|
47
|
+
var a, o;
|
|
48
|
+
if (c(""), t && ((o = (a = t == null ? void 0 : t.target) == null ? void 0 : a.files) == null ? void 0 : o.length) > 0) {
|
|
74
49
|
const g = t.target.files[0];
|
|
75
|
-
g.type.startsWith("image") ? I(g) :
|
|
50
|
+
g.type.startsWith("image") ? I(g) : c(s("Please select an image"));
|
|
76
51
|
}
|
|
77
52
|
}, I = async (t) => {
|
|
78
|
-
if (
|
|
53
|
+
if (p) {
|
|
79
54
|
u(!0);
|
|
80
55
|
try {
|
|
81
|
-
const { url:
|
|
82
|
-
m(
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
} catch (
|
|
86
|
-
|
|
56
|
+
const { url: a } = await p(t);
|
|
57
|
+
m(a), v(void 0);
|
|
58
|
+
const o = await n();
|
|
59
|
+
d(o);
|
|
60
|
+
} catch (a) {
|
|
61
|
+
d([]), c((a == null ? void 0 : a.message) || "Something went wrong.");
|
|
87
62
|
}
|
|
88
63
|
u(!1);
|
|
89
64
|
}
|
|
90
65
|
};
|
|
91
66
|
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
92
|
-
/* @__PURE__ */ e.jsxs("label", { htmlFor:
|
|
67
|
+
/* @__PURE__ */ e.jsxs("label", { htmlFor: r ? "upload-in-modal" : "upload-in-panel", children: [
|
|
93
68
|
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ e.jsxs(
|
|
94
69
|
"label",
|
|
95
70
|
{
|
|
@@ -98,14 +73,14 @@ const S = F([]), Re = ({ isModalView: s, onSelect: m }) => {
|
|
|
98
73
|
children: [
|
|
99
74
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
|
|
100
75
|
/* @__PURE__ */ e.jsx(G, { className: "mb-3 h-10 w-10 text-gray-400" }),
|
|
101
|
-
/* @__PURE__ */ e.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children:
|
|
102
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children:
|
|
76
|
+
/* @__PURE__ */ e.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: s("Click to upload") }) }),
|
|
77
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: s("SVG, PNG, JPG or GIF (Max. 2mb)") })
|
|
103
78
|
] }),
|
|
104
79
|
y ? /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
|
|
105
80
|
/* @__PURE__ */ e.jsx(P, { className: "h-6 w-6 animate-spin" }),
|
|
106
|
-
/* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children:
|
|
81
|
+
/* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children: s("Uploading...") })
|
|
107
82
|
] }) : null,
|
|
108
|
-
h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h ||
|
|
83
|
+
h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h || s("Something went wrong") })
|
|
109
84
|
]
|
|
110
85
|
}
|
|
111
86
|
) }),
|
|
@@ -120,21 +95,21 @@ const S = F([]), Re = ({ isModalView: s, onSelect: m }) => {
|
|
|
120
95
|
}
|
|
121
96
|
)
|
|
122
97
|
] }),
|
|
123
|
-
/* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${
|
|
124
|
-
j(
|
|
125
|
-
j(
|
|
98
|
+
/* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
99
|
+
j(l) && x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: s("Fetching...") }) }),
|
|
100
|
+
j(l) && !x && /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
|
|
126
101
|
/* @__PURE__ */ e.jsx("div", { className: "mb-4 h-12 rounded-full p-6" }),
|
|
127
|
-
/* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children:
|
|
128
|
-
/* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children:
|
|
102
|
+
/* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children: s("No images found") }),
|
|
103
|
+
/* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children: s("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.") })
|
|
129
104
|
] }),
|
|
130
|
-
|
|
105
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(l, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
131
106
|
"img",
|
|
132
107
|
{
|
|
133
108
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
134
109
|
alt: t.name,
|
|
135
110
|
src: t.thumbUrl
|
|
136
111
|
}
|
|
137
|
-
) }) }, t.id)) }) : b(
|
|
112
|
+
) }) }, t.id)) }) : b(l, (t) => (
|
|
138
113
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
139
114
|
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
140
115
|
"img",
|
|
@@ -149,5 +124,5 @@ const S = F([]), Re = ({ isModalView: s, onSelect: m }) => {
|
|
|
149
124
|
] });
|
|
150
125
|
};
|
|
151
126
|
export {
|
|
152
|
-
|
|
127
|
+
ue as default
|
|
153
128
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),o=require("lodash-es"),E=require("jotai"),I=require("./context-menu-sQn7ryJ6.cjs"),w=require("react-i18next"),b=require("./useGlobalBlocksStore-1wJUEOl4.cjs"),q=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("./iconBase-kuD_VwQx.cjs");require("./_commonjsHelpers-f52AuuUj.cjs");require("@react-hookz/web");require("@chaibuilder/runtime");require("tree-model");const k=E.atom([]),S=({isModalView:a,onSelect:u})=>{const{t}=w.useTranslation(),d=b.useBuilderProp("uploadMediaCallback"),x=b.useBuilderProp("fetchMediaCallback"),[l,c]=E.useAtom(k),[R,p]=i.useState(!1),[j,h]=i.useState(!1),[,y]=i.useState(),[f,m]=i.useState("");i.useEffect(()=>{(async()=>{if(!x)return;h(!0);const s=await x();c(s||[]),h(!1)})()},[]);const N=s=>{var r,n;if(m(""),s&&((n=(r=s==null?void 0:s.target)==null?void 0:r.files)==null?void 0:n.length)>0){const g=s.target.files[0];g.type.startsWith("image")?v(g):m(t("Please select an image"))}},v=async s=>{if(d){p(!0);try{const{url:r}=await d(s);u(r),y(void 0);const n=await x();c(n)}catch(r){c([]),m((r==null?void 0:r.message)||"Something went wrong.")}p(!1)}};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:a?"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(q.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)")})]}),R?e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsxRuntimeExports.jsx(q.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:N})]}),e.jsxRuntimeExports.jsxs(I.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${a?"px-2":""} pt-2`,children:[o.isEmpty(l)&&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...")})}),o.isEmpty(l)&&!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.")})]}),a?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:o.map(l,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>u(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))}):o.map(l,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>u(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=S;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function l(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as c,
|
|
7
|
+
l as g
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}exports.commonjsGlobal=o;exports.getDefaultExportFromCjs=l;
|
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-lynOzeB3.cjs"),s=require("./iconBase-kuD_VwQx.cjs"),r=require("./useGlobalBlocksStore-1wJUEOl4.cjs"),u=require("react-i18next"),i=require("i18next");require("./jsx-runtime-JYMCiFoE.cjs");require("react");require("./context-menu-sQn7ryJ6.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("react-quill");require("@chaibuilder/runtime");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@react-hookz/web");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("./_commonjsHelpers-f52AuuUj.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("framer-motion");require("tree-model");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.DarkModeSwitcher=e.DarkMode;exports.DefaultChaiBlocks=e.DefaultChaiBlocks;exports.ImportHTML=e.ImportHTML;exports.Outline=e.Outline;exports.ScreenSizes=e.Breakpoints;exports.ThemeOptions=e.ThemeOptions;exports.UILibraries=e.UILibraries;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.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.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLayoutVariant=e.useLayoutVariant;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;exports.useBlocksStore=r.useBlocksStore;exports.useBlocksStoreUndoableActions=r.useBlocksStoreUndoableActions;exports.useBrandingOptions=r.useBrandingOptions;exports.useBuilderProp=r.useBuilderProp;exports.useCurrentPage=r.useCurrentPage;exports.useGlobalBlocksList=r.useGlobalBlocksList;exports.useGlobalBlocksStore=r.useGlobalBlocksStore;exports.useRemoveBlocks=r.useRemoveBlocks;exports.useSavePage=r.useSavePage;exports.useSelectedBlock=r.useSelectedBlock;exports.useSelectedBlockIds=r.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=r.useSelectedBlocksDisplayChild;exports.useUndoManager=r.useUndoManager;exports.useUpdateBlocksProps=r.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=r.useUpdateBlocksPropsRealtime;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});exports.i18n=i;
|