@chaibuilder/sdk 4.0.0-beta.2 → 4.0.0-beta.4

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.
Files changed (186) hide show
  1. package/dist/{2SSKDMRQ-C4VFVd-q.cjs → 2SSKDMRQ-CopJgtZb.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-DSnzF_1o.js → 2SSKDMRQ-Difo_1pg.js} +2 -2
  3. package/dist/{AP7HFJJL-Cxwj01Aq.js → AP7HFJJL-BPuPBqj4.js} +1 -1
  4. package/dist/{AP7HFJJL-B7YYCY9q.cjs → AP7HFJJL-DYxDgaOs.cjs} +1 -1
  5. package/dist/{IconPicker-RqVvq6G2.js → IconPicker-B2-oriq2.js} +8 -7
  6. package/dist/IconPicker-C0oycHbs.cjs +1 -0
  7. package/dist/{WDYDFRGG-b3T2SQbz.cjs → WDYDFRGG-DbejaRPK.cjs} +1 -1
  8. package/dist/{WDYDFRGG-C7aSUcjs.js → WDYDFRGG-KK8pkcW1.js} +2 -2
  9. package/dist/{actions-registery-YnFmU21O.cjs → actions-registery-JdxhXhT6.cjs} +1 -1
  10. package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-y_ENc8zj.js} +2 -2
  11. package/dist/actions.cjs +1 -1
  12. package/dist/actions.js +2 -2
  13. package/dist/active-in-another-tab-Cu_ASKtx.cjs +1 -0
  14. package/dist/active-in-another-tab-DkR2HWI4.js +35 -0
  15. package/dist/add-new-language-page-BXuwluuU.cjs +1 -0
  16. package/dist/{add-new-language-page-D7NDABl1.js → add-new-language-page-CBY0RR6q.js} +54 -53
  17. package/dist/{add-new-page-BNfwKjRd.cjs → add-new-page-C_PzKby8.cjs} +1 -1
  18. package/dist/{add-new-page-B4hc0B-g.js → add-new-page-DJLJFLAd.js} +2 -2
  19. package/dist/{ai-panel-content-BnbURb7j.js → ai-panel-content--YM01Aly.js} +12 -11
  20. package/dist/ai-panel-content-rRmJdH7L.cjs +1 -0
  21. package/dist/{ai-panel-default-lang-oVk4TDeb.js → ai-panel-default-lang-BZl0tPYo.js} +40 -40
  22. package/dist/{ai-panel-default-lang-3tCHzab5.cjs → ai-panel-default-lang-D2zhXvKP.cjs} +2 -2
  23. package/dist/{ai-panel-other-lang-DmQ3QMDD.js → ai-panel-other-lang-Bfjk2CYZ.js} +8 -8
  24. package/dist/{ai-panel-other-lang-BBHCCSen.cjs → ai-panel-other-lang-Y4bEKHoG.cjs} +1 -1
  25. package/dist/{ai-prompt-input-DaTyfib-.js → ai-prompt-input-DueQYNf-.js} +68 -67
  26. package/dist/ai-prompt-input-N9PcYCFa.cjs +1 -0
  27. package/dist/{ai-translation-prompt-DJPe2O-n.js → ai-translation-prompt-B36F3d7K.js} +2 -2
  28. package/dist/ai-translation-prompt-IAdWMNZb.cjs +1 -0
  29. package/dist/{apply-binding-6iwlED02.js → apply-binding-BvWfJCSZ.js} +204 -196
  30. package/dist/apply-binding-IsUf6UWJ.cjs +1 -0
  31. package/dist/{code-display-BzBq5xSn.js → code-display-Ck81Id9K.js} +1 -1
  32. package/dist/code-display-DloSPyPr.cjs +1 -0
  33. package/dist/{code-editor-DWWnphW9.js → code-editor-Bb7JumZy.js} +11 -10
  34. package/dist/code-editor-DQB8lAOk.cjs +1 -0
  35. package/dist/{continue-editing-in-this-client-BllU94XG.js → continue-editing-in-this-client-Dm9cCj7K.js} +10 -9
  36. package/dist/continue-editing-in-this-client-DmGFLHXw.cjs +1 -0
  37. package/dist/core-Dr7QYemB.js +56 -0
  38. package/dist/core-Y0lXLwkq.cjs +1 -0
  39. package/dist/core.cjs +1 -1
  40. package/dist/core.d.ts +3 -3
  41. package/dist/core.js +41 -39
  42. package/dist/{css-import-modal-D72a-16X.js → css-import-modal-9P_0uNa4.js} +4 -3
  43. package/dist/css-import-modal-Rh1QAVxo.cjs +13 -0
  44. package/dist/{delete-design-token-D_TLlO3I.cjs → delete-design-token-BG8yHcS5.cjs} +1 -1
  45. package/dist/{delete-design-token-Cd1ZDtqT.js → delete-design-token-COvR4G1S.js} +1 -1
  46. package/dist/{delete-page-DC8pzvWW.js → delete-page-CNucxe4P.js} +11 -10
  47. package/dist/delete-page-DAvEjHwF.cjs +1 -0
  48. package/dist/design-token-usage-CXglXgcJ.cjs +1 -0
  49. package/dist/{design-token-usage-DE4XCDdn.js → design-token-usage-MNYsFlPG.js} +14 -13
  50. package/dist/digital-asset-manager-CB5MRBcW.cjs +1 -0
  51. package/dist/{digital-asset-manager-C_gL_0YY.js → digital-asset-manager-CqCWBO0s.js} +6 -5
  52. package/dist/{duplicate-page-BoVhko2q.js → duplicate-page-BknLfqr0.js} +19 -18
  53. package/dist/duplicate-page-DzZByALW.cjs +1 -0
  54. package/dist/{dynamic-page-selector-CSndg2-y.js → dynamic-page-selector-DoW7OyUB.js} +15 -14
  55. package/dist/dynamic-page-selector-WA007Sni.cjs +1 -0
  56. package/dist/get-chai-builder-tailwind-config-BFePCEIS.cjs +1 -0
  57. package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-BXf_xLHk.js} +5 -5
  58. package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-BApShjRz.cjs} +1 -1
  59. package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-DDVRJQ6Z.js} +1 -1
  60. package/dist/{image-editor-oypq8asR.js → image-editor-CQnNtak2.js} +1 -1
  61. package/dist/{image-editor-DTspjj_c.cjs → image-editor-CqwaVxO2.cjs} +1 -1
  62. package/dist/index-C0-pgg_p.cjs +5 -0
  63. package/dist/index-C99FhuF1.cjs +160 -0
  64. package/dist/{index-BDnwJqMw.js → index-Dno42B0a.js} +716 -714
  65. package/dist/{index-S8ibZk9Q.js → index-rAcNbjk_.js} +3744 -3920
  66. package/dist/{json-diff-viewer-XX1pgabt.cjs → json-diff-viewer-CLuUHiPU.cjs} +3 -3
  67. package/dist/{json-diff-viewer-B5dr-Y_L.js → json-diff-viewer-CMvGUvJ2.js} +5 -4
  68. package/dist/{lang-panel-Cn83SRzd.js → lang-panel-CnwTb05j.js} +15 -14
  69. package/dist/lang-panel-fDCYm5Jm.cjs +1 -0
  70. package/dist/{manage-design-tokens-lP4HLS0P.js → manage-design-tokens-BsSZE9Vs.js} +12 -11
  71. package/dist/manage-design-tokens-BvH5KTJX.cjs +1 -0
  72. package/dist/mark-as-template-CpWEBJGd.cjs +1 -0
  73. package/dist/{mark-as-template-jncsjfHm.js → mark-as-template-DBLshWb5.js} +17 -16
  74. package/dist/{nested-path-selector-content-B-8LqhXI.js → nested-path-selector-content-6OBJ8LG8.js} +24 -23
  75. package/dist/nested-path-selector-content-C2sD9dkq.cjs +1 -0
  76. package/dist/no-language-page-content-BvPDdccK.cjs +1 -0
  77. package/dist/{no-language-page-content-D_zd9Rb0.js → no-language-page-content-CzENgtnu.js} +10 -9
  78. package/dist/{no-language-page-dialog-C5Ps6YYL.js → no-language-page-dialog-CbYI2cVg.js} +2 -2
  79. package/dist/{no-language-page-dialog-fXmbQO7L.cjs → no-language-page-dialog-CgW4yJBC.cjs} +1 -1
  80. package/dist/{page-creator-wCMtlE6Z.js → page-creator-Cc83uQqw.js} +113 -112
  81. package/dist/page-creator-g8GqgcKH.cjs +1 -0
  82. package/dist/{page-lock-BPCxfv9J.js → page-lock-BJUkyxdh.js} +2 -2
  83. package/dist/{page-lock-DweiYy1w.cjs → page-lock-CT7SmQqp.cjs} +1 -1
  84. package/dist/page-locked-dialog-Co5b9XIZ.cjs +1 -0
  85. package/dist/{page-locked-dialog-ByGl18_m.js → page-locked-dialog-DsEbWRed.js} +18 -15
  86. package/dist/{page-manager-new-BWFE-S-O.js → page-manager-new-5rFP5DyQ.js} +30 -29
  87. package/dist/page-manager-new-BOkJImo2.cjs +1 -0
  88. package/dist/page-manager-search-and-filter-Bfm0j1gg.cjs +1 -0
  89. package/dist/{page-manager-search-and-filter-kNJFWJ86.js → page-manager-search-and-filter-zq-LfhQ1.js} +13 -12
  90. package/dist/{page-revisions-content-Ulr8slUN.js → page-revisions-content-D38G2tJM.js} +34 -31
  91. package/dist/page-revisions-content-ag-MHBGr.cjs +1 -0
  92. package/dist/pages.cjs +1 -1
  93. package/dist/pages.d.ts +22 -23
  94. package/dist/pages.js +12 -12
  95. package/dist/{plugin-C6rgJDNQ.cjs → plugin-BGlQf0iy.cjs} +1 -1
  96. package/dist/{plugin-3ZKK6RXm.js → plugin-C-ht41UZ.js} +1 -1
  97. package/dist/publish-pages-content-BiX-GMLw.cjs +1 -0
  98. package/dist/{publish-pages-content-BTPzt_m4.js → publish-pages-content-CS7f41Ac.js} +66 -65
  99. package/dist/register-chai-top-bar-BqwKw4uy.cjs +1 -0
  100. package/dist/register-chai-top-bar-ESJHs5s-.js +237 -0
  101. package/dist/render.cjs +2 -2
  102. package/dist/render.d.ts +2 -2
  103. package/dist/render.js +87 -80
  104. package/dist/rte-widget-modal-BKNx2wln.cjs +1 -0
  105. package/dist/{rte-widget-modal-Rk_NW3KU.js → rte-widget-modal-D6Zik0Ta.js} +15 -14
  106. package/dist/runtime.cjs +1 -1
  107. package/dist/runtime.d.ts +168 -4
  108. package/dist/runtime.js +68 -38
  109. package/dist/{save-to-lib-BK3uTFss.js → save-to-lib-WwOzbgiF.js} +39 -38
  110. package/dist/save-to-lib-ffjCZYJ5.cjs +1 -0
  111. package/dist/sdk.css +1 -1
  112. package/dist/{selected-block-display-CU3TwIMA.js → selected-block-display-B1SG_UXw.js} +37 -36
  113. package/dist/selected-block-display-BOgnQRLF.cjs +16 -0
  114. package/dist/{seo-panel-jbzxFioc.js → seo-panel-BkOgRoWd.js} +12 -11
  115. package/dist/seo-panel-FjS1UF_y.cjs +2 -0
  116. package/dist/{shared-json-ld-BL_dv3_q.js → shared-json-ld-uka9TOgA.js} +68 -67
  117. package/dist/shared-json-ld-yJkXjENy.cjs +1 -0
  118. package/dist/slug-input-Cyd6NR6J.cjs +1 -0
  119. package/dist/{slug-input-1qwKkXhA.js → slug-input-DHLmUNrH.js} +9 -8
  120. package/dist/supabase-actions.cjs +1 -1
  121. package/dist/supabase-actions.d.ts +1 -1
  122. package/dist/supabase-actions.js +1 -1
  123. package/dist/{take-over-request-DKvKi3mM.js → take-over-request-Ca0X-qyf.js} +17 -16
  124. package/dist/take-over-request-CmpJVe9T.cjs +1 -0
  125. package/dist/{theme-panel-footer-DbMDLYGI.js → theme-panel-footer-BUXIu252.js} +11 -10
  126. package/dist/theme-panel-footer-CKO9YYwZ.cjs +1 -0
  127. package/dist/{translation-warning-modal-9wTwIy_9.js → translation-warning-modal-DrpFeI83.js} +9 -8
  128. package/dist/translation-warning-modal-pSZVKcNW.cjs +1 -0
  129. package/dist/{unmark-as-template-Dulvf7Zw.js → unmark-as-template-BMqgelv-.js} +11 -10
  130. package/dist/unmark-as-template-DF1Ms4VN.cjs +1 -0
  131. package/dist/unpublish-page-BJ0Bsvt2.js +28 -0
  132. package/dist/unpublish-page-Bsq2yEqQ.cjs +1 -0
  133. package/dist/utils.cjs +1 -1
  134. package/dist/utils.d.ts +4 -1
  135. package/dist/utils.js +2 -2
  136. package/dist/web-blocks.cjs +1 -1
  137. package/dist/web-blocks.js +5 -5
  138. package/dist/{web-preview-DXE4Jnf5.js → web-preview-D6h1L2nV.js} +2 -2
  139. package/dist/web-preview-kres0aG7.cjs +1 -0
  140. package/package.json +4 -2
  141. package/dist/IconPicker-C9-ieDWm.cjs +0 -1
  142. package/dist/active-in-another-tab-Clng6zpY.cjs +0 -1
  143. package/dist/active-in-another-tab-wb8qolB8.js +0 -34
  144. package/dist/add-new-language-page-C4BuMTaN.cjs +0 -1
  145. package/dist/ai-panel-content-DPy2jgKw.cjs +0 -1
  146. package/dist/ai-prompt-input-b5ty81RB.cjs +0 -1
  147. package/dist/ai-translation-prompt-c0Q3zkT2.cjs +0 -1
  148. package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
  149. package/dist/code-display-Q3_sK_Ta.cjs +0 -1
  150. package/dist/code-editor-BQZi6-FB.cjs +0 -1
  151. package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +0 -1
  152. package/dist/core-BoRDjj4h.cjs +0 -1
  153. package/dist/core-yvI6kCyw.js +0 -56
  154. package/dist/css-import-modal-BSMGKA2T.cjs +0 -13
  155. package/dist/delete-page-ByQwBupJ.cjs +0 -1
  156. package/dist/design-token-usage-BqZeR1sT.cjs +0 -1
  157. package/dist/digital-asset-manager-BYLKFEYi.cjs +0 -1
  158. package/dist/duplicate-page-vdvwLQLo.cjs +0 -1
  159. package/dist/dynamic-page-selector-DdnbCuQZ.cjs +0 -1
  160. package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
  161. package/dist/index-CbwxUFy_.cjs +0 -5
  162. package/dist/index-CnSjWE1P.cjs +0 -160
  163. package/dist/lang-panel-BPxex-M2.cjs +0 -1
  164. package/dist/manage-design-tokens-ConiyuPr.cjs +0 -1
  165. package/dist/mark-as-template-DYRxre1f.cjs +0 -1
  166. package/dist/nested-path-selector-content-BYtLi7mC.cjs +0 -1
  167. package/dist/no-language-page-content-DAbLq0gX.cjs +0 -1
  168. package/dist/page-creator-VWIB2VAs.cjs +0 -1
  169. package/dist/page-locked-dialog-BlbgvaG2.cjs +0 -1
  170. package/dist/page-manager-new-D0lGfNnS.cjs +0 -1
  171. package/dist/page-manager-search-and-filter-DpGMoOII.cjs +0 -1
  172. package/dist/page-revisions-content-DYxXZqmh.cjs +0 -1
  173. package/dist/publish-pages-content-D6g8GAsd.cjs +0 -1
  174. package/dist/rte-widget-modal-DrMzWWjw.cjs +0 -1
  175. package/dist/save-to-lib-DHHUO12i.cjs +0 -1
  176. package/dist/selected-block-display-DSFhddPj.cjs +0 -16
  177. package/dist/seo-panel-Dl0IDV09.cjs +0 -2
  178. package/dist/shared-json-ld-DPNkqDC1.cjs +0 -1
  179. package/dist/slug-input-YVLjtTI3.cjs +0 -1
  180. package/dist/take-over-request-DvMIg_cZ.cjs +0 -1
  181. package/dist/theme-panel-footer-BMOaPLWc.cjs +0 -1
  182. package/dist/translation-warning-modal-DjTwz75c.cjs +0 -1
  183. package/dist/unmark-as-template-CdqIJJER.cjs +0 -1
  184. package/dist/unpublish-page-BwSVBf0_.cjs +0 -1
  185. package/dist/unpublish-page-Degu5Cy9.js +0 -27
  186. package/dist/web-preview-YzKxyXft.cjs +0 -1
