@chaibuilder/sdk 1.2.114 → 1.2.116
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/README.md +2 -6
- package/dist/CodeEditor-Bl58eelM.cjs +1 -0
- package/dist/CodeEditor-C1ImRmIp.js +77 -0
- package/dist/Topbar-BpMZTZKz.cjs +1 -0
- package/dist/Topbar-tRFEAMbG.js +113 -0
- package/dist/UnsplashImages-BXarNGDE.cjs +1 -0
- package/dist/{UnsplashImages-chQ74Yzq.js → UnsplashImages-Ds_3IihK.js} +38 -90
- package/dist/UploadImages-DPMndPNm.cjs +1 -0
- package/dist/UploadImages-VZ7-y0rA.js +101 -0
- package/dist/cdn.js +25283 -0
- package/dist/{context-menu-FPX89OKr.js → context-menu-BbqLeYFX.js} +1 -1
- package/dist/{context-menu-sQn7ryJ6.cjs → context-menu-DfAXjmc8.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +50 -17
- package/dist/core.js +74 -127
- package/dist/{iconBase-Ief2hJUZ.js → iconBase-DHfFLkem.js} +6 -12
- package/dist/index-B_be_Or7.cjs +63 -0
- package/dist/{index-IZpHf_8d.js → index-Bn53BEJy.js} +1631 -1658
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-DGlMoOmv.js} +241 -242
- package/dist/{plugin-UiUFs2fK.js → plugin-BOEoR5jk.js} +1 -1
- package/dist/{plugin-xOpS-UNV.cjs → plugin-COMQcYlW.cjs} +1 -1
- package/dist/{plugin-f6SDZ_Or.js → plugin-Dw854zFv.js} +7 -8
- package/dist/{plugin-jum1MjXp.cjs → plugin-I9XxF65G.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.js +10 -14
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +12 -13
- package/dist/style.css +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +5 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -6
- package/dist/ui.js +145 -163
- package/dist/web-blocks.cjs +19 -2
- package/dist/web-blocks.js +116 -102
- package/package.json +3 -1
- package/dist/CodeEditor-BWHGysUw.cjs +0 -1
- package/dist/CodeEditor-q9he9IC8.js +0 -129
- package/dist/Topbar-86JxE7Uw.js +0 -163
- package/dist/Topbar-8LnyJF7S.cjs +0 -1
- package/dist/UnsplashImages-MLEjengP.cjs +0 -1
- package/dist/UploadImages--77rHMEx.cjs +0 -1
- package/dist/UploadImages-Auy8ZPBl.js +0 -153
- package/dist/index-KsZZcMSu.cjs +0 -63
- package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
- /package/dist/{STRINGS-Xxstm-7I.js → STRINGS-eiGM83kj.js} +0 -0
- /package/dist/{STRINGS-Yl7cSWDc.cjs → STRINGS-ew98weUe.cjs} +0 -0
- /package/dist/{controls-p9IwFnPx.cjs → controls-C4n5ycp4.cjs} +0 -0
- /package/dist/{controls-lEwMTdPQ.js → controls-Com-zYCq.js} +0 -0
- /package/dist/{iconBase-aZzpqff_.cjs → iconBase-Cn2BsTrq.cjs} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),b=require("@monaco-editor/react"),k=require("./context-menu-sQn7ryJ6.cjs"),C=require("react-i18next"),u=require("react"),n=require("./index-KsZZcMSu.cjs"),E=require("@radix-ui/react-icons"),R=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-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");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("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("./controls-p9IwFnPx.cjs");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 g(){const{t:s}=C.useTranslation(),[i,d]=u.useState(!1),[l,q]=u.useState(""),[r,o]=n.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=R.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],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 f=()=>{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:f,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(E.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),q(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
-
import k from "@monaco-editor/react";
|
|
3
|
-
import { B as C } from "./context-menu-FPX89OKr.js";
|
|
4
|
-
import { useTranslation as j } from "react-i18next";
|
|
5
|
-
import { useState as l, useCallback as v, useEffect as g } from "react";
|
|
6
|
-
import { u as y, a as N, b as T, c as E } from "./index-IZpHf_8d.js";
|
|
7
|
-
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
8
|
-
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
9
|
-
import "@radix-ui/react-switch";
|
|
10
|
-
import "@radix-ui/react-accordion";
|
|
11
|
-
import "class-variance-authority";
|
|
12
|
-
import "@radix-ui/react-alert-dialog";
|
|
13
|
-
import "@radix-ui/react-slot";
|
|
14
|
-
import "@radix-ui/react-label";
|
|
15
|
-
import "@radix-ui/react-scroll-area";
|
|
16
|
-
import "@radix-ui/react-tabs";
|
|
17
|
-
import "@radix-ui/react-tooltip";
|
|
18
|
-
import "@radix-ui/react-popover";
|
|
19
|
-
import "@radix-ui/react-hover-card";
|
|
20
|
-
import "@radix-ui/react-select";
|
|
21
|
-
import "@radix-ui/react-dropdown-menu";
|
|
22
|
-
import "@radix-ui/react-separator";
|
|
23
|
-
import "@radix-ui/react-toast";
|
|
24
|
-
import "cmdk";
|
|
25
|
-
import "@radix-ui/react-dialog";
|
|
26
|
-
import "@radix-ui/react-context-menu";
|
|
27
|
-
import "clsx";
|
|
28
|
-
import "tailwind-merge";
|
|
29
|
-
import "lodash-es";
|
|
30
|
-
import "jotai";
|
|
31
|
-
import "./iconBase-Ief2hJUZ.js";
|
|
32
|
-
import "@chaibuilder/runtime";
|
|
33
|
-
import "./plugin-f6SDZ_Or.js";
|
|
34
|
-
import "tree-model";
|
|
35
|
-
import "react-quill";
|
|
36
|
-
import "./STRINGS-Xxstm-7I.js";
|
|
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 "react-wrap-balancer";
|
|
46
|
-
import "react-dom";
|
|
47
|
-
import "prop-types";
|
|
48
|
-
import "react-error-boundary";
|
|
49
|
-
import "re-resizable";
|
|
50
|
-
import "lucide-react";
|
|
51
|
-
import "@rjsf/validator-ajv8";
|
|
52
|
-
import "@rjsf/core";
|
|
53
|
-
import "./controls-lEwMTdPQ.js";
|
|
54
|
-
import "react-arborist";
|
|
55
|
-
import "himalaya";
|
|
56
|
-
import "react-icons-picker";
|
|
57
|
-
import "react-autosuggest";
|
|
58
|
-
import "fuse.js";
|
|
59
|
-
import "i18next";
|
|
60
|
-
import "framer-motion";
|
|
61
|
-
const a = (r) => {
|
|
62
|
-
const i = document.createElement("div");
|
|
63
|
-
return i.innerHTML = r, i.innerHTML;
|
|
64
|
-
};
|
|
65
|
-
function Rt() {
|
|
66
|
-
const { t: r } = j(), [i, n] = l(!1), [m, c] = l(""), [o, s] = y(), [p] = N(), d = T(), u = E(), f = B(
|
|
67
|
-
(e) => {
|
|
68
|
-
const b = a(e);
|
|
69
|
-
u([o.blockId], { [o.blockProp]: b });
|
|
70
|
-
},
|
|
71
|
-
[],
|
|
72
|
-
300
|
|
73
|
-
), x = v(() => {
|
|
74
|
-
if (i) {
|
|
75
|
-
const e = a(m);
|
|
76
|
-
d([o.blockId], { [o.blockProp]: e });
|
|
77
|
-
}
|
|
78
|
-
}, [i, m]);
|
|
79
|
-
g(() => {
|
|
80
|
-
p.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
|
|
81
|
-
}, [p]);
|
|
82
|
-
const h = () => {
|
|
83
|
-
s(null);
|
|
84
|
-
};
|
|
85
|
-
return /* @__PURE__ */ t.jsxs("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
|
|
86
|
-
/* @__PURE__ */ t.jsx("button", { onClick: h, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
|
|
87
|
-
/* @__PURE__ */ t.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
|
|
88
|
-
/* @__PURE__ */ t.jsxs("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
|
|
89
|
-
/* @__PURE__ */ t.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
|
|
90
|
-
/* @__PURE__ */ t.jsx("span", { children: r("HTML Code Editor |") }),
|
|
91
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-xs text-gray-400", children: r("Scripts will be only executed in preview and live mode.") })
|
|
92
|
-
] }),
|
|
93
|
-
/* @__PURE__ */ t.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ t.jsx(
|
|
94
|
-
C,
|
|
95
|
-
{
|
|
96
|
-
onClick: () => s(null),
|
|
97
|
-
size: "sm",
|
|
98
|
-
variant: "destructive",
|
|
99
|
-
className: "h-6 w-fit",
|
|
100
|
-
children: /* @__PURE__ */ t.jsx(w, {})
|
|
101
|
-
}
|
|
102
|
-
) })
|
|
103
|
-
] }),
|
|
104
|
-
/* @__PURE__ */ t.jsx(
|
|
105
|
-
k,
|
|
106
|
-
{
|
|
107
|
-
onMount: (e) => {
|
|
108
|
-
e.setValue(o.initialCode);
|
|
109
|
-
},
|
|
110
|
-
onChange: (e) => {
|
|
111
|
-
n(!0), c(e), f(e);
|
|
112
|
-
},
|
|
113
|
-
height: "100%",
|
|
114
|
-
defaultLanguage: "html",
|
|
115
|
-
theme: "vs-dark",
|
|
116
|
-
defaultValue: "",
|
|
117
|
-
options: {
|
|
118
|
-
minimap: {
|
|
119
|
-
enabled: !1
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
] })
|
|
125
|
-
] });
|
|
126
|
-
}
|
|
127
|
-
export {
|
|
128
|
-
Rt as default
|
|
129
|
-
};
|
package/dist/Topbar-86JxE7Uw.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
-
import l, { useMemo as w, Suspense as p } from "react";
|
|
3
|
-
import { B as u, a6 as C, a7 as S, a8 as y, a9 as k, aq as c, al as g } from "./context-menu-FPX89OKr.js";
|
|
4
|
-
import { e as A, F as D, d as n, f as P, g as B, L as x, h as f, i as E } from "./index-IZpHf_8d.js";
|
|
5
|
-
import { useTranslation as v } from "react-i18next";
|
|
6
|
-
import { c as N } from "./iconBase-Ief2hJUZ.js";
|
|
7
|
-
import { EyeOpenIcon as L, ChevronDownIcon as M } from "@radix-ui/react-icons";
|
|
8
|
-
import { forEach as I, uniq as G, get as d, isEmpty as j, map as V } from "lodash-es";
|
|
9
|
-
import "@chaibuilder/runtime";
|
|
10
|
-
import "@radix-ui/react-switch";
|
|
11
|
-
import "@radix-ui/react-accordion";
|
|
12
|
-
import "class-variance-authority";
|
|
13
|
-
import "@radix-ui/react-alert-dialog";
|
|
14
|
-
import "@radix-ui/react-slot";
|
|
15
|
-
import "@radix-ui/react-label";
|
|
16
|
-
import "@radix-ui/react-scroll-area";
|
|
17
|
-
import "@radix-ui/react-tabs";
|
|
18
|
-
import "@radix-ui/react-tooltip";
|
|
19
|
-
import "@radix-ui/react-popover";
|
|
20
|
-
import "@radix-ui/react-hover-card";
|
|
21
|
-
import "@radix-ui/react-select";
|
|
22
|
-
import "@radix-ui/react-dropdown-menu";
|
|
23
|
-
import "@radix-ui/react-separator";
|
|
24
|
-
import "@radix-ui/react-toast";
|
|
25
|
-
import "cmdk";
|
|
26
|
-
import "@radix-ui/react-dialog";
|
|
27
|
-
import "@radix-ui/react-context-menu";
|
|
28
|
-
import "clsx";
|
|
29
|
-
import "tailwind-merge";
|
|
30
|
-
import "jotai";
|
|
31
|
-
import "./plugin-f6SDZ_Or.js";
|
|
32
|
-
import "@react-hookz/web";
|
|
33
|
-
import "tree-model";
|
|
34
|
-
import "react-quill";
|
|
35
|
-
import "./STRINGS-Xxstm-7I.js";
|
|
36
|
-
import "flagged";
|
|
37
|
-
import "react-hotkeys-hook";
|
|
38
|
-
import "@floating-ui/dom";
|
|
39
|
-
import "@floating-ui/react-dom";
|
|
40
|
-
import "react-event-hook";
|
|
41
|
-
import "@tailwindcss/typography";
|
|
42
|
-
import "@tailwindcss/forms";
|
|
43
|
-
import "@tailwindcss/aspect-ratio";
|
|
44
|
-
import "react-wrap-balancer";
|
|
45
|
-
import "react-dom";
|
|
46
|
-
import "prop-types";
|
|
47
|
-
import "react-error-boundary";
|
|
48
|
-
import "re-resizable";
|
|
49
|
-
import "lucide-react";
|
|
50
|
-
import "@rjsf/validator-ajv8";
|
|
51
|
-
import "@rjsf/core";
|
|
52
|
-
import "./controls-lEwMTdPQ.js";
|
|
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 F = () => {
|
|
61
|
-
const { savePage: a, saveState: r } = A(), { t: s } = v(), i = /* @__PURE__ */ e.jsxs(
|
|
62
|
-
u,
|
|
63
|
-
{
|
|
64
|
-
disabled: r === "SAVING",
|
|
65
|
-
onClick: (t) => {
|
|
66
|
-
t.preventDefault(), a();
|
|
67
|
-
},
|
|
68
|
-
className: N(
|
|
69
|
-
"flex h-auto w-fit items-center gap-x-2 p-1 px-2",
|
|
70
|
-
// UNSAVED sate
|
|
71
|
-
"bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
|
|
72
|
-
{
|
|
73
|
-
"animate-pulse bg-gray-300 text-gray-900": r === "SAVING",
|
|
74
|
-
"bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white": r === "SAVED"
|
|
75
|
-
}
|
|
76
|
-
),
|
|
77
|
-
size: "sm",
|
|
78
|
-
variant: "outline",
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ e.jsx(D, { className: "text-sm text-white" }),
|
|
81
|
-
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: s(r === "SAVING" ? "Saving" : r === "SAVED" ? "Saved" : "Unsaved") })
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: i });
|
|
86
|
-
}, z = function() {
|
|
87
|
-
const r = n("previewComponent"), [, s] = P(), { t: i } = v();
|
|
88
|
-
return r ? /* @__PURE__ */ e.jsxs(
|
|
89
|
-
u,
|
|
90
|
-
{
|
|
91
|
-
onClick: (t) => {
|
|
92
|
-
t.preventDefault(), s(!0);
|
|
93
|
-
},
|
|
94
|
-
className: "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
|
|
95
|
-
size: "sm",
|
|
96
|
-
variant: "outline",
|
|
97
|
-
children: [
|
|
98
|
-
/* @__PURE__ */ e.jsx(L, { className: "text-xs" }),
|
|
99
|
-
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: i("Preview") })
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
) : null;
|
|
103
|
-
}, T = () => {
|
|
104
|
-
const { fallbackLang: a, languages: r, selectedLang: s, setSelectedLang: i } = B(), t = (s == null ? void 0 : s.length) > 0 ? s : a, b = w(() => {
|
|
105
|
-
const o = [];
|
|
106
|
-
return I(G([a, ...r]), (m) => {
|
|
107
|
-
const h = d(x, m);
|
|
108
|
-
h && o.push({ key: m, value: h, default: m === a });
|
|
109
|
-
}), o;
|
|
110
|
-
}, [a, r]);
|
|
111
|
-
return j(r) && t === "en" ? null : j(r) && t !== "en" ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600", children: [
|
|
112
|
-
/* @__PURE__ */ e.jsx(f, { className: "h-4 w-4" }),
|
|
113
|
-
d(x, t)
|
|
114
|
-
] }) : /* @__PURE__ */ e.jsxs(C, { children: [
|
|
115
|
-
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsxs(u, { size: "sm", variant: "outline", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
|
|
116
|
-
/* @__PURE__ */ e.jsx(f, { className: "h-4 w-4" }),
|
|
117
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
118
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
119
|
-
" ",
|
|
120
|
-
d(x, t)
|
|
121
|
-
] }),
|
|
122
|
-
/* @__PURE__ */ e.jsx(M, { className: "h-4 w-4" })
|
|
123
|
-
] })
|
|
124
|
-
] }) }),
|
|
125
|
-
/* @__PURE__ */ e.jsx(y, { className: "border-border", children: V(b, (o) => /* @__PURE__ */ e.jsxs(
|
|
126
|
-
k,
|
|
127
|
-
{
|
|
128
|
-
className: N(
|
|
129
|
-
"flex cursor-pointer items-center text-sm",
|
|
130
|
-
o.key === t && "!bg-blue-500 text-white hover:!text-white"
|
|
131
|
-
),
|
|
132
|
-
onClick: () => i(o.key),
|
|
133
|
-
children: [
|
|
134
|
-
/* @__PURE__ */ e.jsx("div", { children: o.value }),
|
|
135
|
-
o.key === a ? /* @__PURE__ */ e.jsx(E, { className: "ml-2 h-4 w-4 text-yellow-400" }) : null
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
)) })
|
|
139
|
-
] });
|
|
140
|
-
}, He = () => {
|
|
141
|
-
const a = n("topBarComponents.left", []), r = n("topBarComponents.center", []), s = n("topBarComponents.right", []), i = n("editable", !0);
|
|
142
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
143
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: l.Children.toArray(
|
|
144
|
-
a.map((t) => /* @__PURE__ */ e.jsx(p, { fallback: /* @__PURE__ */ e.jsx(c, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
145
|
-
) }) }),
|
|
146
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: l.Children.toArray(
|
|
147
|
-
r.map((t) => /* @__PURE__ */ e.jsx(p, { fallback: /* @__PURE__ */ e.jsx(c, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
148
|
-
) }),
|
|
149
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
150
|
-
/* @__PURE__ */ e.jsx(T, {}),
|
|
151
|
-
/* @__PURE__ */ e.jsx(g, { orientation: "vertical" }),
|
|
152
|
-
/* @__PURE__ */ e.jsx(z, {}),
|
|
153
|
-
/* @__PURE__ */ e.jsx(g, { orientation: "vertical" }),
|
|
154
|
-
i ? /* @__PURE__ */ e.jsx(F, {}) : null,
|
|
155
|
-
l.Children.toArray(
|
|
156
|
-
s.map((t) => /* @__PURE__ */ e.jsx(p, { fallback: /* @__PURE__ */ e.jsx(c, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
157
|
-
)
|
|
158
|
-
] })
|
|
159
|
-
] });
|
|
160
|
-
};
|
|
161
|
-
export {
|
|
162
|
-
He as default
|
|
163
|
-
};
|
package/dist/Topbar-8LnyJF7S.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),l=require("react"),i=require("./context-menu-sQn7ryJ6.cjs"),t=require("./index-KsZZcMSu.cjs"),p=require("react-i18next"),j=require("./iconBase-aZzpqff_.cjs"),d=require("@radix-ui/react-icons"),x=require("lodash-es");require("@chaibuilder/runtime");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("jotai");require("./plugin-xOpS-UNV.cjs");require("@react-hookz/web");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("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("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const h=()=>{const{savePage:u,saveState:s}=t.useSavePage(),{t:n}=p.useTranslation(),a=e.jsxRuntimeExports.jsxs(i.Button,{disabled:s==="SAVING",onClick:r=>{r.preventDefault(),u()},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":s==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":s==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(t.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:n(s==="SAVING"?"Saving":s==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:a})},E=function(){const s=t.useBuilderProp("previewComponent"),[,n]=t.usePreviewMode(),{t:a}=p.useTranslation();return s?e.jsxRuntimeExports.jsxs(i.Button,{onClick:r=>{r.preventDefault(),n(!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:a("Preview")})]}):null},g=()=>{const{fallbackLang:u,languages:s,selectedLang:n,setSelectedLang:a}=t.useLanguages(),r=(n==null?void 0:n.length)>0?n:u,q=l.useMemo(()=>{const o=[];return x.forEach(x.uniq([u,...s]),c=>{const m=x.get(t.LANGUAGES,c);m&&o.push({key:c,value:m,default:c===u})}),o},[u,s]);return x.isEmpty(s)&&r==="en"?null:x.isEmpty(s)&&r!=="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(t.FaLanguage,{className:"h-4 w-4"}),x.get(t.LANGUAGES,r)]}):e.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"outline",className:"flex items-center gap-x-1 text-blue-500 hover:text-blue-600",children:[e.jsxRuntimeExports.jsx(t.FaLanguage,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsxs("div",{children:[" ",x.get(t.LANGUAGES,r)]}),e.jsxRuntimeExports.jsx(d.ChevronDownIcon,{className:"h-4 w-4"})]})]})}),e.jsxRuntimeExports.jsx(i.DropdownMenuContent,{className:"border-border",children:x.map(q,o=>e.jsxRuntimeExports.jsxs(i.DropdownMenuItem,{className:j.cn("flex cursor-pointer items-center text-sm",o.key===r&&"!bg-blue-500 text-white hover:!text-white"),onClick:()=>a(o.key),children:[e.jsxRuntimeExports.jsx("div",{children:o.value}),o.key===u?e.jsxRuntimeExports.jsx(t.FaStar,{className:"ml-2 h-4 w-4 text-yellow-400"}):null]}))})]})},v=()=>{const u=t.useBuilderProp("topBarComponents.left",[]),s=t.useBuilderProp("topBarComponents.center",[]),n=t.useBuilderProp("topBarComponents.right",[]),a=t.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:l.Children.toArray(u.map(r=>e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(r,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:l.Children.toArray(s.map(r=>e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(r,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(g,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(E,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),a?e.jsxRuntimeExports.jsx(h,{}):null,l.Children.toArray(n.map(r=>e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(r,{})})))]})]})};exports.default=v;
|
|
@@ -1 +0,0 @@
|
|
|
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"),g=require("./index-KsZZcMSu.cjs"),T=require("@react-hookz/web"),B=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("jotai");require("./iconBase-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");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("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const v=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(l=>{i(l)}).catch(l=>a(l))}),D=({isModalView:h,onSelect:j})=>{const i=g.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[l,b]=n.useState(0),[o,w]=n.useState(),[u,k]=n.useState(),[C,y]=n.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:E}=_.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=l+1;r&&(r.preventDefault(),t=1),c(!0),b(t);const x={query:d,page:t};o&&(x.orientation=o),u&&(x.color=u),v(x,i).then(s=>{var R,N,S;q(t===1?((R=s==null?void 0:s.response)==null?void 0:R.results)||[]:[...a,...((N=s==null?void 0:s.response)==null?void 0:N.results)||[]]),y((S=s==null?void 0:s.response)==null?void 0:S.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!p.isEmpty(d)&&i){c(!0);const r={query:d,page:1};o&&(r.orientation=o),u&&(r.color=u),b(1),v(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),y((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[o,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(g.ChaiSelect,{className:"w-40",placeholder:E("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:o,onValueChange:r=>w(r)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{placeholder:E("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(B.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!p.isEmpty(a)&&l<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=D;exports.fetchImage=v;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),n=require("lodash-es"),E=require("jotai"),I=require("./context-menu-sQn7ryJ6.cjs"),w=require("react-i18next"),g=require("./index-KsZZcMSu.cjs"),b=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-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");require("@react-hookz/web");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("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const k=E.atom([]),S=({isModalView:a,onSelect:o})=>{const{t:s}=w.useTranslation(),d=g.useBuilderProp("uploadMediaCallback"),x=g.useBuilderProp("fetchMediaCallback"),[u,c]=E.useAtom(k),[R,p]=i.useState(!1),[j,q]=i.useState(!1),[,y]=i.useState(),[h,m]=i.useState("");i.useEffect(()=>{(async()=>{if(!x)return;q(!0);const r=await x();c(r||[]),q(!1)})()},[]);const N=r=>{var t,l;if(m(""),r&&((l=(t=r==null?void 0:r.target)==null?void 0:t.files)==null?void 0:l.length)>0){const f=r.target.files[0];f.type.startsWith("image")?v(f):m(s("Please select an image"))}},v=async r=>{if(d){p(!0);try{const{url:t}=await d(r);o(t),y(void 0);const l=await x();c(l)}catch(t){c([]),m((t==null?void 0:t.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(b.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:s("Click to upload")})}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("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(b.Loader,{className:"h-6 w-6 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-sm text-gray-500",children:s("Uploading...")})]}):null,h&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:h||s("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:[n.isEmpty(u)&&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:s("Fetching...")})}),n.isEmpty(u)&&!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:s("No images found")}),e.jsxRuntimeExports.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.")})]}),a?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>o(r.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:r.name,src:r.thumbUrl})})},r.id))}):n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>o(r.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:r.name,src:r.url})})},r.id))]})]})};exports.default=S;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
-
import { useState as l, useEffect as k } from "react";
|
|
3
|
-
import { isEmpty as j, map as b } from "lodash-es";
|
|
4
|
-
import { atom as F, useAtom as U } from "jotai";
|
|
5
|
-
import { S as C } from "./context-menu-FPX89OKr.js";
|
|
6
|
-
import { useTranslation as S } from "react-i18next";
|
|
7
|
-
import { d as N } from "./index-IZpHf_8d.js";
|
|
8
|
-
import { Upload as E, Loader as G } from "lucide-react";
|
|
9
|
-
import "@radix-ui/react-switch";
|
|
10
|
-
import "@radix-ui/react-accordion";
|
|
11
|
-
import "@radix-ui/react-icons";
|
|
12
|
-
import "class-variance-authority";
|
|
13
|
-
import "@radix-ui/react-alert-dialog";
|
|
14
|
-
import "@radix-ui/react-slot";
|
|
15
|
-
import "@radix-ui/react-label";
|
|
16
|
-
import "@radix-ui/react-scroll-area";
|
|
17
|
-
import "@radix-ui/react-tabs";
|
|
18
|
-
import "@radix-ui/react-tooltip";
|
|
19
|
-
import "@radix-ui/react-popover";
|
|
20
|
-
import "@radix-ui/react-hover-card";
|
|
21
|
-
import "@radix-ui/react-select";
|
|
22
|
-
import "@radix-ui/react-dropdown-menu";
|
|
23
|
-
import "@radix-ui/react-separator";
|
|
24
|
-
import "@radix-ui/react-toast";
|
|
25
|
-
import "cmdk";
|
|
26
|
-
import "@radix-ui/react-dialog";
|
|
27
|
-
import "@radix-ui/react-context-menu";
|
|
28
|
-
import "clsx";
|
|
29
|
-
import "tailwind-merge";
|
|
30
|
-
import "./iconBase-Ief2hJUZ.js";
|
|
31
|
-
import "@chaibuilder/runtime";
|
|
32
|
-
import "./plugin-f6SDZ_Or.js";
|
|
33
|
-
import "@react-hookz/web";
|
|
34
|
-
import "tree-model";
|
|
35
|
-
import "react-quill";
|
|
36
|
-
import "./STRINGS-Xxstm-7I.js";
|
|
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 "react-wrap-balancer";
|
|
46
|
-
import "react-dom";
|
|
47
|
-
import "prop-types";
|
|
48
|
-
import "react-error-boundary";
|
|
49
|
-
import "re-resizable";
|
|
50
|
-
import "@rjsf/validator-ajv8";
|
|
51
|
-
import "@rjsf/core";
|
|
52
|
-
import "./controls-lEwMTdPQ.js";
|
|
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 P = F([]), Re = ({ isModalView: s, onSelect: m }) => {
|
|
61
|
-
const { t: r } = S(), c = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [i, d] = U(P), [y, u] = l(!1), [x, f] = l(!1), [, v] = l(), [h, p] = l("");
|
|
62
|
-
k(() => {
|
|
63
|
-
(async () => {
|
|
64
|
-
if (!n)
|
|
65
|
-
return;
|
|
66
|
-
f(!0);
|
|
67
|
-
const t = await n();
|
|
68
|
-
d(t || []), f(!1);
|
|
69
|
-
})();
|
|
70
|
-
}, []);
|
|
71
|
-
const w = (t) => {
|
|
72
|
-
var o, a;
|
|
73
|
-
if (p(""), t && ((a = (o = t == null ? void 0 : t.target) == null ? void 0 : o.files) == null ? void 0 : a.length) > 0) {
|
|
74
|
-
const g = t.target.files[0];
|
|
75
|
-
g.type.startsWith("image") ? I(g) : p(r("Please select an image"));
|
|
76
|
-
}
|
|
77
|
-
}, I = async (t) => {
|
|
78
|
-
if (c) {
|
|
79
|
-
u(!0);
|
|
80
|
-
try {
|
|
81
|
-
const { url: o } = await c(t);
|
|
82
|
-
m(o), v(void 0);
|
|
83
|
-
const a = await n();
|
|
84
|
-
d(a);
|
|
85
|
-
} catch (o) {
|
|
86
|
-
d([]), p((o == null ? void 0 : o.message) || "Something went wrong.");
|
|
87
|
-
}
|
|
88
|
-
u(!1);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
92
|
-
/* @__PURE__ */ e.jsxs("label", { htmlFor: s ? "upload-in-modal" : "upload-in-panel", children: [
|
|
93
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ e.jsxs(
|
|
94
|
-
"label",
|
|
95
|
-
{
|
|
96
|
-
htmlFor: "image-upload",
|
|
97
|
-
className: "flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",
|
|
98
|
-
children: [
|
|
99
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
|
|
100
|
-
/* @__PURE__ */ e.jsx(E, { 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: r("Click to upload") }) }),
|
|
102
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: r("SVG, PNG, JPG or GIF (Max. 2mb)") })
|
|
103
|
-
] }),
|
|
104
|
-
y ? /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
|
|
105
|
-
/* @__PURE__ */ e.jsx(G, { className: "h-6 w-6 animate-spin" }),
|
|
106
|
-
/* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children: r("Uploading...") })
|
|
107
|
-
] }) : null,
|
|
108
|
-
h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h || r("Something went wrong") })
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
) }),
|
|
112
|
-
/* @__PURE__ */ e.jsx(
|
|
113
|
-
"input",
|
|
114
|
-
{
|
|
115
|
-
type: "file",
|
|
116
|
-
id: "image-upload",
|
|
117
|
-
accept: "image/*",
|
|
118
|
-
hidden: !0,
|
|
119
|
-
onChange: w
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
] }),
|
|
123
|
-
/* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${s ? "px-2" : ""} pt-2`, children: [
|
|
124
|
-
j(i) && 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: r("Fetching...") }) }),
|
|
125
|
-
j(i) && !x && /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
|
|
126
|
-
/* @__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: r("No images found") }),
|
|
128
|
-
/* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children: r("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.") })
|
|
129
|
-
] }),
|
|
130
|
-
s ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(i, (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
|
-
"img",
|
|
132
|
-
{
|
|
133
|
-
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
134
|
-
alt: t.name,
|
|
135
|
-
src: t.thumbUrl
|
|
136
|
-
}
|
|
137
|
-
) }) }, t.id)) }) : b(i, (t) => (
|
|
138
|
-
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
139
|
-
/* @__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
|
-
"img",
|
|
141
|
-
{
|
|
142
|
-
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
143
|
-
alt: t.name,
|
|
144
|
-
src: t.url
|
|
145
|
-
}
|
|
146
|
-
) }) }, t.id)
|
|
147
|
-
))
|
|
148
|
-
] })
|
|
149
|
-
] });
|
|
150
|
-
};
|
|
151
|
-
export {
|
|
152
|
-
Re as default
|
|
153
|
-
};
|