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

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 (267) hide show
  1. package/README.md +72 -50
  2. package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-D-2rSLsq.cjs} +1 -1
  3. package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-DKit4bEt.js} +3 -3
  4. package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-BWruCozs.js} +1 -1
  5. package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-CAE2yHEv.cjs} +1 -1
  6. package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-BCYCPK5M.cjs} +1 -1
  7. package/dist/{IconPicker-B2-oriq2.js → IconPicker-BOBnjfJc.js} +2 -2
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-BNve1FlV.cjs} +1 -1
  11. package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Bv40IVPG.js} +4 -4
  12. package/dist/{actions-registery-y_ENc8zj.js → actions-registery-CMKfEXxX.js} +3397 -3202
  13. package/dist/actions-registery-CqhNZFV3.cjs +481 -0
  14. package/dist/actions.cjs +1 -1
  15. package/dist/actions.d.ts +0 -158
  16. package/dist/actions.js +3 -3
  17. package/dist/{active-in-another-tab-Cu_ASKtx.cjs → active-in-another-tab-BPBvEwmD.cjs} +1 -1
  18. package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-C334yD2g.js} +5 -5
  19. package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-BVME8b7v.cjs} +1 -1
  20. package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-DVL-HkWR.js} +4 -4
  21. package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPysPck8.cjs} +1 -1
  22. package/dist/add-new-page-BQOsHkVl.js +31 -0
  23. package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-BsElc0Ke.cjs} +1 -1
  24. package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-BwX0YBGD.js} +6 -6
  25. package/dist/ai-panel-default-lang-BqhAu1iN.cjs +3 -0
  26. package/dist/ai-panel-default-lang-CYZuwSQn.js +317 -0
  27. package/dist/ai-panel-other-lang-CL83Mwha.js +132 -0
  28. package/dist/ai-panel-other-lang-CivH2s8Q.cjs +1 -0
  29. package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-BuP52voq.cjs} +1 -1
  30. package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-C37B_jlE.js} +30 -34
  31. package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-CgZKlkF_.cjs} +1 -1
  32. package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-V5PBEZRn.js} +2 -2
  33. package/dist/apply-binding-BuwI_Uf5.cjs +41 -0
  34. package/dist/apply-binding-RQRSIe56.js +942 -0
  35. package/dist/change-password-modal-AQU_GLqq.js +137 -0
  36. package/dist/change-password-modal-Chufk3yU.cjs +1 -0
  37. package/dist/{code-display-DloSPyPr.cjs → code-display-BR-gij5j.cjs} +1 -1
  38. package/dist/{code-display-Ck81Id9K.js → code-display-DdWcOQ_i.js} +1 -1
  39. package/dist/code-editor-D-fpas30.js +57 -0
  40. package/dist/code-editor-gqdLU-rU.cjs +1 -0
  41. package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-BNEnV0hi.cjs} +1 -1
  42. package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Dx3f64SH.js} +3 -3
  43. package/dist/core-czmLeR0h.cjs +1 -0
  44. package/dist/core-nSRy3D7z.js +54 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +285 -103
  47. package/dist/core.js +71 -42
  48. package/dist/{css-import-modal-Rh1QAVxo.cjs → css-import-modal-B2NoLsdZ.cjs} +1 -1
  49. package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-c_6VH1js.js} +8 -8
  50. package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
  51. package/dist/default-theme-options-saBIkWGT.js +248 -0
  52. package/dist/delete-page-B1R1w8O5.js +84 -0
  53. package/dist/delete-page-DbQDbCyB.cjs +1 -0
  54. package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-11kPk5n1.js} +26 -26
  55. package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-BBLfxzzo.cjs} +1 -1
  56. package/dist/digital-asset-manager-B0h5rUVQ.cjs +1 -0
  57. package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbEQ8cPb.js} +6 -6
  58. package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-BY_Pcqbb.js} +7 -7
  59. package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-BaAzKbiX.cjs} +1 -1
  60. package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-DzH_gCQ4.cjs} +1 -1
  61. package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-bsaLGZkO.js} +16 -16
  62. package/dist/fonts/bungee/Bungee-Regular.woff2 +0 -0
  63. package/dist/fonts/dm_sans/dm-sans-variable.woff2 +0 -0
  64. package/dist/fonts/geist/Geist-VariableFont_wght.ttf +0 -0
  65. package/dist/fonts/geist/Geist-VariableFont_wght.woff2 +0 -0
  66. package/dist/fonts/geist/geist-variable.woff2 +0 -0
  67. package/dist/fonts/geist-mono/GeistMono-VariableFont_wght.woff2 +0 -0
  68. package/dist/fonts/inter/inter-latin.woff2 +0 -0
  69. package/dist/fonts/inter/inter-variable.woff2 +1449 -0
  70. package/dist/fonts/lato/lato-variable.woff2 +0 -0
  71. package/dist/fonts/lavishly_yours/lavishly-yours.woff2 +11 -0
  72. package/dist/fonts/merriweather/merriweather-variable.woff2 +11 -0
  73. package/dist/fonts/montserrat/montserrat-variable.woff2 +0 -0
  74. package/dist/fonts/nunito_sans/nunito-sans-variable.woff2 +11 -0
  75. package/dist/fonts/open_sans/open-sans-variable.woff2 +0 -0
  76. package/dist/fonts/oswald/oswald-variable.woff2 +0 -0
  77. package/dist/fonts/playfair_display/playfair-display-variable.woff2 +11 -0
  78. package/dist/fonts/poppins/poppins-variable.woff2 +0 -0
  79. package/dist/fonts/raleway/raleway-variable.woff2 +0 -0
  80. package/dist/fonts/roboto/roboto-variable.woff2 +11 -0
  81. package/dist/fonts/source_sans_3/source-sans-3-variable.woff2 +11 -0
  82. package/dist/fonts/ubuntu/ubuntu-variable.woff2 +0 -0
  83. package/dist/fonts-B3UYxuJI.js +25 -0
  84. package/dist/fonts-D5fTqvSS.cjs +1 -0
  85. package/dist/{get-chai-builder-tailwind-config-BFePCEIS.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
  86. package/dist/{get-chai-builder-tailwind-config-BXf_xLHk.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +5 -5
  87. package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
  88. package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
  89. package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
  90. package/dist/image-compression-UaU7Bwqe.cjs +1 -0
  91. package/dist/{image-editor-CqwaVxO2.cjs → image-editor-Cfn290vp.cjs} +1 -1
  92. package/dist/{image-editor-CQnNtak2.js → image-editor-CyGqVNvX.js} +1 -1
  93. package/dist/index-BpVxZOd-.js +5082 -0
  94. package/dist/index-CQf0jL1k.cjs +5 -0
  95. package/dist/{index-rAcNbjk_.js → index-DpeytsiB.js} +6145 -6091
  96. package/dist/index-P-2SvZA9.cjs +160 -0
  97. package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-BBERGXdt.cjs} +7 -7
  98. package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-C-bpInzt.js} +87 -85
  99. package/dist/{lang-panel-CnwTb05j.js → lang-panel-4Q_PTmKm.js} +26 -26
  100. package/dist/lang-panel-uI149Beq.cjs +1 -0
  101. package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
  102. package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
  103. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
  104. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
  105. package/dist/library-blocks/bento/product-features/product-features.html +159 -0
  106. package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
  107. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
  108. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
  109. package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
  110. package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
  111. package/dist/library-blocks/blocks-list.json +149 -0
  112. package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
  113. package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
  114. package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
  115. package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
  116. package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
  117. package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
  118. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
  119. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
  120. package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
  121. package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
  122. package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
  123. package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
  124. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
  125. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
  126. package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
  127. package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
  128. package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
  129. package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
  130. package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
  131. package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
  132. package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
  133. package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
  134. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
  135. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
  136. package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
  137. package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
  138. package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
  139. package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
  140. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
  141. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
  142. package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
  143. package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
  144. package/dist/manage-design-tokens-B_-TrQgu.cjs +1 -0
  145. package/dist/manage-design-tokens-CHpHE-dx.js +446 -0
  146. package/dist/manage-design-tokens-modal-Bug5H8PT.cjs +1 -0
  147. package/dist/manage-design-tokens-modal-DO_tHkgp.js +161 -0
  148. package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-BEnMYTql.cjs} +1 -1
  149. package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Ca3QLzX4.js} +11 -11
  150. package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-5gECLoRV.js} +2 -2
  151. package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BHPOfftZ.cjs} +1 -1
  152. package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-Bb3nUSLv.js} +9 -9
  153. package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-CKxggLC_.cjs} +1 -1
  154. package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-BEVRCAhM.js} +2 -2
  155. package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-DMb5Z5on.cjs} +1 -1
  156. package/dist/page-creator-C_95U8kn.cjs +1 -0
  157. package/dist/{page-creator-Cc83uQqw.js → page-creator-DQRFXhNj.js} +143 -143
  158. package/dist/{page-lock-BJUkyxdh.js → page-lock-Be5wPHz5.js} +2 -2
  159. package/dist/{page-lock-CT7SmQqp.cjs → page-lock-DKWt66MX.cjs} +1 -1
  160. package/dist/page-locked-dialog-CWyZol0i.cjs +1 -0
  161. package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-CkXpQUpO.js} +22 -22
  162. package/dist/page-manager-new-2gYNPR6y.js +408 -0
  163. package/dist/page-manager-new-Bt7rBO1J.cjs +1 -0
  164. package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-BotSCoAo.js} +30 -29
  165. package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-Dkwl089C.cjs} +1 -1
  166. package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-OigWteYc.js} +133 -122
  167. package/dist/page-revisions-content-bQ32feXp.cjs +1 -0
  168. package/dist/pages.cjs +1 -1
  169. package/dist/pages.d.ts +330 -96
  170. package/dist/pages.js +23 -19
  171. package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-2RcG3Ptp.js} +39 -39
  172. package/dist/publish-pages-content-Dtkal6ue.cjs +1 -0
  173. package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-D6GjnauV.js} +87 -87
  174. package/dist/register-chai-top-bar-DyW9GPzV.cjs +1 -0
  175. package/dist/render.cjs +2 -2
  176. package/dist/render.d.ts +20 -18
  177. package/dist/render.js +133 -132
  178. package/dist/{rte-widget-modal-BKNx2wln.cjs → rte-widget-modal-CHxO3TQR.cjs} +1 -1
  179. package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-DmQk0Lfj.js} +10 -10
  180. package/dist/runtime-client.cjs +1 -0
  181. package/dist/runtime-client.d.ts +158 -0
  182. package/dist/runtime-client.js +32 -0
  183. package/dist/runtime.cjs +11 -1
  184. package/dist/runtime.d.ts +153 -270
  185. package/dist/runtime.js +107 -71
  186. package/dist/save-to-lib-BSsuvkZS.cjs +1 -0
  187. package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-CVqlFkRK.js} +153 -147
  188. package/dist/sdk.css +1 -1
  189. package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-Cr7R1ojV.cjs} +1 -1
  190. package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-DngI-pF1.js} +12 -12
  191. package/dist/seo-panel-BMYdzcoJ.cjs +2 -0
  192. package/dist/{seo-panel-BkOgRoWd.js → seo-panel-CHkFLI5b.js} +27 -27
  193. package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-BzjOUN-P.js} +88 -88
  194. package/dist/shared-json-ld-ClIZw1aA.cjs +1 -0
  195. package/dist/{slug-input-DHLmUNrH.js → slug-input-07EKw9U5.js} +8 -8
  196. package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-DHVDl_Dv.cjs} +1 -1
  197. package/dist/supabase-actions.cjs +1 -1
  198. package/dist/supabase-actions.d.ts +45 -0
  199. package/dist/supabase-actions.js +380 -275
  200. package/dist/take-over-request-BLdOZhUs.cjs +1 -0
  201. package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-zqtItFSK.js} +13 -13
  202. package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-BxV_8mCE.cjs} +1 -1
  203. package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-DnSd7lOJ.js} +9 -9
  204. package/dist/types.cjs +1 -0
  205. package/dist/types.d.ts +756 -0
  206. package/dist/types.js +1 -0
  207. package/dist/{unmark-as-template-DF1Ms4VN.cjs → unmark-as-template-C4UkGyOP.cjs} +1 -1
  208. package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-DIKZYr01.js} +11 -11
  209. package/dist/unpublish-page-CK0sAZcB.js +28 -0
  210. package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-DFXLzJbc.cjs} +1 -1
  211. package/dist/unpublished-partials-modal-BAr1SkEG.cjs +1 -0
  212. package/dist/unpublished-partials-modal-CDaOvXgp.js +52 -0
  213. package/dist/utils.cjs +1 -1
  214. package/dist/utils.d.ts +6 -6
  215. package/dist/utils.js +2 -2
  216. package/dist/web-blocks.cjs +1 -1
  217. package/dist/web-blocks.js +360 -351
  218. package/dist/{web-preview-D6h1L2nV.js → web-preview-CRSjh2he.js} +2 -2
  219. package/dist/{web-preview-kres0aG7.cjs → web-preview-DA7_F3vv.cjs} +1 -1
  220. package/package.json +34 -35
  221. package/dist/actions-registery-JdxhXhT6.cjs +0 -418
  222. package/dist/add-new-page-DJLJFLAd.js +0 -31
  223. package/dist/ai-panel-default-lang-BZl0tPYo.js +0 -341
  224. package/dist/ai-panel-default-lang-D2zhXvKP.cjs +0 -3
  225. package/dist/ai-panel-other-lang-Bfjk2CYZ.js +0 -162
  226. package/dist/ai-panel-other-lang-Y4bEKHoG.cjs +0 -1
  227. package/dist/apply-binding-BvWfJCSZ.js +0 -841
  228. package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
  229. package/dist/code-editor-Bb7JumZy.js +0 -51
  230. package/dist/code-editor-DQB8lAOk.cjs +0 -1
  231. package/dist/core-Dr7QYemB.js +0 -56
  232. package/dist/core-Y0lXLwkq.cjs +0 -1
  233. package/dist/delete-design-token-BG8yHcS5.cjs +0 -1
  234. package/dist/delete-design-token-COvR4G1S.js +0 -40
  235. package/dist/delete-page-CNucxe4P.js +0 -71
  236. package/dist/delete-page-DAvEjHwF.cjs +0 -1
  237. package/dist/digital-asset-manager-CB5MRBcW.cjs +0 -1
  238. package/dist/fonts/GeistMonoVF.woff +0 -0
  239. package/dist/fonts/GeistVF.woff +0 -0
  240. package/dist/fonts-B-Xt29pe.cjs +0 -1
  241. package/dist/fonts-DRly3Wzd.js +0 -78
  242. package/dist/get-chai-builder-theme-BApShjRz.cjs +0 -1
  243. package/dist/image-compression-DZ9WMmyn.cjs +0 -1
  244. package/dist/index-B-rSiAp_.cjs +0 -1
  245. package/dist/index-C0-pgg_p.cjs +0 -5
  246. package/dist/index-C99FhuF1.cjs +0 -160
  247. package/dist/index-Dno42B0a.js +0 -4734
  248. package/dist/index-Dxfyt4d4.js +0 -39
  249. package/dist/lang-panel-fDCYm5Jm.cjs +0 -1
  250. package/dist/manage-design-tokens-BsSZE9Vs.js +0 -241
  251. package/dist/manage-design-tokens-BvH5KTJX.cjs +0 -1
  252. package/dist/page-creator-g8GqgcKH.cjs +0 -1
  253. package/dist/page-locked-dialog-Co5b9XIZ.cjs +0 -1
  254. package/dist/page-manager-new-5rFP5DyQ.js +0 -395
  255. package/dist/page-manager-new-BOkJImo2.cjs +0 -1
  256. package/dist/page-revisions-content-ag-MHBGr.cjs +0 -1
  257. package/dist/plugin-BGlQf0iy.cjs +0 -22
  258. package/dist/plugin-C-ht41UZ.js +0 -245
  259. package/dist/publish-pages-content-BiX-GMLw.cjs +0 -1
  260. package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
  261. package/dist/save-to-lib-ffjCZYJ5.cjs +0 -1
  262. package/dist/seo-panel-FjS1UF_y.cjs +0 -2
  263. package/dist/shared-json-ld-yJkXjENy.cjs +0 -1
  264. package/dist/take-over-request-CmpJVe9T.cjs +0 -1
  265. package/dist/theme-panel-footer-BUXIu252.js +0 -26
  266. package/dist/theme-panel-footer-CKO9YYwZ.cjs +0 -1
  267. package/dist/unpublish-page-BJ0Bsvt2.js +0 -28
