@chaibuilder/sdk 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-9d1873e7.js → AddBlocks-598b655e.js} +46 -46
- package/dist/{AddBlocks-12a3610b.cjs → AddBlocks-5df8b221.cjs} +2 -2
- package/dist/{BrandingOptions-69d302c5.js → BrandingOptions-0acb0974.js} +1 -1
- package/dist/{BrandingOptions-7439ff1e.cjs → BrandingOptions-2795be29.cjs} +1 -1
- package/dist/{CanvasArea-7424817c.js → CanvasArea-73b0ec3b.js} +2 -2
- package/dist/{CanvasArea-6f24eabe.cjs → CanvasArea-a637ef3a.cjs} +2 -2
- package/dist/{CurrentPage-1e98746d.js → CurrentPage-3a189b02.js} +1 -1
- package/dist/{CurrentPage-526d5497.cjs → CurrentPage-77baf305.cjs} +1 -1
- package/dist/ImagesPanel-68a11293.cjs +1 -0
- package/dist/ImagesPanel-996761b1.js +27 -0
- package/dist/{Layers-8233c000.js → Layers-42ba6c2e.js} +2 -2
- package/dist/{Layers-1fa4a7ad.cjs → Layers-7f3a2335.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-46fcc533.js → MarkAsGlobalBlock-3e708ff4.js} +1 -1
- package/dist/{MarkAsGlobalBlock-9b4b1f4f.cjs → MarkAsGlobalBlock-c18910cc.cjs} +1 -1
- package/dist/{PagesPanel-51d88965.js → PagesPanel-86323919.js} +2 -2
- package/dist/{PagesPanel-4aafb70f.cjs → PagesPanel-dfbcc68b.cjs} +1 -1
- package/dist/{ProjectPanel-0748603f.cjs → ProjectPanel-4be28a35.cjs} +1 -1
- package/dist/{ProjectPanel-af75d218.js → ProjectPanel-9f645945.js} +2 -2
- package/dist/{Settings-29f58509.js → Settings-57f2a7c2.js} +3 -3
- package/dist/{Settings-c184ce31.cjs → Settings-99916fc1.cjs} +1 -1
- package/dist/{SidePanels-279903d7.cjs → SidePanels-0e4ab159.cjs} +1 -1
- package/dist/{SidePanels-54124742.js → SidePanels-b0347e28.js} +2 -2
- package/dist/{Topbar-c7ce8963.cjs → Topbar-44c010e3.cjs} +1 -1
- package/dist/{Topbar-c52e0d3e.js → Topbar-87c1c5b2.js} +1 -1
- package/dist/UnsplashImages-47374e0c.js +181 -0
- package/dist/UnsplashImages-f761ad96.cjs +1 -0
- package/dist/{add-page-modal-fda0926e.js → add-page-modal-71c100f9.js} +4 -4
- package/dist/{add-page-modal-6be96646.cjs → add-page-modal-b4e12262.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-0aa98758.js → delete-page-modal-9dbe3038.js} +1 -1
- package/dist/{delete-page-modal-d7a7059c.cjs → delete-page-modal-fe71e66d.cjs} +1 -1
- package/dist/{form-d82a2694.cjs → form-5d04c9b3.cjs} +1 -1
- package/dist/{form-1ead8a4a.js → form-bf09d392.js} +1 -1
- package/dist/{index-d0cc5c76.js → index-0d399aef.js} +278 -276
- package/dist/{index-2524cb40.cjs → index-d4a18b5d.cjs} +2 -2
- package/dist/{link-fcfa7b45.cjs → link-4585b2d6.cjs} +1 -1
- package/dist/{link-82714c4b.js → link-6467eda6.js} +6 -6
- package/dist/{page-viewer-b65e1389.js → page-viewer-8a0cd017.js} +2 -2
- package/dist/{page-viewer-a53f2a9b.cjs → page-viewer-eec3bdfb.cjs} +1 -1
- package/dist/{project-general-setting-c4907c79.cjs → project-general-setting-12172508.cjs} +1 -1
- package/dist/{project-general-setting-40d772a0.js → project-general-setting-155bc3fc.js} +4 -4
- package/dist/{project-seo-setting-5a54c6a6.cjs → project-seo-setting-3f645a02.cjs} +1 -1
- package/dist/{project-seo-setting-245555ef.js → project-seo-setting-e9587467.js} +3 -3
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +17 -17
- package/dist/server.js +33 -33
- package/dist/{single-page-detail-5e2a7ffe.cjs → single-page-detail-1b3195d1.cjs} +1 -1
- package/dist/{single-page-detail-15c218dc.js → single-page-detail-fb0fe01b.js} +5 -5
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +2 -2
- package/package.json +1 -1
- package/dist/ImagesPanel-36a2f276.js +0 -27
- package/dist/ImagesPanel-731cda7a.cjs +0 -1
- package/dist/UnsplashImages-68492dc9.cjs +0 -1
- package/dist/UnsplashImages-afaa7706.js +0 -151
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
+
import { useState as d, useEffect as D } from "react";
|
|
3
|
+
import { isEmpty as p, startCase as E } from "lodash";
|
|
4
|
+
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
|
+
import { createApi as B } from "unsplash-js";
|
|
6
|
+
import { u as F, B as K } from "./useBuilderProp-81a14920.js";
|
|
7
|
+
import { I as U } from "./input-a0ea2bc7.js";
|
|
8
|
+
import { S as V } from "./scroll-area-9f64a082.js";
|
|
9
|
+
import { P as O, a as Q, b as H } from "./popover-f7addcf4.js";
|
|
10
|
+
import { S as P, c as S, b as C, d as I, f as h } from "./select-7fddd7c3.js";
|
|
11
|
+
import "react-i18next";
|
|
12
|
+
import { useDebouncedState as R } from "@react-hookz/web";
|
|
13
|
+
import { Loader as $ } from "lucide-react";
|
|
14
|
+
import "@radix-ui/react-slot";
|
|
15
|
+
import "class-variance-authority";
|
|
16
|
+
import "./utils-ac68b2c8.js";
|
|
17
|
+
import "clsx";
|
|
18
|
+
import "tailwind-merge";
|
|
19
|
+
import "@radix-ui/react-tooltip";
|
|
20
|
+
import "@radix-ui/react-toast";
|
|
21
|
+
import "jotai";
|
|
22
|
+
import "@radix-ui/react-scroll-area";
|
|
23
|
+
import "@radix-ui/react-popover";
|
|
24
|
+
import "@radix-ui/react-select";
|
|
25
|
+
const k = async (x, g) => new Promise((o, r) => {
|
|
26
|
+
B({ accessKey: g }).search.getPhotos(x).then((l) => {
|
|
27
|
+
o(l);
|
|
28
|
+
}).catch((l) => r(l));
|
|
29
|
+
}), je = ({ isModalView: x, onSelect: g }) => {
|
|
30
|
+
const o = F("unsplashAccessKey"), [r, j] = d([]), [l, v] = d(0), [n, A] = d(), [i, q] = d(), [z, y] = d(0), [u, T] = R("", 1e3), [f, c] = d(!1), _ = async (s) => {
|
|
31
|
+
if (p(u))
|
|
32
|
+
return;
|
|
33
|
+
let t = l + 1;
|
|
34
|
+
s && (s.preventDefault(), t = 1), c(!0), v(t);
|
|
35
|
+
const m = { query: u, page: t };
|
|
36
|
+
n && (m.orientation = n), i && (m.color = i), k(m, o).then((a) => {
|
|
37
|
+
var N, b, w;
|
|
38
|
+
j(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...r, ...((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
|
|
39
|
+
}).catch(() => {
|
|
40
|
+
c(!1);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return D(() => {
|
|
44
|
+
if (!p(u)) {
|
|
45
|
+
c(!0);
|
|
46
|
+
const s = { query: u, page: 1 };
|
|
47
|
+
n && (s.orientation = n), i && (s.color = i), v(1), k(s, o).then((t) => {
|
|
48
|
+
var m, a;
|
|
49
|
+
j(((m = t == null ? void 0 : t.response) == null ? void 0 : m.results) || []), y((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), c(!1);
|
|
50
|
+
}).catch(() => {
|
|
51
|
+
c(!1);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, [n, i, u, o]), p(o) ? /* @__PURE__ */ e.jsx("div", { className: "h-full flex flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
|
|
55
|
+
"To enable Unsplash, kindly provide your",
|
|
56
|
+
/* @__PURE__ */ e.jsx(
|
|
57
|
+
"a",
|
|
58
|
+
{
|
|
59
|
+
href: "https://unsplash.com/documentation#public-authentication",
|
|
60
|
+
className: "underline px-1 hover:text-blue-400",
|
|
61
|
+
target: "_blank",
|
|
62
|
+
rel: "noopener noreferrer",
|
|
63
|
+
children: "Unsplash Access Key"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
67
|
+
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
|
|
68
|
+
/* @__PURE__ */ e.jsx(
|
|
69
|
+
U,
|
|
70
|
+
{
|
|
71
|
+
type: "text",
|
|
72
|
+
name: "query",
|
|
73
|
+
className: "input",
|
|
74
|
+
placeholder: 'Try "dog" or "apple"',
|
|
75
|
+
onChange: (s) => T(s.target.value)
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ e.jsxs(O, { children: [
|
|
79
|
+
/* @__PURE__ */ e.jsx(Q, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
|
|
80
|
+
/* @__PURE__ */ e.jsx(
|
|
81
|
+
H,
|
|
82
|
+
{
|
|
83
|
+
side: x ? "bottom" : "right",
|
|
84
|
+
className: "z-[9999] flex w-max items-center justify-center",
|
|
85
|
+
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
86
|
+
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
87
|
+
/* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => A(s), children: [
|
|
88
|
+
/* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(C, { placeholder: "Select" }) }),
|
|
89
|
+
/* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
|
|
90
|
+
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
91
|
+
/* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
|
|
92
|
+
/* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
|
|
93
|
+
/* @__PURE__ */ e.jsx(h, { value: "squarish", children: "Square" })
|
|
94
|
+
] })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
97
|
+
/* @__PURE__ */ e.jsxs(P, { defaultValue: i, onValueChange: (s) => q(s), children: [
|
|
98
|
+
/* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(C, { placeholder: "Select" }) }),
|
|
99
|
+
/* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
|
|
100
|
+
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
101
|
+
[
|
|
102
|
+
"black_and_white",
|
|
103
|
+
"black",
|
|
104
|
+
"white",
|
|
105
|
+
"yellow",
|
|
106
|
+
"orange",
|
|
107
|
+
"red",
|
|
108
|
+
"purple",
|
|
109
|
+
"magenta",
|
|
110
|
+
"green",
|
|
111
|
+
"teal",
|
|
112
|
+
"blue"
|
|
113
|
+
].map((s) => /* @__PURE__ */ e.jsx(h, { value: s, children: E(s) }, s))
|
|
114
|
+
] })
|
|
115
|
+
] })
|
|
116
|
+
] })
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ e.jsxs(
|
|
122
|
+
V,
|
|
123
|
+
{
|
|
124
|
+
className: `h-full ${x && !p(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
125
|
+
children: [
|
|
126
|
+
p(r) && !f && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
|
127
|
+
/* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
|
|
128
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
|
|
129
|
+
] }),
|
|
130
|
+
x ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((s) => /* @__PURE__ */ e.jsx(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
role: "button",
|
|
134
|
+
tabIndex: 0,
|
|
135
|
+
className: "my-1 flex",
|
|
136
|
+
onClick: () => g(s.urls.regular),
|
|
137
|
+
children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
138
|
+
"img",
|
|
139
|
+
{
|
|
140
|
+
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
141
|
+
alt: s.alt_description,
|
|
142
|
+
src: s.urls.small
|
|
143
|
+
}
|
|
144
|
+
) })
|
|
145
|
+
},
|
|
146
|
+
s.id
|
|
147
|
+
)) }) : r.map((s) => (
|
|
148
|
+
// TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
|
|
149
|
+
/* @__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(
|
|
150
|
+
"img",
|
|
151
|
+
{
|
|
152
|
+
className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
153
|
+
alt: s.alt_description,
|
|
154
|
+
src: s.urls.small
|
|
155
|
+
}
|
|
156
|
+
) }) }, s.id)
|
|
157
|
+
)),
|
|
158
|
+
f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
159
|
+
/* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
|
|
160
|
+
" Loading..."
|
|
161
|
+
] }),
|
|
162
|
+
!p(r) && l < z && !f && /* @__PURE__ */ e.jsx(
|
|
163
|
+
K,
|
|
164
|
+
{
|
|
165
|
+
size: "sm",
|
|
166
|
+
variant: "link",
|
|
167
|
+
className: "w-full",
|
|
168
|
+
onClick: () => _(void 0),
|
|
169
|
+
disabled: f,
|
|
170
|
+
children: f ? "" : "Load More"
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] });
|
|
177
|
+
};
|
|
178
|
+
export {
|
|
179
|
+
je as default,
|
|
180
|
+
k as fetchImage
|
|
181
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),o=require("lodash"),k=require("@radix-ui/react-icons"),T=require("unsplash-js"),b=require("./useBuilderProp-5e57d0c8.cjs"),z=require("./input-42acea7e.cjs"),_=require("./scroll-area-088530b9.cjs"),g=require("./popover-7cb9079b.cjs"),t=require("./select-0e32300c.cjs");require("react-i18next");const D=require("@react-hookz/web"),L=require("lucide-react");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-scroll-area");require("@radix-ui/react-popover");require("@radix-ui/react-select");const R=async(d,E)=>new Promise((l,a)=>{T.createApi({accessKey:E}).search.getPhotos(d).then(c=>{l(c)}).catch(c=>a(c))}),V=({isModalView:d,onSelect:E})=>{const l=b.useBuilderProp("unsplashAccessKey"),[a,f]=i.useState([]),[c,y]=i.useState(0),[x,I]=i.useState(),[u,w]=i.useState(),[P,v]=i.useState(0),[j,C]=D.useDebouncedState("",1e3),[h,m]=i.useState(!1),A=async s=>{if(o.isEmpty(j))return;let n=c+1;s&&(s.preventDefault(),n=1),m(!0),y(n);const p={query:j,page:n};x&&(p.orientation=x),u&&(p.color=u),R(p,l).then(r=>{var q,N,S;f(n===1?((q=r==null?void 0:r.response)==null?void 0:q.results)||[]:[...a,...((N=r==null?void 0:r.response)==null?void 0:N.results)||[]]),v((S=r==null?void 0:r.response)==null?void 0:S.total_pages),m(!1)}).catch(()=>{m(!1)})};return i.useEffect(()=>{if(!o.isEmpty(j)){m(!0);const s={query:j,page:1};x&&(s.orientation=x),u&&(s.color=u),y(1),R(s,l).then(n=>{var p,r;f(((p=n==null?void 0:n.response)==null?void 0:p.results)||[]),v((r=n==null?void 0:n.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[x,u,j,l]),o.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex 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:"underline px-1 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 rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(z.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>C(s.target.value)}),e.jsxRuntimeExports.jsxs(g.Popover,{children:[e.jsxRuntimeExports.jsx(g.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(k.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(g.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>I(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>w(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:o.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(_.ScrollArea,{className:`h-full ${d&&!o.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[o.isEmpty(a)&&!h&&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"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):a.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(L.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!o.isEmpty(a)&&c<P&&!h&&e.jsxRuntimeExports.jsx(b.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>A(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=V;exports.fetchImage=R;
|
|
@@ -4,8 +4,8 @@ import { kebabCase as j } from "lodash";
|
|
|
4
4
|
import { B as c } from "./useBuilderProp-81a14920.js";
|
|
5
5
|
import { D as b, b as C, a as A } from "./dialog-3d4e82ed.js";
|
|
6
6
|
import { SingleLineText as d } from "@chaibuilder/blocks";
|
|
7
|
-
import { F as D } from "./form-
|
|
8
|
-
import { Z as N } from "./index-
|
|
7
|
+
import { F as D } from "./form-bf09d392.js";
|
|
8
|
+
import { Z as N } from "./index-0d399aef.js";
|
|
9
9
|
import "@radix-ui/react-slot";
|
|
10
10
|
import "class-variance-authority";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
@@ -18,10 +18,10 @@ import "jotai";
|
|
|
18
18
|
import "@radix-ui/react-dialog";
|
|
19
19
|
import "@rjsf/core";
|
|
20
20
|
import "@rjsf/validator-ajv8";
|
|
21
|
-
import "./link-
|
|
21
|
+
import "./link-6467eda6.js";
|
|
22
22
|
import "react-icons-picker";
|
|
23
23
|
import "react-dom";
|
|
24
|
-
import "./ImagesPanel-
|
|
24
|
+
import "./ImagesPanel-996761b1.js";
|
|
25
25
|
import "./tabs-85caa1e8.js";
|
|
26
26
|
import "@radix-ui/react-tabs";
|
|
27
27
|
import "react-quill";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-5e57d0c8.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-5e57d0c8.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-5d04c9b3.cjs"),f=require("./index-d4a18b5d.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-dialog");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-4585b2d6.cjs");require("react-icons-picker");require("react-dom");require("./ImagesPanel-68a11293.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("lucide-react");require("sonner");const E=({closeModal:i})=>{var l,o;const s=f.useAddPage(),[r,m]=g.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{}}),p=()=>{s.mutate(r,{onSuccess:()=>i()})},j=({formData:u},t)=>{m(h=>{var d,c;const n={[t]:u[t]};return t==="name"?n.slug=R.kebabCase((d=u[t])==null?void 0:d.replace(/\d/g,"")):t==="slug"&&(n.slug=(c=u[t])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...h,...n}})},P={name:q.SingleLineText({title:"Page Name",default:r.name}),slug:q.SingleLineText({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(a.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(b.Form,{formData:r,properties:P,onChange:j,disabled:s.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(x.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((o=r.slug)==null?void 0:o.length)<2||s.isPending,onClick:p,children:"Add Page"})})]})},S=()=>{const[i,s]=g.useState(!1);return e.jsxRuntimeExports.jsxs(a.Dialog,{open:i,onOpenChange:()=>s(!i),children:[e.jsxRuntimeExports.jsx(a.DialogTrigger,{children:e.jsxRuntimeExports.jsx(x.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>s(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(E,{closeModal:()=>s(!i)})]})};exports.default=S;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-d4a18b5d.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),u=require("react-i18next");require("./jsx-runtime-5c3ac4f7.cjs");require("react");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiBuilderStudio=e.ChaiBuilderStudio;exports.useActiveLanguage=e.useActiveLanguage;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlockContentByLanguage=e.useBlockContentByLanguage;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderReset=e.useBuilderReset;exports.useBuildingBlocks=e.useBuildingBlocks;exports.useCanvasHistory=e.useCanvasHistory;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCurrentPage=e.useCurrentPage$1;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDeveloperPreviewMode=e.useDeveloperPreviewMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useFeatureSupport=e.useFeatureSupport;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useMarkAsGlobalBlock=e.useMarkAsGlobalBlock;exports.useMoveBlocks=e.useMoveBlocks;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.usePrimaryLanguage=e.usePrimaryLanguage;exports.useProject=e.useProject$1;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSetAllBlocks=e.useSetAllBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTranslations=e.useTranslations;exports.useTreeData=e.useTreeData;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useBuilderProp=s.useBuilderProp;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});
|
package/dist/core.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
85
85
|
uiLibraries?: UiLibrary[];
|
|
86
86
|
uploadMediaCallback?: (file: File) => Promise<string>;
|
|
87
87
|
getPages?: () => Promise<ChaiPage[]>;
|
|
88
|
+
unsplashAccessKey?: string;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export declare const ChaiBuilderStudio: (props: ChaiBuilderStudioProps) => JSX_2.Element;
|
|
@@ -93,6 +94,7 @@ export declare type ChaiBuilderStudioProps = {
|
|
|
93
94
|
apiBaseUrl?: string;
|
|
94
95
|
logo?: React_2.FC<any> | React_2.LazyExoticComponent<any>;
|
|
95
96
|
darkMode?: boolean;
|
|
97
|
+
unsplashAccessKey?: string;
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
declare type ChaiPage = {
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a2 as f, am as R, D as T, a5 as x, ah as H, T as b, ai as j, H as w, y as U, al as F, w as G, a3 as O, a6 as W, c as q, e as E, k as J, n as K, a7 as Z, m as _, d as z, a8 as N, l as Q, j as V, a9 as X, S as Y, x as $, ak as ss, _ as es, aa as as, o as os, p as ts, aj as us, ab as ls, a4 as rs, q as is, I as ps, u as cs, A as ds, ad as ms, K as Bs, h as ks, L as ns, f as gs, i as Cs, g as Ss, ae as vs, J as Ps, ac as ys, af as As, W as hs, ag as Ds, C as Is } from "./index-
|
|
1
|
+
import { a2 as f, am as R, D as T, a5 as x, ah as H, T as b, ai as j, H as w, y as U, al as F, w as G, a3 as O, a6 as W, c as q, e as E, k as J, n as K, a7 as Z, m as _, d as z, a8 as N, l as Q, j as V, a9 as X, S as Y, x as $, ak as ss, _ as es, aa as as, o as os, p as ts, aj as us, ab as ls, a4 as rs, q as is, I as ps, u as cs, A as ds, ad as ms, K as Bs, h as ks, L as ns, f as gs, i as Cs, g as Ss, ae as vs, J as Ps, ac as ys, af as As, W as hs, ag as Ds, C as Is } from "./index-0d399aef.js";
|
|
2
2
|
import { u as Ls } from "./useBuilderProp-81a14920.js";
|
|
3
3
|
import { useTranslation as Rs } from "react-i18next";
|
|
4
4
|
import "./jsx-runtime-944c88e2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import { B as m } from "./useBuilderProp-81a14920.js";
|
|
3
3
|
import { A as n, a as d, b as a, e as p, f as c, h as u } from "./alert-dialog-ee98f47e.js";
|
|
4
|
-
import { a1 as h } from "./index-
|
|
4
|
+
import { a1 as h } from "./index-0d399aef.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "@radix-ui/react-slot";
|
|
7
7
|
import "class-variance-authority";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-d4a18b5d.cjs");require("react");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-alert-dialog");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=({pageData:i,projectData:s})=>{const n={},t=d.useDeletePage(),u=i.uuid===s.homepage,o=()=>{t.mutate(i,{onSuccess:()=>{n({uuid:s.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:u,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${u?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx("div",{children:"Del"})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(l.Button,{variant:"destructive",onClick:o,disabled:t.isPending,children:"Yes, Delete"})]})]})]})};exports.default=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const f=require("./jsx-runtime-5c3ac4f7.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash"),d=require("./link-
|
|
1
|
+
"use strict";const f=require("./jsx-runtime-5c3ac4f7.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash"),d=require("./link-4585b2d6.cjs"),h=(n,c="")=>{switch(n.type){case"singular":return n.uiSchema;case"model":const{properties:p}=n,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${c}`:r;u[o]=h(e,c)}),u;case"list":const{itemProperties:m}=n,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${c}`:r;l.items[o]=h(e,c)}),l;default:return{}}},x=(n,c="")=>{switch(n.type){case"singular":return n.schema;case"model":const{properties:p,title:u}=n,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${c}`:o;m.properties[s]=x(t,c)}),m;case"list":const{itemProperties:l,title:r}=n,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${c}`:o;e.items.properties[s]=x(t,c),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:n,properties:c={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(c).forEach(t=>{const s=c[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[n&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:n}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
|
|
@@ -2,7 +2,7 @@ import { j as u } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import x from "@rjsf/core";
|
|
3
3
|
import $ from "@rjsf/validator-ajv8";
|
|
4
4
|
import { includes as h, get as a, set as F, first as P } from "lodash";
|
|
5
|
-
import { R as b, I as E, a as O, L as S } from "./link-
|
|
5
|
+
import { R as b, I as E, a as O, L as S } from "./link-6467eda6.js";
|
|
6
6
|
const d = (i, l = "") => {
|
|
7
7
|
switch (i.type) {
|
|
8
8
|
case "singular":
|