@chaibuilder/sdk 3.2.13 → 4.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +88 -61
  2. package/dist/2SSKDMRQ-CfHqXEo6.cjs +1 -0
  3. package/dist/2SSKDMRQ-KxbQMSQF.js +42 -0
  4. package/dist/AP7HFJJL-B3bVbF4b.cjs +1228 -0
  5. package/dist/AP7HFJJL-DJe0zNfP.js +9214 -0
  6. package/dist/IconPicker-7YKi0cvf.cjs +1 -0
  7. package/dist/IconPicker-CaEjFuuU.js +60 -0
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/WDYDFRGG-4MvQxrrE.cjs +1 -0
  11. package/dist/WDYDFRGG-DesO-YVt.js +33 -0
  12. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  13. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  14. package/dist/actions-registery-BRgseJas.cjs +418 -0
  15. package/dist/actions-registery-DRV8xywr.js +15540 -0
  16. package/dist/actions.cjs +1 -0
  17. package/dist/actions.d.ts +3229 -0
  18. package/dist/actions.js +216 -0
  19. package/dist/active-in-another-tab-BraPCVHD.js +35 -0
  20. package/dist/active-in-another-tab-DmiLcoHl.cjs +1 -0
  21. package/dist/add-new-language-page-BiS0BJFh.cjs +1 -0
  22. package/dist/add-new-language-page-DaNJhujm.js +402 -0
  23. package/dist/add-new-page-BavGPTWz.js +31 -0
  24. package/dist/add-new-page-dbDUyekW.cjs +1 -0
  25. package/dist/ai-panel-content-4Cv-ufXL.js +62 -0
  26. package/dist/ai-panel-content-ClQ5alrF.cjs +1 -0
  27. package/dist/ai-panel-default-lang-BVgCW7Iu.cjs +3 -0
  28. package/dist/ai-panel-default-lang-CByGoNp5.js +341 -0
  29. package/dist/ai-panel-other-lang-BXuiVjMR.cjs +1 -0
  30. package/dist/ai-panel-other-lang-DznZUrL7.js +162 -0
  31. package/dist/ai-prompt-input--MqeAtTu.cjs +1 -0
  32. package/dist/ai-prompt-input-DbNqAJmK.js +656 -0
  33. package/dist/ai-translation-prompt-CqZE5xvG.js +28 -0
  34. package/dist/ai-translation-prompt-yU9T98gu.cjs +1 -0
  35. package/dist/{apply-binding-DLaiD20q.js → apply-binding-CLU6Xp4K.js} +251 -257
  36. package/dist/apply-binding-NvZX_rJe.cjs +1 -0
  37. package/dist/code-display-9Onx6RCq.cjs +1 -0
  38. package/dist/{code-display-DuH-UOhl.js → code-display-oa1j0ri7.js} +1 -1
  39. package/dist/code-editor-DI5chGQy.js +51 -0
  40. package/dist/code-editor-eJ-ha21X.cjs +1 -0
  41. package/dist/continue-editing-in-this-client-BIPyGnqp.cjs +1 -0
  42. package/dist/continue-editing-in-this-client-Bs9Q2ase.js +25 -0
  43. package/dist/core-8lkXy4lC.cjs +1 -0
  44. package/dist/core-BvsZwF26.js +52 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +145 -565
  47. package/dist/core.js +24 -103
  48. package/dist/css-import-modal-Cwq__qKK.cjs +13 -0
  49. package/dist/{css-import-modal-CFB2YjDT.js → css-import-modal-D-_jby_w.js} +40 -38
  50. package/dist/{delete-design-token-BjMakV-b.js → delete-design-token-BowiWJOb.js} +3 -3
  51. package/dist/delete-design-token-DjHXH5dg.cjs +1 -0
  52. package/dist/delete-page-Cs0cenoN.js +71 -0
  53. package/dist/delete-page-DqBuzcBW.cjs +1 -0
  54. package/dist/design-token-usage-DDqd3J3T.cjs +1 -0
  55. package/dist/design-token-usage-cjJe9KUU.js +114 -0
  56. package/dist/digital-asset-manager-DjPTwqCP.cjs +1 -0
  57. package/dist/digital-asset-manager-rw_FW-e4.js +877 -0
  58. package/dist/duplicate-page-B19XZEEh.js +134 -0
  59. package/dist/duplicate-page-CpgDT34h.cjs +1 -0
  60. package/dist/dynamic-page-selector-CJXMaEu0.cjs +1 -0
  61. package/dist/dynamic-page-selector-D1pcyyIi.js +86 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/get-chai-builder-tailwind-config-DNp8Vhme.cjs +1 -0
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +14 -11
  66. package/dist/get-chai-builder-theme-BApShjRz.cjs +1 -0
  67. package/dist/get-chai-builder-theme-DDVRJQ6Z.js +24 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-BihtCpkn.cjs +1 -0
  73. package/dist/image-editor-lztBulYI.js +108 -0
  74. package/dist/index-BEldAI1n.cjs +160 -0
  75. package/dist/index-BqlDf5fg.js +18418 -0
  76. package/dist/index-CsChke2B.js +4741 -0
  77. package/dist/index-DTz1hNwi.cjs +5 -0
  78. package/dist/json-diff-viewer-BDbS64LG.cjs +8 -0
  79. package/dist/json-diff-viewer-DI6nPbs8.js +259 -0
  80. package/dist/lang-panel-B51V4-PX.js +216 -0
  81. package/dist/lang-panel-DFttT_MB.cjs +1 -0
  82. package/dist/manage-design-tokens-D8GDkdB2.cjs +1 -0
  83. package/dist/{manage-design-tokens-BHCCrWFS.js → manage-design-tokens-DCPswHMS.js} +24 -24
  84. package/dist/mark-as-template-DBF2r7aW.js +157 -0
  85. package/dist/mark-as-template-rI-cx5-B.cjs +1 -0
  86. package/dist/models-5gOsRC56.cjs +1 -0
  87. package/dist/models-D95ZYr_x.js +70 -0
  88. package/dist/nested-path-selector-content-BQhK20BE.js +88 -0
  89. package/dist/nested-path-selector-content-o7k86m-q.cjs +1 -0
  90. package/dist/no-language-page-content-C2hLFt7A.js +43 -0
  91. package/dist/no-language-page-content-DmgQLhac.cjs +1 -0
  92. package/dist/no-language-page-dialog-BmB5fz92.js +10 -0
  93. package/dist/no-language-page-dialog-D2Ijv2V4.cjs +1 -0
  94. package/dist/page-creator-CGxrkmut.js +796 -0
  95. package/dist/page-creator-jlPEOhfz.cjs +1 -0
  96. package/dist/page-lock-CnOS_qxc.js +30 -0
  97. package/dist/page-lock-CoAmLhTA.cjs +1 -0
  98. package/dist/page-locked-dialog-B2L9yqX1.js +136 -0
  99. package/dist/page-locked-dialog-BNHr0OAi.cjs +1 -0
  100. package/dist/page-manager-new-CkNowPYt.cjs +1 -0
  101. package/dist/page-manager-new-D_TxW1yk.js +395 -0
  102. package/dist/page-manager-search-and-filter-Bme84N1w.js +202 -0
  103. package/dist/page-manager-search-and-filter-CpjNOQqF.cjs +1 -0
  104. package/dist/page-revisions-content-B_EkI6eN.js +456 -0
  105. package/dist/page-revisions-content-DYt-0IJ3.cjs +1 -0
  106. package/dist/pages.cjs +1 -0
  107. package/dist/pages.d.ts +545 -0
  108. package/dist/pages.js +27 -0
  109. package/dist/plugin-BGlQf0iy.cjs +22 -0
  110. package/dist/{plugin-BOcGV_IY.js → plugin-C-ht41UZ.js} +31 -45
  111. package/dist/publish-pages-content-1_-8jO3C.cjs +1 -0
  112. package/dist/publish-pages-content-Ct-rYFXD.js +179 -0
  113. package/dist/register-chai-top-bar-CX_JkRJn.js +237 -0
  114. package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +25 -23
  119. package/dist/render.js +108 -103
  120. package/dist/rte-widget-modal-88x3Ag4b.cjs +1 -0
  121. package/dist/rte-widget-modal-BpjTwrAJ.js +39 -0
  122. package/dist/runtime-client.cjs +1 -0
  123. package/dist/runtime-client.d.ts +158 -0
  124. package/dist/runtime-client.js +32 -0
  125. package/dist/runtime.cjs +1 -1
  126. package/dist/runtime.d.ts +322 -7
  127. package/dist/runtime.js +74 -1
  128. package/dist/save-to-lib-B5ggugo6.js +423 -0
  129. package/dist/save-to-lib-BSCJSBw9.cjs +1 -0
  130. package/dist/sdk.css +1 -1
  131. package/dist/selected-block-display-DrMFz5_U.js +320 -0
  132. package/dist/selected-block-display-wHwP16Pz.cjs +16 -0
  133. package/dist/seo-panel-Bktda7aV.cjs +2 -0
  134. package/dist/seo-panel-Dzx-sUAi.js +799 -0
  135. package/dist/shared-json-ld-BMt3lSVf.js +566 -0
  136. package/dist/shared-json-ld-RDvoItXK.cjs +1 -0
  137. package/dist/slug-input-BtbW6w7B.cjs +1 -0
  138. package/dist/slug-input-CyKRaEV_.js +87 -0
  139. package/dist/supabase-actions.cjs +1 -0
  140. package/dist/supabase-actions.d.ts +289 -0
  141. package/dist/supabase-actions.js +524 -0
  142. package/dist/take-over-request-BA_e938L.js +64 -0
  143. package/dist/take-over-request-DsDWVplQ.cjs +1 -0
  144. package/dist/theme-panel-footer-6iHKSeON.cjs +1 -0
  145. package/dist/theme-panel-footer-v8PRUzwR.js +26 -0
  146. package/dist/translation-warning-modal-B1tAPMx7.js +27 -0
  147. package/dist/translation-warning-modal-DA7Vj_9F.cjs +1 -0
  148. package/dist/types.cjs +1 -0
  149. package/dist/types.d.ts +598 -0
  150. package/dist/types.js +1 -0
  151. package/dist/unmark-as-template-Bdg5nLBS.cjs +1 -0
  152. package/dist/unmark-as-template-C6pllRk5.js +40 -0
  153. package/dist/unpublish-page-BOrfamLs.cjs +1 -0
  154. package/dist/unpublish-page-C3Wub7gR.js +28 -0
  155. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  156. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  157. package/dist/utils.cjs +1 -0
  158. package/dist/{tailwind.d.ts → utils.d.ts} +12 -12
  159. package/dist/utils.js +7 -0
  160. package/dist/web-blocks.cjs +1 -1
  161. package/dist/web-blocks.d.ts +0 -6
  162. package/dist/web-blocks.js +240 -239
  163. package/dist/web-preview-869kgvNU.cjs +1 -0
  164. package/dist/web-preview-CVAQ53g_.js +73 -0
  165. package/package.json +152 -76
  166. package/dist/IconPicker-6JSublJp.js +0 -64
  167. package/dist/IconPicker-DpQQDK_Q.cjs +0 -1
  168. package/dist/apply-binding-Bn1KC8uC.cjs +0 -1
  169. package/dist/code-display-Dw1tAwiJ.cjs +0 -1
  170. package/dist/code-editor-CEsA4Nlq.cjs +0 -1
  171. package/dist/code-editor-DPr4HDOV.js +0 -59
  172. package/dist/css-import-modal-bGWZSlqv.cjs +0 -13
  173. package/dist/delete-design-token-Bzxspf8D.cjs +0 -1
  174. package/dist/design-token-usage-DyQcFypc.cjs +0 -1
  175. package/dist/design-token-usage-_FBnvL92.js +0 -120
  176. package/dist/get-chai-builder-tailwind-config-C6MHaUM0.cjs +0 -1
  177. package/dist/get-chai-builder-theme-B1tr_NJB.cjs +0 -1
  178. package/dist/get-chai-builder-theme-BarMkcGH.js +0 -12
  179. package/dist/index-CIez6R-d.js +0 -18327
  180. package/dist/index-zLw6cVaV.cjs +0 -160
  181. package/dist/manage-design-tokens-Cfjg_at9.cjs +0 -1
  182. package/dist/mockServiceWorker.js +0 -349
  183. package/dist/plugin-CSgw-f78.cjs +0 -22
  184. package/dist/rte-widget-modal-CsBCpJSY.js +0 -41
  185. package/dist/rte-widget-modal-Dif3ZoFQ.cjs +0 -1
  186. package/dist/tailwind.cjs +0 -1
  187. package/dist/tailwind.js +0 -8
  188. package/dist/tooltip-Ba1-8jmj.cjs +0 -1
  189. package/dist/tooltip-DUosa-uC.js +0 -1067
  190. package/dist/ui.cjs +0 -1
  191. package/dist/ui.d.ts +0 -415
  192. package/dist/ui.js +0 -129
  193. package/dist/vite.svg +0 -1