@@ -1,841 +0,0 @@
1
- import { g as rt, c as R } from "./common-functions-D2lMFR6K.js";
2
- import { memoize as ct, get as y, cloneDeep as q, forEach as N, keys as W, isString as $, startsWith as k, isArray as I, isEmpty as _, includes as B, flatten as pt, flatMapDeep as ut, set as w, find as m, startCase as dt, camelCase as G, has as P, filter as Q, some as yt, capitalize as ht, compact as mt, map as gt, trim as bt, each as xt, last as ft } from "lodash-es";
3
- import { parse as _t, stringify as C } from "himalaya";
4
- import { e as kt, i as vt } from "./core-Dr7QYemB.js";
5
- import { twMerge as wt } from "tailwind-merge";
6
- const x = "#styles:", Ht = "__ADD_BLOCK_INTERNAL_ROOT", qt = "@", Bt = "#", tt = "dt#", st = (s) => {
7
- if (s = s.replace(x, ""), !s) return { baseClasses: "", classes: "" };
8
- const n = s.split(/,(?![^\[]*\])/);
9
- if (n.length === 1)
10
- return { baseClasses: "", classes: n[0].trim() };
11
- const [t, ...e] = n;
12
- return {
13
- baseClasses: t.trim(),
14
- classes: e.join(",").trim().replace(/ +(?= )/g, "")
15
- };
16
- };
17
- import.meta.vitest && describe("getSplitChaiClasses", () => {
18
- it("should return the base classes and the classes", () => {
19
- const s = {
20
- ",styles-2": { baseClasses: "", classes: "styles-2" },
21
- "styles-1,styles-2": { baseClasses: "styles-1", classes: "styles-2" },
22
- ",bg-[linear-gradient(-10deg,black,transparent_100%)]": {
23
- baseClasses: "",
24
- classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
25
- },
26
- "styles-1,bg-[linear-gradient(-10deg,black,transparent_100%)]": {
27
- baseClasses: "styles-1",
28
- classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
29
- },
30
- someclass: {
31
- baseClasses: "",
32
- classes: "someclass"
33
- },
34
- ",bg-red-500 text-center font-bold": {
35
- baseClasses: "",
36
- classes: "bg-red-500 text-center font-bold"
37
- },
38
- "bg-[linear-gradient(-10deg,black,transparent_100%)], bg-[linear-gradient(-10deg,black,transparent_100%)]": {
39
- baseClasses: "bg-[linear-gradient(-10deg,black,transparent_100%)]",
40
- classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
41
- }
42
- };
43
- for (const [n, t] of Object.entries(s)) {
44
- const e = st(`${x}${n}`);
45
- expect(e).toEqual(t);
46
- }
47
- });
48
- });
49
- function Ot(s, n, t) {
50
- const e = y(t, "i18nProps", []);
51
- if (_(n) || _(e)) return s;
52
- const a = q(s);
53
- return N(W(a), (o) => {
54
- if (B(e, o) && !_(n)) {
55
- const i = y(a, o), l = y(a, `${o}-${n}`, "");
56
- $(i) ? a[o] = $(l) && !_(l.trim()) && l.trimStart() || i : a[o] = _(l) ? i : l;
57
- }
58
- }), a;
59
- }
60
- const at = (s, n) => {
61
- const { baseClasses: t, classes: e } = st(s), o = e.split(" ").filter((l) => l.startsWith(tt)).map((l) => {
62
- var u;
63
- return (u = n[l]) == null ? void 0 : u.value;
64
- }), i = e.split(" ").filter((l) => !l.startsWith(tt)).join(" ");
65
- return wt.apply(null, [t, ...o, i]);
66
- };
67
- function Tt(s, n) {
68
- return y(s, `${n}_attrs`, {});
69
- }
70
- function Mt(s, n = !0, t = {}) {
71
- const e = {};
72
- return Object.keys(s).forEach((a) => {
73
- if ($(s[a]) && s[a].startsWith(x)) {
74
- const o = at(s[a], t), i = Tt(s, a);
75
- e[a] = {
76
- ...!_(o) && { className: o },
77
- ...i,
78
- ...n ? {
79
- "data-style-prop": a,
80
- "data-block-parent": s._id,
81
- "data-style-id": `${a}-${s._id}`
82
- } : {}
83
- };
84
- }
85
- }), e;
86
- }
87
- const Vt = ct((s) => {
88
- const n = kt(s), t = y(n, "schema.properties", {});
89
- return Object.fromEntries(Object.entries(t).filter(([, e]) => y(e, "runtime", !1)));
90
- }), Jt = (s, n) => {
91
- if (!I(s)) return s;
92
- let t = s, e;
93
- return typeof n.limit == "number" && n.limit > 0 && (e = n.limit), e !== void 0 && (t = t.slice(0, e)), t;
94
- }, zt = (s, n) => {
95
- const t = q(s);
96
- return N(W(t), (e) => {
97
- if ($(t[e]) && !k(e, "_")) {
98
- let a = t[e];
99
- e === "repeaterItems" && (t.repeaterItemsBinding = a);
100
- const o = /\{\{(.*?)\}\}/g, i = a.match(o);
101
- i && i.forEach((l) => {
102
- let u = l.slice(2, -2);
103
- const r = y(n, u, l);
104
- a = I(r) ? r : a.replace(l, r);
105
- }), t[e] = a;
106
- }
107
- }), t;
108
- }, Et = (s) => {
109
- const n = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, t = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
110
- return n.test(s) || t.test(s);
111
- }, $t = (s) => {
112
- if (_(s)) return s;
113
- const n = /<video[^>]+src=['"]([^'">]+)['"]/, t = /<iframe[^>]+src=['"]([^'">]+)['"]/, e = s.match(n), a = s.match(t), o = e ? e[1] : a ? a[1] : null, i = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, l = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
114
- return o && (i.test(o) || l.test(o)) ? o : s;
115
- }, nt = ["chai-name", "data-chai-name"], Nt = {
116
- img: { alt: "alt", width: "width", height: "height", src: "image" },
117
- video: {
118
- src: "url",
119
- autoplay: "controls.autoPlay",
120
- muted: "controls.muted",
121
- loop: "controls.loop",
122
- controls: "controls.widgets"
123
- },
124
- a: {
125
- href: "link.href",
126
- target: "link.target",
127
- type: ""
128
- // @TODO: Detect here what to url, email, phone, elementId
129
- },
130
- input: {
131
- placeholder: "placeholder",
132
- required: "required",
133
- type: "inputType",
134
- name: "fieldName"
135
- },
136
- textarea: {
137
- placeholder: "placeholder",
138
- required: "required",
139
- type: "inputType",
140
- name: "fieldName"
141
- },
142
- select: {
143
- placeholder: "placeholder",
144
- required: "required",
145
- multiple: "multiple",
146
- name: "fieldName"
147
- },
148
- form: {
149
- action: "action"
150
- }
151
- }, St = (s, n) => {
152
- var t;
153
- return ((t = s.children) == null ? void 0 : t.length) === 1 && B(
154
- ["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
155
- n._type
156
- );
157
- }, j = (s) => s.map((n) => n.type === "text" ? y(n, "content", "") : _(n.children) ? "" : j(n.children || [])).join(""), A = (s) => s === null ? "" : s, ot = (s) => {
158
- const n = mt(gt(s.split(/\s+/), bt)), t = m(n, (l) => /^w-/.test(l)), e = m(n, (l) => /^h-/.test(l));
159
- if (!e || !t) return { height: "", width: "" };
160
- const a = (l) => {
161
- if (!l) return;
162
- const u = l.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);
163
- if (!u) return;
164
- if (u[1]) return u[1];
165
- const r = u[2];
166
- return /^\d+(\.\d+)?$/.test(r) ? `${Number(r) * 4}px` : r === "auto" || B(r, "%") ? r : "16px";
167
- }, o = a(t), i = a(e);
168
- return {
169
- width: B(o, "px") ? o : "16px",
170
- height: B(i, "px") ? i : "16px"
171
- };
172
- }, et = (s) => {
173
- if (s.tagName === "svg") return {};
174
- const n = {}, t = Nt[s.tagName || ""] || {}, e = s.attributes || [];
175
- return N(e, ({ key: a, value: o }) => {
176
- var i;
177
- if (!B(nt, a))
178
- if (a === "bid" && (n._bid = A(o)), t[a]) {
179
- if (s.tagName === "img" && a === "src" && !o.startsWith("http")) {
180
- const l = m(s.attributes, { key: "width" }), u = m(s.attributes, { key: "height" });
181
- l && u ? o = `https://picsum.photos/${l == null ? void 0 : l.value}x${u == null ? void 0 : u.value}` : o = "https://picsum.photos/150x150";
182
- } else if (s.tagName === "a") {
183
- const l = m(s.attributes, { key: "href" });
184
- l && typeof (l == null ? void 0 : l.value) == "string" && ((i = l == null ? void 0 : l.value) != null && i.startsWith("pageType:")) && w(n, "link.type", "pageType");
185
- }
186
- w(n, t[a], A(o));
187
- } else B(["style", "class", "srcset", "bid"], a) || (n.styles_attrs = n.styles_attrs || {}, k(a, "@") && (a = a.replace("@", "x-on:")), n.styles_attrs[`${a}`] = A(o));
188
- }), delete n.class, n;
189
- }, It = (s, n = "styles") => {
190
- if (!s.attributes) return { [n]: `${x},` };
191
- const t = m(s.attributes, { key: "class" });
192
- if (t) {
193
- const e = t.value;
194
- return { [n]: `${x},${e}` };
195
- }
196
- return { [n]: `${x},` };
197
- }, Dt = (s) => {
198
- const n = y(s, "attributes", []), t = n.find((r) => r.key === "data-chai-richtext" || r.key === "chai-richtext"), e = n.find((r) => r.key === "data-chai-lightbox" || r.key === "chai-lightbox"), a = n.find((r) => r.key === "data-chai-dropdown" || r.key === "chai-dropdown"), o = n.find(
199
- (r) => r.key === "data-chai-dropdown-button" || r.key === "chai-dropdown-button"
200
- ), i = n.find(
201
- (r) => r.key === "data-chai-dropdown-content" || r.key === "chai-dropdown-content"
202
- ), l = n.find((r) => r.key === "class"), u = l && l.value.split(/\s+/).includes("rte");
203
- if (a)
204
- return { _type: "Dropdown" };
205
- if (o)
206
- return { _type: "DropdownButton" };
207
- if (i)
208
- return { _type: "DropdownContent" };
209
- if (t || u)
210
- return { _type: "Paragraph" };
211
- if (e)
212
- return { _type: "LightBoxLink" };
213
- switch (s.tagName) {
214
- // self closing tags
215
- case "img":
216
- return { _type: "Image" };
217
- case "input":
218
- return { _type: "Input", showLabel: !1 };
219
- // showLabel: hiding default block label
220
- case "hr":
221
- return { _type: "Divider" };
222
- case "br":
223
- return { _type: "LineBreak" };
224
- case "textarea":
225
- return { _type: "TextArea", showLabel: !1 };
226
- case "audio":
227
- return { _type: "Audio" };
228
- case "canvas":
229
- return { _type: "Canvas" };
230
- case "video":
231
- case "iframe":
232
- return { _type: "CustomHTML" };
233
- case "svg":
234
- return { _type: "Icon" };
235
- // non self closing tags
236
- // fixed structure
237
- case "select":
238
- return { _type: "Select", options: [] };
239
- case "option":
240
- return { _type: "Option" };
241
- case "ul":
242
- case "ol":
243
- case "dl":
244
- return {
245
- _type: "List",
246
- tag: s.tagName,
247
- _listType: s.tagName === "ol" ? "list-decimal" : "list-none"
248
- };
249
- case "li":
250
- case "dt":
251
- return { _type: "ListItem", tag: s.tagName };
252
- // non self closing tags
253
- // free flow structure
254
- case "span":
255
- case "figcaption":
256
- case "legend":
257
- return { _type: "Span", tag: s.tagName };
258
- case "p":
259
- return { _type: "Paragraph", content: "" };
260
- case "a":
261
- return { _type: "Link" };
262
- case "form":
263
- return { _type: "Form" };
264
- case "label":
265
- return { _type: "Label" };
266
- case "button":
267
- return { _type: "Button" };
268
- case "code":
269
- return { _type: "Box", _name: "Code" };
270
- case "h1":
271
- case "h2":
272
- case "h3":
273
- case "h4":
274
- case "h5":
275
- case "h6":
276
- return { _type: "Heading", tag: s.tagName };
277
- case "table":
278
- return { _type: "Table" };
279
- case "tr":
280
- return { _type: "TableRow" };
281
- case "td":
282
- case "th":
283
- return { _type: "TableCell", tag: s.tagName };
284
- case "thead":
285
- return { _type: "TableHead" };
286
- case "tbody":
287
- return { _type: "TableBody" };
288
- case "tfoot":
289
- return { _type: "TableFooter" };
290
- default: {
291
- const r = y(s, "children", []).length > 0 ? "Box" : "EmptyBox";
292
- return {
293
- _type: r,
294
- tag: s.tagName,
295
- _name: r == "EmptyBox" || s.tagName === "div" ? r : ht(s.tagName)
296
- };
297
- }
298
- }
299
- }, H = (s, n = null) => ut(s, (t) => {
300
- var O, M, V, J, z, F, U, Y, K, X;
301
- if (t.type === "comment") return [];
302
- let e = { _id: rt() };
303
- if (n && (e._parent = n.block._id), t.type === "text")
304
- return _(y(t, "content", "")) ? [] : n && St(n.node, n.block) ? (w(n, "block.content", y(t, "content", "")), []) : { ...e, _type: "Text", content: y(t, "content", "") };
305
- if (k(t.tagName, "chai-")) {
306
- const c = t.attributes || [], p = m(c, { key: "chai-type" }), d = (p == null ? void 0 : p.value) || dt(G(t.tagName || "")).replace(/ /g, "").replace(/\s+/g, "");
307
- e._type = d, N(c, ({ key: g, value: Z }) => {
308
- if (g === "about-this-component" || g === "chai-type" || g === "can-move" || g === "can-delete") return;
309
- if (g === "id") {
310
- e._id = Z;
311
- return;
312
- }
313
- const lt = k(g, "_") ? g : G(g);
314
- let S = A(Z);
315
- typeof S == "string" && k(S, "#styles:") && (S = S.replace("#styles:", "#styles:,")), e[lt] = S;
316
- });
317
- const h = H(t.children || [], { block: e, node: t });
318
- return [e, ...h];
319
- }
320
- const a = y(t, "attributes", []), o = t.tagName === "p" || a.find((c) => c.key === "data-chai-richtext" || c.key === "chai-richtext"), i = a.find((c) => c.key === "class"), l = i && i.value.split(/\s+/).includes("rte"), u = a.find(
321
- (c) => c.key === "data-chai-lightbox" || c.key === "chai-lightbox"
322
- ), r = a.find(
323
- (c) => c.key === "data-chai-dropdown" || c.key === "chai-dropdown"
324
- ), T = a.find(
325
- (c) => c.key === "data-chai-dropdown-button" || c.key === "chai-dropdown-button"
326
- ), D = a.find(
327
- (c) => c.key === "data-chai-dropdown-content" || c.key === "chai-dropdown-content"
328
- );
329
- if (e = {
330
- ...e,
331
- ...Dt(t),
332
- ...et(t),
333
- ...It(t)
334
- }, t.attributes) {
335
- const c = t.attributes.find((p) => B(nt, p.key));
336
- c && (e._name = c.value);
337
- }
338
- if (o || l)
339
- return e.content = `<p>${C(t.children || [])}</p>`, P(e, "styles_attrs.data-chai-richtext") && delete e.styles_attrs["data-chai-richtext"], P(e, "styles_attrs.chai-richtext") && delete e.styles_attrs["chai-richtext"], [e];
340
- if (u) {
341
- const c = [
342
- "data-chai-lightbox",
343
- "chai-lightbox",
344
- "data-vbtype",
345
- "data-autoplay",
346
- "data-maxwidth",
347
- "data-overlay",
348
- "data-gall",
349
- "href"
350
- ];
351
- e = {
352
- ...e,
353
- href: ((O = a.find((p) => p.key === "href")) == null ? void 0 : O.value) || "",
354
- hrefType: ((M = a.find((p) => p.key === "data-vbtype")) == null ? void 0 : M.value) || "video",
355
- autoplay: ((V = a.find((p) => p.key === "data-autoplay")) == null ? void 0 : V.value) === "true" ? "true" : "false",
356
- maxWidth: ((z = (J = a.find((p) => p.key === "data-maxwidth")) == null ? void 0 : J.value) == null ? void 0 : z.replace("px", "")) || "",
357
- backdropColor: ((F = a.find((p) => p.key === "data-overlay")) == null ? void 0 : F.value) || "",
358
- galleryName: ((U = a.find((p) => p.key === "data-gall")) == null ? void 0 : U.value) || ""
359
- }, N(c, (p) => {
360
- P(e, `styles_attrs.${p}`) && delete e.styles_attrs[p];
361
- });
362
- }
363
- if (r && (delete e.styles_attrs, e.showDropdown = !1), D && delete e.styles_attrs, T) {
364
- delete e.styles_attrs;
365
- const c = Q(t.children || [], (d) => (d == null ? void 0 : d.tagName) !== "span");
366
- e.content = j(c);
367
- const p = m(
368
- t.children || [],
369
- (d) => (d == null ? void 0 : d.tagName) === "span" && yt(d.children || [], (h) => (h == null ? void 0 : h.tagName) === "svg")
370
- );
371
- if (p) {
372
- const d = m(p.children || [], (h) => (h == null ? void 0 : h.tagName) === "svg");
373
- if (d) {
374
- e.icon = C([d]);
375
- const { height: h, width: g } = Ct(d, "16px", "16px");
376
- e.iconHeight = h, e.iconWidth = g;
377
- }
378
- }
379
- return [e];
380
- }
381
- if (e._type === "Input") {
382
- const c = e.inputType || "text";
383
- c === "checkbox" ? w(e, "_type", "Checkbox") : c === "radio" && w(e, "_type", "Radio");
384
- } else if (t.tagName === "video" || t.tagName === "iframe") {
385
- const c = C([t]);
386
- return Et(c) && (w(e, "_type", "Video"), w(e, "url", $t(c)), w(e, "styles", `${x},`), w(e, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), e.content = c, [e];
387
- } else if (t.tagName === "svg") {
388
- const c = y(m(t.attributes, { key: "class" }), "value", ""), { height: p, width: d } = ot(c);
389
- if (p && d)
390
- e.styles = `${x}, ${R(`w-${d} h-${p}`, c)}`.trim(), e.height = p == null ? void 0 : p.replace("px", ""), e.width = d == null ? void 0 : d.replace("px", "");
391
- else {
392
- const h = (Y = m(t.attributes, { key: "height" })) == null ? void 0 : Y.value, g = (K = m(t.attributes, { key: "width" })) == null ? void 0 : K.value;
393
- h && g ? (e.styles = `${x}, ${R(`w-[${g}px] h-[${h}px]`, c)}`.trim(), e.height = h, e.width = g) : e.styles = `${x}, ${R("w-full h-full", c)}`.trim();
394
- }
395
- return t.attributes = Q(t.attributes, (h) => !B(["style", "width", "height", "class"], h.key)), e.icon = C([t]), [e];
396
- } else if (t.tagName == "option" && n && ((X = n.block) == null ? void 0 : X._type) === "Select")
397
- return n.block.options.push({
398
- label: j(t.children || []),
399
- ...et(t)
400
- }), [];
401
- const E = H(t.children || [], { block: e, node: t });
402
- return [e, ...E];
403
- }), Ct = (s, n, t) => {
404
- var u, r;
405
- const e = y(s, "attributes", []), { height: a, width: o } = ot(
406
- y(m(e, { key: "class" }), "value", "")
407
- );
408
- if (a && o)
409
- return {
410
- height: `[${a}px]`,
411
- width: `[${o}px]`
412
- };
413
- const i = (u = m(e, { key: "height" })) == null ? void 0 : u.value, l = (r = m(e, { key: "width" })) == null ? void 0 : r.value;
414
- return {
415
- height: i ? `[${i}px]` : t,
416
- width: l ? `[${l}px]` : n
417
- };
418
- }, Lt = (s) => {
419
- s = s.replace(/(\w+)=\\?"(.*?)\\?"/g, (e, a, o) => {
420
- let i = o.replace(/\\"/g, '"');
421
- return i = i.replace(/{([^}]+)}/g, (l) => l.replace(/"/g, '\\"')), `${a}="${i.replace(/\\"/g, '"')}"`;
422
- }), s = s.replace(/\\n/g, "").replace(/\\\\/g, "").replace(/\\([/<>])/g, "$1").replace(/\\./g, "").replace(/[\n\r\t\f\v]/g, ""), s = s.replace(/\$name="[^"]*"/g, "");
423
- const n = s.match(/<body[^>]*>[\s\S]*?<\/body>/);
424
- return (n && n.length > 0 ? n[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : s).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
425
- }, Ft = (s) => {
426
- const n = _t(Lt(s));
427
- if (_(s)) return [];
428
- const t = pt(H(n));
429
- return vt(t);
430
- }, f = (s, n) => s.map((t) => {
431
- const e = W(t).filter((a) => $(t[a]) && t[a].startsWith(x));
432
- return xt(e, (a) => {
433
- t[a] = `${x},${at(t[a], n)}`;
434
- }), t;
435
- });
436
- import.meta.vitest && describe("applyDesignTokens", () => {
437
- const s = {
438
- "dt#token1": { name: "primary-color", value: "bg-blue-500" },
439
- "dt#token2": { name: "text-size", value: "text-lg" },
440
- "dt#token3": { name: "spacing", value: "p-4" }
441
- }, n = [
442
- {
443
- _id: "block1",
444
- _type: "div",
445
- styles: "#styles:,dt#token1 bg-white text-sm",
446
- className: "#styles:,dt#token2 dt#token3",
447
- otherProp: "not-a-style",
448
- _name: "Test Block"
449
- },
450
- {
451
- _id: "block2",
452
- _type: "button",
453
- styles: "#styles:bg-red-500",
454
- nonStringProp: 123,
455
- _name: "Button Block"
456
- },
457
- {
458
- _id: "block3",
459
- _type: "span",
460
- noStyles: "regular-string",
461
- _name: "No Styles Block"
462
- }
463
- ];
464
- it("should process blocks and replace style properties with generated class names", () => {
465
- const t = f(n, s);
466
- expect(t).toHaveLength(3), expect(t[0].styles).toBe("#styles:,bg-white text-sm"), expect(t[0].className).toBe("#styles:,text-lg p-4"), expect(t[0].otherProp).toBe("not-a-style"), expect(t[0]._id).toBe("block1"), expect(t[0]._type).toBe("div");
467
- }), it("should handle blocks with no style properties", () => {
468
- const t = f(n, s);
469
- expect(t[2].noStyles).toBe("regular-string"), expect(t[2]._id).toBe("block3");
470
- }), it("should handle empty blocks array", () => {
471
- const t = f([], s);
472
- expect(t).toEqual([]);
473
- }), it("should handle empty design tokens", () => {
474
- const t = f(n, {});
475
- expect(t[0].styles).toBe("#styles:,bg-white text-sm");
476
- }), it("should handle blocks with only style prefix", () => {
477
- const e = f([
478
- {
479
- _id: "block1",
480
- _type: "div",
481
- styles: "#styles:",
482
- _name: "Prefix Only"
483
- }
484
- ], s);
485
- expect(e[0].styles).toBe("#styles:,");
486
- }), it("should handle blocks with multiple style properties", () => {
487
- const e = f([
488
- {
489
- _id: "block1",
490
- _type: "div",
491
- styles: "#styles:bg-white dt#token1",
492
- hoverStyles: "#styles:bg-gray-100 dt#token2",
493
- focusStyles: "#styles:outline-none dt#token3",
494
- _name: "Multi Style"
495
- }
496
- ], s);
497
- expect(e[0].styles).toBe("#styles:,bg-white"), expect(e[0].hoverStyles).toBe("#styles:,text-lg bg-gray-100"), expect(e[0].focusStyles).toBe("#styles:,p-4 outline-none");
498
- }), it("should not modify non-string properties that start with #styles:", () => {
499
- const e = f([
500
- {
501
- _id: "block1",
502
- _type: "div",
503
- styles: "#styles:bg-white",
504
- objectStyles: { startsWith: "#styles:" },
505
- arrayStyles: ["#styles:bg-red-500"],
506
- _name: "Non String Styles"
507
- }
508
- ], s);
509
- expect(e[0].styles).toBe("#styles:,bg-white"), expect(e[0].objectStyles).toEqual({ startsWith: "#styles:" }), expect(e[0].arrayStyles).toEqual(["#styles:bg-red-500"]);
510
- }), it("should handle undefined and null values", () => {
511
- const e = f([
512
- {
513
- _id: "block1",
514
- _type: "div",
515
- styles: "#styles:bg-white",
516
- nullStyles: null,
517
- undefinedStyles: void 0,
518
- _name: " Null Undefined"
519
- }
520
- ], s);
521
- expect(e[0].styles).toBe("#styles:,bg-white"), expect(e[0].nullStyles).toBeNull(), expect(e[0].undefinedStyles).toBeUndefined();
522
- }), it("should preserve block structure and non-style properties", () => {
523
- f(n, s).forEach((e, a) => {
524
- expect(e._id).toBe(n[a]._id), expect(e._type).toBe(n[a]._type), expect(e._name).toBe(n[a]._name);
525
- });
526
- }), it("should handle complex design token values", () => {
527
- const a = f([
528
- {
529
- _id: "block1",
530
- _type: "div",
531
- styles: "#styles:bg-white dt#complex1",
532
- _name: "Complex Tokens"
533
- }
534
- ], {
535
- "dt#complex1": { name: "complex-token", value: "hover:bg-blue-600 focus:outline-none transition-colors" },
536
- "dt#complex2": { name: "spacing-token", value: "px-6 py-3 m-2" }
537
- });
538
- expect(a[0].styles).toBe("#styles:,hover:bg-blue-600 focus:outline-none transition-colors bg-white");
539
- }), it("should handle tokens with empty values", () => {
540
- const a = f([
541
- {
542
- _id: "block1",
543
- _type: "div",
544
- styles: "#styles:bg-white dt#empty1 dt#valid1",
545
- _name: "Empty Value Tokens"
546
- }
547
- ], {
548
- "dt#empty1": { name: "empty-token", value: "" },
549
- "dt#valid1": { name: "valid-token", value: "bg-green-500" }
550
- });
551
- expect(a[0].styles).toBe("#styles:,bg-white");
552
- });
553
- });
554
- const v = (s) => {
555
- const n = ft(s);
556
- return s.map((t) => {
557
- const e = Object.keys(t);
558
- for (let a = 0; a < e.length; a++)
559
- if ($(t[e[a]]) && k(e[a], "content")) {
560
- const o = t === n ? "" : " ";
561
- t[e[a]] = `${t[e[a]].trim()}${o}`;
562
- }
563
- return t;
564
- });
565
- };
566
- if (import.meta.vitest) {
567
- const { describe: s, it: n, expect: t } = import.meta.vitest;
568
- s("adjustSpacingInContentBlocks", () => {
569
- n("should add space after content fields except for the last block", () => {
570
- const a = v([
571
- { _id: "1", _type: "Text", content: "First" },
572
- { _id: "2", _type: "Text", content: "Second" },
573
- { _id: "3", _type: "Text", content: "Third" }
574
- ]);
575
- t(a[0].content).toBe("First "), t(a[1].content).toBe("Second "), t(a[2].content).toBe("Third");
576
- }), n("should trim whitespace from content before adding space", () => {
577
- const a = v([
578
- { _id: "1", _type: "Text", content: " First " },
579
- { _id: "2", _type: "Text", content: " Second " }
580
- ]);
581
- t(a[0].content).toBe("First "), t(a[1].content).toBe("Second");
582
- }), n("should handle multiple content fields in a single block", () => {
583
- const a = v([
584
- { _id: "1", _type: "Text", content: "Main", contentAlt: "Alt" },
585
- { _id: "2", _type: "Text", content: "Last", contentSecondary: "Secondary" }
586
- ]);
587
- t(a[0].content).toBe("Main "), t(a[0].contentAlt).toBe("Alt "), t(a[1].content).toBe("Last"), t(a[1].contentSecondary).toBe("Secondary");
588
- }), n("should only process fields that start with 'content'", () => {
589
- const a = v([
590
- { _id: "1", _type: "Text", content: "Text", title: "Title", text: "Text" },
591
- { _id: "2", _type: "Text", content: "Last" }
592
- ]);
593
- t(a[0].content).toBe("Text "), t(a[0].title).toBe("Title"), t(a[0].text).toBe("Text"), t(a[1].content).toBe("Last");
594
- }), n("should handle empty array", () => {
595
- const a = v([]);
596
- t(a).toEqual([]);
597
- }), n("should handle single block", () => {
598
- const a = v([{ _id: "1", _type: "Text", content: "Only" }]);
599
- t(a[0].content).toBe("Only");
600
- }), n("should handle blocks without content fields", () => {
601
- const a = v([
602
- { _id: "1", _type: "Container", title: "Title" },
603
- { _id: "2", _type: "Container", name: "Name" }
604
- ]);
605
- t(a[0].title).toBe("Title"), t(a[1].name).toBe("Name");
606
- }), n("should handle blocks with non-string content fields", () => {
607
- const a = v([
608
- { _id: "1", _type: "Text", content: "Text", contentNum: 123 },
609
- { _id: "2", _type: "Text", content: "Last", contentBool: !0 }
610
- ]);
611
- t(a[0].content).toBe("Text "), t(a[0].contentNum).toBe(123), t(a[1].content).toBe("Last"), t(a[1].contentBool).toBe(!0);
612
- }), n("should handle empty string content", () => {
613
- const a = v([
614
- { _id: "1", _type: "Text", content: "" },
615
- { _id: "2", _type: "Text", content: "Last" }
616
- ]);
617
- t(a[0].content).toBe(" "), t(a[1].content).toBe("Last");
618
- });
619
- });
620
- }
621
- const b = (s, n, { index: t, key: e }, a) => {
622
- if ($(s)) {
623
- let o = s;
624
- const i = /\{\{(.*?)\}\}/g, l = s.match(i);
625
- if (l) {
626
- const u = a === "image" || a === "mobileImage";
627
- l.forEach((r) => {
628
- let T = r.slice(2, -2).trim(), D = e.slice(2, -2).trim();
629
- t !== -1 && k(T, "$index.") ? T = `${D}.${t}.${T.slice(7)}` : t !== -1 && k(T, "$index") && (T = `${D}.${t}`);
630
- const E = y(n, T);
631
- E === void 0 ? o = o.replace(r, "") : u && !I(E) ? o = E : o = I(E) ? E : o.replace(r, E);
632
- });
633
- }
634
- return o;
635
- }
636
- if (I(s))
637
- return s.map((o) => b(o, n, { index: t, key: e }, a));
638
- if (s && typeof s == "object") {
639
- const o = {};
640
- return N(W(s), (i) => {
641
- !k(i, "_") && i !== "$repeaterItemsKey" ? o[i] = b(
642
- s[i],
643
- n,
644
- { index: t, key: e },
645
- i
646
- ) : o[i] = s[i];
647
- }), o;
648
- }
649
- return s;
650
- }, L = (s, n, { index: t, key: e }) => {
651
- let a = q(s);
652
- return a.repeaterItems && (a.$repeaterItemsKey = a.repeaterItems, k(a.repeaterItems, `{{${Bt}`) && (a.$repeaterItemsKey = a.repeaterItems = `${a.repeaterItems.replace("}}", `/${a._id}}}`)}`), !_(a.repeaterItems) && a.pagination && (a.repeaterTotalItems = `${a.repeaterItems.replace("}}", `/${a._id}/totalItems}}`)}`)), b(a, n, { index: t, key: e });
653
- };
654
- import.meta.vitest && (describe("applyBindingToValue", () => {
655
- it("should handle string values with bindings", () => {
656
- const t = b("Hello {{user.name}}", { user: { name: "John" } }, { index: -1, key: "" });
657
- expect(t).toBe("Hello John");
658
- }), it("should handle nested object properties", () => {
659
- const t = b({
660
- name: "John",
661
- address: {
662
- city: "{{user.city}}",
663
- street: "123 Main St"
664
- }
665
- }, { user: { city: "New York" } }, { index: -1, key: "" });
666
- expect(t).toEqual({
667
- name: "John",
668
- address: {
669
- city: "New York",
670
- street: "123 Main St"
671
- }
672
- });
673
- }), it("should handle arrays of values", () => {
674
- const t = b(["Hello {{user.name}}", "Welcome {{user.role}}"], { user: { name: "John", role: "Admin" } }, { index: -1, key: "" });
675
- expect(t).toEqual(["Hello John", "Welcome Admin"]);
676
- }), it("should handle $index binding in repeater context", () => {
677
- const t = b("Item {{$index}}", { items: ["a", "b", "c"] }, { index: 1, key: "{{items}}" });
678
- expect(t).toBe("Item b");
679
- }), it("should handle $index binding with dot notation", () => {
680
- const t = b("Item {{$index.value}}", { items: [{ value: "apple" }, { value: "banana" }, { value: "cherry" }] }, { index: 1, key: "{{items}}" });
681
- expect(t).toBe("Item banana");
682
- }), it("should return an empty string for non-existing bindings", () => {
683
- const t = b("Hello {{user.nonexistent}}", { user: { name: "John" } }, { index: -1, key: "" });
684
- expect(t).toBe("Hello ");
685
- }), it("should preserve private properties starting with _", () => {
686
- const n = b({
687
- name: "John",
688
- _private: "secret"
689
- }, {}, { index: -1, key: "" });
690
- expect(n).toEqual({
691
- name: "John",
692
- _private: "secret"
693
- });
694
- }), it("should completely replace image property value when binding exists", () => {
695
- const t = b({
696
- image: "https://default.jpg{{user.avatar}}",
697
- title: "Hello {{user.name}}"
698
- }, { user: { avatar: "https://avatar.jpg", name: "John" } }, { index: -1, key: "" });
699
- expect(t).toEqual({
700
- image: "https://avatar.jpg",
701
- // Completely replaced, not concatenated
702
- title: "Hello John"
703
- // Normal replacement
704
- });
705
- }), it("should completely replace mobileImage property value when binding exists", () => {
706
- const t = b({
707
- mobileImage: "https://default-mobile.jpg{{user.mobileAvatar}}",
708
- alt: "Avatar for {{user.name}}"
709
- }, { user: { mobileAvatar: "https://mobile-avatar.jpg", name: "John" } }, { index: -1, key: "" });
710
- expect(t).toEqual({
711
- mobileImage: "https://mobile-avatar.jpg",
712
- // Completely replaced
713
- alt: "Avatar for John"
714
- // Normal replacement
715
- });
716
- }), it("should handle image binding with only binding syntax", () => {
717
- const t = b({
718
- image: "{{product.thumbnail}}"
719
- }, { product: { thumbnail: "https://product.jpg" } }, { index: -1, key: "" });
720
- expect(t).toEqual({
721
- image: "https://product.jpg"
722
- });
723
- }), it("should not affect non-image properties with similar bindings", () => {
724
- const t = b({
725
- url: "https://default.com{{page.slug}}",
726
- link: "https://example.com/{{page.id}}"
727
- }, { page: { slug: "/about", id: "123" } }, { index: -1, key: "" });
728
- expect(t).toEqual({
729
- url: "https://default.com/about",
730
- // Concatenated normally
731
- link: "https://example.com/123"
732
- // Concatenated normally
733
- });
734
- });
735
- }), describe("applyBindingToBlockProps", () => {
736
- it("should handle basic block with bindings", () => {
737
- const t = L({
738
- _id: "test-block",
739
- _type: "text",
740
- type: "text",
741
- content: "Hello {{user.name}}",
742
- style: {
743
- color: "{{theme.color}}"
744
- }
745
- }, { user: { name: "John" }, theme: { color: "blue" } }, { index: -1, key: "" });
746
- expect(t).toEqual({
747
- _id: "test-block",
748
- _type: "text",
749
- type: "text",
750
- content: "Hello John",
751
- style: {
752
- color: "blue"
753
- }
754
- });
755
- }), it("should handle repeaterItems and repeaterItemsBinding", () => {
756
- const t = L({
757
- _id: "test-block",
758
- _type: "repeater",
759
- type: "repeater",
760
- repeaterItems: "{{items}}",
761
- items: ["a", "b", "c"]
762
- }, { items: ["x", "y", "z"] }, { index: -1, key: "" });
763
- expect(t).toEqual({
764
- _id: "test-block",
765
- _type: "repeater",
766
- type: "repeater",
767
- $repeaterItemsKey: "{{items}}",
768
- repeaterItems: ["x", "y", "z"],
769
- items: ["a", "b", "c"]
770
- });
771
- }), it("should handle nested blocks with bindings", () => {
772
- const t = L({
773
- _id: "test-block",
774
- _type: "container",
775
- type: "container",
776
- children: [
777
- {
778
- _id: "child-block",
779
- _type: "text",
780
- type: "text",
781
- content: "Item {{$index}}",
782
- style: {
783
- color: "{{theme.color}}"
784
- }
785
- }
786
- ]
787
- }, { theme: { color: "red" }, items: ["x", "y", "z"] }, { index: 2, key: "{{items}}" });
788
- expect(t).toEqual({
789
- _id: "test-block",
790
- _type: "container",
791
- type: "container",
792
- children: [
793
- {
794
- _id: "child-block",
795
- _type: "text",
796
- type: "text",
797
- content: "Item z",
798
- style: {
799
- color: "red"
800
- }
801
- }
802
- ]
803
- });
804
- }), it("should handle arrays of blocks", () => {
805
- const t = L({
806
- _id: "test-block",
807
- _type: "list",
808
- type: "list",
809
- items: [
810
- { _id: "item1", content: "Item {{$index}}" },
811
- { _id: "item2", content: "Item {{$index}}" }
812
- ]
813
- }, { items: ["x", "y", "z"] }, { index: 0, key: "{{items}}" });
814
- expect(t).toEqual({
815
- _id: "test-block",
816
- _type: "list",
817
- type: "list",
818
- items: [
819
- { _id: "item1", content: "Item x" },
820
- { _id: "item2", content: "Item x" }
821
- ]
822
- });
823
- });
824
- }));
825
- export {
826
- Bt as C,
827
- tt as D,
828
- qt as R,
829
- x as S,
830
- L as a,
831
- Ot as b,
832
- Mt as c,
833
- Vt as d,
834
- Jt as e,
835
- v as f,
836
- Ft as g,
837
- zt as h,
838
- f as i,
839
- st as j,
840
- Ht as k
841
- };