@chaibuilder/sdk 2.0.4 → 2.0.6

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.js CHANGED
@@ -3,50 +3,50 @@ var K = (o, n, r) => n in o ? G(o, n, { enumerable: !0, configurable: !0, writab
3
3
  var V = (o, n, r) => K(o, typeof n != "symbol" ? n + "" : n, r);
4
4
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
5
5
  import * as React from "react";
6
- import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useMemo, Component, Children, useState, useRef, Suspense, createElement, memo, lazy } from "react";
7
- import { O as DropdownMenu, P as DropdownMenuTrigger, Q as DropdownMenuContent, R as DropdownMenuItem, S as Skeleton, B as Button, a6 as Label, H as Dialog, I as DialogTrigger, J as DialogContent, a7 as Popover, ak as Tooltip, al as TooltipTrigger, a8 as PopoverTrigger, am as TooltipContent, a9 as PopoverContent, v as Command, x as CommandInput, y as CommandList, z as CommandEmpty, D as CommandGroup, E as CommandItem, K as DialogHeader, M as DialogTitle, n as Badge, V as DropdownMenuLabel, W as DropdownMenuSeparator, T as DropdownMenuCheckboxItem, a2 as HoverCard, a3 as HoverCardTrigger, a4 as HoverCardContent, aj as Textarea, a5 as Input$1, ao as TooltipPortal, a as AccordionItem, b as AccordionTrigger, d as AccordionContent, aa as ScrollArea, Y as DropdownMenuGroup, X as DropdownMenuShortcut, A as Accordion, C as Card, q as CardHeader, t as CardDescription, u as CardContent, r as CardFooter, af as Tabs, ag as TabsList, ah as TabsTrigger, ai as TabsContent, e as AlertDialog, f as AlertDialogTrigger, g as AlertDialogContent, h as AlertDialogHeader, j as AlertDialogTitle, k as AlertDialogDescription, i as AlertDialogFooter, m as AlertDialogCancel, l as AlertDialogAction, ae as Switch, ac as Separator, an as TooltipProvider, ad as Toaster } from "./tooltip-PKiP886L.js";
6
+ import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useMemo, Component, Children, useRef, useState, Suspense, createElement, memo, lazy } from "react";
7
+ import { O as DropdownMenu, P as DropdownMenuTrigger, Q as DropdownMenuContent, R as DropdownMenuItem, S as Skeleton, B as Button, H as Dialog, I as DialogTrigger, J as DialogContent, a7 as Popover, ak as Tooltip, al as TooltipTrigger, a8 as PopoverTrigger, am as TooltipContent, a9 as PopoverContent, v as Command, x as CommandInput, y as CommandList, z as CommandEmpty, D as CommandGroup, E as CommandItem, K as DialogHeader, M as DialogTitle, n as Badge, V as DropdownMenuLabel, W as DropdownMenuSeparator, T as DropdownMenuCheckboxItem, a2 as HoverCard, a3 as HoverCardTrigger, a4 as HoverCardContent, aj as Textarea, a5 as Input$1, ao as TooltipPortal, a as AccordionItem, b as AccordionTrigger, d as AccordionContent, A as Accordion, C as Card, q as CardHeader, t as CardDescription, u as CardContent, a6 as Label, r as CardFooter, aa as ScrollArea, af as Tabs, ag as TabsList, ah as TabsTrigger, ai as TabsContent, e as AlertDialog, f as AlertDialogTrigger, g as AlertDialogContent, h as AlertDialogHeader, j as AlertDialogTitle, k as AlertDialogDescription, i as AlertDialogFooter, m as AlertDialogCancel, l as AlertDialogAction, ae as Switch, ac as Separator, an as TooltipProvider, ad as Toaster } from "./tooltip-PKiP886L.js";
8
8
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
9
- import { find, filter, flatten, map, omit, isString, has, get, isObject, memoize, compact, isEmpty, noop, includes, without, each, first, keys, range, values, flattenDeep, set, startsWith, forEach, unset, chunk, cloneDeep, pick, isNull, findIndex, throttle, isFunction as isFunction$1, reverse, startCase, debounce, capitalize, split, take, toUpper, toLower, nth, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, uniq, flatMapDeep, some, reject, sortBy, round } from "lodash-es";
9
+ import { find, filter, flatten, map, omit, isString, has, get, isObject, memoize, compact, isEmpty, noop, includes, without, each, first, keys, range, values, flattenDeep, set, startsWith, forEach, unset, chunk, cloneDeep, pick, isNull, findIndex, throttle, isFunction as isFunction$1, reverse, split, take, startCase, debounce, toUpper, toLower, nth, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, capitalize, groupBy, uniq, flatMapDeep, some, reject, sortBy, round } from "lodash-es";
10
10
  import { Provider as Provider$1 } from "react-wrap-balancer";
11
11
  import { useTranslation, initReactI18next } from "react-i18next";
12
12
  import { useTranslation as He } from "react-i18next";
13
13
  import { g as generateUUID, a as getBreakpointValue, c as cn$1 } from "./Functions-BGzDsf1z.js";
14
14
  import { flip } from "@floating-ui/dom";
15
15
  import { useFloating, shift } from "@floating-ui/react-dom";