@@ -0,0 +1,158 @@
1
+ import { ComponentType } from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ export declare const ADD_BLOCK_TABS: Record<string, AddBlockTab>;
5
+
6
+ export declare type AddBlockTab = {
7
+ id: string;
8
+ tab: React.ComponentType;
9
+ tabContent: React.ComponentType;
10
+ };
11
+
12
+ export declare const CHAI_BUILDER_PANELS: Record<string, ChaiSidebarPanel>;
13
+
14
+ declare type ChaiAsset = {
15
+ url: string;
16
+ id?: string;
17
+ thumbnailUrl?: string;
18
+ description?: string;
19
+ width?: number;
20
+ height?: number;
21
+ };
22
+
23
+ declare type ChaiBlock<T = Record<string, any>> = {
24
+ _id: string;
25
+ _name?: string;
26
+ _parent?: string | null | undefined;
27
+ _libBlock?: string;
28
+ _type: string;
29
+ partialBlockId?: string;
30
+ } & T;
31
+
32
+ declare type ChaiFlagOptions = {
33
+ key: string;
34
+ value?: any;
35
+ description?: string;
36
+ };
37
+
38
+ declare type ChaiLibrary<T = Record<string, any>> = {
39
+ id: string;
40
+ name: string;
41
+ blocks?: ChaiLibraryBlock[];
42
+ description?: string;
43
+ } & T;
44
+
45
+ declare type ChaiLibraryBlock<T = Record<string, any>> = {
46
+ id: string;
47
+ group: string;
48
+ name: string;
49
+ preview?: string;
50
+ tags?: string[];
51
+ description?: string;
52
+ } & T;
53
+
54
+ declare type ChaiLibraryConfig<T> = {
55
+ id: string;
56
+ name: string;
57
+ description: string;
58
+ getBlocksList: (library: ChaiLibrary) => Promise<ChaiLibraryBlock<T>[]>;
59
+ getBlock: ({ library, block, }: {
60
+ library: ChaiLibrary;
61
+ block: ChaiLibraryBlock<T>;
62
+ }) => Promise<HTMLString | ChaiBlock[]>;
63
+ };
64
+
65
+ export declare interface ChaiSidebarPanel {
66
+ id: string;
67
+ position: "top" | "bottom";
68
+ view?: "standard" | "modal" | "overlay" | "drawer";
69
+ button: React.ComponentType<{
70
+ isActive: boolean;
71
+ show: () => void;
72
+ panelId: string;
73
+ position: "top" | "bottom";
74
+ }>;
75
+ label: string;
76
+ panel?: ComponentType;
77
+ width?: number;
78
+ isInternal?: boolean;
79
+ icon?: React.ReactNode;
80
+ }
81
+
82
+ export declare const getChaiLibrary: (id: string) => ChaiLibraryConfig<any>;
83
+
84
+ export declare const getPreImportHTML: (code: string) => Promise<string>;
85
+
86
+ declare type HTMLString = string;
87
+
88
+ export declare const IfChaiFeatureFlag: ({ flagKey, children }: {
89
+ flagKey: string;
90
+ children: React.ReactNode;
91
+ }) => ReactNode;
92
+
93
+ export declare type MediaManagerProps = {
94
+ assetId?: string;
95
+ close: () => void;
96
+ onSelect: (assets: ChaiAsset | ChaiAsset[]) => void;
97
+ mode?: "image" | "video" | "audio";
98
+ };
99
+
100
+ export declare const registerBlockSettingField: (id: string, component: React.ComponentType<any>) => void;
101
+
102
+ export declare const registerBlockSettingTemplate: (id: string, component: React.ComponentType<any>) => void;
103
+
104
+ export declare const registerBlockSettingWidget: (id: string, component: React.ComponentType<any>) => void;
105
+
106
+ export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
107
+
108
+ export declare const registerChaiFeatureFlag: (key: string, flagOptions: Omit<ChaiFlagOptions, "key">) => void;
109
+
110
+ export declare const registerChaiFeatureFlags: (flags: Record<string, Omit<ChaiFlagOptions, "key">>) => void;
111
+
112
+ export declare const registerChaiLibrary: <T extends Record<string, any> = Record<string, any>>(id: string, library: Omit<ChaiLibraryConfig<T>, "id">) => void;
113
+
114
+ export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
115
+
116
+ export declare const registerChaiPreImportHTMLHook: (fn: (code: string) => Promise<string>) => void;
117
+
118
+ export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
119
+
120
+ export declare const registerChaiSidebarPanel: (panelId: string, panelOptions: Omit<ChaiSidebarPanel, "id">) => void;
121
+
122
+ export declare const registerChaiTopBar: (component: React.ComponentType) => void;
123
+
124
+ export declare const resetSaveToLibrary: () => void;
125
+
126
+ export declare const RJSF_EXTENSIONS: Record<string, {
127
+ id: string;
128
+ component: React.ComponentType<any>;
129
+ type: string;
130
+ }>;
131
+
132
+ export declare type SaveToLibraryProps = {
133
+ blockId: string;
134
+ blocks: ChaiBlock[];
135
+ close: () => void;
136
+ };
137
+
138
+ export declare const useBlockSettingComponents: (type: "widget" | "field" | "template") => Record<string, React.ComponentType<any>>;
139
+
140
+ export declare const useChaiAddBlockTabs: () => AddBlockTab[];
141
+
142
+ export declare const useChaiFeatureFlag: (flagKey: string) => boolean;
143
+
144
+ export declare const useChaiFeatureFlags: () => Record<string, ChaiFlagOptions>;
145
+
146
+ export declare const useChaiLibraries: () => ChaiLibraryConfig<any>[];
147
+
148
+ export declare const useChaiSidebarPanels: (position: "top" | "bottom") => ChaiSidebarPanel[];
149
+
150
+ export declare const useMediaManagerComponent: () => ComponentType<MediaManagerProps>;
151
+
152
+ export declare const useSaveToLibraryComponent: () => ComponentType<SaveToLibraryProps> | null;
153
+
154
+ export declare const useToggleChaiFeatureFlag: (flagKey: string) => () => void;
155
+
156
+ export declare const useTopBarComponent: () => ComponentType< {}>;
157
+
158
+ export { }
@@ -0,0 +1,32 @@
1
+ import { A as s, C as r, I as i, R as t, k as g, o, a as C, b as h, r as l, c as n, e as u, f as F, j as S, m as T, p as b, q as d, v as p, x as B, t as L, u as m, d as k, h as c, g as A, l as I, w as y, n as M, s as P, i as _, y as v } from "./register-chai-top-bar-CX_JkRJn.js";
2
+ export {
3
+ s as ADD_BLOCK_TABS,
4
+ r as CHAI_BUILDER_PANELS,
5
+ i as IfChaiFeatureFlag,
6
+ t as RJSF_EXTENSIONS,
7
+ g as getChaiLibrary,
8
+ o as getPreImportHTML,
9
+ C as registerBlockSettingField,
10
+ h as registerBlockSettingTemplate,
11
+ l as registerBlockSettingWidget,
12
+ n as registerChaiAddBlockTab,
13
+ u as registerChaiFeatureFlag,
14
+ F as registerChaiFeatureFlags,
15
+ S as registerChaiLibrary,
16
+ T as registerChaiMediaManager,
17
+ b as registerChaiPreImportHTMLHook,
18
+ d as registerChaiSaveToLibrary,
19
+ p as registerChaiSidebarPanel,
20
+ B as registerChaiTopBar,
21
+ L as resetSaveToLibrary,
22
+ m as useBlockSettingComponents,
23
+ k as useChaiAddBlockTabs,
24
+ c as useChaiFeatureFlag,
25
+ A as useChaiFeatureFlags,
26
+ I as useChaiLibraries,
27
+ y as useChaiSidebarPanels,
28
+ M as useMediaManagerComponent,
29
+ P as useSaveToLibraryComponent,
30
+ _ as useToggleChaiFeatureFlag,
31
+ v as useTopBarComponent
32
+ };
package/dist/runtime.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@chaibuilder/runtime");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./STRINGS-FNnfjF5H.cjs"),i=require("lodash-es"),r=require("./register-partial-type-ig9fUWIJ.cjs"),t=require("./core-8lkXy4lC.cjs"),s=require("./fonts-B-Xt29pe.cjs"),p=t.setChaiServerBlockDataProvider,C=e=>{const n=["_type","_id","_parent","_bindings","_name"],c=["$loading","blockProps","inBuilder","lang","draft","pageProps","pageData","children"],o=i.keys(e.properties);if(i.intersection(o,n).length>0)throw new Error(`Reserved props are not allowed: ${i.intersection(o,n).join(", ")}`);if(i.intersection(o,c).length>0)throw new Error(`Runtime props are not allowed in schema: ${i.intersection(o,c).join(", ")}`);const a=i.get(e,"properties",{}),g={};return i.each(a,(h,u)=>{i.isEmpty(h.ui)||(g[u]={...h.ui},delete a[u].ui)}),{schema:i.isEmpty(a)?{}:{...i.omit(e,["ui"])},uiSchema:{...i.get(e,"ui",{}),...g}}},d=(e="")=>(console.warn("StylesProp is deprecated, use stylesProp instead"),{type:"string",styles:!0,default:`${l.STYLES_KEY},${e}`,ui:{"ui:widget":"hidden"}}),P=(e="")=>({type:"string",styles:!0,default:`${l.STYLES_KEY},${e}`,ui:{"ui:widget":"hidden"}}),B=e=>(console.warn("runtimeProp is deprecated, use builderProp instead"),{runtime:!0,...e}),y=e=>({builderProp:!0,...e}),k=e=>`${l.STYLES_KEY},${e}`;Object.defineProperty(exports,"CHAI_GLOBAL_DATA_PROVIDER",{enumerable:!0,get:()=>r.CHAI_GLOBAL_DATA_PROVIDER});exports.COLLECTIONS=r.COLLECTIONS;exports.PAGE_TYPES=r.PAGE_TYPES;exports.getChaiCollection=r.getChaiCollection;exports.getChaiCollections=r.getChaiCollections;exports.getChaiGlobalData=r.getChaiGlobalData;exports.getChaiPageType=r.getChaiPageType;exports.getChaiPageTypes=r.getChaiPageTypes;exports.registerChaiCollection=r.registerChaiCollection;exports.registerChaiGlobalDataProvider=r.registerChaiGlobalDataProvider;exports.registerChaiPageType=r.registerChaiPageType;exports.registerChaiPartialType=r.registerChaiPartialType;exports.closestBlockProp=t.closestBlockProp;exports.getAIBlockProps=t.getAIBlockProps;exports.getBlockFormSchemas=t.getBlockFormSchemas;exports.getDefaultBlockProps=t.getDefaultBlockProps;exports.getI18nBlockProps=t.getI18nBlockProps;exports.getRegisteredChaiBlock=t.getRegisteredChaiBlock;exports.registerChaiBlock=t.registerChaiBlock;exports.registerChaiServerBlock=t.registerChaiServerBlock;exports.setChaiBlockComponent=t.setChaiBlockComponent;exports.setChaiServerBlockDataProvider=t.setChaiServerBlockDataProvider;exports.syncBlocksWithDefaults=t.syncBlocksWithDefaults;exports.useRegisteredChaiBlock=t.useRegisteredChaiBlock;exports.useRegisteredChaiBlocks=t.useRegisteredChaiBlocks;exports.getAllRegisteredFonts=s.getAllRegisteredFonts;exports.getRegisteredFont=s.getRegisteredFont;exports.registerChaiFont=s.registerChaiFont;exports.useRegisteredFonts=s.useRegisteredFonts;exports.StylesProp=d;exports.builderProp=y;exports.defaultChaiStyles=k;exports.registerChaiBlockSchema=C;exports.runtimeProp=B;exports.setChaiBlockDataProvider=p;exports.stylesProp=P;
package/dist/runtime.d.ts CHANGED
@@ -1,10 +1,325 @@
1
+ import { default as default_2 } from 'react';
2
+ import { RJSFSchema } from '@rjsf/utils';
3
+ import { UiSchema } from '@rjsf/utils';
1
4
 
