@chaibuilder/sdk 2.2.25 → 2.2.26
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/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +69 -63
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
package/dist/core.js
CHANGED
|
@@ -9322,7 +9322,7 @@ const SettingsPanel = () => {
|
|
|
9322
9322
|
}, registerChaiTopBar = (o) => {
|
|
9323
9323
|
TOP_BAR.component = o;
|
|
9324
9324
|
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: o, show: r }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: r, children: /* @__PURE__ */ jsx(Layers, { size: 20 }) }), AiButton = ({ isActive: o, show: r }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: r, children: /* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }) });
|
|
9325
|
-
function
|
|
9325
|
+
function useSidebarDefaultPanels() {
|
|
9326
9326
|
const o = useBuilderProp("askAiCallBack", null), r = useFeature("aiChat");
|
|
9327
9327
|
return useMemo(() => {
|
|
9328
9328
|
const n = [];
|
|
@@ -9348,11 +9348,17 @@ const RootLayout = () => {
|
|
|
9348
9348
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
9349
9349
|
n("outline");
|
|
9350
9350
|
});
|
|
9351
|
-
const p = useChaiSidebarPanels("top"),
|
|
9351
|
+
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((S) => {
|
|
9352
9352
|
S.preventDefault();
|
|
9353
|
-
}, []),
|
|
9354
|
-
|
|
9355
|
-
|
|
9353
|
+
}, []), m = useCallback(
|
|
9354
|
+
(S) => {
|
|
9355
|
+
n(r === S ? null : S);
|
|
9356
|
+
},
|
|
9357
|
+
[r]
|
|
9358
|
+
), { t: f } = useTranslation(), x = useMemo(
|
|
9359
|
+
() => [...p, ...u, ...g],
|
|
9360
|
+
[p, u, g]
|
|
9361
|
+
), y = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: r }) ?? first(x), v = get(b, "width", DEFAULT_PANEL_WIDTH);
|
|
9356
9362
|
useEffect(() => {
|
|
9357
9363
|
if (r !== null) {
|
|
9358
9364
|
const S = find(x, { id: r });
|
|
@@ -9373,21 +9379,21 @@ const RootLayout = () => {
|
|
|
9373
9379
|
}, [r, x]);
|
|
9374
9380
|
const _ = useCallback(
|
|
9375
9381
|
(S) => {
|
|
9376
|
-
|
|
9382
|
+
m(S);
|
|
9377
9383
|
},
|
|
9378
|
-
[
|
|
9384
|
+
[m]
|
|
9379
9385
|
);
|
|
9380
9386
|
return /* @__PURE__ */ jsx("div", { dir: y, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
|
|
9381
9387
|
/* @__PURE__ */ jsxs(
|
|
9382
9388
|
"div",
|
|
9383
9389
|
{
|
|
9384
|
-
onContextMenu:
|
|
9390
|
+
onContextMenu: h,
|
|
9385
9391
|
className: "flex h-screen max-h-full flex-col bg-background text-foreground",
|
|
9386
9392
|
children: [
|
|
9387
|
-
/* @__PURE__ */ jsx("div", { className: "h-
|
|
9393
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9388
9394
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9389
9395
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9390
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children:
|
|
9396
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9391
9397
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9392
9398
|
position: "top",
|
|
9393
9399
|
panelId: S.id,
|
|
@@ -9397,7 +9403,7 @@ const RootLayout = () => {
|
|
|
9397
9403
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9398
9404
|
] }, "button-top-" + A)) }),
|
|
9399
9405
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9400
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children:
|
|
9406
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9401
9407
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9402
9408
|
position: "bottom",
|
|
9403
9409
|
panelId: S.id,
|
|
@@ -9463,63 +9469,63 @@ const RootLayout = () => {
|
|
|
9463
9469
|
/* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: c === "ai" ? /* @__PURE__ */ jsx(AskAI, {}) : c === "theme" ? /* @__PURE__ */ jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsx(SettingsPanel, {}) }) })
|
|
9464
9470
|
] }) })
|
|
9465
9471
|
}
|
|
9466
|
-
),
|
|
9467
|
-
r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "p-0 sm:max-w-full", style: { width: `${v}px` }, children: [
|
|
9468
|
-
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9469
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9470
|
-
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9471
|
-
] }) }),
|
|
9472
|
-
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9473
|
-
close: E
|
|
9474
|
-
}) }) })
|
|
9475
|
-
] }) }),
|
|
9476
|
-
" ",
|
|
9477
|
-
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-0", style: { maxWidth: `${v}px` }, children: [
|
|
9478
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9479
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9480
|
-
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9481
|
-
] }) }),
|
|
9482
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9483
|
-
close: E
|
|
9484
|
-
}) }) })
|
|
9485
|
-
] }) }),
|
|
9486
|
-
r !== null && get(b, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
9487
|
-
motion.div,
|
|
9488
|
-
{
|
|
9489
|
-
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
9490
|
-
initial: { opacity: 0 },
|
|
9491
|
-
animate: { opacity: 1 },
|
|
9492
|
-
exit: { opacity: 0 },
|
|
9493
|
-
transition: { duration: 0.3 },
|
|
9494
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxs(
|
|
9495
|
-
motion.div,
|
|
9496
|
-
{
|
|
9497
|
-
className: "flex h-full w-full flex-col bg-background",
|
|
9498
|
-
initial: { y: -20, opacity: 0 },
|
|
9499
|
-
animate: { y: 0, opacity: 1 },
|
|
9500
|
-
exit: { y: 20, opacity: 0 },
|
|
9501
|
-
transition: { duration: 0.3, delay: 0.1 },
|
|
9502
|
-
children: [
|
|
9503
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border p-4 py-2", children: [
|
|
9504
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-lg font-bold", children: [
|
|
9505
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9506
|
-
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9507
|
-
] }),
|
|
9508
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => w(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9509
|
-
] }),
|
|
9510
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9511
|
-
close: E
|
|
9512
|
-
}) }) })
|
|
9513
|
-
]
|
|
9514
|
-
}
|
|
9515
|
-
) })
|
|
9516
|
-
}
|
|
9517
9472
|
)
|
|
9518
9473
|
] })
|
|
9519
9474
|
]
|
|
9520
9475
|
}
|
|
9521
9476
|
),
|
|
9522
|
-
/* @__PURE__ */ jsx(AddBlocksDialog, {})
|
|
9477
|
+
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9478
|
+
r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "p-0 sm:max-w-full", style: { width: `${v}px` }, children: [
|
|
9479
|
+
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9480
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9481
|
+
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9482
|
+
] }) }),
|
|
9483
|
+
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9484
|
+
close: E
|
|
9485
|
+
}) }) })
|
|
9486
|
+
] }) }),
|
|
9487
|
+
" ",
|
|
9488
|
+
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-0", style: { maxWidth: `${v}px` }, children: [
|
|
9489
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9490
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9491
|
+
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9492
|
+
] }) }),
|
|
9493
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9494
|
+
close: E
|
|
9495
|
+
}) }) })
|
|
9496
|
+
] }) }),
|
|
9497
|
+
r !== null && get(b, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
9498
|
+
motion.div,
|
|
9499
|
+
{
|
|
9500
|
+
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
9501
|
+
initial: { opacity: 0 },
|
|
9502
|
+
animate: { opacity: 1 },
|
|
9503
|
+
exit: { opacity: 0 },
|
|
9504
|
+
transition: { duration: 0.3 },
|
|
9505
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxs(
|
|
9506
|
+
motion.div,
|
|
9507
|
+
{
|
|
9508
|
+
className: "flex h-full w-full flex-col bg-background",
|
|
9509
|
+
initial: { y: -20, opacity: 0 },
|
|
9510
|
+
animate: { y: 0, opacity: 1 },
|
|
9511
|
+
exit: { y: 20, opacity: 0 },
|
|
9512
|
+
transition: { duration: 0.3, delay: 0.1 },
|
|
9513
|
+
children: [
|
|
9514
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9515
|
+
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9516
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9517
|
+
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9518
|
+
] }),
|
|
9519
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => w(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9520
|
+
] }),
|
|
9521
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9522
|
+
close: E
|
|
9523
|
+
}) }) })
|
|
9524
|
+
]
|
|
9525
|
+
}
|
|
9526
|
+
) })
|
|
9527
|
+
}
|
|
9528
|
+
)
|
|
9523
9529
|
] }) });
|
|
9524
9530
|
}, PreviewScreen = () => {
|
|
9525
9531
|
const [o, r] = usePreviewMode(), { t: n } = useTranslation(), a = useBuilderProp("previewComponent", null);
|