16
- import { PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, Cross2Icon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, BoxIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CardStackIcon, CardStackPlusIcon, ScissorsIcon, CheckIcon, SunIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
16
+ import { PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, Cross2Icon, InfoCircledIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, BoxIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretRightIcon, CardStackIcon, CardStackPlusIcon, ScissorsIcon, CheckIcon, SunIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
17
17
  import { useThrottledCallback, useDebouncedCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
18
18
  import { useFeature, FlagsProvider } from "flagged";
19
19
  import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
20
20
  import { registerChaiBlock as Ue } from "@chaibuilder/runtime";
21
21
  import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, a as getChaiThemeCssVariables, c as getThemeFontsLinkMarkup } from "./ChaiThemeFn-Cort9tch.js";
22
- import TreeModel from "tree-model";
23
- import { useHotkeys } from "react-hotkeys-hook";
24
- import { toast } from "sonner";
25
22
  import { PlusIcon as PlusIcon$1, ChevronRight, DatabaseIcon, ChevronLeft, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, X, Plus, PlusCircle, ChevronDown, Loader, SparklesIcon, Globe, PencilIcon, FileJson, Zap, EyeOff, MoreVertical, Eye, ChevronsDown, ChevronsUp, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, Moon, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
26
- import { useEditor, EditorContent } from "@tiptap/react";
27
- import StarterKit from "@tiptap/starter-kit";
28
- import typography from "@tailwindcss/typography";
29
- import forms from "@tailwindcss/forms";
30
- import aspectRatio from "@tailwindcss/aspect-ratio";
31
- import containerQueries from "@tailwindcss/container-queries";
32
- import { twMerge } from "tailwind-merge";
33
- import { S as STYLES_KEY, g as getSplitChaiClasses, R as ROOT_TEMP_KEY } from "./getSplitClasses-DphwgQiE.js";
34
- import ReactDOM from "react-dom";
35
- import { ErrorBoundary } from "react-error-boundary";
36
- import { Resizable } from "re-resizable";
37
23
  import RjForm from "@rjsf/core";
38
24
  import validator from "@rjsf/validator-ajv8";
39
25
  import Link from "@tiptap/extension-link";
40
26
  import TextAlign from "@tiptap/extension-text-align";
41
27
  import Underline from "@tiptap/extension-underline";
28
+ import { useEditor, EditorContent } from "@tiptap/react";
29
+ import StarterKit from "@tiptap/starter-kit";
42
30
  import clsx$1, { clsx } from "clsx";
31
+ import { twMerge } from "tailwind-merge";
43
32
  import Autosuggest from "react-autosuggest";
33
+ import { toast } from "sonner";
44
34
  import Fuse from "fuse.js";
35
+ import { S as STYLES_KEY, g as getSplitChaiClasses, R as ROOT_TEMP_KEY } from "./getSplitClasses-DphwgQiE.js";
45
36
  import { parse, stringify } from "himalaya";
46
37
  import { Tree } from "react-arborist";
47
38
  import i18n from "i18next";
48
39
  import { default as ze } from "i18next";
40
+ import { ErrorBoundary } from "react-error-boundary";
41
+ import { useHotkeys } from "react-hotkeys-hook";
49
42
  import { motion } from "framer-motion";
43
+ import TreeModel from "tree-model";
44
+ import typography from "@tailwindcss/typography";
45
+ import forms from "@tailwindcss/forms";
46
+ import aspectRatio from "@tailwindcss/aspect-ratio";
47
+ import containerQueries from "@tailwindcss/container-queries";
48
+ import ReactDOM from "react-dom";
49
+ import { Resizable } from "re-resizable";
50
50
  const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.write, isAtomStateInitialized = (o) => "v" in o || "e" in o, returnAtomValue = (o) => {
51
51
  if ("e" in o)
52
52
  throw o.e;
@@ -1458,6 +1458,22 @@ const useBlocksStoreManager = () => {
1458
1458
  });
1459
1459
  }
1460
1460
  };
1461
+ }, libraryBlocksAtom = atom$1(
1462
+ {}
1463
+ ), useLibraryBlocks = (o) => {
1464
+ const [n, r] = useAtom$1(libraryBlocksAtom), a = useBuilderProp("getUILibraryBlocks", noop), l = get(n, `${o == null ? void 0 : o.id}.blocks`, null), i = get(n, `${o == null ? void 0 : o.id}.loading`, "idle"), c = useRef("idle");
1465
+ useEffect(() => {
1466
+ (async () => {
1467
+ if (i === "complete" || c.current === "loading") return;
1468
+ c.current = "loading", r((u) => ({ ...u, [o == null ? void 0 : o.id]: { loading: "loading", blocks: [] } }));
1469
+ const p = await a(o);
1470
+ c.current = "idle", r((u) => ({ ...u, [o == null ? void 0 : o.id]: { loading: "complete", blocks: p || [] } }));
1471
+ })();
1472
+ }, [o, l, i, c, r, a]);
1473
+ const d = useCallback(() => {
1474
+ r((p) => ({ ...p, [o == null ? void 0 : o.id]: { loading: "idle", blocks: [] } }));
1475
+ }, [o, r]);
1476
+ return { data: l || [], isLoading: i === "loading", resetLibrary: d };
1461
1477
  }, canAcceptChildBlock = (o, n) => {
1462
1478
  if (!o) return !0;
1463
1479
  const r = getRegisteredChaiBlock(o);
@@ -4105,227 +4121,7 @@ const getBlockRuntimeProps = memoize((o) => {
4105
4121
  o ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(Resizable, { enable: { top: !0, bottom: !1 }, className: "max-h-[400px] min-h-[200px]", children: /* @__PURE__ */ jsx(CodeEditor$1, {}) }) }) : null,
4106
4122
  /* @__PURE__ */ jsx(Breadcrumb, {})
4107
4123
  ] }) });
