@chaibuilder/sdk 1.2.95 → 1.2.97

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.
@@ -1,9 +1,9 @@
1
1
  import { registerChaiBlock as u } from "@chaibuilder/runtime";
2
2
  import { j as s } from "./jsx-runtime-Sp0orL4X.js";
3
3
  import * as p from "react";
4
- import { c as j, T as m, f as v, o as C, b, q as N, y as I, l as T, d as L, m as S, v as R, r as k, e as F, G, g as B, S as O } from "./iconBase-HBZkvN04.js";
5
- import { ButtonIcon as H, CodeIcon as U, HeadingIcon as V, TextIcon as W, CursorTextIcon as X, Link1Icon as Y, ImageIcon as z, RowsIcon as Z, ColumnsIcon as J, SketchLogoIcon as K, VideoIcon as Q, DividerHorizontalIcon as ee, MoonIcon as te, SpaceBetweenVerticallyIcon as q, GroupIcon as le, InputIcon as A, RadiobuttonIcon as oe, DropdownMenuIcon as se, CheckboxIcon as ae } from "@radix-ui/react-icons";
6
- import { isNull as ne, isEmpty as y, get as x, pick as re, omit as ce, map as M } from "lodash-es";
4
+ import { c as j, T as m, f as v, o as C, b, q as N, y as I, l as T, d as L, m as S, v as R, r as g, e as F, G, g as B, S as V } from "./iconBase-HBZkvN04.js";
5
+ import { ButtonIcon as H, CodeIcon as O, HeadingIcon as U, TextIcon as W, CursorTextIcon as X, Link1Icon as Y, ImageIcon as z, RowsIcon as Z, ColumnsIcon as J, SketchLogoIcon as K, VideoIcon as Q, DividerHorizontalIcon as ee, MoonIcon as te, SpaceBetweenVerticallyIcon as A, GroupIcon as le, InputIcon as q, RadiobuttonIcon as oe, DropdownMenuIcon as se, CheckboxIcon as ae } from "@radix-ui/react-icons";
6
+ import { isNull as ne, isEmpty as k, get as x, pick as re, omit as ce, map as M } from "lodash-es";
7
7
  import { GlobeIcon as ie } from "lucide-react";
8
8
  import "clsx";
9
9
  import "tailwind-merge";
@@ -104,7 +104,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
104
104
  type: "CustomHTML",
105
105
  label: "web_blocks.custom_html",
106
106
  category: "core",
107
- icon: U,
107
+ icon: O,
108
108
  group: "advanced",
109
109
  props: {
110
110
  styles: m({ default: "" }),
@@ -114,12 +114,12 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
114
114
  placeholder: "web_blocks.placeholder"
115
115
  })
116
116
  }
117
- }, ke = p.memo(
117
+ }, ge = p.memo(
118
118
  (e) => {
119
119
  const { blockProps: l, styles: t } = e;
120
120
  return p.createElement("div", { ...l, ...t });
121
121
  }
122
- ), ge = {
122
+ ), ye = {
123
123
  type: "EmptyBox",
124
124
  label: "web_blocks.empty_box",
125
125
  category: "core",
@@ -128,7 +128,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
128
128
  styles: m({ default: "" }),
129
129
  backgroundImage: C({ title: "web_blocks.background_image" })
130
130
  }
