@chaibuilder/sdk 2.0.8 → 2.0.10

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
@@ -16,9 +16,9 @@ import { useFloating, shift } from "@floating-ui/react-dom";
16
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
- import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
19
+ import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
20
20
  import { registerChaiBlock as Ue } from "@chaibuilder/runtime";
21
- import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, a as getChaiThemeCssVariables, c as getThemeFontsLinkMarkup } from "./ChaiThemeFn-Cort9tch.js";
21
+ import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, a as getChaiThemeCssVariables, c as getThemeFontsLinkMarkup, f as getThemeCustomFontFace } from "./chai-theme-helpers-DC7cFoyJ.js";
22
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, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
23
23
  import RjForm from "@rjsf/core";
24
24
  import validator from "@rjsf/validator-ajv8";
@@ -41,10 +41,10 @@ import { ErrorBoundary } from "react-error-boundary";
41
41
  import { useHotkeys } from "react-hotkeys-hook";
42
42
  import { motion } from "framer-motion";
43
43
  import TreeModel from "tree-model";
44
- import typography from "@tailwindcss/typography";
45
- import forms from "@tailwindcss/forms";
46
44
  import aspectRatio from "@tailwindcss/aspect-ratio";
47
45
  import containerQueries from "@tailwindcss/container-queries";
46
+ import forms from "@tailwindcss/forms";
47
+ import typography from "@tailwindcss/typography";
48
48
  import ReactDOM from "react-dom";
49
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) => {
@@ -3793,7 +3793,9 @@ const useHandleCanvasDblClick = (o, n) => {
3793
3793
  );
3794
3794
  useEffect(() => {
3795
3795
  a ? d == null || d.documentElement.classList.add("dark") : d == null || d.documentElement.classList.remove("dark");
3796
- }, [a, d]), useEffect(() => {
3796
+ }, [a, d]);
3797
+ const f = useRegisteredFonts();
3798
+ useEffect(() => {
3797
3799
  !p || !p.tailwind || (p.tailwind.config = {
3798
3800
  darkMode: "class",
3799
3801
  theme: {
@@ -3813,22 +3815,22 @@ const useHandleCanvasDblClick = (o, n) => {
3813
3815
  forms,
3814
3816
  aspectRatio,
3815
3817
  containerQueries,
3816
- plugin(function({ addBase: b, theme: y }) {
3817
- b({
3818
+ plugin(function({ addBase: S, theme: B }) {
3819
+ S({
3818
3820
  "h1,h2,h3,h4,h5,h6": {
3819
- fontFamily: y("fontFamily.heading")
3821
+ fontFamily: B("fontFamily.heading")
3820
3822
  },
3821
3823
  body: {
3822
- fontFamily: y("fontFamily.body"),
3823
- color: y("colors.foreground"),
3824
- backgroundColor: y("colors.background")
3824
+ fontFamily: B("fontFamily.body"),
3825
+ color: B("colors.foreground"),
3826
+ backgroundColor: B("colors.background")
3825
3827
  }
3826
3828
  });
3827
3829
  })
3828
3830
  ]
3829
3831
  });
3830
3832
  }, [o, n, p]), useEffect(() => {
3831
- g && (g.textContent = `${map(r, (b) => `[data-block-id="${b}"]`).join(",")}{
3833
+ g && (g.textContent = `${map(r, (S) => `[data-block-id="${S}"]`).join(",")}{
3832
3834
  outline: 1px solid ${r.length === 1 ? "#42a1fc !important" : "orange !important"}; outline-offset: -1px;
3833
3835
  }`);
3834
3836
  }, [r, g]), useEffect(() => {
@@ -3836,19 +3838,26 @@ const useHandleCanvasDblClick = (o, n) => {
3836
3838
  }, [i, h]), useEffect(() => {
3837
3839
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3838
3840
  }, [u]), useEffect(() => {
3839
- m && (m.textContent = `${map(l, ({ id: b }) => `[data-style-id="${b}"]`).join(",")}{
3841
+ m && (m.textContent = `${map(l, ({ id: S }) => `[data-style-id="${S}"]`).join(",")}{
3840
3842
  outline: 1px solid orange !important; outline-offset: -1px;
3841
3843
  }`);
3842
3844
  }, [l, m]), useEffect(() => {
3843
3845
  d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3844
3846
  }, [c, d]);
3845
- const f = useMemo(
3846
- () => getChaiThemeCssVariables(o),
3847
- [o]
3848
- ), x = useMemo(() => getThemeFontsLinkMarkup(pick(o, ["fontFamily"])), [o]);
3847
+ const x = useMemo(() => getChaiThemeCssVariables(o), [o]), b = useMemo(() => {
3848
+ const { heading: S, body: B } = {
3849
+ heading: get(o, "fontFamily.heading"),
3850
+ body: get(o, "fontFamily.body")
3851
+ };
3852
+ return f.filter((E) => E.name === S || E.name === B);
3853
+ }, [o == null ? void 0 : o.fontFamily, f]), y = useMemo(() => getThemeFontsLinkMarkup(filter(b, (S) => has(S, "url"))), [b]), v = useMemo(
3854
+ () => getThemeCustomFontFace(filter(b, (S) => !has(S, "url"))),
3855
+ [b]
3856
+ );
3849
3857
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3850
- /* @__PURE__ */ jsx("style", { id: "chai-theme", children: f }),
3851
- /* @__PURE__ */ jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: x } })
3858
+ /* @__PURE__ */ jsx("style", { id: "chai-theme", children: x }),
3859
+ /* @__PURE__ */ jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: y } }),
3860
+ /* @__PURE__ */ jsx("style", { id: "chai-custom-fonts", dangerouslySetInnerHTML: { __html: v } })
3852
3861
  ] });