4108
- }, FONTS = [
4109
- { title: "Roboto", value: "Roboto" },
4110
- { title: "Open Sans", value: "Open Sans" },
4111
- { title: "Montserrat", value: "Montserrat" },
4112
- { title: "Lato", value: "Lato" },
4113
- { title: "Poppins", value: "Poppins" },
4114
- { title: "Oswald", value: "Oswald" },
4115
- { title: "Raleway", value: "Raleway" },
4116
- { title: "Ubuntu", value: "Ubuntu" },
4117
- { title: "Nunito", value: "Nunito" },
4118
- { title: "Merriweather", value: "Merriweather" },
4119
- { title: "Nunito Sans", value: "Nunito Sans" },
4120
- { title: "Playfair Display", value: "Playfair Display" },
4121
- { title: "Rubik", value: "Rubik" },
4122
- { title: "Inter", value: "Inter" },
4123
- { title: "Lora", value: "Lora" },
4124
- { title: "Kanit", value: "Kanit" },
4125
- { title: "Fira Sans", value: "Fira Sans" },
4126
- { title: "Hind", value: "Hind" },
4127
- { title: "Quicksand", value: "Quicksand" },
4128
- { title: "Mulish", value: "Mulish" },
4129
- { title: "Barlow", value: "Barlow" },
4130
- { title: "Inconsolata", value: "Inconsolata" },
4131
- { title: "Titillium Web", value: "Titillium Web" },
4132
- { title: "Heebo", value: "Heebo" },
4133
- { title: "IBM Plex Sans", value: "IBM Plex Sans" },
4134
- { title: "DM Sans", value: "DM Sans" },
4135
- { title: "Nanum Gothic", value: "Nanum Gothic" },
4136
- { title: "Karla", value: "Karla" },
4137
- { title: "Arimo", value: "Arimo" },
4138
- { title: "Cabin", value: "Cabin" },
4139
- { title: "Oxygen", value: "Oxygen" },
4140
- { title: "Overpass", value: "Overpass" },
4141
- { title: "Assistant", value: "Assistant" },
4142
- { title: "Tajawal", value: "Tajawal" },
4143
- { title: "Play", value: "Play" },
4144
- { title: "Exo", value: "Exo" },
4145
- { title: "Cinzel", value: "Cinzel" },
4146
- { title: "Faustina", value: "Faustina" },
4147
- { title: "Philosopher", value: "Philosopher" },
4148
- { title: "Gelasio", value: "Gelasio" },
4149
- { title: "Sofia Sans Condensed", value: "Sofia Sans Condensed" },
4150
- { title: "Noto Sans Devanagari", value: "Noto Sans Devanagari" },
4151
- { title: "Actor", value: "Actor" },
4152
- { title: "Epilogue", value: "Epilogue" },
4153
- { title: "Glegoo", value: "Glegoo" },
4154
- { title: "Overlock", value: "Overlock" },
4155
- { title: "Lustria", value: "Lustria" },
4156
- { title: "Ovo", value: "Ovo" },
4157
- { title: "Suranna", value: "Suranna" },
4158
- { title: "Bebas Neue", value: "Bebas Neue" },
4159
- { title: "Manrope", value: "Manrope" }
4160
- ], FontSelector = ({
4161
- label: o,
4162
- value: n,
4163
- onChange: r
4164
- }) => /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
4165
- /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: startCase(o) }),
4166
- /* @__PURE__ */ jsx(
4167
- "select",
4168
- {
4169
- className: "mt-1 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
4170
- value: n,
4171
- onChange: (a) => r(a.target.value),
4172
- children: FONTS.map((a) => /* @__PURE__ */ jsx("option", { value: a.value, children: a.title }, a.value))
4173
- }
4174
- )
4175
- ] }), ColorPickerInput = ({ value: o, onChange: n }) => {
4176
- const r = debounce((a) => n(a), 200);
4177
- return /* @__PURE__ */ jsx(
4178
- "div",
4179
- {
4180
- className: "relative flex h-6 w-6 cursor-pointer rounded-lg border border-border",
4181
- style: { backgroundColor: o },
4182
- children: /* @__PURE__ */ jsx(
4183
- "input",
4184
- {
4185
- type: "color",
4186
- value: o.startsWith("#") ? o : "#000000",
4187
- onChange: (a) => {
4188
- const l = a.target.value;
4189
- /^#[0-9A-F]{6}$/i.test(l) && r(l);
4190
- },
4191
- className: "absolute inset-0 h-full w-full cursor-pointer rounded-lg border-0 opacity-0"
4192
- }
4193
- )
4194
- }
4195
- );
4196
- }, BorderRadiusInput = ({ value: o, onChange: n, disabled: r }) => {
4197
- const a = debounce((l) => n(l), 200);
4198
- return /* @__PURE__ */ jsx(
4199
- "input",
4200
- {
4201
- type: "range",
4202
- min: "0",
4203
- step: "1",
4204
- max: "30",
4205
- disabled: r,
4206
- defaultValue: o.replace("px", ""),
4207
- onChange: (l) => a(l.target.value),
4208
- className: "flex-1 cursor-pointer"
4209
- }
4210
- );
4211
- }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
4212
- const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), m = (A) => {
4213
- a(A);
4214
- }, x = () => {
4215
- const A = l.find((B) => Object.keys(B)[0] === r);
4216
- if (A) {
4217
- const B = Object.values(A)[0];
4218
- B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
4219
- } else
4220
- console.error("Preset not found:", r);
4221
- }, f = useDebouncedCallback(
4222
- (A, B) => {
4223
- p(() => ({
4224
- ...d,
4225
- fontFamily: {
4226
- ...d.fontFamily,
4227
- [A.replace(/font-/g, "")]: B
4228
- }
4229
- }));
4230
- },
4231
- [d],
4232
- 200
4233
- ), h = useDebouncedCallback(
4234
- (A) => {
4235
- p(() => ({
4236
- ...d,
4237
- borderRadius: `${A}px`
4238
- }));
4239
- },
4240
- [d],
4241
- 200
4242
- ), b = useDebouncedCallback(
4243
- (A, B) => {
4244
- p(() => {
4245
- const C = get(d, `colors.${A}`);
4246
- return n ? set(C, 1, B) : set(C, 0, B), {
4247
- ...d,
4248
- colors: {
4249
- ...d.colors,
4250
- [A]: C
4251
- }
4252
- };
4253
- });
4254
- },
4255
- [d],
4256
- 200
4257
- ), k = (A) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(A.items).map(([B]) => {
4258
- const C = get(d, `colors.${B}.${n ? 1 : 0}`);
4259
- return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
4260
- /* @__PURE__ */ jsx(
4261
- ColorPickerInput,
4262
- {
4263
- value: C,
4264
- onChange: (j) => b(B, j)
4265
- }
4266
- ),
4267
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: B.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((j) => j.charAt(0).toUpperCase() + j.slice(1)).join(" ") + (!B.toLowerCase().includes("foreground") && !B.toLowerCase().includes("border") && !B.toLowerCase().includes("input") && !B.toLowerCase().includes("ring") && !B.toLowerCase().includes("background") ? " Background" : "") })
4268
- ] }, B);
4269
- }) });
4270
- return c("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
4271
- /* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
4272
- l.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 py-2", children: [
4273
- /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
4274
- /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: g("Presets") }),
4275
- /* @__PURE__ */ jsxs(
4276
- "select",
4277
- {
4278
- value: r,
4279
- onChange: (A) => m(A.target.value),
4280
- className: "w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
4281
- children: [
4282
- /* @__PURE__ */ jsx("option", { value: "", children: "Select preset" }),
4283
- Array.isArray(l) && l.map((A) => /* @__PURE__ */ jsx("option", { value: Object.keys(A)[0], children: capitalize(Object.keys(A)[0]) }, Object.keys(A)[0]))
4284
- ]
4285
- }
4286
- )
4287
- ] }),
4288
- /* @__PURE__ */ jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsx(
4289
- Button,
4290
- {
4291
- className: "w-full text-sm",
4292
- disabled: r === "",
4293
- variant: "default",
4294
- onClick: x,
4295
- children: g("Apply")
4296
- }
4297
- ) })
4298
- ] }),
4299
- /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", o), children: [
4300
- (u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([A, B]) => /* @__PURE__ */ jsx(
4301
- FontSelector,
4302
- {
4303
- label: A,
4304
- value: d.fontFamily[A.replace(/font-/g, "")] || B[Object.keys(B)[0]],
4305
- onChange: (C) => f(A, C)
4306
- },
4307
- A
4308
- )) }),
4309
- (u == null ? void 0 : u.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 py-3", children: [
4310
- /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: g("Border Radius") }),
4311
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 py-2", children: [
4312
- /* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: h }),
4313
- /* @__PURE__ */ jsx("span", { className: "w-12 text-sm", children: d.borderRadius })
4314
- ] })
4315
- ] }),
4316
- (u == null ? void 0 : u.colors) && /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-0.5", children: [
4317
- /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: g("Colors") }),
4318
- /* @__PURE__ */ jsx("div", { className: "w-full space-y-4 pt-2", children: u.colors.map((A) => k(A)) }, n ? "dark" : "light")
4319
- ] })
4320
- ] }),
4321
- /* @__PURE__ */ jsx("br", {}),
4322
- /* @__PURE__ */ jsx("br", {}),
4323
- /* @__PURE__ */ jsx("br", {}),
4324
- /* @__PURE__ */ jsx("br", {})
4325
- ] }),
4326
- i && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 w-full", children: React.createElement(i) })
4327
- ] }) : /* @__PURE__ */ jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsx("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto text-center", o), children: /* @__PURE__ */ jsx("div", { className: "mt-10 h-full items-center justify-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: "You don't have permission to edit the theme. Please contact your administrator to get access." }) }) }) });
4328
- }), removeSizeAttributes = (o) => {
4124
+ }, removeSizeAttributes = (o) => {
4329
4125
  try {
4330
4126
  return o.replace(/<svg([^>]*)\sheight="[^"]*"([^>]*)>/gi, "<svg$1$2>").replace(/<svg([^>]*)\swidth="[^"]*"([^>]*)>/gi, "<svg$1$2>");
4331
4127
  } catch {
@@ -5832,8 +5628,157 @@ const BASIC_UNITS = ["px", "%", "em", "rem", "ch", "vh", "vw"], FLEX_CHILD_SECTI
5832
5628
  }
5833
5629
  ];
5834
5630
  BASIC_UNITS.concat("auto"), BASIC_UNITS.concat("auto"), [...BASIC_UNITS], BASIC_UNITS.concat("auto"), BASIC_UNITS.concat("auto"), BASIC_UNITS.concat("auto"), BASIC_UNITS.concat("auto"), BASIC_UNITS.concat("-");
