@chaibuilder/sdk 1.2.91 → 1.2.92
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-awVVPqel.cjs +1 -0
- package/dist/{CodeEditor-_Pim7pDO.js → CodeEditor-orTEdw7a.js} +30 -28
- package/dist/Topbar--KOfsR94.cjs +1 -0
- package/dist/{Topbar-4ejjKoRn.js → Topbar-OPlOc1Ha.js} +21 -19
- package/dist/{UnsplashImages-fpbR9Jbs.js → UnsplashImages-WaGyNL1z.js} +35 -33
- package/dist/UnsplashImages-g-8MvB9W.cjs +1 -0
- package/dist/{UploadImages-9hzL5Hu1.js → UploadImages-GiKofaXX.js} +37 -62
- package/dist/UploadImages-Ic_iZgWY.cjs +1 -0
- package/dist/_commonjsHelpers-f3sTPFkQ.js +8 -0
- package/dist/_commonjsHelpers-f52AuuUj.cjs +1 -0
- package/dist/button-9Duvj2dH.js +42 -0
- package/dist/button-oQgWN0j0.cjs +1 -0
- package/dist/context-menu-8MWP_Ikf.cjs +1 -0
- package/dist/{context-menu-9cWJcKdh.js → context-menu-yLeOsx9j.js} +427 -463
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +34 -11
- package/dist/core.js +79 -75
- package/dist/iconBase-BnEC5_qG.js +1583 -0
- package/dist/iconBase-_bgMuxa5.cjs +1 -0
- package/dist/index-Hj8wMhx_.cjs +223 -0
- package/dist/{index-ry3B_D93.js → index-yJ1H6b2C.js} +9626 -10795
- 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/ui.cjs +1 -1
- package/dist/ui.js +113 -112
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +344 -289
- 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/context-menu-sQn7ryJ6.cjs +0 -1
- package/dist/iconBase-vJD0OXxU.cjs +0 -1
- package/dist/iconBase-zweRWSz0.js +0 -323
- package/dist/index-VBJLJ6fO.cjs +0 -223
- package/dist/plugin-_F-KZp1i.cjs +0 -1
- package/dist/plugin-sJ3Hzvpv.js +0 -57
|
@@ -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("./button-oQgWN0j0.cjs"),C=require("react-i18next"),u=require("react"),o=require("./iconBase-_bgMuxa5.cjs"),E=require("./index-Hj8wMhx_.cjs"),R=require("@radix-ui/react-icons"),g=require("@react-hookz/web");require("@radix-ui/react-slot");require("class-variance-authority");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./_commonjsHelpers-f52AuuUj.cjs");require("@chaibuilder/runtime");require("tree-model");require("./context-menu-8MWP_Ikf.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-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("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 t=document.createElement("div");return t.innerHTML=s,t.innerHTML};function v(){const{t:s}=C.useTranslation(),[t,q]=u.useState(!1),[l,d]=u.useState(""),[r,n]=E.useCodeEditor(),[c]=o.useSelectedBlockIds(),x=o.useUpdateBlocksProps(),m=o.useUpdateBlocksPropsRealtime(),p=g.useThrottledCallback(i=>{const f=a(i);m([r.blockId],{[r.blockProp]:f})},[],300),j=u.useCallback(()=>{if(t){const i=a(l);x([r.blockId],{[r.blockProp]:i})}},[t,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),n(null))},[c]);const b=()=>{n(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:()=>n(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(R.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(h,{onMount:i=>{i.setValue(r.initialCode)},onChange:i=>{q(!0),d(i),p(i)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=v;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import k from "@monaco-editor/react";
|
|
3
|
-
import { B as C } from "./
|
|
3
|
+
import { B as C } from "./button-9Duvj2dH.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, n as N, D as T } from "./iconBase-BnEC5_qG.js";
|
|
7
|
+
import { u as E } from "./index-yJ1H6b2C.js";
|
|
7
8
|
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
8
9
|
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
10
|
+
import "@radix-ui/react-slot";
|
|
11
|
+
import "class-variance-authority";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "tailwind-merge";
|
|
14
|
+
import "lodash-es";
|
|
15
|
+
import "jotai";
|
|
16
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
17
|
+
import "@chaibuilder/runtime";
|
|
18
|
+
import "tree-model";
|
|
19
|
+
import "./context-menu-yLeOsx9j.js";
|
|
9
20
|
import "@radix-ui/react-switch";
|
|
10
21
|
import "@radix-ui/react-accordion";
|
|
11
|
-
import "class-variance-authority";
|
|
12
22
|
import "@radix-ui/react-alert-dialog";
|
|
13
|
-
import "@radix-ui/react-slot";
|
|
14
23
|
import "@radix-ui/react-label";
|
|
15
24
|
import "@radix-ui/react-scroll-area";
|
|
16
25
|
import "@radix-ui/react-tabs";
|
|
@@ -24,14 +33,6 @@ import "@radix-ui/react-toast";
|
|
|
24
33
|
import "cmdk";
|
|
25
34
|
import "@radix-ui/react-dialog";
|
|
26
35
|
import "@radix-ui/react-context-menu";
|
|
27
|
-
import "clsx";
|
|
28
|
-
import "tailwind-merge";
|
|
29
|
-
import "lodash-es";
|
|
30
|
-
import "jotai";
|
|
31
|
-
import "./iconBase-zweRWSz0.js";
|
|
32
|
-
import "@chaibuilder/runtime";
|
|
33
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
34
|
-
import "tree-model";
|
|
35
36
|
import "react-quill";
|
|
36
37
|
import "./STRINGS-TDN5UhWi.js";
|
|
37
38
|
import "flagged";
|
|
@@ -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";
|
|
@@ -58,24 +60,24 @@ import "react-autosuggest";
|
|
|
58
60
|
import "fuse.js";
|
|
59
61
|
import "i18next";
|
|
60
62
|
import "framer-motion";
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
return
|
|
63
|
+
const n = (r) => {
|
|
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 =
|
|
67
|
+
function Dt() {
|
|
68
|
+
const { t: r } = j(), [e, a] = l(!1), [m, c] = l(""), [o, s] = E(), [p] = y(), d = N(), u = T(), f = B(
|
|
69
|
+
(i) => {
|
|
70
|
+
const b = n(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 = n(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
|
-
|
|
112
|
+
onChange: (i) => {
|
|
113
|
+
a(!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
|
+
Dt as default
|
|
129
131
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),a=require("./context-menu-8MWP_Ikf.cjs"),x=require("./button-oQgWN0j0.cjs"),i=require("./iconBase-_bgMuxa5.cjs"),c=require("react-i18next"),l=require("./index-Hj8wMhx_.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-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("@radix-ui/react-slot");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:o,saveState:r}=i.useSavePage(),{t:s}=c.useTranslation(),u=e.jsxRuntimeExports.jsxs(x.Button,{disabled:r==="SAVING",onClick:t=>{t.preventDefault(),o()},className:i.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(l.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:u})},q=function(){const r=i.useBuilderProp("previewComponent"),[,s]=l.usePreviewMode(),{t:u}=c.useTranslation();return r?e.jsxRuntimeExports.jsxs(x.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:u("preview")})]}):null},j=()=>{const o=i.useBuilderProp("topBarComponents.left",[]),r=i.useBuilderProp("topBarComponents.center",[]),s=i.useBuilderProp("topBarComponents.right",[]),u=i.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:n.Children.toArray(o.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(a.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(a.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(a.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(m,{}):null,n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(a.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=j;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import m, { Suspense as p } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { S as n, ab as x } from "./context-menu-yLeOsx9j.js";
|
|
4
|
+
import { B as l } from "./button-9Duvj2dH.js";
|
|
5
|
+
import { T as d, B as h, m as s } from "./iconBase-BnEC5_qG.js";
|
|
6
|
+
import { useTranslation as c } from "react-i18next";
|
|
7
|
+
import { F as f, a as u } from "./index-yJ1H6b2C.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";
|
|
10
11
|
import "class-variance-authority";
|
|
11
12
|
import "@radix-ui/react-alert-dialog";
|
|
12
|
-
import "@radix-ui/react-slot";
|
|
13
13
|
import "@radix-ui/react-label";
|
|
14
14
|
import "@radix-ui/react-scroll-area";
|
|
15
15
|
import "@radix-ui/react-tabs";
|
|
@@ -23,13 +23,14 @@ import "@radix-ui/react-toast";
|
|
|
23
23
|
import "cmdk";
|
|
24
24
|
import "@radix-ui/react-dialog";
|
|
25
25
|
import "@radix-ui/react-context-menu";
|
|
26
|
+
import "@radix-ui/react-slot";
|
|
26
27
|
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,14 +60,14 @@ import "fuse.js";
|
|
|
58
60
|
import "i18next";
|
|
59
61
|
import "framer-motion";
|
|
60
62
|
const j = () => {
|
|
61
|
-
const { savePage: a, saveState: e } = d(), { t:
|
|
62
|
-
|
|
63
|
+
const { savePage: a, saveState: e } = d(), { t: o } = c(), i = /* @__PURE__ */ t.jsxs(
|
|
64
|
+
l,
|
|
63
65
|
{
|
|
64
66
|
disabled: e === "SAVING",
|
|
65
67
|
onClick: (r) => {
|
|
66
68
|
r.preventDefault(), a();
|
|
67
69
|
},
|
|
68
|
-
className:
|
|
70
|
+
className: h(
|
|
69
71
|
"flex h-auto w-fit items-center gap-x-2 p-1 px-2",
|
|
70
72
|
// UNSAVED sate
|
|
71
73
|
"bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
|
|
@@ -77,19 +79,19 @@ const j = () => {
|
|
|
77
79
|
size: "sm",
|
|
78
80
|
variant: "outline",
|
|
79
81
|
children: [
|
|
80
|
-
/* @__PURE__ */ t.jsx(
|
|
81
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children:
|
|
82
|
+
/* @__PURE__ */ t.jsx(f, { className: "text-sm text-white" }),
|
|
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] = u(), { t: i } = c();
|
|
88
90
|
return e ? /* @__PURE__ */ t.jsxs(
|
|
89
|
-
|
|
91
|
+
l,
|
|
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
|
};
|
|
@@ -2,17 +2,21 @@ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
2
2
|
import { useState as c, useEffect as S } from "react";
|
|
3
3
|
import { isEmpty as d } from "lodash-es";
|
|
4
4
|
import { createApi as B } from "unsplash-js";
|
|
5
|
-
import {
|
|
5
|
+
import { B as D } from "./button-9Duvj2dH.js";
|
|
6
|
+
import { M as E, U as L } from "./context-menu-yLeOsx9j.js";
|
|
6
7
|
import { useTranslation as T } from "react-i18next";
|
|
7
|
-
import {
|
|
8
|
+
import { m as U } from "./iconBase-BnEC5_qG.js";
|
|
8
9
|
import { useDebouncedState as F } from "@react-hookz/web";
|
|
9
10
|
import { Loader as K } from "lucide-react";
|
|
11
|
+
import { C as k } from "./index-yJ1H6b2C.js";
|
|
12
|
+
import "@radix-ui/react-slot";
|
|
13
|
+
import "class-variance-authority";
|
|
14
|
+
import "clsx";
|
|
15
|
+
import "tailwind-merge";
|
|
10
16
|
import "@radix-ui/react-switch";
|
|
11
17
|
import "@radix-ui/react-accordion";
|
|
12
18
|
import "@radix-ui/react-icons";
|
|
13
|
-
import "class-variance-authority";
|
|
14
19
|
import "@radix-ui/react-alert-dialog";
|
|
15
|
-
import "@radix-ui/react-slot";
|
|
16
20
|
import "@radix-ui/react-label";
|
|
17
21
|
import "@radix-ui/react-scroll-area";
|
|
18
22
|
import "@radix-ui/react-tabs";
|
|
@@ -26,12 +30,9 @@ import "@radix-ui/react-toast";
|
|
|
26
30
|
import "cmdk";
|
|
27
31
|
import "@radix-ui/react-dialog";
|
|
28
32
|
import "@radix-ui/react-context-menu";
|
|
29
|
-
import "clsx";
|
|
30
|
-
import "tailwind-merge";
|
|
31
33
|
import "jotai";
|
|
32
|
-
import "./
|
|
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,16 +64,16 @@ 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
|
-
}),
|
|
66
|
-
const s =
|
|
67
|
+
}), Ge = ({ isModalView: f, onSelect: g }) => {
|
|
68
|
+
const s = U("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 (o) => {
|
|
67
69
|
if (d(h))
|
|
68
70
|
return;
|
|
69
71
|
let t = i + 1;
|
|
70
|
-
|
|
72
|
+
o && (o.preventDefault(), t = 1), m(!0), v(t);
|
|
71
73
|
const p = { query: h, page: t };
|
|
72
|
-
l && (p.orientation = l), n && (p.color = n), C(p, s).then((
|
|
74
|
+
l && (p.orientation = l), n && (p.color = n), C(p, s).then((a) => {
|
|
73
75
|
var y, N, w;
|
|
74
|
-
x(t === 1 ? ((y =
|
|
76
|
+
x(t === 1 ? ((y = a == null ? void 0 : a.response) == null ? void 0 : y.results) || [] : [...r, ...((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || []]), b((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), m(!1);
|
|
75
77
|
}).catch(() => {
|
|
76
78
|
m(!1);
|
|
77
79
|
});
|
|
@@ -79,10 +81,10 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
79
81
|
return S(() => {
|
|
80
82
|
if (!d(h) && s) {
|
|
81
83
|
m(!0);
|
|
82
|
-
const
|
|
83
|
-
l && (
|
|
84
|
-
var p,
|
|
85
|
-
x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((
|
|
84
|
+
const o = { query: h, page: 1 };
|
|
85
|
+
l && (o.orientation = l), n && (o.color = n), v(1), C(o, s).then((t) => {
|
|
86
|
+
var p, a;
|
|
87
|
+
x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), m(!1);
|
|
86
88
|
}).catch(() => {
|
|
87
89
|
m(!1);
|
|
88
90
|
});
|
|
@@ -102,13 +104,13 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
102
104
|
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
103
105
|
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
|
|
104
106
|
/* @__PURE__ */ e.jsx(
|
|
105
|
-
|
|
107
|
+
E,
|
|
106
108
|
{
|
|
107
109
|
type: "text",
|
|
108
110
|
name: "query",
|
|
109
111
|
className: "text-foreground",
|
|
110
112
|
placeholder: 'Try "dog" or "apple"',
|
|
111
|
-
onChange: (
|
|
113
|
+
onChange: (o) => q(o.target.value)
|
|
112
114
|
}
|
|
113
115
|
),
|
|
114
116
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
@@ -135,7 +137,7 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
135
137
|
}
|
|
136
138
|
],
|
|
137
139
|
defaultValue: l,
|
|
138
|
-
onValueChange: (
|
|
140
|
+
onValueChange: (o) => P(o)
|
|
139
141
|
}
|
|
140
142
|
) }),
|
|
141
143
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
@@ -177,12 +179,12 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
177
179
|
}
|
|
178
180
|
],
|
|
179
181
|
defaultValue: n,
|
|
180
|
-
onValueChange: (
|
|
182
|
+
onValueChange: (o) => A(o)
|
|
181
183
|
}
|
|
182
184
|
) })
|
|
183
185
|
] }),
|
|
184
186
|
/* @__PURE__ */ e.jsxs(
|
|
185
|
-
|
|
187
|
+
L,
|
|
186
188
|
{
|
|
187
189
|
className: `h-full ${f && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
188
190
|
children: [
|
|
@@ -190,40 +192,40 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
190
192
|
/* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
|
|
191
193
|
/* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
|
|
192
194
|
] }),
|
|
193
|
-
f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((
|
|
195
|
+
f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((o) => /* @__PURE__ */ e.jsx(
|
|
194
196
|
"div",
|
|
195
197
|
{
|
|
196
198
|
role: "button",
|
|
197
199
|
tabIndex: 0,
|
|
198
200
|
className: "my-1 flex",
|
|
199
|
-
onClick: () => g(
|
|
201
|
+
onClick: () => g(o.urls.regular),
|
|
200
202
|
children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
201
203
|
"img",
|
|
202
204
|
{
|
|
203
205
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
204
|
-
alt:
|
|
205
|
-
src:
|
|
206
|
+
alt: o.alt_description,
|
|
207
|
+
src: o.urls.small
|
|
206
208
|
}
|
|
207
209
|
) })
|
|
208
210
|
},
|
|
209
|
-
|
|
210
|
-
)) }) : r.map((
|
|
211
|
+
o.id
|
|
212
|
+
)) }) : r.map((o) => (
|
|
211
213
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
|
|
212
214
|
/* @__PURE__ */ e.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
213
215
|
"img",
|
|
214
216
|
{
|
|
215
217
|
className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
216
|
-
alt:
|
|
217
|
-
src:
|
|
218
|
+
alt: o.alt_description,
|
|
219
|
+
src: o.urls.small
|
|
218
220
|
}
|
|
219
|
-
) }) },
|
|
221
|
+
) }) }, o.id)
|
|
220
222
|
)),
|
|
221
223
|
u && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
222
224
|
/* @__PURE__ */ e.jsx(K, { className: "h-6 w-6 animate-spin" }),
|
|
223
225
|
" Loading..."
|
|
224
226
|
] }),
|
|
225
227
|
!d(r) && i < _ && !u && /* @__PURE__ */ e.jsx(
|
|
226
|
-
|
|
228
|
+
D,
|
|
227
229
|
{
|
|
228
230
|
size: "sm",
|
|
229
231
|
variant: "link",
|
|
@@ -239,6 +241,6 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
239
241
|
] });
|
|
240
242
|
};
|
|
241
243
|
export {
|
|
242
|
-
|
|
244
|
+
Ge 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"),_=require("./button-oQgWN0j0.cjs"),N=require("./context-menu-8MWP_Ikf.cjs"),B=require("react-i18next"),T=require("./iconBase-_bgMuxa5.cjs"),D=require("@react-hookz/web"),L=require("lucide-react"),S=require("./index-Hj8wMhx_.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-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("jotai");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 f=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(o=>{i(o)}).catch(o=>a(o))}),F=({isModalView:h,onSelect:j})=>{const i=T.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[o,g]=n.useState(0),[l,w]=n.useState(),[u,k]=n.useState(),[C,b]=n.useState(0),[d,P]=D.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:v}=B.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=o+1;r&&(r.preventDefault(),t=1),c(!0),g(t);const x={query:d,page:t};l&&(x.orientation=l),u&&(x.color=u),f(x,i).then(s=>{var y,E,R;q(t===1?((y=s==null?void 0:s.response)==null?void 0:y.results)||[]:[...a,...((E=s==null?void 0:s.response)==null?void 0:E.results)||[]]),b((R=s==null?void 0:s.response)==null?void 0:R.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),g(1),f(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),b((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(N.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:v("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:v("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(N.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(L.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!p.isEmpty(a)&&o<C&&!m&&e.jsxRuntimeExports.jsx(_.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(void 0),disabled:m,children:m?"":"Load More"})]})]})};exports.default=F;exports.fetchImage=f;
|
|
@@ -1,17 +1,20 @@
|
|
|
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
|
-
import { atom as
|
|
5
|
-
import {
|
|
4
|
+
import { atom as U, useAtom as F } from "jotai";
|
|
5
|
+
import { U as C } from "./context-menu-yLeOsx9j.js";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { m as N } from "./iconBase-BnEC5_qG.js";
|
|
8
8
|
import { Upload as G, Loader as P } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-switch";
|
|
10
|
+
import "./button-9Duvj2dH.js";
|
|
11
|
+
import "@radix-ui/react-slot";
|
|
12
|
+
import "class-variance-authority";
|
|
13
|
+
import "clsx";
|
|
14
|
+
import "tailwind-merge";
|
|
10
15
|
import "@radix-ui/react-accordion";
|
|
11
16
|
import "@radix-ui/react-icons";
|
|
12
|
-
import "class-variance-authority";
|
|
13
17
|
import "@radix-ui/react-alert-dialog";
|
|
14
|
-
import "@radix-ui/react-slot";
|
|
15
18
|
import "@radix-ui/react-label";
|
|
16
19
|
import "@radix-ui/react-scroll-area";
|
|
17
20
|
import "@radix-ui/react-tabs";
|
|
@@ -25,71 +28,43 @@ import "@radix-ui/react-toast";
|
|
|
25
28
|
import "cmdk";
|
|
26
29
|
import "@radix-ui/react-dialog";
|
|
27
30
|
import "@radix-ui/react-context-menu";
|
|
28
|
-
import "
|
|
29
|
-
import "tailwind-merge";
|
|
30
|
-
import "./iconBase-zweRWSz0.js";
|
|
31
|
-
import "@chaibuilder/runtime";
|
|
32
|
-
import "./plugin-sJ3Hzvpv.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 = U([]), ue = ({ isModalView: r, onSelect: m }) => {
|
|
36
|
+
const { t: s } = E(), p = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [l, d] = F(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-8MWP_Ikf.cjs"),w=require("react-i18next"),q=require("./iconBase-_bgMuxa5.cjs"),b=require("lucide-react");require("@radix-ui/react-switch");require("./button-oQgWN0j0.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("clsx");require("tailwind-merge");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-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("./_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=q.useBuilderProp("uploadMediaCallback"),x=q.useBuilderProp("fetchMediaCallback"),[n,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,l;if(m(""),s&&((l=(r=s==null?void 0:s.target)==null?void 0:r.files)==null?void 0:l.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 l=await x();c(l)}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(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: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(b.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(n)&&j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:t("Fetching...")})}),o.isEmpty(n)&&!j&&e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsxRuntimeExports.jsx("h3",{className:"mb-2 text-sm font-semibold",children:t("No images found")}),e.jsxRuntimeExports.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:t("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),a?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:o.map(n,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(n,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;
|