@chaibuilder/sdk 3.0.6 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.js +18 -8
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -504,6 +504,8 @@ export declare const registerChaiLibrary: <T extends Record<string, any> = Recor
|
|
|
504
504
|
|
|
505
505
|
export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
|
|
506
506
|
|
|
507
|
+
export declare const registerChaiPreImportHTMLHook: (fn: (code: string) => Promise<string>) => void;
|
|
508
|
+
|
|
507
509
|
export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
|
|
508
510
|
|
|
509
511
|
export declare const registerChaiSidebarPanel: (panelId: string, panelOptions: Omit<ChaiSidebarPanel, "id">) => void;
|
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ var $ = (o, n, r) => U(o, typeof n != "symbol" ? n + "" : n, r);
|
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
6
6
|
import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, sortBy, round } from "lodash-es";
|
|
7
|
-
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, ReloadIcon, MagicWandIcon, MagnifyingGlassIcon, CaretRightIcon, FrameIcon, CheckIcon, LinkBreak2Icon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, ChatBubbleIcon, FaceIcon, ShuffleIcon, ImageIcon, PaperPlaneIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } from "@radix-ui/react-icons";
|
|
7
|
+
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, ReloadIcon, MagicWandIcon, CircleIcon, MagnifyingGlassIcon, CaretRightIcon, FrameIcon, CheckIcon, LinkBreak2Icon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, ChatBubbleIcon, FaceIcon, ShuffleIcon, ImageIcon, PaperPlaneIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } from "@radix-ui/react-icons";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
|
|
10
10
|
import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
|
|
@@ -6832,10 +6832,15 @@ const CoreBlock = ({
|
|
|
6832
6832
|
blocks: l.core
|
|
6833
6833
|
}
|
|
6834
6834
|
);
|
|
6835
|
-
}
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6835
|
+
};
|
|
6836
|
+
let PRE_IMPORT_HTML_HOOK = async (o) => o;
|
|
6837
|
+
const registerChaiPreImportHTMLHook = (o) => {
|
|
6838
|
+
PRE_IMPORT_HTML_HOOK = o;
|
|
6839
|
+
}, getPreImportHTML = async (o) => await PRE_IMPORT_HTML_HOOK(o), ImportHTML = ({ parentId: o, position: n }) => {
|
|
6840
|
+
const { t: r } = useTranslation(), [a, l] = useState(""), { addPredefinedBlock: i } = useAddBlock(), [c, d] = useState(!1), p = async () => {
|
|
6841
|
+
d(!0);
|
|
6842
|
+
const u = await getPreImportHTML(a), g = getBlocksFromHTML(u);
|
|
6843
|
+
i([...g], o, n), l(""), d(!1), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6839
6844
|
};
|
|
6840
6845
|
return /* @__PURE__ */ jsxs(Card, { className: "border-border/0 p-0 shadow-none", children: [
|
|
6841
6846
|
/* @__PURE__ */ jsx(CardHeader, { className: "p-3", children: /* @__PURE__ */ jsx(CardDescription, { children: r("Use HTML snippets from Tailwind CSS component libraries") }) }),
|
|
@@ -6846,8 +6851,8 @@ const CoreBlock = ({
|
|
|
6846
6851
|
{
|
|
6847
6852
|
autoFocus: !0,
|
|
6848
6853
|
tabIndex: 1,
|
|
6849
|
-
ref: (
|
|
6850
|
-
onChange: (
|
|
6854
|
+
ref: (u) => u && u.focus(),
|
|
6855
|
+
onChange: (u) => l(u.target.value),
|
|
6851
6856
|
rows: 12,
|
|
6852
6857
|
value: a,
|
|
6853
6858
|
placeholder: r("Enter your code snippet here"),
|
|
@@ -6855,7 +6860,11 @@ const CoreBlock = ({
|
|
|
6855
6860
|
}
|
|
6856
6861
|
)
|
|
6857
6862
|
] }) }),
|
|
6858
|
-
/* @__PURE__ */ jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsx(Button, { disabled: a.trim() === "", onClick: () =>
|
|
6863
|
+
/* @__PURE__ */ jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsx(Button, { disabled: a.trim() === "" || c, onClick: () => p(), size: "sm", className: "w-fit", children: c ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6864
|
+
/* @__PURE__ */ jsx(CircleIcon, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
6865
|
+
" ",
|
|
6866
|
+
r("Importing...")
|
|
6867
|
+
] }) : r("Import HTML") }) })
|
|
6859
6868
|
] });
|
|
6860
6869
|
}, ChaiSelect = ({
|
|
6861
6870
|
defaultValue: o = "",
|
|
@@ -10383,6 +10392,7 @@ export {
|
|
|
10383
10392
|
registerChaiFeatureFlags,
|
|
10384
10393
|
registerChaiLibrary,
|
|
10385
10394
|
registerChaiMediaManager,
|
|
10395
|
+
registerChaiPreImportHTMLHook,
|
|
10386
10396
|
registerChaiSaveToLibrary,
|
|
10387
10397
|
registerChaiSidebarPanel,
|
|
10388
10398
|
registerChaiTopBar,
|