@chaibuilder/sdk 3.0.7 → 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.d.ts CHANGED
@@ -504,7 +504,7 @@ 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) => string) => void;
507
+ export declare const registerChaiPreImportHTMLHook: (fn: (code: string) => Promise<string>) => void;
508
508
 
509
509
  export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
510
510
 
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";
@@ -6833,13 +6833,14 @@ const CoreBlock = ({
6833
6833
  }
6834
6834
  );
6835
6835
  };
6836
- let PRE_IMPORT_HTML_HOOK = (o) => o;
6836
+ let PRE_IMPORT_HTML_HOOK = async (o) => o;
6837
6837
  const registerChaiPreImportHTMLHook = (o) => {
6838
6838
  PRE_IMPORT_HTML_HOOK = o;
6839
- }, getPreImportHTML = (o) => PRE_IMPORT_HTML_HOOK(o), ImportHTML = ({ parentId: o, position: n }) => {
6840
- const { t: r } = useTranslation(), [a, l] = useState(""), { addPredefinedBlock: i } = useAddBlock(), c = () => {
6841
- const d = getPreImportHTML(a), p = getBlocksFromHTML(d);
6842
- i([...p], o, n), l(""), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
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);
6843
6844
  };
6844
6845
  return /* @__PURE__ */ jsxs(Card, { className: "border-border/0 p-0 shadow-none", children: [
6845
6846
  /* @__PURE__ */ jsx(CardHeader, { className: "p-3", children: /* @__PURE__ */ jsx(CardDescription, { children: r("Use HTML snippets from Tailwind CSS component libraries") }) }),
@@ -6850,8 +6851,8 @@ const registerChaiPreImportHTMLHook = (o) => {
6850
6851
  {
6851
6852
  autoFocus: !0,
6852
6853
  tabIndex: 1,
6853
- ref: (d) => d && d.focus(),
6854
- onChange: (d) => l(d.target.value),
6854
+ ref: (u) => u && u.focus(),
6855
+ onChange: (u) => l(u.target.value),
6855
6856
  rows: 12,
6856
6857
  value: a,
6857
6858
  placeholder: r("Enter your code snippet here"),
@@ -6859,7 +6860,11 @@ const registerChaiPreImportHTMLHook = (o) => {
6859
6860
  }
6860
6861
  )
6861
6862
  ] }) }),
6862
- /* @__PURE__ */ jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsx(Button, { disabled: a.trim() === "", onClick: () => c(), size: "sm", className: "w-fit", children: r("Import HTML") }) })
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") }) })
6863
6868
  ] });
6864
6869
  }, ChaiSelect = ({
6865
6870
  defaultValue: o = "",
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "3.0.7",
8
+ "version": "3.0.8",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",