2
- export * from "@chaibuilder/runtime";
5
+ export declare const builderProp: (options: ChaiBlockPropSchema) => ChaiBlockPropSchema;
6
+
7
+ export declare let CHAI_GLOBAL_DATA_PROVIDER: (args: {
8
+ lang: string;
9
+ draft: boolean;
10
+ inBuilder: boolean;
11
+ }) => Promise<any>;
12
+
13
+ declare type ChaiBlock<T = Record<string, any>> = {
14
+ _id: string;
15
+ _name?: string;
16
+ _parent?: string | null | undefined;
17
+ _libBlock?: string;
18
+ _type: string;
19
+ partialBlockId?: string;
20
+ } & T;
21
+
22
+ declare type ChaiBlockComponentProps<BlockProps, PageData = Record<string, unknown>> = ChaiBlock<BlockProps> & {
23
+ $loading?: boolean;
24
+ blockProps: Record<string, string>;
25
+ inBuilder: boolean;
26
+ lang: string;
27
+ draft: boolean;
28
+ pageProps?: ChaiPageProps;
29
+ pageData?: PageData;
30
+ children?: default_2.ReactNode;
31
+ };
32
+
33
+ declare interface ChaiBlockDefinition<T = Record<string, any>, K = Record<string, any>> {
34
+ component: default_2.ComponentType<ChaiBlockComponentProps<T>>;
35
+ type: string;
36
+ label: string;
37
+ group: string;
38
+ description?: string;
39
+ wrapper?: boolean;
40
+ blocks?: ChaiBlock[] | (() => ChaiBlock[]);
41
+ category?: string;
42
+ hidden?: boolean | ((parentType?: string) => boolean);
43
+ icon?: default_2.ReactNode | default_2.ComponentType;
44
+ dataProviderMode?: "live" | "mock";
45
+ dataProviderDependencies?: string[];
46
+ dataProvider?: (args: {
47
+ lang: string;
48
+ draft: boolean;
49
+ inBuilder: boolean;
50
+ block: ChaiBlock<T>;
51
+ pageProps: ChaiPageProps;
52
+ }) => K;
53
+ schema?: ChaiBlockSchema;
54
+ uiSchema?: ChaiBlockUiSchema;
55
+ i18nProps?: string[];
56
+ aiProps?: string[];
57
+ inlineEditProps?: string[];
58
+ canAcceptBlock?: (type: string) => boolean;
59
+ canDelete?: () => boolean;
60
+ canMove?: () => boolean;
61
+ canDuplicate?: () => boolean;
62
+ canBeNested?: (type: string) => boolean;
63
+ }
64
+
65
+ declare type ChaiBlockDefinitionOptions<T, K> = Omit<ChaiBlockDefinition<T, K>, "component">;
66
+
67
+ declare type ChaiBlockPropSchema = RJSFSchema & {
68
+ ui?: ChaiBlockUiSchema;
69
+ default: any;
70
+ };
71
+
72
+ declare type ChaiBlockSchema = {
73
+ properties?: Record<string, ChaiBlockPropSchema>;
74
+ allOf?: any[];
75
+ oneOf?: any[];
76
+ } & Partial<Pick<ChaiBlockPropSchema, "required" | "dependencies" | "ui" | "title" | "description" | "default">>;
77
+
78
+ declare type ChaiBlockSchemas = {
79
+ schema: object | Omit<ChaiBlockSchema, "ui">;
80
+ uiSchema?: ChaiBlockUiSchema;
81
+ };
82
+
83
+ declare type ChaiBlockUiSchema = UiSchema;
84
+
85
+ declare interface ChaiDesignTokens {
86
+ [uniqueId: string]: {
87
+ name: string;
88
+ value: string;
89
+ };
90
+ }
91
+
92
+ declare type ChaiFont = ChaiFontViaUrl | ChaiFontViaSrc;
93
+
94
+ declare type ChaiFontViaSrc = {
95
+ family: string;
96
+ src: {
97
+ url: string;
98
+ format: string;
99
+ fontWeight?: string;
100
+ fontStyle?: string;
101
+ fontDisplay?: string;
102
+ fontStretch?: string;
103
+ }[];
104
+ fallback: string;
105
+ };
106
+
107
+ declare type ChaiFontViaUrl = {
108
+ family: string;
109
+ url: string;
110
+ fallback: string;
111
+ };
112
+
113
+ declare type ChaiPage = {
114
+ id: string;
115
+ slug: string;
116
+ lang: string;
117
+ name: string;
118
+ pageType: string;
119
+ blocks: ChaiBlock[];
120
+ createdAt: string;
121
+ lastSaved: string;
122
+ dynamic: boolean;
123
+ online: boolean;
124
+ seo: ChaiPageSeo;
125
+ app: string;
126
+ primaryPage?: string | null;
127
+ currentEditor?: string | null;
128
+ changes: object[];
129
+ parent?: string | null;
130
+ libRefId?: string | null;
131
+ dynamicSlugCustom?: string | null;
132
+ metadata?: object;
133
+ jsonld?: object;
134
+ globalJsonLds?: string[];
135
+ links?: string;
136
+ partialBlocks?: string;
137
+ designTokens?: ChaiDesignTokens;
138
+ };
139
+
140
+ declare type ChaiPageProps<T = Record<string, any>> = {
141
+ slug: string;
142
+ searchParams?: Record<string, string>;
143
+ } & T;
144
+
145
+ declare type ChaiPageSeo = {
146
+ title?: string;
147
+ description?: string;
148
+ ogTitle?: string;
149
+ ogDescription?: string;
150
+ ogImage?: string;
151
+ canonicalUrl?: string;
152
+ noIndex?: boolean;
153
+ noFollow?: boolean;
154
+ jsonLD?: string;
155
+ };
156
+
157
+ declare type ChaiPageType = {
158
+ key: string;
159
+ helpText?: string;
160
+ icon?: string;
161
+ hasSlug?: boolean;
162
+ name: string | (() => Promise<string>);
163
+ dynamicSegments?: string;
164
+ dynamicSlug?: string;
165
+ getDynamicPages?: ({ query, uuid, }: {
166
+ query?: string;
167
+ uuid?: string;
168
+ }) => Promise<Pick<ChaiPage, "id" | "name" | "slug" | "primaryPage">[]>;
169
+ search?: (query: string) => Promise<Pick<ChaiPage, "id" | "name" | "slug">[] | Error>;
170
+ resolveLink?: (id: string, draft?: boolean, lang?: string) => Promise<string>;
171
+ onCreate?: (data: Partial<ChaiPage> & {
172
+ id: string;
173
+ }) => Promise<void>;
174
+ onUpdate?: (data: Partial<ChaiPage> & {
175
+ id: string;
176
+ }) => Promise<void>;
177
+ onDelete?: (data: Pick<ChaiPage, "id">) => Promise<void>;
178
+ dataProvider?: (args: {
179
+ lang: string;
180
+ draft: boolean;
181
+ inBuilder: boolean;
182
+ pageProps: ChaiPageProps;
183
+ }) => Promise<Record<string, any>>;
184
+ defaultSeo?: () => Record<string, any>;
185
+ defaultJSONLD?: () => Record<string, any>;
186
+ defaultMetaTags?: () => Record<string, string>;
187
+ };
188
+
189
+ declare interface ChaiServerBlockDefinition<T = Record<string, any>, K = Record<string, any>> {
190
+ component: default_2.ComponentType<ChaiBlockComponentProps<T>>;
191
+ type: string;
192
+ dataProvider?: (args: {
193
+ draft: boolean;
194
+ inBuilder: boolean;
195
+ lang: string;
196
+ block: ChaiBlock<T>;
197
+ pageProps: ChaiPageProps;
198
+ }) => Promise<K>;
199
+ suspenseFallback?: default_2.ComponentType<any>;
200
+ }
201
+
202
+ export declare const closestBlockProp: (blockType: keyof typeof REGISTERED_CHAI_BLOCKS, prop: string) => ChaiBlockPropSchema;
203
+
204
+ declare interface CollectionConfig<T> {
205
+ id: string;
206
+ name: string;
207
+ icon?: string;
208
+ filters?: {
209
+ id: string;
210
+ name: string;
211
+ }[];
212
+ sort?: {
213
+ id: string;
214
+ name: string;
215
+ }[];
216
+ fetch: (params: CollectionFetchParams) => Promise<{
217
+ items: T[];
218
+ totalItems?: number;
219
+ }>;
220
+ }
221
+
222
+ export declare type CollectionFetchParams = {
223
+ block: ChaiBlock;
224
+ inBuilder: boolean;
225
+ draft: boolean;
226
+ lang: string;
227
+ pageProps: {
228
+ slug: string;
229
+ params?: Record<string, string>;
230
+ [key: string]: any;
231
+ };
232
+ };
233
+
234
+ export declare const COLLECTIONS: Record<string, CollectionConfig<any>>;
235
+
236
+ export declare const defaultChaiStyles: (classes: string) => string;
237
+
238
+ export declare const getAIBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => never[] | ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>>;
239
+
240
+ export declare const getAllRegisteredFonts: () => ChaiFont[];
241
+
242
+ export declare const getBlockFormSchemas: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => {
243
+ schema: RJSFSchema;
244
+ uiSchema: UiSchema;
245
+ } | null;
246
+
247
+ export declare const getChaiCollection: (key: string) => CollectionConfig<any>;
248
+
249
+ export declare const getChaiCollections: () => CollectionConfig<any>[];
250
+
251
+ export declare const getChaiGlobalData: (args: {
252
+ lang: string;
253
+ draft: boolean;
254
+ inBuilder: boolean;
255
+ }) => Promise<any>;
256
+
257
+ export declare const getChaiPageType: (key: keyof typeof PAGE_TYPES) => ChaiPageType;
258
+
259
+ export declare const getChaiPageTypes: () => ChaiPageType[];
260
+
261
+ export declare const getDefaultBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => Record<string, any>;
262
+
263
+ export declare const getI18nBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => never[] | ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>>;
264
+
265
+ export declare const getRegisteredChaiBlock: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => ChaiBlockDefinition | null;
266
+
267
+ export declare const getRegisteredFont: (family: string) => ChaiFont | undefined;
268
+
269
+ export declare const PAGE_TYPES: Record<string, ChaiPageType>;
270
+
271
+ export declare const registerChaiBlock: <T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>>(component: default_2.ComponentType<ChaiBlockComponentProps<T>>, options: ChaiBlockDefinitionOptions<T, K>) => void;
272
+
273
+ export declare const registerChaiBlockSchema: (blockSchema: ChaiBlockSchema) => ChaiBlockSchemas;
274
+
275
+ export declare function registerChaiCollection<T = Record<any, any>>(id: string, collection: Omit<CollectionConfig<T>, "id">): void;
276
+
277
+ export declare const registerChaiFont: (family: string, font: Omit<ChaiFont, "family">) => void;
278
+
279
+ export declare const registerChaiGlobalDataProvider: <T>(globalDataProvider: (args: {
280
+ lang: string;
281
+ draft: boolean;
282
+ inBuilder: boolean;
283
+ }) => Promise<T>) => void;
284
+
285
+ export declare const registerChaiPageType: (key: string, pageTypeOptions: Omit<ChaiPageType, "key" | "hasSlug">) => void;
286
+
287
+ export declare const registerChaiPartialType: (key: string, pageTypeOptions: Omit<ChaiPageType, "key">) => void;
288
+
289
+ export declare const registerChaiServerBlock: <T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>>(component: default_2.ComponentType<ChaiBlockComponentProps<T>>, options: Pick<ChaiBlockDefinition<T, K>, "type" | "dataProvider" | "i18nProps" | "aiProps">) => void;
290
+
291
+ declare const REGISTERED_CHAI_BLOCKS: Record<string, ChaiBlockDefinition | ChaiServerBlockDefinition>;
292
+
293
+ export declare const runtimeProp: (options: ChaiBlockPropSchema) => ChaiBlockPropSchema;
294
+
295
+ export declare const setChaiBlockComponent: <T extends Record<string, any> = Record<string, any>>(type: keyof typeof REGISTERED_CHAI_BLOCKS, component: default_2.ComponentType<ChaiBlockComponentProps<T>>) => void;
296
+
297
+ export declare const setChaiBlockDataProvider: <K extends Record<string, any> = Record<string, any>>(type: string, dataProvider: (args: {
298
+ lang: string;
299
+ draft: boolean;
300
+ inBuilder: boolean;
301
+ block: ChaiBlock<K>;
302
+ pageProps: ChaiPageProps;
303
+ }) => Promise<K>) => void;
304
+
305
+ export declare const setChaiServerBlockDataProvider: <K extends Record<string, any> = Record<string, any>>(type: keyof typeof REGISTERED_CHAI_BLOCKS, dataProvider: (args: {
306
+ lang: string;
307
+ draft: boolean;
308
+ inBuilder: boolean;
309
+ block: ChaiBlock<K>;
310
+ pageProps: ChaiPageProps;
311
+ }) => Promise<K>) => void;
312
+
313
+ export declare const StylesProp: (defaultClasses?: string) => ChaiBlockPropSchema;
314
+
315
+ export declare const stylesProp: (defaultClasses?: string) => ChaiBlockPropSchema;
316
+
317
+ export declare const syncBlocksWithDefaults: (blocks: ChaiBlock[]) => ChaiBlock[];
318
+
319
+ export declare const useRegisteredChaiBlock: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>> | null;
320
+
321
+ export declare const useRegisteredChaiBlocks: () => Record<string, ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>>>;
322
+
323
+ export declare const useRegisteredFonts: () => ChaiFont[];
3
324
 