package/dist/render.js CHANGED
@@ -1,16 +1,16 @@
1
- import { a as Le, b as De, c as Ke } from "./plugin-3ZKK6RXm.js";
2
- import { a as O, b as N, c as E, d as J, e as C, f as j } from "./apply-binding-6iwlED02.js";
3
- import { h as Ae, i as Fe, g as Me } from "./apply-binding-6iwlED02.js";
1
+ import { a as Le, b as De, c as Ke } from "./plugin-C-ht41UZ.js";
2
+ import { a as O, b as N, c as E, d as J, e as C, f as j } from "./apply-binding-BvWfJCSZ.js";
3
+ import { h as Ae, i as Fe, g as Me } from "./apply-binding-BvWfJCSZ.js";
4
4
  import { jsx as m } from "react/jsx-runtime";
5
- import { has as P, isFunction as w, omit as q, get as d, isNull as H, isArray as B, uniqBy as W, filter as $, isEmpty as h, map as U, find as R, cloneDeep as Q } from "lodash-es";
6
- import { Suspense as A, createElement as u } from "react";
7
- import { e as S } from "./core-yvI6kCyw.js";
5
+ import { has as P, isFunction as w, omit as q, get as d, isNull as H, isArray as B, uniqBy as W, filter as $, isEmpty as h, map as U, find as R, cloneDeep as z } from "lodash-es";
6
+ import { Suspense as A, createElement as g } from "react";
7
+ import { e as S } from "./core-Dr7QYemB.js";
8
8
  import { createTailwindcss as X } from "@mhsdesign/jit-browser-tailwindcss";