5835
- const EDITOR_ICONS = {
5836
- "not-italic": () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
5631
+ const BlockStylingProps = () => {
5632
+ const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), { t: a } = useTranslation();
5633
+ if (!o) return null;
5634
+ const l = Object.keys(o).filter(
5635
+ (c) => typeof o[c] == "string" && o[c].startsWith("#styles:")
5636
+ );
5637
+ if (isEmpty(l) || l.length <= 1) return null;
5638
+ const i = (c) => find(n, (d) => d.prop === c);
5639
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5640
+ /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5641
+ a("Style element"),
5642
+ ":"
5643
+ ] }),
5644
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(l, (c) => /* @__PURE__ */ jsx(
5645
+ Badge,
5646
+ {
5647
+ className: "cursor-pointer",
5648
+ onClick: () => {
5649
+ r([{ id: `${c}-${o._id}`, blockId: o._id, prop: c }]);
5650
+ },
5651
+ variant: i(c) ? "default" : "secondary",
5652
+ children: startCase(c)
5653
+ },
5654
+ c
5655
+ )) }),
5656
+ /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5657
+ ] });
5658
+ }, StyleContext = createContext({ canReset: !1, canChange: !0 }), BlockStyleProvider = ({ children: o, canReset: n = !1, canChange: r = !0 }) => (
5659
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
5660
+ /* @__PURE__ */ jsx(StyleContext.Provider, { value: { canReset: n, canChange: r }, children: o })
5661
+ ), DropDownChoices = ({ label: o, property: n, onChange: r }) => {
5662
+ const { getClasses: a } = useTailwindClassList(), l = a(n), i = useCurrentClassByProperty(n), c = useMemo(() => get(i, "cls", ""), [i]), { canChange: d } = useContext(StyleContext), p = /\[.*\]/g.test(c);
5663
+ return /* @__PURE__ */ jsx("div", { className: o ? "w-full rounded" : "grow", children: p ? /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
5664
+ /* @__PURE__ */ jsx(Input$1, { className: "w-[70%] rounded py-1", readOnly: !0, value: c }),
5665
+ /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5666
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
5667
+ /* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind arbitrary value." })
5668
+ ] })
5669
+ ] }) : /* @__PURE__ */ jsx(
5670
+ DropDown,
5671
+ {
5672
+ rounded: o,
5673
+ onChange: (u) => r(u, n),
5674
+ selected: c,
5675
+ options: l,
5676
+ disabled: !d
5677
+ }
5678
+ ) });
5679
+ };
5680
+ function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disabled: l = !1 }) {
5681
+ const i = o.replace(/.*:/g, "").trim(), { undo: c, redo: d } = useUndoManager();
5682
+ return /* @__PURE__ */ jsxs(
5683
+ "select",
5684
+ {
5685
+ disabled: !a.length || l,
5686
+ className: `${r ? "rounded-md border border-border" : "border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,
5687
+ onChange: (p) => n(p.target.value),
5688
+ onKeyDown: (p) => {
5689
+ p.ctrlKey && (p.key === "z" && c(), p.key === "y" && d());
5690
+ },
5691
+ value: i,
5692
+ children: [
5693
+ /* @__PURE__ */ jsx("option", { className: "bg-transparent", value: "" }),
5694
+ a.map((p, u) => /* @__PURE__ */ jsx("option", { className: "bg-transparent", value: p, children: p }, `option-${u}`))
5695
+ ]
5696
+ }
5697
+ );
5698
+ }
5699
+ const COLOR_PROP = {
5700
+ backgroundColor: "bg",
5701
+ textColor: "text",
5702
+ borderColor: "border",
5703
+ boxShadowColor: "shadow",
5704
+ outlineColor: "outline",
5705
+ divideColor: "divide",
5706
+ fromColor: "from",
5707
+ viaColor: "via",
5708
+ toColor: "to",
5709
+ ringColor: "ring",
5710
+ ringOffsetColor: "ring-offset"
5711
+ }, ColorChoice = ({ property: o, onChange: n }) => {
5712
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), m = get(u, "2", ""), x = useCallback(
5713
+ // eslint-disable-next-line no-shadow
5714
+ (b) => {
5715
+ ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), p({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((k) => ({ ...k, color: b, shade: k.shade ? k.shade : "500" })));
5716
+ },
5717
+ [c, p]
5718
+ );
5719
+ useEffect(() => {
5720
+ if (["current", "inherit", "transparent", "black", "white"].includes(g))
5721
+ return c([]);
5722
+ c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
5723
+ }, [g]);
5724
+ const f = useCallback(
5725
+ // eslint-disable-next-line no-shadow
5726
+ (b) => {
5727
+ p({ color: g, shade: b });
5728
+ },
5729
+ [g]
5730
+ );
5731
+ useEffect(() => {
5732
+ p({ color: "", shade: "" });
5733
+ }, [r]);
5734
+ const { match: h } = useTailwindClassList();
5735
+ return useEffect(() => {
5736
+ const k = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
5737
+ h(o, k) && n(k, o);
5738
+ }, [h, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5739
+ /* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
5740
+ DropDown,
5741
+ {
5742
+ disabled: !l,
5743
+ rounded: !0,
5744
+ selected: g,
5745
+ onChange: x,
5746
+ options: [
5747
+ "current",
5748
+ "transparent",
5749
+ "primary",
5750
+ "secondary",
5751
+ "black",
5752
+ "white",
5753
+ "slate",
5754
+ "gray",
5755
+ "zinc",
5756
+ "neutral",
5757
+ "stone",
5758
+ "red",
5759
+ "orange",
5760
+ "amber",
5761
+ "yellow",
5762
+ "lime",
5763
+ "green",
5764
+ "emerald",
5765
+ "teal",
5766
+ "cyan",
5767
+ "sky",
5768
+ "blue",
5769
+ "indigo",
5770
+ "violet",
5771
+ "purple",
5772
+ "fuchsia",
5773
+ "pink",
5774
+ "rose"
5775
+ ]
5776
+ }
5777
+ ) }),
5778
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: f, options: i }) })
5779
+ ] });
5780
+ }, EDITOR_ICONS = {
5781
+ "not-italic": () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
5837
5782
  // visibility
5838
5783
  visible: EyeOpenIcon,
5839
5784
  invisible: EyeClosedIcon,
@@ -6026,130 +5971,6 @@ const EDITOR_ICONS = {
6026
5971
  )
6027
5972
  ] }),
6028
5973
  static: Cross1Icon
6029
- }, StyleContext = createContext({ canReset: !1, canChange: !0 }), BlockStyleProvider = ({ children: o, canReset: n = !1, canChange: r = !0 }) => (
6030
- // eslint-disable-next-line react/jsx-no-constructed-context-values
6031
- /* @__PURE__ */ jsx(StyleContext.Provider, { value: { canReset: n, canChange: r }, children: o })
6032
- ), DropDownChoices = ({ label: o, property: n, onChange: r }) => {
6033
- const { getClasses: a } = useTailwindClassList(), l = a(n), i = useCurrentClassByProperty(n), c = useMemo(() => get(i, "cls", ""), [i]), { canChange: d } = useContext(StyleContext), p = /\[.*\]/g.test(c);
6034
- return /* @__PURE__ */ jsx("div", { className: o ? "w-full rounded" : "grow", children: p ? /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
6035
- /* @__PURE__ */ jsx(Input$1, { className: "w-[70%] rounded py-1", readOnly: !0, value: c }),
6036
- /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6037
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
6038
- /* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind arbitrary value." })
6039
- ] })
6040
- ] }) : /* @__PURE__ */ jsx(
6041
- DropDown,
6042
- {
6043
- rounded: o,
6044
- onChange: (u) => r(u, n),
6045
- selected: c,
6046
- options: l,
6047
- disabled: !d
6048
- }
6049
- ) });
6050
- };
6051
- function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disabled: l = !1 }) {
6052
- const i = o.replace(/.*:/g, "").trim(), { undo: c, redo: d } = useUndoManager();
6053
- return /* @__PURE__ */ jsxs(
6054
- "select",
6055
- {
6056
- disabled: !a.length || l,
6057
- className: `${r ? "rounded-md border border-border" : "border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,
6058
- onChange: (p) => n(p.target.value),
6059
- onKeyDown: (p) => {
6060
- p.ctrlKey && (p.key === "z" && c(), p.key === "y" && d());
6061
- },
6062
- value: i,
6063
- children: [
6064
- /* @__PURE__ */ jsx("option", { className: "bg-transparent", value: "" }),
6065
- React__default.Children.toArray(
6066
- a.map((p) => /* @__PURE__ */ jsx("option", { className: "bg-transparent", value: p, children: p }))
6067
- )
6068
- ]
6069
- }
6070
- );
6071
- }
6072
- const COLOR_PROP = {
6073
- backgroundColor: "bg",
6074
- textColor: "text",
6075
- borderColor: "border",
6076
- boxShadowColor: "shadow",
6077
- outlineColor: "outline",
6078
- divideColor: "divide",
6079
- fromColor: "from",
6080
- viaColor: "via",
6081
- toColor: "to",
6082
- ringColor: "ring",
6083
- ringOffsetColor: "ring-offset"
6084
- }, ColorChoice = ({ property: o, onChange: n }) => {
6085
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), m = get(u, "2", ""), x = useCallback(
6086
- // eslint-disable-next-line no-shadow
6087
- (b) => {
6088
- ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), p({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((k) => ({ ...k, color: b, shade: k.shade ? k.shade : "500" })));
6089
- },
6090
- [c, p]
6091
- );
6092
- useEffect(() => {
6093
- if (["current", "inherit", "transparent", "black", "white"].includes(g))
6094
- return c([]);
6095
- c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6096
- }, [g]);
6097
- const f = useCallback(
6098
- // eslint-disable-next-line no-shadow
6099
- (b) => {
6100
- p({ color: g, shade: b });
6101
- },
6102
- [g]
6103
- );
6104
- useEffect(() => {
6105
- p({ color: "", shade: "" });
6106
- }, [r]);
6107
- const { match: h } = useTailwindClassList();
6108
- return useEffect(() => {
6109
- const k = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6110
- h(o, k) && n(k, o);
6111
- }, [h, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6112
- /* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
6113
- DropDown,
6114
- {
6115
- disabled: !l,
6116
- rounded: !0,
6117
- selected: g,
6118
- onChange: x,
6119
- options: [
6120
- "current",
6121
- "transparent",
6122
- "primary",
6123
- "secondary",
6124
- "black",
6125
- "white",
6126
- "slate",
6127
- "gray",
6128
- "zinc",
6129
- "neutral",
6130
- "stone",
6131
- "red",
6132
- "orange",
6133
- "amber",
6134
- "yellow",
6135
- "lime",
6136
- "green",
6137
- "emerald",
6138
- "teal",
6139
- "cyan",
6140
- "sky",
6141
- "blue",
6142
- "indigo",
6143
- "violet",
6144
- "purple",
6145
- "fuchsia",
6146
- "pink",
6147
- "rose"
6148
- ]
6149
- }
6150
- ) }),
6151
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: f, options: i }) })
6152
- ] });
6153
5974
  }, IconChoices = ({ property: o, onChange: n }) => {
6154
5975
  const { getClasses: r } = useTailwindClassList(), a = r(o), { canChange: l } = useContext(StyleContext), i = useCurrentClassByProperty(o), c = useMemo(() => get(i, "cls", ""), [i]);
6155
5976
  return /* @__PURE__ */ jsx("div", { className: "flex grow flex-wrap gap-1", children: map(a, (d) => /* @__PURE__ */ jsxs(Tooltip, { children: [
@@ -6673,25 +6494,23 @@ const COLOR_PROP = {
6673
6494
  children: [
6674
6495
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
6675
6496
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6676
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6677
- n.map(({ label: x, key: f }) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6678
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6679
- "button",
6680
- {
6681
- type: "button",
6682
- onClick: () => u(f),
6683
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6684
- children: [
6685
- React__default.createElement("div", {
6686
- className: m(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6687
- }),
6688
- React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
6689
- ]
6690
- }
6691
- ) }),
6692
- /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(x)) })
6693
- ] }) }))
6694
- ) })
6497
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: x, key: f }, h) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6498
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6499
+ "button",
6500
+ {
6501
+ type: "button",
6502
+ onClick: () => u(f),
6503
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6504
+ children: [
6505
+ React__default.createElement("div", {
6506
+ className: m(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6507
+ }),
6508
+ React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
6509
+ ]
6510
+ }
6511
+ ) }),
6512
+ /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(x)) })
6513
+ ] }) }, `option-${h}`)) })
6695
6514
  ] }),