3853
3862
  }, ResizableCanvasWrapper = ({ children: o, onMount: n, onResize: r }) => {
3854
3863
  const [, a] = useSelectedBlockIds(), [, l] = useSelectedStylingBlocks(), i = useRef(null), c = useDebouncedCallback(
@@ -7991,74 +8000,25 @@ const selectParent = (o, n) => {
7991
8000
  ) }),
7992
8001
  /* @__PURE__ */ jsx(PasteAtRootContextMenu, { parentContext, setParentContext })
7993
8002
  ] });
7994
- }, FONTS = [
7995
- { title: "Roboto", value: "Roboto" },
7996
- { title: "Open Sans", value: "Open Sans" },
7997
- { title: "Montserrat", value: "Montserrat" },
7998
- { title: "Lato", value: "Lato" },
7999
- { title: "Poppins", value: "Poppins" },
8000
- { title: "Oswald", value: "Oswald" },
8001
- { title: "Raleway", value: "Raleway" },
8002
- { title: "Ubuntu", value: "Ubuntu" },
8003
- { title: "Nunito", value: "Nunito" },
8004
- { title: "Merriweather", value: "Merriweather" },
8005
- { title: "Nunito Sans", value: "Nunito Sans" },
8006
- { title: "Playfair Display", value: "Playfair Display" },
8007
- { title: "Rubik", value: "Rubik" },
8008
- { title: "Inter", value: "Inter" },
8009
- { title: "Lora", value: "Lora" },
8010
- { title: "Kanit", value: "Kanit" },
8011
- { title: "Fira Sans", value: "Fira Sans" },
8012
- { title: "Hind", value: "Hind" },
8013
- { title: "Quicksand", value: "Quicksand" },
8014
- { title: "Mulish", value: "Mulish" },
8015
- { title: "Barlow", value: "Barlow" },
8016
- { title: "Inconsolata", value: "Inconsolata" },
8017
- { title: "Titillium Web", value: "Titillium Web" },
8018
- { title: "Heebo", value: "Heebo" },
8019
- { title: "IBM Plex Sans", value: "IBM Plex Sans" },
8020
- { title: "DM Sans", value: "DM Sans" },
8021
- { title: "Nanum Gothic", value: "Nanum Gothic" },
8022
- { title: "Karla", value: "Karla" },
8023
- { title: "Arimo", value: "Arimo" },
8024
- { title: "Cabin", value: "Cabin" },
8025
- { title: "Oxygen", value: "Oxygen" },
8026
- { title: "Overpass", value: "Overpass" },
8027
- { title: "Assistant", value: "Assistant" },
8028
- { title: "Tajawal", value: "Tajawal" },
8029
- { title: "Play", value: "Play" },
8030
- { title: "Exo", value: "Exo" },
8031
- { title: "Cinzel", value: "Cinzel" },
8032
- { title: "Faustina", value: "Faustina" },
8033
- { title: "Philosopher", value: "Philosopher" },
8034
- { title: "Gelasio", value: "Gelasio" },
8035
- { title: "Sofia Sans Condensed", value: "Sofia Sans Condensed" },
8036
- { title: "Noto Sans Devanagari", value: "Noto Sans Devanagari" },
8037
- { title: "Actor", value: "Actor" },
8038
- { title: "Epilogue", value: "Epilogue" },
8039
- { title: "Glegoo", value: "Glegoo" },
8040
- { title: "Overlock", value: "Overlock" },
8041
- { title: "Lustria", value: "Lustria" },
8042
- { title: "Ovo", value: "Ovo" },
8043
- { title: "Suranna", value: "Suranna" },
8044
- { title: "Bebas Neue", value: "Bebas Neue" },
8045
- { title: "Manrope", value: "Manrope" }
8046
- ], FontSelector = ({
8003
+ }, FontSelector = ({
8047
8004
  label: o,
8048
8005
  value: n,
8049
8006
  onChange: r
8050
- }) => /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8051
- /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: startCase(o) }),
8052
- /* @__PURE__ */ jsx(
8053
- "select",
8054
- {
8055
- 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",
8056
- value: n,
8057
- onChange: (a) => r(a.target.value),
8058
- children: FONTS.map((a) => /* @__PURE__ */ jsx("option", { value: a.value, children: a.title }, a.value))
8059
- }
8060
- )
8061
- ] }), ColorPickerInput = ({ value: o, onChange: n }) => {
8007
+ }) => {
8008
+ const a = useRegisteredFonts();
8009
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8010
+ /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: startCase(o) }),
8011
+ /* @__PURE__ */ jsx(
8012
+ "select",
8013
+ {
8014
+ 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",
8015
+ value: n,
8016
+ onChange: (l) => r(l.target.value),
8017
+ children: a.map((l) => /* @__PURE__ */ jsx("option", { value: l.name, children: l.name }, l.name))
8018
+ }
8019
+ )
8020
+ ] });
8021
+ }, ColorPickerInput = ({ value: o, onChange: n }) => {
8062
8022
  const r = debounce((a) => n(a), 200);
8063
8023
  return /* @__PURE__ */ jsx(
8064
8024
  "div",
@@ -9460,7 +9420,11 @@ const RootLayout = () => {
9460
9420
  y.preventDefault();
9461
9421
  }, u = (y) => {
9462
9422
  n(o === y ? null : y);
9463
- }, g = useSidebarMenuItems(), { t: m } = useTranslation(), h = useMemo(() => [...g, ...c], [g, c]), f = useBuilderProp("htmlDir", "ltr"), x = find(h, { id: o }), b = get(x, "width", DEFAULT_PANEL_WIDTH);
9423
+ }, g = useSidebarMenuItems(), { t: m } = useTranslation(), h = useMemo(() => [...g, ...c], [g, c]), f = useBuilderProp("htmlDir", "ltr");
9424
+ useEffect(() => {
9425
+ find(h, { id: o }) || n("outline");
9426
+ }, [o, h]);
9427
+ const x = find(h, { id: o }) ?? first(h), b = get(x, "width", DEFAULT_PANEL_WIDTH);
9464
9428
  return /* @__PURE__ */ jsx("div", { dir: f, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
9465
9429
  /* @__PURE__ */ jsxs(
9466
9430
  "div",
@@ -9501,7 +9465,7 @@ const RootLayout = () => {
9501
9465
  className: `absolute top-2 flex h-10 items-center space-x-1 bg-white py-2 text-base font-bold ${get(x, "isInternal", !1) ? "" : "w-64"}`,
9502
9466
  children: [
9503
9467
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(x, "icon", null) }),
9504
- /* @__PURE__ */ jsx("span", { children: m(x == null ? void 0 : x.label) })
9468
+ /* @__PURE__ */ jsx("span", { children: m(get(x, "label", "")) })
9505
9469
  ]
9506
9470
  }
9507
9471
  ),
Binary file
Binary file
@@ -0,0 +1 @@
1
+ "use strict";const o=require("./chai-theme-helpers-DKMzVh0t.cjs"),n=(i=o.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...o.getChaiThemeOptions(i)}),r=o.plugin(function({addBase:i,theme:e}){i({"h1,h2,h3,h4,h5,h6":{fontFamily:e("fontFamily.heading")},body:{fontFamily:e("fontFamily.body"),color:e("colors.foreground"),backgroundColor:e("colors.background")}})});exports.chaiBuilderPlugin=r;exports.getChaiBuilderTheme=n;
@@ -1,4 +1,4 @@
1
- import { g as r, d as a, p as i } from "./ChaiThemeFn-Cort9tch.js";
1
+ import { g as r, d as a, p as i } from "./chai-theme-helpers-DC7cFoyJ.js";
2
2
  const t = (n = a) => ({
3
3
  container: {
4
4
  center: !0,
package/dist/render.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./ChaiThemeFn-DQu-2Eh9.cjs"),s=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),b=require("@tailwindcss/aspect-ratio"),k=require("@tailwindcss/container-queries"),M=require("@tailwindcss/forms"),N=require("@tailwindcss/typography"),w=require("./plugin-2xcljWGM.cjs"),g=require("react/jsx-runtime"),T=require("@chaibuilder/runtime"),p=require("react"),Y=require("tailwind-merge"),I=(e,r="")=>{const{classes:n}=m.getSplitChaiClasses(e),t=n.split(" ").map(i=>i.split(" ").map(a=>{if(a==="")return"";if(a.includes(":")){const u=a.split(":");return u[u.length-1]=r+s.last(u),u.join(":")}return`${r}${a}`}).join(" "));return s.flattenDeep(t).join(" ")},A=e=>{if(!e)return[];try{return JSON.parse(J(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function J(e){const r=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(r,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function K(e,r,n=[],t="",i){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:w.getChaiBuilderTheme(e)},plugins:[M,N,b,k,w.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./chai-theme-helpers-DKMzVh0t.cjs"),s=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),b=require("@tailwindcss/aspect-ratio"),k=require("@tailwindcss/container-queries"),M=require("@tailwindcss/forms"),N=require("@tailwindcss/typography"),w=require("./plugin-3oYvWHBg.cjs"),g=require("react/jsx-runtime"),T=require("@chaibuilder/runtime"),p=require("react"),Y=require("tailwind-merge"),I=(e,r="")=>{const{classes:n}=m.getSplitChaiClasses(e),t=n.split(" ").map(i=>i.split(" ").map(a=>{if(a==="")return"";if(a.includes(":")){const u=a.split(":");return u[u.length-1]=r+s.last(u),u.join(":")}return`${r}${a}`}).join(" "));return s.flattenDeep(t).join(" ")},A=e=>{if(!e)return[];try{return JSON.parse(J(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function J(e){const r=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(r,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function K(e,r,n=[],t="",i){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:w.getChaiBuilderTheme(e)},plugins:[M,N,b,k,w.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,r)}const L=(e,r,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,c)=>`#styles:${c.replace(/,/g," ")}`.replace(/#styles:/g,""));return K(r,[t],[],"",n)},V=async(e,r=S.defaultThemeOptions,n=!1)=>await L(e,r,n);async function U(e){const r=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return s.has(r,"$metadata")&&e.dataProviderMetadataCallback(e.block,r.$metadata),g.jsx(p.Suspense,{children:p.createElement(e.component,{...s.omit(e.props,["dataProvider","dataProviderMetadataCallback"]),...s.omit(r,"$metadata")})})}const z=s.memoize((e,r)=>{const{baseClasses:n,classes:t}=m.getSplitChaiClasses(e),i=Y.twMerge(n,t);return r===""?i.replace(m.STYLES_KEY,"").trim():I(i,r).replace(m.STYLES_KEY,"").trim()}),j=(e,r)=>{const n=s.cloneDeep(e);return s.forEach(s.keys(n),t=>{if(s.isString(n[t])){let i=n[t];const c=/\{\{(.*?)\}\}/g,l=i.match(c);l&&l.forEach(a=>{const u=a.slice(2,-2),h=s.get(r,u,a);i=i.replace(a,h)}),n[t]=i}s.isObject(n[t])&&(n[t]=j(n[t],r))}),n};function D(e,r){const n=s.get(e,`${r}_attrs`,{}),t=s.keys(n).join(" ");return s.includes(t,"x-show")&&!s.includes(t,"x-transition")&&(n["x-transition"]=""),n}function W(e,r){const n={};return Object.keys(e).forEach(t=>{if(s.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=z(e[t],r);n[t]={className:i,...D(e,t)}}}),n}function Q(e,r,n){if(s.isEmpty(r))return e;const t=s.cloneDeep(e),i=s.get(n,"i18nProps",[]);return s.forEach(s.keys(t),c=>{i.includes(c)&&!s.isEmpty(r)&&(t[c]=s.get(t,`${c}-${r}`,t[c]))}),t}const G=s.memoize(e=>{const r=T.getRegisteredChaiBlock(e),n=s.get(r,"schema.properties",{});return Object.fromEntries(Object.entries(n).filter(([,t])=>s.get(t,"runtime",!1)))}),H=(e,r,n)=>s.isEmpty(n)?{}:Object.entries(n).reduce((t,[i,c])=>{const l=[];let a=s.find(e,{_id:r});for(;a;)l.push(a),a=s.find(e,{_id:a._parent});const u=s.find(l,{_type:c.block});return u&&(t[i]=s.get(u,s.get(c,"prop"),null)),t},{}),X=()=>g.jsx("span",{children:"Loading..."});function E({blocks:e,parent:r,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:c="",fallbackLang:l="",metadata:a={},dataProviderMetadataCallback:u=()=>{}}){const h=e,P=o=>W(o,n),q=r?s.filter(e,{_parent:r}):s.filter(e,o=>s.isEmpty(o._parent));return s.uniqBy(q,"_id").map((o,v)=>{const y={},x=s.filter(h,{_parent:o._id});y.children=x.length>0?g.jsx(E,{externalData:t,classPrefix:n,parent:o._id,blocks:h,lang:c||l,metadata:a},o._id):null;const d=T.getRegisteredChaiBlock(o._type);if(d!==null){let f=o;const C=d.component;f={...d.defaults,...o},i&&(f=i(f));const O=c===l?"":c,R=H(h,o._id,G(o._type)),_=j(Q(o,O,d),t),B=s.omit({blockProps:{},inBuilder:!1,...f,index:v,..._,...P(_),...y,...R,metadata:a,lang:c||l,key:o._id},["_parent"]);if(s.has(d,"dataProvider")){const $=s.get(d,"suspenseFallback",X);return g.jsx(p.Suspense,{fallback:p.createElement($),children:g.jsx(U,{dataProviderMetadataCallback:u,lang:c||l,metadata:a,dataProvider:d.dataProvider,block:o,component:C,props:B},o._id)},o._id)}return g.jsx(p.Suspense,{children:p.createElement(C,B)},o._id)}return g.jsxs("noscript",{children:[o._type," not found"]},o._id)})}exports.getChaiThemeCssVariables=S.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=S.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=S.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=E;exports.convertToBlocks=A;exports.getStylesForBlocks=V;
3
+ @tailwind utilities;`,r)}const V=(e,r,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return K(r,[t],[],"",n)},L=async(e,r=S.defaultThemeOptions,n=!1)=>await V(e,r,n);async function U(e){const r=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return s.has(r,"$metadata")&&e.dataProviderMetadataCallback(e.block,r.$metadata),g.jsx(p.Suspense,{children:p.createElement(e.component,{...s.omit(e.props,["dataProvider","dataProviderMetadataCallback"]),...s.omit(r,"$metadata"),key:`${e.block._id}-async`})})}const z=s.memoize((e,r)=>{const{baseClasses:n,classes:t}=m.getSplitChaiClasses(e),i=Y.twMerge(n,t);return r===""?i.replace(m.STYLES_KEY,"").trim():I(i,r).replace(m.STYLES_KEY,"").trim()}),j=(e,r)=>{const n=s.cloneDeep(e);return s.forEach(s.keys(n),t=>{if(s.isString(n[t])){let i=n[t];const o=/\{\{(.*?)\}\}/g,l=i.match(o);l&&l.forEach(a=>{const u=a.slice(2,-2),h=s.get(r,u,a);i=i.replace(a,h)}),n[t]=i}s.isObject(n[t])&&(n[t]=j(n[t],r))}),n};function D(e,r){const n=s.get(e,`${r}_attrs`,{}),t=s.keys(n).join(" ");return s.includes(t,"x-show")&&!s.includes(t,"x-transition")&&(n["x-transition"]=""),n}function W(e,r){const n={};return Object.keys(e).forEach(t=>{if(s.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=z(e[t],r);n[t]={className:i,...D(e,t)}}}),n}function H(e,r,n){if(s.isEmpty(r))return e;const t=s.cloneDeep(e),i=s.get(n,"i18nProps",[]);return s.forEach(s.keys(t),o=>{i.includes(o)&&!s.isEmpty(r)&&(t[o]=s.get(t,`${o}-${r}`,t[o]))}),t}const Q=s.memoize(e=>{const r=T.getRegisteredChaiBlock(e),n=s.get(r,"schema.properties",{});return Object.fromEntries(Object.entries(n).filter(([,t])=>s.get(t,"runtime",!1)))}),G=(e,r,n)=>s.isEmpty(n)?{}:Object.entries(n).reduce((t,[i,o])=>{const l=[];let a=s.find(e,{_id:r});for(;a;)l.push(a),a=s.find(e,{_id:a._parent});const u=s.find(l,{_type:o.block});return u&&(t[i]=s.get(u,s.get(o,"prop"),null)),t},{}),X=()=>g.jsx("span",{children:"Loading..."});function E({blocks:e,parent:r,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:o="",fallbackLang:l="",metadata:a={},dataProviderMetadataCallback:u=()=>{}}){const h=e,P=c=>W(c,n),$=r?s.filter(e,{_parent:r}):s.filter(e,c=>s.isEmpty(c._parent));return s.uniqBy($,"_id").map((c,q)=>{const y={},v=s.filter(h,{_parent:c._id});y.children=v.length>0?g.jsx(E,{externalData:t,classPrefix:n,parent:c._id,blocks:h,lang:o||l,metadata:a,fallbackLang:l,dataProviderMetadataCallback:u},`${c._id}-children`):null;const d=T.getRegisteredChaiBlock(c._type);if(d!==null){let f=c;const _=d.component;f={...d.defaults,...c},i&&(f=i(f));const x=o===l?"":o,O=G(h,c._id,Q(c._type)),C=j(H(c,x,d),t),B=s.omit({blockProps:{},inBuilder:!1,...f,index:q,...C,...P(C),...y,...O,metadata:a,lang:o||l,key:c._id},["_parent"]);if(s.has(d,"dataProvider")){const R=s.get(d,"suspenseFallback",X);return g.jsx(p.Suspense,{fallback:p.createElement(R),children:g.jsx(U,{dataProviderMetadataCallback:u,lang:o||l,metadata:a,dataProvider:d.dataProvider,block:c,component:_,props:B},`${c._id}-async`)},`${c._id}-suspense`)}return g.jsx(p.Suspense,{children:p.createElement(_,B)},`${c._id}-suspense`)}return g.jsxs("noscript",{children:[c._type," not found"]},`${c._id}-noscript`)})}exports.getChaiThemeCssVariables=S.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=S.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=S.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=E;exports.convertToBlocks=A;exports.getStylesForBlocks=L;
package/dist/render.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ChaiGoogleFont } from '@chaibuilder/runtime';
2
+
1
3
  declare type BorderRadiusValue = false | string;
2
4
 
3
5
  declare type ChaiBlock<T = Record<string, any>> = {
@@ -33,11 +35,9 @@ export declare const getChaiThemeCssVariables: (chaiTheme: Partial<ChaiBuilderTh
33
35
 
34
36
  export declare const getStylesForBlocks: (blocks: ChaiBlock[], themeOptions?: ChaiBuilderThemeOptions, includeBaseStyles?: boolean) => Promise<string>;
35
37
 
36
- export declare const getThemeFontsCSSImport: (chaiTheme: {
37
- fontFamily: Record<string, string>;
38
- }) => any;
38
+ export declare const getThemeFontsCSSImport: (fonts: ChaiGoogleFont[]) => string;
39
39
 
40
- export declare const getThemeFontsLinkMarkup: (chaiTheme: Pick<Partial<ChaiBuilderThemeValues>, "fontFamily">) => any;
40
+ export declare const getThemeFontsLinkMarkup: (fonts: ChaiGoogleFont[]) => string;
41
41
 
42
42
  declare type HSLColor = string;
43
43
 
package/dist/render.js CHANGED
@@ -1,19 +1,19 @@
1
- import { d as Y } from "./ChaiThemeFn-Cort9tch.js";
2
- import { a as At, b as It, c as Jt } from "./ChaiThemeFn-Cort9tch.js";
3
- import { last as q, flattenDeep as z, has as O, omit as S, memoize as $, get as d, filter as h, isEmpty as g, uniqBy as D, cloneDeep as E, forEach as x, keys as w, isString as R, isObject as L, find as _, includes as j } from "lodash-es";
4
- import { g as b, S as y } from "./getSplitClasses-DphwgQiE.js";
5
- import { createTailwindcss as Q } from "@mhsdesign/jit-browser-tailwindcss";
6
- import G from "@tailwindcss/aspect-ratio";
7
- import H from "@tailwindcss/container-queries";
1
+ import { d as Y } from "./chai-theme-helpers-DC7cFoyJ.js";
2
+ import { a as At, b as It, c as Jt } from "./chai-theme-helpers-DC7cFoyJ.js";
3
+ import { last as q, flattenDeep as z, has as v, omit as y, memoize as O, get as d, filter as h, isEmpty as g, uniqBy as D, cloneDeep as E, forEach as x, keys as B, isString as R, isObject as Q, find as _, includes as j } from "lodash-es";
4
+ import { g as F, S } from "./getSplitClasses-DphwgQiE.js";
5
+ import { createTailwindcss as G } from "@mhsdesign/jit-browser-tailwindcss";
6
+ import H from "@tailwindcss/aspect-ratio";
7
+ import L from "@tailwindcss/container-queries";
8
8
  import X from "@tailwindcss/forms";
9
9
  import Z from "@tailwindcss/typography";
10
- import { g as k, c as tt } from "./plugin-kUMxtQR5.js";
10
+ import { g as k, c as tt } from "./plugin-jViUnwnQ.js";
11
11
  import { jsx as p, jsxs as et } from "react/jsx-runtime";
12
- import { getRegisteredChaiBlock as F } from "@chaibuilder/runtime";
13
- import N, { Suspense as C, createElement as nt } from "react";
12
+ import { getRegisteredChaiBlock as N } from "@chaibuilder/runtime";
13
+ import b, { Suspense as w, createElement as nt } from "react";
14
14
  import { twMerge as st } from "tailwind-merge";
15
15
  const rt = (t, s = "") => {
16
- const { classes: n } = b(t), e = n.split(" ").map((r) => r.split(" ").map((a) => {
16
+ const { classes: n } = F(t), e = n.split(" ").map((r) => r.split(" ").map((a) => {
17
17
  if (a === "") return "";
18
18
  if (a.includes(":")) {
19
19
  const l = a.split(":");
@@ -38,12 +38,12 @@ function it(t) {
38
38
  });
39
39
  }
40
40
  async function ot(t, s, n = [], e = "", r) {
41
- return await Q({
41
+ return await G({
42
42
  tailwindConfig: {
43
43
  darkMode: "class",
44
44
  safelist: n,
45
45
  theme: { extend: k(t) },
46
- plugins: [X, Z, G, H, tt],
46
+ plugins: [X, Z, H, L, tt],
47
47
  corePlugins: { preflight: r },
48
48
  ...e ? { prefix: `${e}` } : {}
49
49
  }
@@ -57,20 +57,21 @@ async function ot(t, s, n = [], e = "", r) {
57
57
  const at = (t, s, n) => {
58
58
  const e = JSON.stringify(t).replace(/#styles:([^"]*)/g, (r, o) => `#styles:${o.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
59
59
  return ot(s, [e], [], "", n);
60
- }, bt = async (t, s = Y, n = !1) => await at(t, s, n);
60
+ }, Ft = async (t, s = Y, n = !1) => await at(t, s, n);
61
61
  async function ct(t) {
62
62
  const s = await (t == null ? void 0 : t.dataProvider(t.block, t.lang, t.metadata));
63
- return O(s, "$metadata") && t.dataProviderMetadataCallback(t.block, s.$metadata), /* @__PURE__ */ p(C, { children: N.createElement(t.component, {
64
- ...S(t.props, ["dataProvider", "dataProviderMetadataCallback"]),
65
- ...S(s, "$metadata")
63
+ return v(s, "$metadata") && t.dataProviderMetadataCallback(t.block, s.$metadata), /* @__PURE__ */ p(w, { children: b.createElement(t.component, {
64
+ ...y(t.props, ["dataProvider", "dataProviderMetadataCallback"]),
65
+ ...y(s, "$metadata"),
66
+ key: `${t.block._id}-async`
66
67
  }) });
67
68
  }
68
- const lt = $((t, s) => {
69
- const { baseClasses: n, classes: e } = b(t), r = st(n, e);
70
- return s === "" ? r.replace(y, "").trim() : rt(r, s).replace(y, "").trim();
69
+ const lt = O((t, s) => {
70
+ const { baseClasses: n, classes: e } = F(t), r = st(n, e);
71
+ return s === "" ? r.replace(S, "").trim() : rt(r, s).replace(S, "").trim();
71
72
  }), A = (t, s) => {
72
73
  const n = E(t);
73
- return x(w(n), (e) => {
74
+ return x(B(n), (e) => {
74
75
  if (R(n[e])) {
75
76
  let r = n[e];
76
77
  const o = /\{\{(.*?)\}\}/g, c = r.match(o);
@@ -79,17 +80,17 @@ const lt = $((t, s) => {
79
80
  r = r.replace(a, m);
80
81
  }), n[e] = r;
81
82
  }
82
- L(n[e]) && (n[e] = A(n[e], s));
83
+ Q(n[e]) && (n[e] = A(n[e], s));
83
84
  }), n;
84
85
  };
85
86
  function dt(t, s) {
86
- const n = d(t, `${s}_attrs`, {}), e = w(n).join(" ");
87
+ const n = d(t, `${s}_attrs`, {}), e = B(n).join(" ");
87
88
  return j(e, "x-show") && !j(e, "x-transition") && (n["x-transition"] = ""), n;
88
89
  }
89
90
  function ut(t, s) {
90
91
  const n = {};
91
92
  return Object.keys(t).forEach((e) => {
92
- if (R(t[e]) && t[e].startsWith(y)) {
93
+ if (R(t[e]) && t[e].startsWith(S)) {
93
94
  const r = lt(t[e], s);
94
95
  n[e] = {
95
96
  className: r,
@@ -101,12 +102,12 @@ function ut(t, s) {
101
102
  function pt(t, s, n) {
102
103
  if (g(s)) return t;
103
104
  const e = E(t), r = d(n, "i18nProps", []);
104
- return x(w(e), (o) => {
105
+ return x(B(e), (o) => {
105
106
  r.includes(o) && !g(s) && (e[o] = d(e, `${o}-${s}`, e[o]));
106
107
  }), e;
107
108
  }
108
- const mt = $((t) => {
109
- const s = F(t), n = d(s, "schema.properties", {});
109
+ const mt = O((t) => {
110
+ const s = N(t), n = d(s, "schema.properties", {});
110
111
  return Object.fromEntries(Object.entries(n).filter(([, e]) => d(e, "runtime", !1)));
111
112
  }), ft = (t, s, n) => g(n) ? {} : Object.entries(n).reduce((e, [r, o]) => {
112
113
  const c = [];
@@ -130,8 +131,8 @@ function ht({
130
131
  }) {
131
132
  const m = t, I = (i) => ut(i, n), J = s ? h(t, { _parent: s }) : h(t, (i) => g(i._parent));
132
133
  return D(J, "_id").map((i, M) => {
133
- const B = {}, U = h(m, { _parent: i._id });
134
- B.children = U.length > 0 ? /* @__PURE__ */ p(
134
+ const C = {}, U = h(m, { _parent: i._id });
135
+ C.children = U.length > 0 ? /* @__PURE__ */ p(
135
136
  ht,
136
137
  {
137
138
  externalData: e,
@@ -139,24 +140,26 @@ function ht({
139
140
  parent: i._id,
140
141
  blocks: m,
141
142
  lang: o || c,
142
- metadata: a
143
+ metadata: a,
144
+ fallbackLang: c,
145
+ dataProviderMetadataCallback: l
143
146
  },
144
- i._id
147
+ `${i._id}-children`
145
148
  ) : null;
146
- const u = F(i._type);
149
+ const u = N(i._type);
147
150
  if (u !== null) {
148
151
  let f = i;
149
152
  const P = u.component;
150
153
  f = { ...u.defaults, ...i }, r && (f = r(f));
151
- const V = o === c ? "" : o, K = ft(m, i._id, mt(i._type)), v = A(pt(i, V, u), e), T = S(
154
+ const V = o === c ? "" : o, K = ft(m, i._id, mt(i._type)), $ = A(pt(i, V, u), e), T = y(
152
155
  {
153
156
  blockProps: {},
154
157
  inBuilder: !1,
155
158
  ...f,
156
159
  index: M,
157
- ...v,
158
- ...I(v),
159
- ...B,
160
+ ...$,
161
+ ...I($),
162
+ ...C,
160
163
  ...K,
161
164
  metadata: a,
162
165
  lang: o || c,
@@ -164,9 +167,9 @@ function ht({
164
167
  },
165
168
  ["_parent"]
166
169
  );
167
- if (O(u, "dataProvider")) {
170
+ if (v(u, "dataProvider")) {
168
171
  const W = d(u, "suspenseFallback", gt);
169
- return /* @__PURE__ */ p(C, { fallback: nt(W), children: /* @__PURE__ */ p(
172
+ return /* @__PURE__ */ p(w, { fallback: nt(W), children: /* @__PURE__ */ p(
170
173
  ct,
171
174
  {
172
175
  dataProviderMetadataCallback: l,
@@ -177,22 +180,22 @@ function ht({
177
180
  component: P,
178
181
  props: T
179
182
  },
180
- i._id
181
- ) }, i._id);
183
+ `${i._id}-async`
184
+ ) }, `${i._id}-suspense`);
182
185
  }
183
- return /* @__PURE__ */ p(C, { children: N.createElement(P, T) }, i._id);
186
+ return /* @__PURE__ */ p(w, { children: b.createElement(P, T) }, `${i._id}-suspense`);
184
187
  }
185
188
  return /* @__PURE__ */ et("noscript", { children: [
186
189
  i._type,
187
190
  " not found"
188
- ] }, i._id);
191
+ ] }, `${i._id}-noscript`);
189
192
  });
190
193
  }
191
194
  export {
192
195
  ht as RenderChaiBlocks,
193
196
  Rt as convertToBlocks,
194
197
  At as getChaiThemeCssVariables,
195
- bt as getStylesForBlocks,
198
+ Ft as getStylesForBlocks,
196
199
  It as getThemeFontsCSSImport,
197
200
  Jt as getThemeFontsLinkMarkup
198
201
  };
package/dist/tailwind.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tailwindcss/aspect-ratio"),a=require("@tailwindcss/forms"),n=require("@tailwindcss/typography"),d=require("tailwindcss-animate"),r=require("./plugin-2xcljWGM.cjs");function i(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}}const t=e=>({darkMode:"class",content:[...e,"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],theme:{extend:i()},plugins:[d,n,a,o]});exports.chaiBuilderPlugin=r.chaiBuilderPlugin;exports.getChaiBuilderTheme=r.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tailwindcss/aspect-ratio"),a=require("@tailwindcss/forms"),n=require("@tailwindcss/typography"),d=require("tailwindcss-animate"),r=require("./plugin-3oYvWHBg.cjs");function i(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}}const t=e=>({darkMode:"class",content:[...e,"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],theme:{extend:i()},plugins:[d,n,a,o]});exports.chaiBuilderPlugin=r.chaiBuilderPlugin;exports.getChaiBuilderTheme=r.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=t;
@@ -1,6 +1,6 @@
1
1
  import { Config } from 'tailwindcss/types/config';
2
- import { default as default_2 } from '@tailwindcss/typography';
3
- import { default as default_3 } from '@tailwindcss/forms';
2
+ import { default as default_2 } from '@tailwindcss/forms';
3
+ import { default as default_3 } from '@tailwindcss/typography';
4
4
  import { PluginCreator } from 'tailwindcss/types/config';
5
5
 
6
6
  declare type BorderRadiusValue = false | string;
@@ -93,9 +93,9 @@ export declare const getChaiBuilderTailwindConfig: (content: string[]) => {
93
93
  };
94
94
  };
95
95
  };
96
- plugins: (typeof default_2 | typeof default_3 | {
96
+ plugins: ({
97
97
  handler: () => void;
98
- })[];
98
+ } | typeof default_2 | typeof default_3)[];
99
99
  };
100
100
 
101
101
  export declare const getChaiBuilderTheme: (themeOptions?: ChaiBuilderThemeOptions) => {
package/dist/tailwind.js CHANGED
@@ -2,7 +2,7 @@ import o from "@tailwindcss/aspect-ratio";
2
2
  import e from "@tailwindcss/forms";
3
3
  import a from "@tailwindcss/typography";
4
4
  import d from "tailwindcss-animate";
5
- import { c as l, g as v } from "./plugin-kUMxtQR5.js";
5
+ import { c as l, g as v } from "./plugin-jViUnwnQ.js";
6
6
  function n() {
7
7
  return {
8
8
  colors: {
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": "2.0.8",
8
+ "version": "2.0.10",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",
@@ -53,7 +53,7 @@
53
53
  }
54
54
  },
55
55
  "peerDependencies": {
56
- "@chaibuilder/runtime": "2.0.1",
56
+ "@chaibuilder/runtime": "2.0.4",
57
57
  "@types/react": "*",
58
58
  "@types/react-dom": "*",
59
59
  "jotai": "2.12.1",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@ai-sdk/react": "^1.2.2",
73
- "@chaibuilder/runtime": "2.0.1",
73
+ "@chaibuilder/runtime": "2.0.4",
74
74
  "@floating-ui/dom": "1.6.13",
75
75
  "@floating-ui/react-dom": "2.1.2",
76
76
  "@mhsdesign/jit-browser-tailwindcss": "0.4.2",
@@ -1,13 +0,0 @@
1
- "use strict";const a=require("lodash-es");function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const _={fontFamily:{"font-heading":"Inter","font-body":"Inter"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]};var c={},d={},p;function v(){return p||(p=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});function n(t,o){return{handler:t,config:o}}n.withOptions=function(t,o=()=>({})){const u=function(s){return{__options:s,handler:t(s),config:o(s)}};return u.__isOptionsFunction=!0,u.__pluginFunction=t,u.__configFunction=o,u};const r=n}(d)),d}var m;function P(){return m||(m=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const n=r(v());function r(o){return o&&o.__esModule?o:{default:o}}const t=n.default}(c)),c}var f,y;function C(){if(y)return f;y=1;let e=P();return f=(e.__esModule?e:{default:e}).default,f}var j=C();const E=b(j),O=e=>({fontFamily:e.fontFamily?a.keys(e.fontFamily).reduce((r,t)=>({...r,[t.replace("font-","")]:`var(--${t})`}),{}):{},borderRadius:e.borderRadius?{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}:{},colors:e.colors?a.flatten(e.colors.map(r=>Object.entries(r.items))).reduce((r,[t])=>({...r,[t]:`hsl(var(--${t}))`}),{}):{}});function $(e){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=parseInt(n[1],16),t=parseInt(n[2],16),o=parseInt(n[3],16);r/=255,t/=255,o/=255;const u=Math.max(r,t,o),s=Math.min(r,t,o);let i,l;const g=(u+s)/2;if(u==s)i=l=0;else{const F=u-s;switch(l=g>.5?F/(2-u-s):F/(u+s),u){case r:i=(t-o)/F+(t<o?6:0);break;case t:i=(o-r)/F+2;break;case o:i=(r-t)/F+4;break}i/=6}return`${Math.round(i*360)} ${Math.round(l*100)}% ${Math.round(g*100)}%`}const k=e=>`:root {
2
- ${e.fontFamily&&Object.entries(e.fontFamily).map(([n,r])=>`--font-${n}: "${r}";`).join(`
3
- `)}
4
- ${e.borderRadius&&`--radius: ${e.borderRadius};`}
5
- ${e.colors&&Object.entries(e.colors).map(([n,r])=>`--${n}: ${$(r[0])};`).join(`
6
- `)}
7
- }
8
- .dark {
9
- ${e.colors&&Object.entries(e.colors).map(([n,r])=>`--${n}: ${$(r[1])};`).join(`
10
- `)}
11
- }`,M=e=>a.isEmpty(e.fontFamily)?"":a.uniq(Object.entries(e.fontFamily).map(([,r])=>r)).map(r=>`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${r.replace(/\s+/g,"+")}&display=swap`}">`).join(`
12
- `),h=e=>a.isEmpty(e.fontFamily)?"":a.uniq(Object.entries(e.fontFamily).map(([,r])=>r)).map(r=>`@import url("${`https://fonts.googleapis.com/css2?family=${r.replace(/\s+/g,"+")}&display=swap`}");`).join(`
13
- `);exports.defaultThemeOptions=_;exports.getChaiThemeCssVariables=k;exports.getChaiThemeOptions=O;exports.getDefaultExportFromCjs=b;exports.getThemeFontsCSSImport=h;exports.getThemeFontsLinkMarkup=M;exports.plugin=E;
@@ -1 +0,0 @@
1
- "use strict";const n=require("./ChaiThemeFn-DQu-2Eh9.cjs"),o=(i=n.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...n.getChaiThemeOptions(i)}),r=n.plugin(function({addBase:i,theme:e}){i({"h1,h2,h3,h4,h5,h6":{fontFamily:e("fontFamily.heading")},body:{fontFamily:e("fontFamily.body"),color:e("colors.foreground"),backgroundColor:e("colors.background")}})});exports.chaiBuilderPlugin=r;exports.getChaiBuilderTheme=o;