9
9
  import Y from "@tailwindcss/aspect-ratio";
10
10
  import Z from "@tailwindcss/container-queries";
11
11
  import ee from "@tailwindcss/forms";
12
12
  import te from "@tailwindcss/typography";
13
- import { c as ae, g as re } from "./get-chai-builder-theme-BYtp20KD.js";
13
+ import { c as ae, g as re } from "./get-chai-builder-theme-DDVRJQ6Z.js";
14
14
  async function ne(e) {
15
15
  const t = {
16
16
  pageProps: e.pageProps,
@@ -24,34 +24,35 @@ async function ne(e) {
24
24
  });
25
25
  }
26
26
  const ie = () => /* @__PURE__ */ m("div", {}), oe = (e) => {
27
- const { block: t, lang: r, fallbackLang: i, children: n, externalData: s, blocks: o, draft: a, pageProps: l, dataProviderMetadataCallback: y } = e, c = S(t._type), p = d(c, "component", null), _ = d(e.repeaterData, "index", -1), k = d(e.repeaterData, "dataKey", ""), f = O(
28
- N(t, r === i ? "" : r, c),
29
- s,
27
+ const { block: t, lang: r, fallbackLang: i, children: n, externalData: o, blocks: s, draft: a, pageProps: l, dataProviderMetadataCallback: y } = e, c = S(t._type), u = d(c, "component", null), _ = d(e.repeaterData, "index", -1), k = d(e.repeaterData, "dataKey", ""), f = O(
28
+ N(t, r === i ? "" : r ?? "", c),
29
+ o ?? {},
30
30
  { index: _, key: k }
31
- ), g = E(t, !1), x = V(o, t._id, J(t._type)), L = P(c, "dataProvider") && w(c.dataProvider), b = {
31
+ ), p = E(t, !1), x = V(s, t._id, J(t._type)), L = P(c, "dataProvider") && w(c.dataProvider), b = {
32
32
  ...f,
33
- ...g,
33
+ ...p,
34
34
  ...x
35
35
  }, v = {
36
36
  blockProps: {},
37
37
  inBuilder: !1,
38
- lang: r || i,
39
- pageData: s,
38
+ lang: r || i || "en",
39
+ draft: a ?? !1,
40
+ pageData: o ?? {},
40
41
  ...b
41
42
  }, I = d(b, "_show", !0);
42
- if (H(p) || !I) return null;
43
+ if (H(u) || !I) return null;
43
44
  if (L) {
44
45
  const D = d(c, "suspenseFallback", ie);
45
- return /* @__PURE__ */ m(A, { fallback: u(D), children: /* @__PURE__ */ m(
46
+ return /* @__PURE__ */ m(A, { fallback: g(D), children: /* @__PURE__ */ m(
46
47
  ne,
47
48
  {
48
- lang: r,
49
+ lang: r ?? "",
49
50
  pageProps: l,
50
51
  block: b,
51
52
  dataProvider: c.dataProvider,
52
53
  ...y ? { dataProviderMetadataCallback: y } : {},
53
- draft: a,
54
- children: (K) => u(p, {
54
+ draft: a ?? !1,
55
+ children: (K) => g(u, {
55
56
  ...v,
56
57
  ...K,
57
58
  children: n({
@@ -67,7 +68,7 @@ const ie = () => /* @__PURE__ */ m("div", {}), oe = (e) => {
67
68
  }
68
69
  ) });
69
70
  }
70
- return /* @__PURE__ */ m(A, { children: u(p, {
71
+ return /* @__PURE__ */ m(A, { children: g(u, {
71
72
  ...v,
72
73
  children: n({
73
74
  _id: t._id,
@@ -81,20 +82,20 @@ const ie = () => /* @__PURE__ */ m("div", {}), oe = (e) => {
81
82
  }) });
82
83
  }, F = (e) => {
83
84
  const { blocks: t, parent: r, repeaterData: i, type: n } = e;
84
- let s = W(
85
+ let o = W(
85
86
  $(t, (a) => P(a, "_id") && (h(r) ? !a._parent : a._parent === r)),
86
87
  "_id"
87
88
  );
88
- const o = (a) => $(t, (l) => l._parent === a).length > 0;
89
- return (n === "Heading" || n === "Paragraph" || n === "Link" || n === "Span") && (s = j(s)), U(s, (a) => a ? /* @__PURE__ */ u(oe, { ...e, key: a._id, block: a }, ({ _id: l, _type: y, repeaterItems: c, $repeaterItemsKey: p }) => y === "Repeater" ? B(c) && c.map((_, k) => /* @__PURE__ */ u(
89
+ const s = (a) => $(t, (l) => l._parent === a).length > 0;
90
+ return (n === "Heading" || n === "Paragraph" || n === "Link" || n === "Span") && (o = j(o)), U(o, (a) => a ? /* @__PURE__ */ g(oe, { ...e, key: a._id, block: a }, ({ _id: l, _type: y, repeaterItems: c, $repeaterItemsKey: u }) => y === "Repeater" ? B(c) && c.map((_, k) => /* @__PURE__ */ g(
90
91
  F,
91
92
  {
92
93
  ...e,
93
94
  parent: a._id,
94
95
  key: `${d(a, "_parent", "root")}-${a._id}-${k}`,
95
- repeaterData: { index: k, dataKey: p }
96
+ repeaterData: { index: k, dataKey: u }
96
97
  }
97
- )) : o(l) ? /* @__PURE__ */ u(
98
+ )) : s(l) ? /* @__PURE__ */ g(
98
99
  F,
99
100
  {
100
101
  ...e,
@@ -104,14 +105,17 @@ const ie = () => /* @__PURE__ */ m("div", {}), oe = (e) => {
104
105
  type: a._type
105
106
  }
106
107
  ) : null) : null);
107
- }, V = (e, t, r) => h(r) ? {} : Object.entries(r).reduce((i, [n, s]) => {
108
- const o = [];
109
- let a = R(e, { _id: t });
110
- for (; a; )
111
- o.push(a), a = R(e, { _id: a._parent });
112
- const l = R(o, { _type: s.block });
113
- return l && (i[n] = d(l, d(s, "prop"), null)), i;
114
- }, {});
108
+ }, V = (e, t, r) => h(r) ? {} : Object.entries(r).reduce(
109
+ (i, [n, o]) => {
110
+ const s = [];
111
+ let a = R(e, { _id: t });
112
+ for (; a; )
113
+ s.push(a), a = R(e, { _id: a._parent });
114
+ const l = R(s, { _type: o.block });
115
+ return l && (i[n] = d(l, d(o, "prop"), null)), i;
116
+ },
117
+ {}
118
+ );
115
119
  function we(e) {
116
120
  if (h(e.lang) && !h(e.fallbackLang))
117
121
  throw new Error("lang prop is required when fallbackLang is provided");
@@ -132,85 +136,84 @@ const le = () => /* @__PURE__ */ m("div", {}), de = async (e) => {
132
136
  lang: r,
133
137
  fallbackLang: i,
134
138
  children: n,
135
- externalData: s,
136
- blocks: o,
139
+ externalData: o,
140
+ blocks: s,
137
141
  draft: a,
138
142
  pageProps: l,
139
143
  dataProviderMetadataCallback: y,
140
144
  dataProviders: c
141
- } = e, p = S(t._type), _ = d(p, "component", null), k = d(e.repeaterData, "index", -1), M = d(e.repeaterData, "dataKey", ""), g = O(
142
- N(t, r === i ? "" : r, p),
143
- s,
145
+ } = e, u = S(t._type), _ = d(u, "component", null), k = d(e.repeaterData, "index", -1), M = d(e.repeaterData, "dataKey", ""), p = O(
146
+ N(t, r === i ? "" : r ?? "en", u),
147
+ o ?? {},
144
148
  { index: k, key: M }
145
- ), x = E(t, !1), L = V(o, t._id, J(t._type)), b = P(p, "dataProvider") && w(p.dataProvider), v = {
146
- ...g,
149
+ ), x = E(t, !1), L = V(s, t._id, J(t._type)), b = P(u, "dataProvider") && w(u.dataProvider), v = {
150
+ ...p,
147
151
  ...x,
148
152
  ...L
149
153
  }, I = {
150
154
  blockProps: {},
151
155
  inBuilder: !1,
152
- lang: r || i,
153
- pageData: s,
156
+ lang: r || i || "en",
157
+ draft: a ?? !1,
158
+ pageData: o ?? {},
154
159
  ...v
155
160
  }, D = d(v, "_show", !0);
156
161
  if (H(_) || !D) return null;
157
162
  if (b) {
158
- const K = d(c, t._id, Promise.resolve({})), G = d(p, "suspenseFallback", le);
159
- return /* @__PURE__ */ m(A, { fallback: u(G), children: /* @__PURE__ */ m(
163
+ const K = d(c, t._id, Promise.resolve({})), G = d(u, "suspenseFallback", le);
164
+ return /* @__PURE__ */ m(A, { fallback: g(G), children: /* @__PURE__ */ m(
160
165
  se,
161
166
  {
162
- lang: r,
167
+ lang: r ?? "",
163
168
  pageProps: l,
164
169
  block: v,
165
170
  dataProvider: K,
166
171
  ...y ? { dataProviderMetadataCallback: y } : {},
167
- draft: a,
168
- children: (z) => u(_, {
172
+ draft: a ?? !1,
173
+ children: (Q) => g(_, {
169
174
  ...I,
170
- draft: a,
171
- ...z,
175
+ ...Q,
172
176
  children: n({
173
177
  _id: t._id,
174
178
  _type: t._type,
175
- ...B(g.repeaterItems) ? {
176
- repeaterItems: C(g.repeaterItems, t),
177
- $repeaterItemsKey: g.$repeaterItemsKey,
178
- repeaterTotalItems: g.repeaterTotalItems ?? -1
179
+ ...B(p.repeaterItems) ? {
180
+ repeaterItems: C(p.repeaterItems, t),
181
+ $repeaterItemsKey: p.$repeaterItemsKey,
182
+ repeaterTotalItems: p.repeaterTotalItems ?? -1
179
183
  } : {}
180
184
  })
181
185
  })
182
186
  }
183
187
  ) });
184
188
  }
185
- return u(_, {
189
+ return g(_, {
186
190
  ...I,
187
- draft: a,
188
191
  children: n({
189
192
  _id: t._id,
190
193
  _type: t._type,
191
- ...B(g.repeaterItems) ? {
192
- repeaterItems: C(g.repeaterItems, t),
193
- $repeaterItemsKey: g.$repeaterItemsKey,
194
- repeaterTotalItems: g.repeaterTotalItems ?? -1
194
+ ...B(p.repeaterItems) ? {
195
+ repeaterItems: C(p.repeaterItems, t),
196
+ $repeaterItemsKey: p.$repeaterItemsKey,
197
+ repeaterTotalItems: p.repeaterTotalItems ?? -1
195
198
  } : {}
196
199
  })
197
200
  });
198
201
  }, T = async (e) => {
199
202
  const { blocks: t, parent: r, repeaterData: i, type: n } = e;
200
- let s = W(
203
+ let o = W(
201
204
  $(t, (a) => P(a, "_id") && (h(r) ? !a._parent : a._parent === r)),
202
205
  "_id"
203
206
  );
204
- const o = (a) => $(t, (l) => l._parent === a).length > 0;
205
- return o && (n === "Heading" || n === "Paragraph" || n === "Link") && (s = j(s)), U(s, (a) => a ? /* @__PURE__ */ u(de, { dataProviders: e.dataProviders, ...e, key: a._id, block: a }, ({ _id: l, _type: y, repeaterItems: c, $repeaterItemsKey: p }) => y === "Repeater" ? B(c) && c.map((_, k) => /* @__PURE__ */ u(
207
+ const s = (a) => $(t, (l) => l._parent === a).length > 0;
208
+ return (n === "Heading" || n === "Paragraph" || n === "Link") && (o = j(o)), U(o, (a) => a ? /* @__PURE__ */ g(de, { ...e, dataProviders: e.dataProviders, key: a._id, block: a }, ({ _id: l, _type: y, repeaterItems: c, $repeaterItemsKey: u }) => y === "Repeater" ? B(c) && c.map((_, k) => /* @__PURE__ */ g(
206
209
  T,
207
210
  {
208
211
  ...e,
209
212
  parent: a._id,
210
213
  key: `${d(a, "_parent", "root")}-${a._id}-${k}`,
211
- repeaterData: { index: k, dataKey: p }
214
+ repeaterData: { index: k, dataKey: u }
212
215
  }
213
- )) : o(l) ? /* @__PURE__ */ u(
216
+ )) : s(l) ? /* @__PURE__ */ g(
214
217
  T,
215
218
  {
216
219
  ...e,
@@ -229,19 +232,22 @@ async function Ie(e) {
229
232
  const t = e.lang ?? "en", r = e.fallbackLang ?? t;
230
233
  if (e.dataProviders)
231
234
  return /* @__PURE__ */ m(T, { ...e, lang: t, fallbackLang: r, dataProviders: e.dataProviders });
232
- const n = e.blocks.filter((s) => {
233
- const o = S(s._type);
234
- return !!(P(o, "dataProvider") && w(o.dataProvider));
235
+ const n = e.blocks.filter((o) => {
236
+ const s = S(o._type);
237
+ return !!(P(s, "dataProvider") && w(s.dataProvider));
235
238
  }).reduce(
236
- (s, o) => {
237
- const a = S(o._type), l = {
239
+ (o, s) => {
240
+ const a = S(s._type);
241
+ if (!a || !a.dataProvider)
242
+ return o;
243
+ const l = {
238
244
  pageProps: e.pageProps,
239
- block: o,
245
+ block: s,
240
246
  lang: e.lang,
241
247
  draft: e.draft,
242
248
  inBuilder: !1
243
249
  };
244
- return s[o._id] = a.dataProvider(l), s;
250
+ return o[s._id] = a.dataProvider(l), o;
245
251
  },
246
252
  {}
247
253
  );
@@ -250,12 +256,12 @@ async function Ie(e) {
250
256
  function Ce(e, t) {
251
257
  const r = e.filter((i) => i._type === "GlobalBlock" || i._type === "PartialBlock");
252
258
  for (let i = 0; i < r.length; i++) {
253
- const n = r[i], s = d(n, "partialBlockId", d(n, "globalBlock", ""));
254
- if (s === "") continue;
255
- let o = Q(d(t, s, []));
256
- n._parent && (o == null ? void 0 : o.length) > 0 && (o = o.map((l) => (h(l._parent) && (l._parent = n._parent), l)));
259
+ const n = r[i], o = d(n, "partialBlockId", d(n, "globalBlock", ""));
260
+ if (o === "") continue;
261
+ let s = z(d(t, o, []));
262
+ n._parent && (s == null ? void 0 : s.length) > 0 && (s = s.map((l) => (h(l._parent) && (l._parent = n._parent), l)));
257
263
  const a = e.indexOf(n);
258
- e.splice(a, 1, ...o);
264
+ e.splice(a, 1, ...s);
259
265
  }
260
266
  return e;
261
267
  }
@@ -274,12 +280,13 @@ function ce(e) {
274
280
  return n !== -1 ? i.substring(n + 6) : i;
275
281
  });
276
282
  }
277
- async function pe(e, t = [], r = !1) {
283
+ async function ue(e, t = [], r = !1) {
278
284
  return await X({
279
285
  tailwindConfig: {
280
286
  darkMode: "class",
281
287
  safelist: t,
282
288
  theme: {
289
+ // @ts-ignore
283
290
  extend: {
284
291
  ...re(),
285
292
  keyframes: {
@@ -316,10 +323,10 @@ async function pe(e, t = [], r = !1) {
316
323
  e
317
324
  );
318
325
  }
319
- const ue = (e, t) => {
326
+ const ge = (e, t) => {
320
327
  const r = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, n) => `#styles:${n.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
321
- return pe([r], [], t);
322
- }, Se = async (e, t = !1) => await ue(e, t);
328
+ return ue([r], [], t);
329
+ }, Se = async (e, t = !1) => await ge(e, t);
323
330
  export {
324
331
  Ie as AsyncRenderChaiBlocks,
325
332
  we as RenderChaiBlocks,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./register-chai-top-bar-BqwKw4uy.cjs"),s=require("./index-C99FhuF1.cjs"),S=({isOpen:m,onClose:r,editor:t,rteElement:f})=>{const a=s.usePageExternalData(),u=o=>{if(!t)return;const i=`{{${o}}}`;t.commands.focus();const{from:j,to:g}=t.state.selection;if(j!==g)t.chain().deleteSelection().insertContent(i).run();else{const{state:c}=t,n=c.selection.from,x=c.doc.textBetween(Math.max(0,n-1),n),l=c.doc.textBetween(n,Math.min(n+1,c.doc.content.size));let d="";n>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";l&&l!==" "&&!/[.,!?;:]/.test(l)&&(h=" "),t.chain().insertContent(d+i+h).run()}};return e.jsx(s.Dialog,{open:m,onOpenChange:o=>!o&&r(),children:e.jsxs(s.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(s.DialogHeader,{children:e.jsxs(s.DialogTitle,{className:"flex items-center justify-between pr-8",children:[e.jsx("span",{children:"Rich Text Editor"}),a&&Object.keys(a).length>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 text-sm text-muted-foreground",children:"Add field:"}),e.jsx("div",{className:"rte-path-selector",children:e.jsx(s.NestedPathSelector,{data:a,onSelect:u})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(p.Button,{onClick:r,children:"Done"})})]})})};exports.default=S;
@@ -1,38 +1,39 @@
1
1
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import { g as D, D as N, d as S, e as j, f as v, N as w, B } from "./index-S8ibZk9Q.js";
3
- const P = ({
2
+ import { B as D } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { g as N, D as S, d as j, e as v, f as w, N as B } from "./index-rAcNbjk_.js";
4
+ const M = ({
4
5
  isOpen: f,
5
- onClose: i,
6
+ onClose: r,
6
7
  editor: t,
7
8
  rteElement: x
8
9
  }) => {
9
- const a = D(), u = (c) => {
10
+ const a = N(), u = (c) => {
10
11
  if (!t) return;
11
- const r = `{{${c}}}`;
12
+ const i = `{{${c}}}`;
12
13
  t.commands.focus();
13
14
  const { from: p, to: g } = t.state.selection;
14
15
  if (p !== g)
15
- t.chain().deleteSelection().insertContent(r).run();
16
+ t.chain().deleteSelection().insertContent(i).run();
16
17
  else {
17
18
  const { state: s } = t, n = s.selection.from, d = s.doc.textBetween(Math.max(0, n - 1), n), o = s.doc.textBetween(n, Math.min(n + 1, s.doc.content.size));
18
- let h = "";
19
- n > 0 && d !== " " && !/[.,!?;:]/.test(d) && (h = " ");
20
19
  let m = "";
21
- o && o !== " " && !/[.,!?;:]/.test(o) && (m = " "), t.chain().insertContent(h + r + m).run();
20
+ n > 0 && d !== " " && !/[.,!?;:]/.test(d) && (m = " ");
21
+ let h = "";
22
+ o && o !== " " && !/[.,!?;:]/.test(o) && (h = " "), t.chain().insertContent(m + i + h).run();
22
23
  }
23
24
  };
24
- return /* @__PURE__ */ e(N, { open: f, onOpenChange: (c) => !c && i(), children: /* @__PURE__ */ l(S, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
25
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ l(v, { className: "flex items-center justify-between pr-8", children: [
25
+ return /* @__PURE__ */ e(S, { open: f, onOpenChange: (c) => !c && r(), children: /* @__PURE__ */ l(j, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
26
+ /* @__PURE__ */ e(v, { children: /* @__PURE__ */ l(w, { className: "flex items-center justify-between pr-8", children: [
26
27
  /* @__PURE__ */ e("span", { children: "Rich Text Editor" }),
27
28
  a && Object.keys(a).length > 0 && /* @__PURE__ */ l("div", { className: "flex items-center", children: [
28
29
  /* @__PURE__ */ e("span", { className: "mr-2 text-sm text-muted-foreground", children: "Add field:" }),
29
- /* @__PURE__ */ e("div", { className: "rte-path-selector", children: /* @__PURE__ */ e(w, { data: a, onSelect: u }) })
30
+ /* @__PURE__ */ e("div", { className: "rte-path-selector", children: /* @__PURE__ */ e(B, { data: a, onSelect: u }) })
30
31
  ] })
31
32
  ] }) }),
32
33
  x,
33
- /* @__PURE__ */ e("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ e(B, { onClick: i, children: "Done" }) })
34
+ /* @__PURE__ */ e("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ e(D, { onClick: r, children: "Done" }) })
34
35
  ] }) });
35
36
  };
36
37
  export {
37
- P as default
38
+ M as default
38
39
  };
package/dist/runtime.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-B-rSiAp_.cjs"),t=require("./register-partial-type-ig9fUWIJ.cjs"),i=require("./fonts-B-Xt29pe.cjs"),e=require("./core-BoRDjj4h.cjs"),o=e.setChaiServerBlockDataProvider;exports.StylesProp=r.StylesProp;exports.builderProp=r.builderProp;exports.defaultChaiStyles=r.defaultChaiStyles;exports.registerChaiBlockSchema=r.registerChaiBlockSchema;exports.runtimeProp=r.runtimeProp;exports.stylesProp=r.stylesProp;Object.defineProperty(exports,"CHAI_GLOBAL_DATA_PROVIDER",{enumerable:!0,get:()=>t.CHAI_GLOBAL_DATA_PROVIDER});exports.COLLECTIONS=t.COLLECTIONS;exports.PAGE_TYPES=t.PAGE_TYPES;exports.getChaiCollection=t.getChaiCollection;exports.getChaiCollections=t.getChaiCollections;exports.getChaiGlobalData=t.getChaiGlobalData;exports.getChaiPageType=t.getChaiPageType;exports.getChaiPageTypes=t.getChaiPageTypes;exports.registerChaiCollection=t.registerChaiCollection;exports.registerChaiGlobalDataProvider=t.registerChaiGlobalDataProvider;exports.registerChaiPageType=t.registerChaiPageType;exports.registerChaiPartialType=t.registerChaiPartialType;exports.getAllRegisteredFonts=i.getAllRegisteredFonts;exports.getRegisteredFont=i.getRegisteredFont;exports.registerChaiFont=i.registerChaiFont;exports.useRegisteredFonts=i.useRegisteredFonts;exports.closestBlockProp=e.closestBlockProp;exports.getAIBlockProps=e.getAIBlockProps;exports.getBlockFormSchemas=e.getBlockFormSchemas;exports.getDefaultBlockProps=e.getDefaultBlockProps;exports.getI18nBlockProps=e.getI18nBlockProps;exports.getRegisteredChaiBlock=e.getRegisteredChaiBlock;exports.registerChaiBlock=e.registerChaiBlock;exports.registerChaiServerBlock=e.registerChaiServerBlock;exports.setChaiBlockComponent=e.setChaiBlockComponent;exports.setChaiServerBlockDataProvider=e.setChaiServerBlockDataProvider;exports.syncBlocksWithDefaults=e.syncBlocksWithDefaults;exports.useRegisteredChaiBlock=e.useRegisteredChaiBlock;exports.useRegisteredChaiBlocks=e.useRegisteredChaiBlocks;exports.setChaiBlockDataProvider=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-B-rSiAp_.cjs"),e=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./register-partial-type-ig9fUWIJ.cjs"),i=require("./fonts-B-Xt29pe.cjs"),r=require("./core-Y0lXLwkq.cjs"),o=r.setChaiServerBlockDataProvider;exports.StylesProp=a.StylesProp;exports.builderProp=a.builderProp;exports.defaultChaiStyles=a.defaultChaiStyles;exports.registerChaiBlockSchema=a.registerChaiBlockSchema;exports.runtimeProp=a.runtimeProp;exports.stylesProp=a.stylesProp;exports.ADD_BLOCK_TABS=e.ADD_BLOCK_TABS;exports.CHAI_BUILDER_PANELS=e.CHAI_BUILDER_PANELS;exports.IfChaiFeatureFlag=e.IfChaiFeatureFlag;exports.RJSF_EXTENSIONS=e.RJSF_EXTENSIONS;exports.getChaiLibrary=e.getChaiLibrary;exports.getPreImportHTML=e.getPreImportHTML;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiFeatureFlag=e.registerChaiFeatureFlag;exports.registerChaiFeatureFlags=e.registerChaiFeatureFlags;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.resetSaveToLibrary=e.resetSaveToLibrary;exports.useBlockSettingComponents=e.useBlockSettingComponents;exports.useChaiAddBlockTabs=e.useChaiAddBlockTabs;exports.useChaiFeatureFlag=e.useChaiFeatureFlag;exports.useChaiFeatureFlags=e.useChaiFeatureFlags;exports.useChaiLibraries=e.useChaiLibraries;exports.useChaiSidebarPanels=e.useChaiSidebarPanels;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.useSaveToLibraryComponent=e.useSaveToLibraryComponent;exports.useToggleChaiFeatureFlag=e.useToggleChaiFeatureFlag;exports.useTopBarComponent=e.useTopBarComponent;Object.defineProperty(exports,"CHAI_GLOBAL_DATA_PROVIDER",{enumerable:!0,get:()=>t.CHAI_GLOBAL_DATA_PROVIDER});exports.COLLECTIONS=t.COLLECTIONS;exports.PAGE_TYPES=t.PAGE_TYPES;exports.getChaiCollection=t.getChaiCollection;exports.getChaiCollections=t.getChaiCollections;exports.getChaiGlobalData=t.getChaiGlobalData;exports.getChaiPageType=t.getChaiPageType;exports.getChaiPageTypes=t.getChaiPageTypes;exports.registerChaiCollection=t.registerChaiCollection;exports.registerChaiGlobalDataProvider=t.registerChaiGlobalDataProvider;exports.registerChaiPageType=t.registerChaiPageType;exports.registerChaiPartialType=t.registerChaiPartialType;exports.getAllRegisteredFonts=i.getAllRegisteredFonts;exports.getRegisteredFont=i.getRegisteredFont;exports.registerChaiFont=i.registerChaiFont;exports.useRegisteredFonts=i.useRegisteredFonts;exports.closestBlockProp=r.closestBlockProp;exports.getAIBlockProps=r.getAIBlockProps;exports.getBlockFormSchemas=r.getBlockFormSchemas;exports.getDefaultBlockProps=r.getDefaultBlockProps;exports.getI18nBlockProps=r.getI18nBlockProps;exports.getRegisteredChaiBlock=r.getRegisteredChaiBlock;exports.registerChaiBlock=r.registerChaiBlock;exports.registerChaiServerBlock=r.registerChaiServerBlock;exports.setChaiBlockComponent=r.setChaiBlockComponent;exports.setChaiServerBlockDataProvider=r.setChaiServerBlockDataProvider;exports.syncBlocksWithDefaults=r.syncBlocksWithDefaults;exports.useRegisteredChaiBlock=r.useRegisteredChaiBlock;exports.useRegisteredChaiBlocks=r.useRegisteredChaiBlocks;exports.setChaiBlockDataProvider=o;