6696
6515
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
6697
6516
  BlockStyle,
@@ -6739,71 +6558,14 @@ const COLOR_PROP = {
6739
6558
  p = !1;
6740
6559
  break;
6741
6560
  }
6742
- return p;
6743
- },
6744
- [a]
6745
- ), i = useMemo(() => ({}), []);
6746
- return /* @__PURE__ */ jsx(SectionContext.Provider, { value: i, children: n ? /* @__PURE__ */ jsxs(AccordionItem, { value: o.heading, className: "border-none", children: [
6747
- /* @__PURE__ */ jsx(AccordionTrigger, { className: "border-slate-150 border-t py-2 text-xs", children: /* @__PURE__ */ jsx("div", { className: "flex items-center py-2", children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2 text-xs font-medium", children: startCase(r(o.heading)) }) }) }),
6748
- /* @__PURE__ */ jsx(AccordionContent, { className: "py-2", children: React__default.Children.toArray(
6749
- o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsx(MultipleChoices, { ...c }, c.label) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsx(NestedOptions, { ...c }, c.label) : null : /* @__PURE__ */ jsx(BlockStyle, { ...c }, c.label))
6750
- ) })
6751
- ] }) : /* @__PURE__ */ jsx("div", { className: "py-2", children: React__default.Children.toArray(
6752
- o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsx(MultipleChoices, { ...c }, c.label) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsx(NestedOptions, { ...c }, c.label) : null : /* @__PURE__ */ jsx(BlockStyle, { ...c }, c.label))
6753
- ) }) });
6754
- }, StylingHelpers = () => {
6755
- const o = useSelectedBlock(), [n] = useSelectedStylingBlocks(), { t: r } = useTranslation(), a = useAddClassesToBlocks(), l = getRegisteredChaiBlock(o._type), i = get(first(n), "prop"), c = get(l.props, `${i}.presets`, {});
6756
- if (!has(l, "props") || isEmpty(c))
6757
- return null;
6758
- const d = (p) => {
6759
- const u = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6760
- a([o._id], u, !0);
6761
- };
6762
- return /* @__PURE__ */ jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6763
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
6764
- r("Apply Presets"),
6765
- /* @__PURE__ */ jsx(CaretDownIcon, {})
6766
- ] }) }) }),
6767
- /* @__PURE__ */ jsx(DropdownMenuContent, { className: "max-h-80 w-56", children: /* @__PURE__ */ jsx(ScrollArea, { className: "no-scrollbar h-full", children: isEmpty(c) ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
6768
- /* @__PURE__ */ jsxs(DropdownMenuLabel, { children: [
6769
- l.type,
6770
- " ",
6771
- r("presets")
6772
- ] }),
6773
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6774
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: keys(c).map((p) => /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => d(c[p]), children: [
6775
- capitalize(startCase(r(p))),
6776
- /* @__PURE__ */ jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6777
- ] })) })
6778
- ] }) }) })
6779
- ] }) });
6780
- }, BlockStylingProps = () => {
6781
- const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), { t: a } = useTranslation();
6782
- if (!o) return null;
6783
- const l = Object.keys(o).filter(
6784
- (c) => typeof o[c] == "string" && o[c].startsWith("#styles:")
6785
- );
6786
- if (isEmpty(l) || l.length <= 1) return null;
6787
- const i = (c) => find(n, (d) => d.prop === c);
6788
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
6789
- /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
6790
- a("Style element"),
6791
- ":"
6792
- ] }),
6793
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(l, (c) => /* @__PURE__ */ jsx(
6794
- Badge,
6795
- {
6796
- className: "cursor-pointer",
6797
- onClick: () => {
6798
- r([{ id: `${c}-${o._id}`, blockId: o._id, prop: c }]);
6799
- },
6800
- variant: i(c) ? "default" : "secondary",
6801
- children: startCase(c)
6802
- },
6803
- c
6804
- )) }),
6805
- /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
6806
- ] });
6561
+ return p;
6562
+ },
6563
+ [a]
6564
+ ), i = useMemo(() => ({}), []);
6565
+ return /* @__PURE__ */ jsx(SectionContext.Provider, { value: i, children: n ? /* @__PURE__ */ jsxs(AccordionItem, { value: o.heading, className: "border-none", children: [
6566
+ /* @__PURE__ */ jsx(AccordionTrigger, { className: "border-slate-150 border-t py-2 text-xs", children: /* @__PURE__ */ jsx("div", { className: "flex items-center py-2", children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2 text-xs font-medium", children: startCase(r(o.heading)) }) }) }),
6567
+ /* @__PURE__ */ jsx(AccordionContent, { className: "py-2", children: o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsx(MultipleChoices, { ...c }, c.label) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsx(NestedOptions, { ...c }, c.label) : null : /* @__PURE__ */ jsx(BlockStyle, { ...c }, c.label)) })
6568
+ ] }) : /* @__PURE__ */ jsx("div", { className: "py-2", children: o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsx(MultipleChoices, { ...c }, c.label) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsx(NestedOptions, { ...c }, c.label) : null : /* @__PURE__ */ jsx(BlockStyle, { ...c }, c.label)) }) });
6807
6569
  }, MAPPER = {
6808
6570
  px: 1,
6809
6571
  "%": 1,
@@ -6861,7 +6623,6 @@ function BlockStyling() {
6861
6623
  ) : null,
6862
6624
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
6863
6625
  /* @__PURE__ */ jsx(BlockStylingProps, {}),
6864
- /* @__PURE__ */ jsx(StylingHelpers, {}),
6865
6626
  /* @__PURE__ */ jsxs(Accordion, { defaultValue: ["Styles"], type: "multiple", className: "w-full", children: [
6866
6627
  o && /* @__PURE__ */ jsx(StylingGroup, { section: FLEX_CHILD_SECTION, showAccordian: o || n }),
6867
6628
  n && /* @__PURE__ */ jsx(StylingGroup, { section: GRID_CHILD_SECTION, showAccordian: o || n }),
@@ -7390,21 +7151,19 @@ const CHAI_BUILDER_EVENTS = {
7390
7151
  '"'
7391
7152
  ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: L.map((y) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7392
7153
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(y.toLowerCase())) }),
7393
- /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: React__default.Children.toArray(
7394
- reject(
7395
- x === "all" ? filter(values(w), { group: y }) : values(w),
7396
- { hidden: !0 }
7397
- ).map((E) => /* @__PURE__ */ jsx(
7398
- CoreBlock,
7399
- {
7400
- parentId: r,
7401
- position: a,
7402
- block: E,
7403
- disabled: !canAcceptChildBlock(m, E.type) || !canBeNestedInside(m, E.type)
7404
- },
7405
- E.type
7406
- ))
7407
- ) })
7154
+ /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
7155
+ x === "all" ? filter(values(w), { group: y }) : values(w),
7156
+ { hidden: !0 }
7157
+ ).map((E) => /* @__PURE__ */ jsx(
7158
+ CoreBlock,
7159
+ {
7160
+ parentId: r,
7161
+ position: a,
7162
+ block: E,
7163
+ disabled: !canAcceptChildBlock(m, E.type) || !canBeNestedInside(m, E.type)
7164
+ },
7165
+ E.type
7166
+ )) })
7408
7167
  ] }, y)) }) }) })
