@chaibuilder/sdk 1.2.111 → 1.2.112
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-CyIfkAq1.cjs → CodeEditor-OFX9fvtD.cjs} +1 -1
- package/dist/{CodeEditor-PpTH-bSI.js → CodeEditor-jYbEyzBc.js} +1 -1
- package/dist/{Topbar-AVw1fDtS.js → Topbar--pIiTNKx.js} +1 -1
- package/dist/{Topbar-p3_z7KZx.cjs → Topbar-INi1ISbz.cjs} +1 -1
- package/dist/{UnsplashImages-3PCaHZ-A.js → UnsplashImages-ZioqVljV.js} +1 -1
- package/dist/{UnsplashImages-OAqJlJqi.cjs → UnsplashImages-fIWjSjdU.cjs} +1 -1
- package/dist/{UploadImages-59gviFgk.cjs → UploadImages-rLpU_xPR.cjs} +1 -1
- package/dist/{UploadImages-Zr4jZDj5.js → UploadImages-yuV6rhCT.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +19 -2
- package/dist/core.js +1 -1
- package/dist/{index-mK4NwGjb.cjs → index-s0DEFawb.cjs} +4 -4
- package/dist/{index-JW1mcrcJ.js → index-vR8OFnh5.js} +22 -14
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
7
|
import { aq as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, N as Tooltip, O as TooltipTrigger, P as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, L as Label, T as Textarea, y as CardFooter, D as Dialog, r as DialogTrigger, s as DialogContent, t as DialogHeader, v as DialogTitle, w as DialogDescription, u as DialogFooter, U as Popover, V as PopoverTrigger, W as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, H as Tabs, J as TabsList, K as TabsTrigger, M as TabsContent, a as Switch, A as Accordion, d as AccordionItem, e as AccordionTrigger, f as AccordionContent, an as useToast, I as Input$1, R as TooltipPortal, a6 as DropdownMenu, a7 as DropdownMenuTrigger, a8 as DropdownMenuContent, S as ScrollArea, ac as DropdownMenuLabel, ad as DropdownMenuSeparator, af as DropdownMenuGroup, a9 as DropdownMenuItem, ae as DropdownMenuShortcut, i as AlertDialog, k as AlertDialogContent, l as AlertDialogHeader, n as AlertDialogTitle, j as AlertDialogTrigger, o as AlertDialogDescription, m as AlertDialogFooter, q as AlertDialogCancel, p as AlertDialogAction, aa as DropdownMenuCheckboxItem, X as HoverCard, Y as HoverCardTrigger, Z as HoverCardContent, al as Separator, g as Badge, _ as Select$1, a1 as SelectTrigger, a0 as SelectValue, a2 as SelectContent, a4 as SelectItem, Q as TooltipProvider, ap as Toaster } from "./context-menu-FPX89OKr.js";
|
|
8
|
-
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop,
|
|
8
|
+
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
|
|
9
9
|
import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
|
|
10
10
|
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
|
|
11
11
|
import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
@@ -1066,10 +1066,16 @@ const useSavePage = () => {
|
|
|
1066
1066
|
const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (u) => {
|
|
1067
1067
|
}), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = usePageDataProviders(), [c] = useBrandingOptions();
|
|
1068
1068
|
return { savePage: useThrottledCallback(
|
|
1069
|
-
async () => {
|
|
1069
|
+
async (u = !1) => {
|
|
1070
1070
|
n("SAVING"), a("SAVING");
|
|
1071
|
-
const
|
|
1072
|
-
return await r({
|
|
1071
|
+
const p = l();
|
|
1072
|
+
return await r({
|
|
1073
|
+
autoSave: u,
|
|
1074
|
+
blocks: p.blocks,
|
|
1075
|
+
providers: i,
|
|
1076
|
+
brandingOptions: c,
|
|
1077
|
+
themeConfiguration: c
|
|
1078
|
+
}), setTimeout(() => {
|
|
1073
1079
|
n("SAVED"), a("SAVED");
|
|
1074
1080
|
}, 100), !0;
|
|
1075
1081
|
},
|
|
@@ -1179,7 +1185,7 @@ const useBlocksStoreManager = () => {
|
|
|
1179
1185
|
return r.map((l) => {
|
|
1180
1186
|
if (a.includes(l._id)) {
|
|
1181
1187
|
const i = find(n, { _id: l._id });
|
|
1182
|
-
return
|
|
1188
|
+
return { ...l, ...omit(i, "_id") };
|
|
1183
1189
|
}
|
|
1184
1190
|
return l;
|
|
1185
1191
|
});
|
|
@@ -3129,9 +3135,11 @@ const useHandleCanvasDblClick = () => {
|
|
|
3129
3135
|
const p = new Quill(u, { placeholder: "Type here..." });
|
|
3130
3136
|
function m() {
|
|
3131
3137
|
const x = p.getText(0, p.getLength());
|
|
3132
|
-
n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l();
|
|
3138
|
+
n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l(), u.remove();
|
|
3133
3139
|
}
|
|
3134
|
-
u.addEventListener("blur", m, !0), u.addEventListener("
|
|
3140
|
+
u.addEventListener("blur", m, !0), u.addEventListener("click", (x) => {
|
|
3141
|
+
x.stopPropagation();
|
|
3142
|
+
}), u.addEventListener("keydown", (x) => {
|
|
3135
3143
|
(x.key === "Enter" || x.key === "Escape") && m();
|
|
3136
3144
|
}), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
|
|
3137
3145
|
};
|
|
@@ -3777,7 +3785,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3777
3785
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3778
3786
|
] }, l))
|
|
3779
3787
|
] }) });
|
|
3780
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3788
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-jYbEyzBc.js")), CanvasArea = () => {
|
|
3781
3789
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3782
3790
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3783
3791
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -5202,7 +5210,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5202
5210
|
}
|
|
5203
5211
|
)
|
|
5204
5212
|
] });
|
|
5205
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5213
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-ZioqVljV.js")), UploadImages = React__default.lazy(() => import("./UploadImages-yuV6rhCT.js")), ImagesPanel = ({
|
|
5206
5214
|
isModalView: o = !1,
|
|
5207
5215
|
onSelect: n = () => {
|
|
5208
5216
|
}
|
|
@@ -5292,7 +5300,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5292
5300
|
}
|
|
5293
5301
|
);
|
|
5294
5302
|
}, LinkField = ({ schema: o, formData: n, onChange: r }) => {
|
|
5295
|
-
const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: u = "self" } = n;
|
|
5303
|
+
const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "#", target: u = "self" } = n;
|
|
5296
5304
|
return useEffect(() => {
|
|
5297
5305
|
(async () => {
|
|
5298
5306
|
const p = await i();
|
|
@@ -5308,7 +5316,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5308
5316
|
{ const: "telephone", title: "Call Phone" },
|
|
5309
5317
|
{ const: "scroll", title: "Scroll to element" }
|
|
5310
5318
|
].map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)) }),
|
|
5311
|
-
c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (p) => r({ ...n, href: p.target.value
|
|
5319
|
+
c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (p) => r({ ...n, href: p.target.value }), children: [
|
|
5312
5320
|
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Choose page" }),
|
|
5313
5321
|
map(a, (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.slug, children: p.name }, p.uuid))
|
|
5314
5322
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5320,7 +5328,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5320
5328
|
name: "href",
|
|
5321
5329
|
type: "text",
|
|
5322
5330
|
value: d,
|
|
5323
|
-
onChange: (p) => r({ ...n, href: p.target.value
|
|
5331
|
+
onChange: (p) => r({ ...n, href: p.target.value }),
|
|
5324
5332
|
placeholder: c === "page" || c === "url" ? "Enter URL" : c === "scroll" ? "#ElementID" : "Enter detail"
|
|
5325
5333
|
}
|
|
5326
5334
|
),
|
|
@@ -8858,7 +8866,7 @@ const PageDataProviders = () => {
|
|
|
8858
8866
|
function AiFillDatabase(o) {
|
|
8859
8867
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
|
|
8860
8868
|
}
|
|
8861
|
-
const TopBar = lazy(() => import("./Topbar
|
|
8869
|
+
const TopBar = lazy(() => import("./Topbar--pIiTNKx.js"));
|
|
8862
8870
|
function useSidebarMenuItems(o) {
|
|
8863
8871
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8864
8872
|
return useMemo(() => {
|
|
@@ -9005,7 +9013,7 @@ const RootLayout = () => {
|
|
|
9005
9013
|
}, useAutoSave = () => {
|
|
9006
9014
|
const { savePage: o } = useSavePage(), n = useBuilderProp("autoSaveSupport", !0), r = useBuilderProp("autoSaveInterval", 60);
|
|
9007
9015
|
useIntervalEffect(() => {
|
|
9008
|
-
n && o();
|
|
9016
|
+
n && o(!0);
|
|
9009
9017
|
}, r * 1e3);
|
|
9010
9018
|
}, ChaiBuilderComponent = (o) => {
|
|
9011
9019
|
const [, n] = useBlocksStore(), [, r] = useBrandingOptions(), a = useBuilderReset(), [l] = useAtom(builderSaveStateAtom), i = useMemo(() => o.layout || RootLayout, [o.layout]);
|