4
325
  export { }
5
-
6
- declare global {
7
- interface Window {
8
- clarity: any;
9
- }
10
- }
package/dist/runtime.js CHANGED
@@ -1 +1,74 @@
1
- export * from "@chaibuilder/runtime";
1
+ import { S as a } from "./STRINGS-BExFecZW.js";
2
+ import { keys as u, intersection as s, get as g, each as d, isEmpty as c, omit as h } from "lodash-es";
3
+ import { b as $, C as T, P as v, a as A, g as b, d as F, f as I, e as L, r as x, c as G, h as O, i as j } from "./register-partial-type-BjtdfKHE.js";
4
+ import { s as C } from "./core-BvsZwF26.js";
5
+ import { c as K, g as H, a as N, b as V, d as W, e as q, r as z, f as J, h as M, i as Q, u as U, j as X } from "./core-BvsZwF26.js";
6
+ import { a as ee, g as re, r as se, u as te } from "./fonts-DRly3Wzd.js";
7
+ const y = C, B = (e) => {
8
+ const i = ["_type", "_id", "_parent", "_bindings", "_name"], o = ["$loading", "blockProps", "inBuilder", "lang", "draft", "pageProps", "pageData", "children"], r = u(e.properties);
9
+ if (s(r, i).length > 0)
10
+ throw new Error(`Reserved props are not allowed: ${s(r, i).join(", ")}`);
11
+ if (s(r, o).length > 0)
12
+ throw new Error(`Runtime props are not allowed in schema: ${s(r, o).join(", ")}`);
13
+ const t = g(e, "properties", {}), n = {};
14
+ return d(t, (l, p) => {
15
+ c(l.ui) || (n[p] = { ...l.ui }, delete t[p].ui);
16
+ }), {
17
+ schema: c(t) ? {} : { ...h(e, ["ui"]) },
18
+ uiSchema: { ...g(e, "ui", {}), ...n }
19
+ };
20
+ }, k = (e = "") => (console.warn("StylesProp is deprecated, use stylesProp instead"), {
21
+ type: "string",
22
+ styles: !0,
23
+ default: `${a},${e}`,
24
+ ui: { "ui:widget": "hidden" }
25
+ }), S = (e = "") => ({
26
+ type: "string",
27
+ styles: !0,
28
+ default: `${a},${e}`,
29
+ ui: { "ui:widget": "hidden" }
30
+ }), w = (e) => (console.warn("runtimeProp is deprecated, use builderProp instead"), {
31
+ runtime: !0,
32
+ ...e
33
+ }), R = (e) => ({
34
+ builderProp: !0,
35
+ ...e
36
+ }), _ = (e) => `${a},${e}`;
37
+ export {
38
+ $ as CHAI_GLOBAL_DATA_PROVIDER,
39
+ T as COLLECTIONS,
40
+ v as PAGE_TYPES,
41
+ k as StylesProp,
42
+ R as builderProp,
43
+ K as closestBlockProp,
44
+ _ as defaultChaiStyles,
45
+ H as getAIBlockProps,
46
+ ee as getAllRegisteredFonts,
47
+ N as getBlockFormSchemas,
48
+ A as getChaiCollection,
49
+ b as getChaiCollections,
50
+ F as getChaiGlobalData,
51
+ I as getChaiPageType,
52
+ L as getChaiPageTypes,
53
+ V as getDefaultBlockProps,
54
+ W as getI18nBlockProps,
55
+ q as getRegisteredChaiBlock,
56
+ re as getRegisteredFont,
57
+ z as registerChaiBlock,
58
+ B as registerChaiBlockSchema,
59
+ x as registerChaiCollection,
60
+ se as registerChaiFont,
61
+ G as registerChaiGlobalDataProvider,
62
+ O as registerChaiPageType,
63
+ j as registerChaiPartialType,
64
+ J as registerChaiServerBlock,
65
+ w as runtimeProp,
66
+ M as setChaiBlockComponent,
67
+ y as setChaiBlockDataProvider,
68
+ C as setChaiServerBlockDataProvider,
69
+ S as stylesProp,
70
+ Q as syncBlocksWithDefaults,
71
+ U as useRegisteredChaiBlock,
72
+ X as useRegisteredChaiBlocks,
73
+ te as useRegisteredFonts
74
+ };