7409
7168
  ] })
7410
7169
  ] });
@@ -7488,7 +7247,7 @@ function UILibrariesSelect({
7488
7247
  {
7489
7248
  className: "mt-1",
7490
7249
  options: o.map((l) => ({
7491
- value: l.uuid,
7250
+ value: l.id,
7492
7251
  label: l.name
7493
7252
  })),
7494
7253
  defaultValue: n,
@@ -7556,20 +7315,8 @@ const BlockCard = ({
7556
7315
  ) }),
7557
7316
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: m }) })
7558
7317
  ] });
7559
- }, libraryBlocksAtom = atom$1(
7560
- {}
7561
- ), useLibraryBlocks = (o) => {
7562
- const [n, r] = useAtom$1(libraryBlocksAtom), a = useBuilderProp("getUILibraryBlocks", noop), l = get(n, `${o == null ? void 0 : o.uuid}.blocks`, null), i = get(n, `${o == null ? void 0 : o.uuid}.loading`, "idle"), c = useRef("idle");
7563
- return useEffect(() => {
7564
- (async () => {
7565
- if (i === "complete" || c.current === "loading") return;
7566
- c.current = "loading", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7567
- const d = await a(o);
7568
- c.current = "idle", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7569
- })();
7570
- }, [o, l, i, c, r, a]), { data: l || [], isLoading: i === "loading" };
7571
7318
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7572
- const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((C) => C.category === "custom"), d = l.find((C) => C.uuid === r) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), g = groupBy([...p, ...c], "group"), [m, x] = useState("Hero"), f = get(g, m, []), h = useRef(null), { t: b } = useTranslation(), k = (C) => {
7319
+ const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((C) => C.category === "custom"), d = l.find((C) => C.id === r) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), g = groupBy([...p, ...c], "group"), [m, x] = useState("Hero"), f = get(g, m, []), h = useRef(null), { t: b } = useTranslation(), k = (C) => {
7573
7320
  h.current && (clearTimeout(h.current), h.current = null), h.current = setTimeout(() => {
7574
7321
  h.current && x(C);
7575
7322
  }, 300);
@@ -7582,29 +7329,27 @@ const BlockCard = ({
7582
7329
  const A = filter(f, (C, j) => j % 2 === 0), B = filter(f, (C, j) => j % 2 === 1);
7583
7330
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full pt-2", children: [
7584
7331
  /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7585
- /* @__PURE__ */ jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
7332
+ /* @__PURE__ */ jsx(UILibrariesSelect, { library: d == null ? void 0 : d.id, setLibrary: a, uiLibraries: l }),
7586
7333
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7587
7334
  /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: b("Groups") }),
7588
7335
  /* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
7589
- /* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
7590
- map(g, (C, j) => /* @__PURE__ */ jsxs(
7591
- "div",
7592
- {
7593
- onMouseEnter: () => k(j),
7594
- onMouseLeave: () => clearTimeout(h.current),
7595
- onClick: () => x(j),
7596
- className: cn$1(
7597
- "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
7598
- j === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7599
- ),
7600
- children: [
7601
- /* @__PURE__ */ jsx("span", { children: capitalize(b(j.toLowerCase())) }),
7602
- /* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7603
- ]
7604
- },
7605
- j
7606
- ))
7607
- ) })
7336
+ /* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: map(g, (C, j) => /* @__PURE__ */ jsxs(
7337
+ "div",
7338
+ {
7339
+ onMouseEnter: () => k(j),
7340
+ onMouseLeave: () => clearTimeout(h.current),
7341
+ onClick: () => x(j),
7342
+ className: cn$1(
7343
+ "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
7344
+ j === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7345
+ ),
7346
+ children: [
7347
+ /* @__PURE__ */ jsx("span", { children: capitalize(b(j.toLowerCase())) }),
7348
+ /* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7349
+ ]
7350
+ },
7351
+ j
7352
+ )) })
7608
7353
  ] })
7609
7354
  ] }),
7610
7355
  /* @__PURE__ */ jsxs(
@@ -7614,12 +7359,26 @@ const BlockCard = ({
7614
7359
  className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
7615
7360
  children: [
7616
7361
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7617
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7618
- A.map((C) => /* @__PURE__ */ jsx(BlockCard, { parentId: o, position: n, block: C, library: d }))
7619
- ) }),
7620
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7621
- B.map((C) => /* @__PURE__ */ jsx(BlockCard, { parentId: o, position: n, block: C, library: d }))
7622
- ) })
7362
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: A.map((C, j) => /* @__PURE__ */ jsx(
7363
+ BlockCard,
7364
+ {
7365
+ parentId: o,
7366
+ position: n,
7367
+ block: C,
7368
+ library: d
7369
+ },
7370
+ `block-${j}`
7371
+ )) }),
7372
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: B.map((C, j) => /* @__PURE__ */ jsx(
7373
+ BlockCard,
7374
+ {
7375
+ parentId: o,
7376
+ position: n,
7377
+ block: C,
7378
+ library: d
7379
+ },
7380
+ `block-${j}`
7381
+ )) })
7623
7382
  ] }),
7624
7383
  /* @__PURE__ */ jsx("br", {}),
7625
7384
  /* @__PURE__ */ jsx("br", {}),
@@ -8226,7 +7985,227 @@ const selectParent = (o, n) => {
8226
7985
  ) }),
8227
7986
  /* @__PURE__ */ jsx(PasteAtRootContextMenu, { parentContext, setParentContext })
8228
7987
  ] });
