@chaibuilder/sdk 2.0.5 → 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.cjs +5 -5
- package/dist/core.d.ts +30 -28
- package/dist/core.js +456 -447
- package/dist/render.cjs +2 -2
- package/dist/render.js +60 -60
- package/package.json +1 -1
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,
|
|
7
|
-
import { O as DropdownMenu, P as DropdownMenuTrigger, Q as DropdownMenuContent, R as DropdownMenuItem, S as Skeleton, B as Button,
|
|
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,
|
|
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,
|
|
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
|
-
},
|
|
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 {
|
|
@@ -5859,7 +5655,129 @@ const BlockStylingProps = () => {
|
|
|
5859
5655
|
)) }),
|
|
5860
5656
|
/* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
|
|
5861
5657
|
] });
|
|
5862
|
-
},
|
|
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 = {
|
|
5863
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" }) }),
|
|
5864
5782
|
// visibility
|
|
5865
5783
|
visible: EyeOpenIcon,
|
|
@@ -6053,130 +5971,6 @@ const BlockStylingProps = () => {
|
|
|
6053
5971
|
)
|
|
6054
5972
|
] }),
|
|
6055
5973
|
static: Cross1Icon
|
|
6056
|
-
}, StyleContext = createContext({ canReset: !1, canChange: !0 }), BlockStyleProvider = ({ children: o, canReset: n = !1, canChange: r = !0 }) => (
|
|
6057
|
-
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
6058
|
-
/* @__PURE__ */ jsx(StyleContext.Provider, { value: { canReset: n, canChange: r }, children: o })
|
|
6059
|
-
), DropDownChoices = ({ label: o, property: n, onChange: r }) => {
|
|
6060
|
-
const { getClasses: a } = useTailwindClassList(), l = a(n), i = useCurrentClassByProperty(n), c = useMemo(() => get(i, "cls", ""), [i]), { canChange: d } = useContext(StyleContext), p = /\[.*\]/g.test(c);
|
|
6061
|
-
return /* @__PURE__ */ jsx("div", { className: o ? "w-full rounded" : "grow", children: p ? /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
6062
|
-
/* @__PURE__ */ jsx(Input$1, { className: "w-[70%] rounded py-1", readOnly: !0, value: c }),
|
|
6063
|
-
/* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6064
|
-
/* @__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, {}) }) }),
|
|
6065
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind arbitrary value." })
|
|
6066
|
-
] })
|
|
6067
|
-
] }) : /* @__PURE__ */ jsx(
|
|
6068
|
-
DropDown,
|
|
6069
|
-
{
|
|
6070
|
-
rounded: o,
|
|
6071
|
-
onChange: (u) => r(u, n),
|
|
6072
|
-
selected: c,
|
|
6073
|
-
options: l,
|
|
6074
|
-
disabled: !d
|
|
6075
|
-
}
|
|
6076
|
-
) });
|
|
6077
|
-
};
|
|
6078
|
-
function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disabled: l = !1 }) {
|
|
6079
|
-
const i = o.replace(/.*:/g, "").trim(), { undo: c, redo: d } = useUndoManager();
|
|
6080
|
-
return /* @__PURE__ */ jsxs(
|
|
6081
|
-
"select",
|
|
6082
|
-
{
|
|
6083
|
-
disabled: !a.length || l,
|
|
6084
|
-
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`,
|
|
6085
|
-
onChange: (p) => n(p.target.value),
|
|
6086
|
-
onKeyDown: (p) => {
|
|
6087
|
-
p.ctrlKey && (p.key === "z" && c(), p.key === "y" && d());
|
|
6088
|
-
},
|
|
6089
|
-
value: i,
|
|
6090
|
-
children: [
|
|
6091
|
-
/* @__PURE__ */ jsx("option", { className: "bg-transparent", value: "" }),
|
|
6092
|
-
React__default.Children.toArray(
|
|
6093
|
-
a.map((p) => /* @__PURE__ */ jsx("option", { className: "bg-transparent", value: p, children: p }))
|
|
6094
|
-
)
|
|
6095
|
-
]
|
|
6096
|
-
}
|
|
6097
|
-
);
|
|
6098
|
-
}
|
|
6099
|
-
const COLOR_PROP = {
|
|
6100
|
-
backgroundColor: "bg",
|
|
6101
|
-
textColor: "text",
|
|
6102
|
-
borderColor: "border",
|
|
6103
|
-
boxShadowColor: "shadow",
|
|
6104
|
-
outlineColor: "outline",
|
|
6105
|
-
divideColor: "divide",
|
|
6106
|
-
fromColor: "from",
|
|
6107
|
-
viaColor: "via",
|
|
6108
|
-
toColor: "to",
|
|
6109
|
-
ringColor: "ring",
|
|
6110
|
-
ringOffsetColor: "ring-offset"
|
|
6111
|
-
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6112
|
-
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(
|
|
6113
|
-
// eslint-disable-next-line no-shadow
|
|
6114
|
-
(b) => {
|
|
6115
|
-
["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" })));
|
|
6116
|
-
},
|
|
6117
|
-
[c, p]
|
|
6118
|
-
);
|
|
6119
|
-
useEffect(() => {
|
|
6120
|
-
if (["current", "inherit", "transparent", "black", "white"].includes(g))
|
|
6121
|
-
return c([]);
|
|
6122
|
-
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6123
|
-
}, [g]);
|
|
6124
|
-
const f = useCallback(
|
|
6125
|
-
// eslint-disable-next-line no-shadow
|
|
6126
|
-
(b) => {
|
|
6127
|
-
p({ color: g, shade: b });
|
|
6128
|
-
},
|
|
6129
|
-
[g]
|
|
6130
|
-
);
|
|
6131
|
-
useEffect(() => {
|
|
6132
|
-
p({ color: "", shade: "" });
|
|
6133
|
-
}, [r]);
|
|
6134
|
-
const { match: h } = useTailwindClassList();
|
|
6135
|
-
return useEffect(() => {
|
|
6136
|
-
const k = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6137
|
-
h(o, k) && n(k, o);
|
|
6138
|
-
}, [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: [
|
|
6139
|
-
/* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
|
|
6140
|
-
DropDown,
|
|
6141
|
-
{
|
|
6142
|
-
disabled: !l,
|
|
6143
|
-
rounded: !0,
|
|
6144
|
-
selected: g,
|
|
6145
|
-
onChange: x,
|
|
6146
|
-
options: [
|
|
6147
|
-
"current",
|
|
6148
|
-
"transparent",
|
|
6149
|
-
"primary",
|
|
6150
|
-
"secondary",
|
|
6151
|
-
"black",
|
|
6152
|
-
"white",
|
|
6153
|
-
"slate",
|
|
6154
|
-
"gray",
|
|
6155
|
-
"zinc",
|
|
6156
|
-
"neutral",
|
|
6157
|
-
"stone",
|
|
6158
|
-
"red",
|
|
6159
|
-
"orange",
|
|
6160
|
-
"amber",
|
|
6161
|
-
"yellow",
|
|
6162
|
-
"lime",
|
|
6163
|
-
"green",
|
|
6164
|
-
"emerald",
|
|
6165
|
-
"teal",
|
|
6166
|
-
"cyan",
|
|
6167
|
-
"sky",
|
|
6168
|
-
"blue",
|
|
6169
|
-
"indigo",
|
|
6170
|
-
"violet",
|
|
6171
|
-
"purple",
|
|
6172
|
-
"fuchsia",
|
|
6173
|
-
"pink",
|
|
6174
|
-
"rose"
|
|
6175
|
-
]
|
|
6176
|
-
}
|
|
6177
|
-
) }),
|
|
6178
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: f, options: i }) })
|
|
6179
|
-
] });
|
|
6180
5974
|
}, IconChoices = ({ property: o, onChange: n }) => {
|
|
6181
5975
|
const { getClasses: r } = useTailwindClassList(), a = r(o), { canChange: l } = useContext(StyleContext), i = useCurrentClassByProperty(o), c = useMemo(() => get(i, "cls", ""), [i]);
|
|
6182
5976
|
return /* @__PURE__ */ jsx("div", { className: "flex grow flex-wrap gap-1", children: map(a, (d) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
@@ -6700,25 +6494,23 @@ const COLOR_PROP = {
|
|
|
6700
6494
|
children: [
|
|
6701
6495
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6702
6496
|
o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6703
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children:
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
] }) }))
|
|
6721
|
-
) })
|
|
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}`)) })
|
|
6722
6514
|
] }),
|
|
6723
6515
|
/* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
|
|
6724
6516
|
BlockStyle,
|
|
@@ -6772,12 +6564,8 @@ const COLOR_PROP = {
|
|
|
6772
6564
|
), i = useMemo(() => ({}), []);
|
|
6773
6565
|
return /* @__PURE__ */ jsx(SectionContext.Provider, { value: i, children: n ? /* @__PURE__ */ jsxs(AccordionItem, { value: o.heading, className: "border-none", children: [
|
|
6774
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)) }) }) }),
|
|
6775
|
-
/* @__PURE__ */ jsx(AccordionContent, { className: "py-2", children: React__default.
|
|
6776
|
-
|
|
6777
|
-
) })
|
|
6778
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "py-2", children: React__default.Children.toArray(
|
|
6779
|
-
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))
|
|
6780
|
-
) }) });
|
|
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)) }) });
|
|
6781
6569
|
}, MAPPER = {
|
|
6782
6570
|
px: 1,
|
|
6783
6571
|
"%": 1,
|
|
@@ -7363,21 +7151,19 @@ const CHAI_BUILDER_EVENTS = {
|
|
|
7363
7151
|
'"'
|
|
7364
7152
|
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: L.map((y) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7365
7153
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(y.toLowerCase())) }),
|
|
7366
|
-
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children:
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
))
|
|
7380
|
-
) })
|
|
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
|
+
)) })
|
|
7381
7167
|
] }, y)) }) }) })
|
|
7382
7168
|
] })
|
|
7383
7169
|
] });
|
|
@@ -7461,7 +7247,7 @@ function UILibrariesSelect({
|
|
|
7461
7247
|
{
|
|
7462
7248
|
className: "mt-1",
|
|
7463
7249
|
options: o.map((l) => ({
|
|
7464
|
-
value: l.
|
|
7250
|
+
value: l.id,
|
|
7465
7251
|
label: l.name
|
|
7466
7252
|
})),
|
|
7467
7253
|
defaultValue: n,
|
|
@@ -7529,20 +7315,8 @@ const BlockCard = ({
|
|
|
7529
7315
|
) }),
|
|
7530
7316
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: m }) })
|
|
7531
7317
|
] });
|
|
7532
|
-
}, libraryBlocksAtom = atom$1(
|
|
7533
|
-
{}
|
|
7534
|
-
), useLibraryBlocks = (o) => {
|
|
7535
|
-
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");
|
|
7536
|
-
return useEffect(() => {
|
|
7537
|
-
(async () => {
|
|
7538
|
-
if (i === "complete" || c.current === "loading") return;
|
|
7539
|
-
c.current = "loading", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
|
|
7540
|
-
const d = await a(o);
|
|
7541
|
-
c.current = "idle", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
|
|
7542
|
-
})();
|
|
7543
|
-
}, [o, l, i, c, r, a]), { data: l || [], isLoading: i === "loading" };
|
|
7544
7318
|
}, UILibrarySection = ({ parentId: o, position: n }) => {
|
|
7545
|
-
const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((C) => C.category === "custom"), d = l.find((C) => 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) => {
|
|
7546
7320
|
h.current && (clearTimeout(h.current), h.current = null), h.current = setTimeout(() => {
|
|
7547
7321
|
h.current && x(C);
|
|
7548
7322
|
}, 300);
|
|
@@ -7555,29 +7329,27 @@ const BlockCard = ({
|
|
|
7555
7329
|
const A = filter(f, (C, j) => j % 2 === 0), B = filter(f, (C, j) => j % 2 === 1);
|
|
7556
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: [
|
|
7557
7331
|
/* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7558
|
-
/* @__PURE__ */ jsx(UILibrariesSelect, { library: d == null ? void 0 : d.
|
|
7332
|
+
/* @__PURE__ */ jsx(UILibrariesSelect, { library: d == null ? void 0 : d.id, setLibrary: a, uiLibraries: l }),
|
|
7559
7333
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7560
7334
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: b("Groups") }),
|
|
7561
7335
|
/* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
|
|
7562
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children:
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
children:
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
))
|
|
7580
|
-
) })
|
|
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
|
+
)) })
|
|
7581
7353
|
] })
|
|
7582
7354
|
] }),
|
|
7583
7355
|
/* @__PURE__ */ jsxs(
|
|
@@ -7587,12 +7359,26 @@ const BlockCard = ({
|
|
|
7587
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",
|
|
7588
7360
|
children: [
|
|
7589
7361
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7590
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
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
|
+
)) })
|
|
7596
7382
|
] }),
|
|
7597
7383
|
/* @__PURE__ */ jsx("br", {}),
|
|
7598
7384
|
/* @__PURE__ */ jsx("br", {}),
|
|
@@ -8199,7 +7985,227 @@ const selectParent = (o, n) => {
|
|
|
8199
7985
|
) }),
|
|
8200
7986
|
/* @__PURE__ */ jsx(PasteAtRootContextMenu, { parentContext, setParentContext })
|
|
8201
7987
|
] });
|
|
8202
|
-
},
|
|
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 = {
|
|
8203
8209
|
"Add block": "Add Block",
|
|
8204
8210
|
"Add blocks": "Add blocks",
|
|
8205
8211
|
"Enter or paste TailwindCSS HTML snippet": "Enter or paste TailwindCSS HTML snippet",
|
|
@@ -9472,6 +9478,8 @@ const RootLayout = () => {
|
|
|
9472
9478
|
/* @__PURE__ */ jsx(Toaster, {})
|
|
9473
9479
|
] }) }) });
|
|
9474
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.");
|
|
9475
9483
|
export {
|
|
9476
9484
|
AISetContext,
|
|
9477
9485
|
AIUserPrompt,
|
|
@@ -9489,8 +9497,8 @@ export {
|
|
|
9489
9497
|
ListTree as Outline,
|
|
9490
9498
|
PERMISSIONS,
|
|
9491
9499
|
Breakpoints$1 as ScreenSizes,
|
|
9492
|
-
ThemeConfigPanel
|
|
9493
|
-
UILibrariesPanel
|
|
9500
|
+
ThemeConfigPanel,
|
|
9501
|
+
UILibrariesPanel,
|
|
9494
9502
|
UndoRedo,
|
|
9495
9503
|
generateUUID as generateBlockId,
|
|
9496
9504
|
getBlocksFromHTML,
|
|
@@ -9520,6 +9528,7 @@ export {
|
|
|
9520
9528
|
useHighlightBlockId,
|
|
9521
9529
|
useLanguages,
|
|
9522
9530
|
useLayoutVariant,
|
|
9531
|
+
useLibraryBlocks,
|
|
9523
9532
|
usePartailBlocksStore,
|
|
9524
9533
|
usePartialBlocksList,
|
|
9525
9534
|
usePasteBlocks,
|