131
- }, ye = (e) => {
131
+ }, ke = (e) => {
132
132
  const { blockProps: l, styles: t, content: a, level: o = "h1", children: n = null } = e;
133
133
  return n ? p.createElement(o, { ...t, ...l }, n) : p.createElement(o, {
134
134
  ...t,
@@ -141,7 +141,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
141
141
  type: "Heading",
142
142
  label: "web_blocks.heading",
143
143
  category: "core",
144
- icon: V,
144
+ icon: U,
145
145
  group: "typography",
146
146
  props: {
147
147
  level: v({
@@ -190,7 +190,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
190
190
  ...t,
191
191
  ...l,
192
192
  "data-ai-key": "content",
193
- dangerouslySetInnerHTML: { __html: a }
193
+ dangerouslySetInnerHTML: { __html: a || "" }
194
194
  });
195
195
  }, Be = {
196
196
  type: "Span",
@@ -199,7 +199,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
199
199
  group: "typography",
200
200
  props: {
201
201
  styles: m({ default: "" }),
202
- content: L({ title: "web_blocks.content", default: "" })
202
+ content: L({ title: "Content", default: "" })
203
203
  },
204
204
  canAcceptBlock: () => !0
205
205
  }, Ie = (e) => {
@@ -229,7 +229,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
229
229
  }
230
230
  }, Le = (e) => {
231
231
  const { blockProps: l, link: t, children: a, styles: o, inBuilder: n, content: r } = e;
232
- return !a && y(o == null ? void 0 : o.className) && y(r) ? /* @__PURE__ */ s.jsx(_, { inBuilder: n }) : n ? a ? /* @__PURE__ */ s.jsx("span", { ...l, ...o, children: a }) : p.createElement("span", {
232
+ return !a && k(o == null ? void 0 : o.className) && k(r) ? /* @__PURE__ */ s.jsx(_, { inBuilder: n }) : n ? a ? /* @__PURE__ */ s.jsx("span", { ...l, ...o, children: a }) : p.createElement("span", {
233
233
  ...l,
234
234
  ...o,
235
235
  dangerouslySetInnerHTML: { __html: r }
@@ -260,52 +260,52 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
260
260
  ...e,
261
261
  className: j(e.className, ...l)
262
262
  }), Se = (e) => {
263
- const { blockProps: l, children: t, styles: a, inBuilder: o, content: n, href: r } = e, { hrefType: i, autoplay: c, maxWidth: d, backdropColor: h, galleryName: f } = e, g = D(a, "cb-lightbox");
264
- if (!t && y(a == null ? void 0 : a.className) && y(n))
263
+ const { blockProps: l, children: t, styles: a, inBuilder: o, content: n, href: r } = e, { hrefType: i, autoplay: c, maxWidth: d, backdropColor: h, galleryName: f } = e, y = D(a, "cb-lightbox");
264
+ if (!t && k(a == null ? void 0 : a.className) && k(n))
265
265
  return /* @__PURE__ */ s.jsx(_, { inBuilder: o });
266
266
  if (o)
267
- return t ? /* @__PURE__ */ s.jsx("span", { ...l, ...g, children: t }) : p.createElement("span", {
267
+ return t ? /* @__PURE__ */ s.jsx("span", { ...l, ...y, children: t }) : p.createElement("span", {
268
268
  ...l,
269
- ...g,
269
+ ...y,
270
270
  dangerouslySetInnerHTML: { __html: n }
271
271
  });
272
272
  const w = {};
273
- return w["data-vbtype"] = i, c && (w["data-autoplay"] = "true"), d && (w["data-maxwidth"] = d + "px"), h && (w["data-overlay"] = h), f && (w["data-gall"] = f), t ? /* @__PURE__ */ s.jsx("a", { ...w, href: r || "#/", ...l, ...g, children: t }) : p.createElement("a", {
273
+ return w["data-vbtype"] = i, c && (w["data-autoplay"] = "true"), d && (w["data-maxwidth"] = d + "px"), h && (w["data-overlay"] = h), f && (w["data-gall"] = f), t ? /* @__PURE__ */ s.jsx("a", { ...w, href: r || "#/", ...l, ...y, children: t }) : p.createElement("a", {
274
274
  ...l,
275
- ...g,
275
+ ...y,
276
276
  ...w,
277
277
  href: r || "#",
278
278
  dangerouslySetInnerHTML: { __html: n }
279
279
  });
280
280
  }, Me = {
281
281
  type: "LightBoxLink",
282
- label: "web_blocks.lightbox_link",
282
+ label: "Lightbox Link",
283
283
  category: "core",
284
284
  icon: z,
285
285
  group: "basic",
286
286
  props: {
287
287
  styles: m({ default: "" }),
288
- content: b({ title: "web_blocks.content", default: "Link text or drop blocks inside" }),
289
- href: b({ title: "web_blocks.href", default: "" }),
288
+ content: b({ title: "Content", default: "Link text or drop blocks inside" }),
289
+ href: b({ title: "Href", default: "" }),
290
290
  hrefType: v({
291
- title: "web_blocks.type",
291
+ title: "Type",
292
292
  default: "video",
293
293
  options: [
294
- { value: "video", title: "web_blocks.video" },
295
- { value: "iframe", title: "web_blocks.iframe" },
296
- { value: "inline", title: "web_blocks.inline" },
297
- { value: "ajax", title: "web_blocks.ajax" }
294
+ { value: "video", title: "Video" },
295
+ { value: "iframe", title: "Iframe" },
296
+ { value: "inline", title: "Inline" },
297
+ { value: "ajax", title: "Ajax" }
298
298
  ]
299
299
  }),
300
- autoplay: k({ title: "web_blocks.autoplay", default: !1 }),
301
- maxWidth: I({ title: "web_blocks.max_width", default: "" }),
302
- backdropColor: b({ title: "backdrop_color", default: "" }),
303
- galleryName: b({ title: "web_blocks.gallery_name", default: "" })
300
+ autoplay: g({ title: "Autoplay", default: !1 }),
301
+ maxWidth: I({ title: "Max Width", default: "" }),
302
+ backdropColor: b({ title: "Backdrop Color", default: "" }),
303
+ galleryName: b({ title: "Gallery Name", default: "" })
304
304
  },
305
305
  canAcceptBlock: (e) => e !== "Link" && e !== "LightBoxLink"
306
306
  }, Ne = (e) => {
307
307
  const { blockProps: l, children: t, listType: a, styles: o, tag: n, inBuilder: r } = e, i = j(x(o, "className", ""), a);
308
- return !t && y(o == null ? void 0 : o.className) ? /* @__PURE__ */ s.jsx(_, { inBuilder: r }) : p.createElement(
308
+ return !t && k(o == null ? void 0 : o.className) ? /* @__PURE__ */ s.jsx(_, { inBuilder: r }) : p.createElement(
309
309
  n || (a === "list-decimal" ? "ol" : "ul"),
310
310
  { ...l, ...o, className: i },
311
311
  t
@@ -375,7 +375,7 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
375
375
  canBeNested: (e) => e === "List"
376
376
  }, Te = (e) => {
377
377
  const { blockProps: l, icon: t, styles: a, width: o, inBuilder: n, height: r } = e, i = D(a, j(o ? `w-[${o}px]` : "", r ? `h-[${r}px]` : ""));
378
- if (y(t))
378
+ if (k(t))
379
379
  return /* @__PURE__ */ s.jsx(_, { inBuilder: n, className: "h-8 w-14" });
380
380
  const c = t.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
381
381
  return p.createElement("span", {
@@ -399,17 +399,17 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
399
399
  height: I({ title: "web_blocks.height", default: "" })
400
400
  }
401
401
  }, ze = (e) => {
402
- const { blockProps: l, image: t, styles: a, alt: o, height: n, width: r } = e;
403
- return y(t) ? /* @__PURE__ */ s.jsx(_, { className: "h-36" }) : p.createElement("img", {
402
+ const { blockProps: l, image: t, styles: a, alt: o, height: n, width: r, lazyLoading: i } = e;
403
+ return k(t) ? /* @__PURE__ */ s.jsx(_, { className: "h-36" }) : p.createElement("img", {
404
404
  ...l,
405
405
  ...a,
406
406
  src: t,
407
407
  alt: o,
408
- loading: "lazy",
408
+ loading: i ? "lazy" : "eager",
409
409
  height: n,
410
410
  width: r
411
411
  });
412
- }, qe = {
412
+ }, Ae = {
413
413
  type: "Image",
414
414
  label: "web_blocks.image",
415
415
  category: "core",
@@ -423,9 +423,10 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
423
423
  }),
424
424
  alt: b({ title: "web_blocks.alt", default: "" }),
425
425
  width: b({ title: "web_blocks.width", default: "" }),
426
- height: b({ title: "web_blocks.height", default: "" })
426
+ height: b({ title: "web_blocks.height", default: "" }),
427
+ lazyLoading: g({ title: "Lazy Load", default: !0 })
427
428
  }
428
- }, $ = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/, E = /^(https?:\/\/)?(www\.)?player.vimeo\.com/, P = /^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/, Ae = (e) => {
429
+ }, $ = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/, E = /^(https?:\/\/)?(www\.)?player.vimeo\.com/, P = /^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/, qe = (e) => {
429
430
  if ($.test(e)) {
430
431
  const l = e.match($);
431
432
  return l ? `https://www.youtube.com/embed/${l[4]}` : e;
@@ -442,13 +443,13 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
442
443
  }, De = p.memo(
443
444
  (e) => {
444
445
  const { blockProps: l, inBuilder: t, styles: a, url: o, controls: n } = e, r = x(n, "autoPlay", !1), i = x(n, "controls", !1), c = r || x(n, "muted", !0), d = x(n, "loop", !1);
445
- if (y(o))
446
+ if (k(o))
446
447
  return /* @__PURE__ */ s.jsx(_, { inBuilder: t, className: "h-36" });
447
- let h = Ae(o), f = null;
448
+ let h = qe(o), f = null;
448
449
  if (h) {
449
- if (!y(h)) {
450
- const g = [];
451
- g.push(`autoplay=${r ? 1 : 0}`), g.push(`controls=${n ? 1 : 0}`), g.push(`mute=${c ? 1 : 0}&muted=${c ? 1 : 0}`), g.push(`loop=${d ? 1 : 0}`), h = `${h}?${g.join("&")}`;
450
+ if (!k(h)) {
451
+ const y = [];
452
+ y.push(`autoplay=${r ? 1 : 0}`), y.push(`controls=${n ? 1 : 0}`), y.push(`mute=${c ? 1 : 0}&muted=${c ? 1 : 0}`), y.push(`loop=${d ? 1 : 0}`), h = `${h}?${y.join("&")}`;
452
453
  }
453
454
  f = p.createElement("iframe", {
454
455
  ...l,
@@ -488,10 +489,10 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
488
489
  controls: F({
489
490
  title: "web_blocks.controls",
490
491
  properties: {
491
- autoPlay: k({ title: "web_blocks.autoplay", default: !0 }),
492
- controls: k({ title: "web_blocks.controls", default: !1 }),
493
- loop: k({ title: "web_blocks.loop", default: !1 }),
494
- muted: k({ title: "web_blocks.muted", default: !0 })
492
+ autoPlay: g({ title: "web_blocks.autoplay", default: !0 }),
493
+ controls: g({ title: "web_blocks.controls", default: !1 }),
494
+ loop: g({ title: "web_blocks.loop", default: !1 }),
495
+ muted: g({ title: "web_blocks.muted", default: !0 })
495
496
  }
496
497
  })
497
498
  }
@@ -502,7 +503,7 @@ function Fe(e) {
502
503
  const Ge = (e) => {
503
504
  const { scripts: l, inBuilder: t, blockProps: a } = e;
504
505
  return t ? /* @__PURE__ */ s.jsx("div", { ...a, children: /* @__PURE__ */ s.jsx("div", { className: j("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ s.jsx("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ s.jsx("p", { className: "text-left text-xs text-gray-400", children: "Scripts will be only executed in preview and live mode. Place your script at the bottom of the" }) }) }) }) : /* @__PURE__ */ s.jsx("div", { dangerouslySetInnerHTML: { __html: l } });
505
- }, Oe = {
506
+ }, Ve = {
506
507
  type: "CustomScript",
507
508
  label: "web_blocks.custom_script",
508
509
  category: "core",
@@ -515,10 +516,10 @@ const Ge = (e) => {
515
516
  placeholder: "<script>console.log('Hello, world!');<\/script>"
516
517
  })
517
518
  }
518
- }, Ue = (e) => {
519
+ }, Oe = (e) => {
519
520
  const { blockProps: l, styles: t } = e;
520
521
  return p.createElement("hr", { ...t, ...l });
521
- }, Ve = {
522
+ }, Ue = {
522
523
  type: "Divider",
523
524
  label: "web_blocks.divider",
524
525
  category: "core",
@@ -614,7 +615,7 @@ const Ge = (e) => {
614
615
  hidden: !0,
615
616
  category: "core",
616
617
  group: "typography",
617
- icon: q,
618
+ icon: A,
618
619
  props: {
619
620
  content: L({ title: "web_blocks.content", defaultValue: "" })
620
621
  }
@@ -645,7 +646,7 @@ const Ge = (e) => {
645
646
  category: "core",
646
647
  group: "basic",
647
648
  hidden: !0,
648
- icon: q,
649
+ icon: A,
649
650
  props: {
650
651
  styles: m({ default: "" })
651
652
  }
@@ -784,7 +785,7 @@ const Ge = (e) => {
784
785
  type: "Input",
785
786
  label: "web_blocks.input",
786
787
  category: "core",
787
- icon: A,
788
+ icon: q,
788
789
  group: "form",
789
790
  props: {
790
791
  styles: m({ default: "" }),
@@ -801,14 +802,14 @@ const Ge = (e) => {
801
802
  default: "text"
802
803
  }),
803
804
  value: b({ title: "web_blocks.value", default: "" }),
804
- showLabel: k({ title: "web_blocks.show_label", default: !0 }),
805
+ showLabel: g({ title: "web_blocks.show_label", default: !0 }),
805
806
  inputStyles: m({ default: "w-full p-1" }),
806
807
  label: b({ title: "web_blocks.label", default: "Label" }),
807
808
  placeholder: b({
808
809
  title: "web_blocks.placeholder",
809
810
  default: "Placeholder"
810
811
  }),
811
- required: k({ title: "web_blocks.required", default: !1 })
812
+ required: g({ title: "web_blocks.required", default: !1 })
812
813
  }
813
814
  }, it = (e) => {
814
815
  const { blockProps: l, fieldName: t, label: a, styles: o, inputStyles: n, checked: r, required: i, showLabel: c = !0 } = e, d = B();
@@ -838,8 +839,8 @@ const Ge = (e) => {
838
839
  styles: m({ default: "flex items-center w-max gap-x-2" }),
839
840
  fieldName: b({ title: "web_blocks.field_name", default: "radio" }),
840
841
  label: b({ title: "web_blocks.label", default: "Label" }),
841
- checked: k({ title: "web_blocks.checked", default: !1 }),
842
- required: k({ title: "web_blocks.required", default: !1 })
842
+ checked: g({ title: "web_blocks.checked", default: !1 }),
843
+ required: g({ title: "web_blocks.required", default: !1 })
843
844
  }
844
845
  }, ut = (e) => {
845
846
  const {
@@ -899,16 +900,16 @@ const Ge = (e) => {
899
900
  props: {
900
901
  styles: m({ default: "" }),
901
902
  fieldName: b({ title: "web_blocks.field_name", default: "select" }),
902
- showLabel: k({ title: "web_blocks.show_label", default: !0 }),
903
+ showLabel: g({ title: "web_blocks.show_label", default: !0 }),
903
904
  inputStyles: m({ default: "w-full p-1" }),
904
905
  label: b({ title: "web_blocks.label", default: "Label" }),
905
906
  placeholder: b({
906
907
  title: "web_blocks.placeholder",
907
908
  default: "Placeholder"
908
909
  }),
909
- required: k({ title: "web_blocks.required", default: !1 }),
910
- _multiple: k({ title: "web_blocks.multiple", default: !1 }),
911
- options: O({
910
+ required: g({ title: "web_blocks.required", default: !1 }),
911
+ _multiple: g({ title: "web_blocks.multiple", default: !1 }),
912
+ options: V({
912
913
  title: "web_blocks.options",
913
914
  itemProperties: {
914
915
  label: b({ title: "web_blocks.label", default: "" }),
@@ -937,11 +938,11 @@ const Ge = (e) => {
937
938
  type: "TextArea",
938
939
  label: "web_blocks.textarea",
939
940
  category: "core",
940
- icon: A,
941
+ icon: q,
941
942
  group: "form",
942
943
  props: {
943
944
  fieldName: b({ title: "web_blocks.field_name", default: "textarea" }),
944
- showLabel: k({ title: "web_blocks.show_label", default: !0 }),
945
+ showLabel: g({ title: "web_blocks.show_label", default: !0 }),
945
946
  styles: m({ default: "" }),
946
947
  inputStyles: m({ default: "w-full p-1" }),
947
948
  label: b({ title: "web_blocks.label", default: "Label" }),
@@ -988,11 +989,11 @@ const Ge = (e) => {
988
989
  fieldName: b({ title: "Field Name", default: "checkbox" }),
989
990
  styles: m({ default: "flex items-center gap-x-2" }),
990
991
  label: b({ title: "web_blocks.label", default: "Label" }),
991
- checked: k({ title: "web_blocks.checked", default: !1 }),
992
- required: k({ title: "web_blocks.required", default: !1 })
992
+ checked: g({ title: "web_blocks.checked", default: !1 }),
993
+ required: g({ title: "web_blocks.required", default: !1 })
993
994
  }
994
995
  }, It = () => {
995
- u(ue, be), u(ke, ge), u(pe, me), u(ye, _e), u(we, xe), u(ve, Be), u(Ie, je), u(Le, Ce), u(Se, Me), u(Ne, $e), u(Ee, Pe), u(Te, He), u(ze, qe), u(De, Re), u(fe, he), u(Je, Ke), u(ot, st), u(at, nt), u(rt, ct), u(ft, ht), u(it, dt), u(ut, bt), u(pt, mt), u(tt, lt), u(Qe, et), u(Ge, Oe), u(Ue, Ve), u(We, Xe), u(Ye, Ze);
996
+ u(ue, be), u(ge, ye), u(pe, me), u(ke, _e), u(we, xe), u(ve, Be), u(Ie, je), u(Le, Ce), u(Se, Me), u(Ne, $e), u(Ee, Pe), u(Te, He), u(ze, Ae), u(De, Re), u(fe, he), u(Je, Ke), u(ot, st), u(at, nt), u(rt, ct), u(ft, ht), u(it, dt), u(ut, bt), u(pt, mt), u(tt, lt), u(Qe, et), u(Ge, Ve), u(Oe, Ue), u(We, Xe), u(Ye, Ze);
996
997
  };
997
998
  export {
998
999
  It as loadWebBlocks
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": "1.2.95",
8
+ "version": "1.2.97",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",