8229
- }, Core = "Core", Import = "Import", Breakpoints = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Styling", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", theme_config = { heading_font: "Heading Font", body_font: "Body Font", rounded_corner: "Rounded Corners", primary: "Primary", secondary: "Secondary", background: "Background", text_color: "Text Color", background_dark_mode: "Background (Dark Mode)", text_color_dark_mode: "Text Color (Dark Mode)" }, web_blocks = { box: "box", tag: "Tag", div: "div", level: "Level", header: "header", footer: "footer", section: "section", article: "article", aside: "aside", main: "main", nav: "navigation", figure: "figure", details: "details", summary: "summary", dialog: "dialog", strike: "strike", caption: "caption", legend: "legend", figcaption: "figure caption", mark: "mark", background_image: "Background Image", label: "Label", default: "default", icon_size: "Icon Size", icon_position: "Icon Position", start: "Start", end: "End", button: "Button", custom_html: "Custom HTML", html_code: "HTML Code", default_snippet: "The HTML snippet goes here...", placeholder: "Enter custom HTML code here", custom_script: "Custom Script", dark_mode: "Dark Mode", divider: "Divider", empty_box: "Empty Box", heading: "Heading", image: "Image", alt: "Alt", width: "Width", height: "Height", video: "Video", span: "Span", content: "Content", icon: "Icon", richtext: "Rich Text", list: "List", list_type: "List Type", listitem: "List Item", link: "Link", list_item: "List Item", none: "None", disc: "Disc", number: "Number", paragraph: "Paragraph", lightbox_link: "Lightbox Link", href: "Link", type: "Type", iframe: "iframe", inline: "inline", ajax: "ajax", autoplay: "Video autoplay", max_width: "Max Width", backdrop_color: "Background Color", gallery_name: "Gallery Name", slot: "Slot", empty_slot: "Empty Slot", text: "Text", video_url: "Video URL", controls: "Show Controls", loop: "Loop", muted: "Muted", checkbox: "Checkbox", required: "Required", checked: "Checked", submit_button: "Submit Button", form: "Form", submit_url: "Submit URL", error_message: "Error Message", success_message: "Success Message", input: "Input", value: "Value", show_label: "Show Label", field_name: "Field Name", radio: "Radio", multiple: "Multiple", options: "Options", select: "Select", multiple_choice: "Multiple Choice", textarea: "Textarea", rows: "Rows" }, Undo = "Undo", Redo = "Redo", Duplicate = "Duplicate", Close = "Close", Selected = "Selected", Select = "Select", Attributes = "Attributes", apply = "apply", presets = "presets", Orientation = "Orientation", Color = "Color", Upload = "Upload", lngEn = {
7988
+ }, FONTS = [
7989
+ { title: "Roboto", value: "Roboto" },
7990
+ { title: "Open Sans", value: "Open Sans" },
7991
+ { title: "Montserrat", value: "Montserrat" },
7992
+ { title: "Lato", value: "Lato" },
7993
+ { title: "Poppins", value: "Poppins" },
7994
+ { title: "Oswald", value: "Oswald" },
7995
+ { title: "Raleway", value: "Raleway" },
7996
+ { title: "Ubuntu", value: "Ubuntu" },
7997
+ { title: "Nunito", value: "Nunito" },
7998
+ { title: "Merriweather", value: "Merriweather" },
7999
+ { title: "Nunito Sans", value: "Nunito Sans" },
8000
+ { title: "Playfair Display", value: "Playfair Display" },
8001
+ { title: "Rubik", value: "Rubik" },
8002
+ { title: "Inter", value: "Inter" },
8003
+ { title: "Lora", value: "Lora" },
8004
+ { title: "Kanit", value: "Kanit" },
8005
+ { title: "Fira Sans", value: "Fira Sans" },
8006
+ { title: "Hind", value: "Hind" },
8007
+ { title: "Quicksand", value: "Quicksand" },
8008
+ { title: "Mulish", value: "Mulish" },
8009
+ { title: "Barlow", value: "Barlow" },
8010
+ { title: "Inconsolata", value: "Inconsolata" },
8011
+ { title: "Titillium Web", value: "Titillium Web" },
8012
+ { title: "Heebo", value: "Heebo" },
8013
+ { title: "IBM Plex Sans", value: "IBM Plex Sans" },
8014
+ { title: "DM Sans", value: "DM Sans" },
8015
+ { title: "Nanum Gothic", value: "Nanum Gothic" },
8016
+ { title: "Karla", value: "Karla" },
8017
+ { title: "Arimo", value: "Arimo" },
8018
+ { title: "Cabin", value: "Cabin" },
8019
+ { title: "Oxygen", value: "Oxygen" },
8020
+ { title: "Overpass", value: "Overpass" },
8021
+ { title: "Assistant", value: "Assistant" },
8022
+ { title: "Tajawal", value: "Tajawal" },
8023
+ { title: "Play", value: "Play" },
8024
+ { title: "Exo", value: "Exo" },
8025
+ { title: "Cinzel", value: "Cinzel" },
8026
+ { title: "Faustina", value: "Faustina" },
8027
+ { title: "Philosopher", value: "Philosopher" },
8028
+ { title: "Gelasio", value: "Gelasio" },
8029
+ { title: "Sofia Sans Condensed", value: "Sofia Sans Condensed" },
8030
+ { title: "Noto Sans Devanagari", value: "Noto Sans Devanagari" },
8031
+ { title: "Actor", value: "Actor" },
8032
+ { title: "Epilogue", value: "Epilogue" },
8033
+ { title: "Glegoo", value: "Glegoo" },
8034
+ { title: "Overlock", value: "Overlock" },
8035
+ { title: "Lustria", value: "Lustria" },
8036
+ { title: "Ovo", value: "Ovo" },
8037
+ { title: "Suranna", value: "Suranna" },
8038
+ { title: "Bebas Neue", value: "Bebas Neue" },
8039
+ { title: "Manrope", value: "Manrope" }
8040
+ ], FontSelector = ({
8041
+ label: o,
8042
+ value: n,
8043
+ onChange: r
8044
+ }) => /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8045
+ /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: startCase(o) }),
8046
+ /* @__PURE__ */ jsx(
8047
+ "select",
8048
+ {
8049
+ className: "mt-1 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8050
+ value: n,
8051
+ onChange: (a) => r(a.target.value),
8052
+ children: FONTS.map((a) => /* @__PURE__ */ jsx("option", { value: a.value, children: a.title }, a.value))
8053
+ }
8054
+ )
8055
+ ] }), ColorPickerInput = ({ value: o, onChange: n }) => {
8056
+ const r = debounce((a) => n(a), 200);
8057
+ return /* @__PURE__ */ jsx(
8058
+ "div",
8059
+ {
8060
+ className: "relative flex h-6 w-6 cursor-pointer rounded-lg border border-border",
8061
+ style: { backgroundColor: o },
8062
+ children: /* @__PURE__ */ jsx(
8063
+ "input",
8064
+ {
8065
+ type: "color",
8066
+ value: o.startsWith("#") ? o : "#000000",
8067
+ onChange: (a) => {
8068
+ const l = a.target.value;
8069
+ /^#[0-9A-F]{6}$/i.test(l) && r(l);
8070
+ },
8071
+ className: "absolute inset-0 h-full w-full cursor-pointer rounded-lg border-0 opacity-0"
8072
+ }
8073
+ )
8074
+ }
8075
+ );
8076
+ }, BorderRadiusInput = ({ value: o, onChange: n, disabled: r }) => {
8077
+ const a = debounce((l) => n(l), 200);
8078
+ return /* @__PURE__ */ jsx(
8079
+ "input",
8080
+ {
8081
+ type: "range",
8082
+ min: "0",
8083
+ step: "1",
8084
+ max: "30",
8085
+ disabled: r,
8086
+ defaultValue: o.replace("px", ""),
8087
+ onChange: (l) => a(l.target.value),
8088
+ className: "flex-1 cursor-pointer"
8089
+ }
8090
+ );
8091
+ }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
8092
+ const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), m = (A) => {
8093
+ a(A);
8094
+ }, x = () => {
8095
+ const A = l.find((B) => Object.keys(B)[0] === r);
8096
+ if (A) {
8097
+ const B = Object.values(A)[0];
8098
+ B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
8099
+ } else
8100
+ console.error("Preset not found:", r);
8101
+ }, f = useDebouncedCallback(
8102
+ (A, B) => {
8103
+ p(() => ({
8104
+ ...d,
8105
+ fontFamily: {
8106
+ ...d.fontFamily,
8107
+ [A.replace(/font-/g, "")]: B
8108
+ }
8109
+ }));
8110
+ },
8111
+ [d],
8112
+ 200
8113
+ ), h = useDebouncedCallback(
8114
+ (A) => {
8115
+ p(() => ({
8116
+ ...d,
8117
+ borderRadius: `${A}px`
8118
+ }));
8119
+ },
8120
+ [d],
8121
+ 200
8122
+ ), b = useDebouncedCallback(
8123
+ (A, B) => {
8124
+ p(() => {
8125
+ const C = get(d, `colors.${A}`);
8126
+ return n ? set(C, 1, B) : set(C, 0, B), {
8127
+ ...d,
8128
+ colors: {
8129
+ ...d.colors,
8130
+ [A]: C
8131
+ }
8132
+ };
8133
+ });
8134
+ },
8135
+ [d],
8136
+ 200
8137
+ ), k = (A) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(A.items).map(([B]) => {
8138
+ const C = get(d, `colors.${B}.${n ? 1 : 0}`);
8139
+ return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
8140
+ /* @__PURE__ */ jsx(
8141
+ ColorPickerInput,
8142
+ {
8143
+ value: C,
8144
+ onChange: (j) => b(B, j)
8145
+ }
8146
+ ),
8147
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: B.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((j) => j.charAt(0).toUpperCase() + j.slice(1)).join(" ") + (!B.toLowerCase().includes("foreground") && !B.toLowerCase().includes("border") && !B.toLowerCase().includes("input") && !B.toLowerCase().includes("ring") && !B.toLowerCase().includes("background") ? " Background" : "") })
8148
+ ] }, B);
8149
+ }) });
8150
+ return c("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
8151
+ /* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
8152
+ l.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 py-2", children: [
8153
+ /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
8154
+ /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: g("Presets") }),
8155
+ /* @__PURE__ */ jsxs(
8156
+ "select",
8157
+ {
8158
+ value: r,
8159
+ onChange: (A) => m(A.target.value),
8160
+ className: "w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8161
+ children: [
8162
+ /* @__PURE__ */ jsx("option", { value: "", children: "Select preset" }),
8163
+ Array.isArray(l) && l.map((A) => /* @__PURE__ */ jsx("option", { value: Object.keys(A)[0], children: capitalize(Object.keys(A)[0]) }, Object.keys(A)[0]))
8164
+ ]
8165
+ }
8166
+ )
8167
+ ] }),
8168
+ /* @__PURE__ */ jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsx(
8169
+ Button,
8170
+ {
8171
+ className: "w-full text-sm",
8172
+ disabled: r === "",
8173
+ variant: "default",
8174
+ onClick: x,
8175
+ children: g("Apply")
8176
+ }
8177
+ ) })
8178
+ ] }),
8179
+ /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", o), children: [
8180
+ (u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([A, B]) => /* @__PURE__ */ jsx(
8181
+ FontSelector,
8182
+ {
8183
+ label: A,
8184
+ value: d.fontFamily[A.replace(/font-/g, "")] || B[Object.keys(B)[0]],
8185
+ onChange: (C) => f(A, C)
8186
+ },
8187
+ A
8188
+ )) }),
8189
+ (u == null ? void 0 : u.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 py-3", children: [
8190
+ /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: g("Border Radius") }),
8191
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 py-2", children: [
8192
+ /* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: h }),
8193
+ /* @__PURE__ */ jsx("span", { className: "w-12 text-sm", children: d.borderRadius })
8194
+ ] })
8195
+ ] }),
8196
+ (u == null ? void 0 : u.colors) && /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-0.5", children: [
8197
+ /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: g("Colors") }),
8198
+ /* @__PURE__ */ jsx("div", { className: "w-full space-y-4 pt-2", children: u.colors.map((A) => k(A)) }, n ? "dark" : "light")
8199
+ ] })
8200
+ ] }),
8201
+ /* @__PURE__ */ jsx("br", {}),
8202
+ /* @__PURE__ */ jsx("br", {}),
8203
+ /* @__PURE__ */ jsx("br", {}),
8204
+ /* @__PURE__ */ jsx("br", {})
8205
+ ] }),
8206
+ i && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 w-full", children: React.createElement(i) })
8207
+ ] }) : /* @__PURE__ */ jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsx("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto text-center", o), children: /* @__PURE__ */ jsx("div", { className: "mt-10 h-full items-center justify-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: "You don't have permission to edit the theme. Please contact your administrator to get access." }) }) }) });
8208
+ }), Core = "Core", Import = "Import", Breakpoints = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Styling", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", theme_config = { heading_font: "Heading Font", body_font: "Body Font", rounded_corner: "Rounded Corners", primary: "Primary", secondary: "Secondary", background: "Background", text_color: "Text Color", background_dark_mode: "Background (Dark Mode)", text_color_dark_mode: "Text Color (Dark Mode)" }, web_blocks = { box: "box", tag: "Tag", div: "div", level: "Level", header: "header", footer: "footer", section: "section", article: "article", aside: "aside", main: "main", nav: "navigation", figure: "figure", details: "details", summary: "summary", dialog: "dialog", strike: "strike", caption: "caption", legend: "legend", figcaption: "figure caption", mark: "mark", background_image: "Background Image", label: "Label", default: "default", icon_size: "Icon Size", icon_position: "Icon Position", start: "Start", end: "End", button: "Button", custom_html: "Custom HTML", html_code: "HTML Code", default_snippet: "The HTML snippet goes here...", placeholder: "Enter custom HTML code here", custom_script: "Custom Script", dark_mode: "Dark Mode", divider: "Divider", empty_box: "Empty Box", heading: "Heading", image: "Image", alt: "Alt", width: "Width", height: "Height", video: "Video", span: "Span", content: "Content", icon: "Icon", richtext: "Rich Text", list: "List", list_type: "List Type", listitem: "List Item", link: "Link", list_item: "List Item", none: "None", disc: "Disc", number: "Number", paragraph: "Paragraph", lightbox_link: "Lightbox Link", href: "Link", type: "Type", iframe: "iframe", inline: "inline", ajax: "ajax", autoplay: "Video autoplay", max_width: "Max Width", backdrop_color: "Background Color", gallery_name: "Gallery Name", slot: "Slot", empty_slot: "Empty Slot", text: "Text", video_url: "Video URL", controls: "Show Controls", loop: "Loop", muted: "Muted", checkbox: "Checkbox", required: "Required", checked: "Checked", submit_button: "Submit Button", form: "Form", submit_url: "Submit URL", error_message: "Error Message", success_message: "Success Message", input: "Input", value: "Value", show_label: "Show Label", field_name: "Field Name", radio: "Radio", multiple: "Multiple", options: "Options", select: "Select", multiple_choice: "Multiple Choice", textarea: "Textarea", rows: "Rows" }, Undo = "Undo", Redo = "Redo", Duplicate = "Duplicate", Close = "Close", Selected = "Selected", Select = "Select", Attributes = "Attributes", apply = "apply", presets = "presets", Orientation = "Orientation", Color = "Color", Upload = "Upload", lngEn = {
8230
8209
  "Add block": "Add Block",
8231
8210
  "Add blocks": "Add blocks",
8232
8211
  "Enter or paste TailwindCSS HTML snippet": "Enter or paste TailwindCSS HTML snippet",
@@ -9499,6 +9478,8 @@ const RootLayout = () => {
9499
9478
  /* @__PURE__ */ jsx(Toaster, {})
9500
9479
  ] }) }) });
9501
9480
  };
9481
+ if (typeof window > "u")
9482
+ throw new Error("@chaibuilder/sdk is only supported in the browser. Avoid using it in the server side.");
9502
9483
  export {
9503
9484
  AISetContext,
9504
9485
  AIUserPrompt,
@@ -9516,8 +9497,8 @@ export {
9516
9497
  ListTree as Outline,
9517
9498
  PERMISSIONS,
9518
9499
  Breakpoints$1 as ScreenSizes,
9519
- ThemeConfigPanel as ThemeOptions,
9520
- UILibrariesPanel as UILibraries,
9500
+ ThemeConfigPanel,
9501
+ UILibrariesPanel,
9521
9502
  UndoRedo,
9522
9503
  generateUUID as generateBlockId,
9523
9504
  getBlocksFromHTML,
@@ -9547,6 +9528,7 @@ export {
9547
9528
  useHighlightBlockId,
9548
9529
  useLanguages,
9549
9530
  useLayoutVariant,
9531
+ useLibraryBlocks,
9550
9532
  usePartailBlocksStore,
9551
9533
  usePartialBlocksList,
9552
9534
  usePasteBlocks,