@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -20
- package/dist/2SSKDMRQ-BnsZi3K3.cjs +1 -0
- package/dist/2SSKDMRQ-CnSDkQcy.js +42 -0
- package/dist/AP7HFJJL-B31839PG.cjs +1228 -0
- package/dist/AP7HFJJL-CymCmW14.js +9214 -0
- package/dist/IconPicker-B1rWC-Ex.js +59 -0
- package/dist/IconPicker-DREyo007.cjs +1 -0
- package/dist/WDYDFRGG-BUVnbAci.js +33 -0
- package/dist/WDYDFRGG-BxhOCHc3.cjs +1 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
- package/dist/actions-registery-CZ1w0NKa.js +15545 -0
- package/dist/actions-registery-YnFmU21O.cjs +418 -0
- package/dist/actions.cjs +1 -0
- package/dist/actions.d.ts +3202 -0
- package/dist/actions.js +216 -0
- package/dist/active-in-another-tab-B47YjQGN.cjs +1 -0
- package/dist/active-in-another-tab-CyjngVA6.js +34 -0
- package/dist/add-new-language-page-88xzrUy8.cjs +1 -0
- package/dist/add-new-language-page-WmlCnytQ.js +401 -0
- package/dist/add-new-page-VW2wAYZp.js +31 -0
- package/dist/add-new-page-soZ8GAkN.cjs +1 -0
- package/dist/ai-panel-content-7zCil042.cjs +1 -0
- package/dist/ai-panel-content-D_o7Q_A-.js +61 -0
- package/dist/ai-panel-default-lang-COYaxNwn.cjs +3 -0
- package/dist/ai-panel-default-lang-DnElspF0.js +341 -0
- package/dist/ai-panel-other-lang-CkynNlAU.cjs +1 -0
- package/dist/ai-panel-other-lang-Dp0E9_Hx.js +162 -0
- package/dist/ai-prompt-input-Bhc0ds7X.js +655 -0
- package/dist/ai-prompt-input-CThbVp0_.cjs +1 -0
- package/dist/ai-translation-prompt-C2kJQFDX.cjs +1 -0
- package/dist/ai-translation-prompt-CZ55HQmo.js +28 -0
- package/dist/apply-binding-6iwlED02.js +833 -0
- package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
- package/dist/code-display-BnqzqzoP.cjs +1 -0
- package/dist/{code-display-337R7Dev.js → code-display-DhD_RBcg.js} +1 -1
- package/dist/code-editor-DRIAnNbb.js +50 -0
- package/dist/code-editor-o3___nu2.cjs +1 -0
- package/dist/common-functions-B3a4xKt_.cjs +1 -0
- package/dist/common-functions-D2lMFR6K.js +13 -0
- package/dist/continue-editing-in-this-client-CS2aQ7yY.js +24 -0
- package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +1 -0
- package/dist/core-BoRDjj4h.cjs +1 -0
- package/dist/core-yvI6kCyw.js +56 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +51 -383
- package/dist/core.js +39 -106
- package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-Byg6wV0O.js} +36 -36
- package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
- package/dist/delete-design-token-BRZZiWtQ.js +40 -0
- package/dist/delete-design-token-DkVs1oBf.cjs +1 -0
- package/dist/delete-page-BzyX9TN-.js +70 -0
- package/dist/delete-page-DxX7PFIE.cjs +1 -0
- package/dist/design-token-usage-CAHzEGgJ.cjs +1 -0
- package/dist/design-token-usage-xQs6SlaJ.js +113 -0
- package/dist/digital-asset-manager--uO8Agia.cjs +1 -0
- package/dist/digital-asset-manager-DbtwzxRz.js +876 -0
- package/dist/duplicate-page-BR7Dlo9d.js +133 -0
- package/dist/duplicate-page-CaNAbXwV.cjs +1 -0
- package/dist/dynamic-page-selector-Cb5r_W8s.js +85 -0
- package/dist/dynamic-page-selector-Cxk_gjni.cjs +1 -0
- package/dist/fonts-B-Xt29pe.cjs +1 -0
- package/dist/fonts-DRly3Wzd.js +78 -0
- package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
- package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
- package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
- package/dist/get-seo-defaults-9zHebckY.js +65 -0
- package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
- package/dist/image-compression-DZ9WMmyn.cjs +1 -0
- package/dist/image-compression-DsZ1oqpb.js +37 -0
- package/dist/image-editor-DV8kUKhl.js +108 -0
- package/dist/image-editor-G-K28aTS.cjs +1 -0
- package/dist/index-B-rSiAp_.cjs +1 -0
- package/dist/index-Ct7ElCGK.js +19069 -0
- package/dist/index-DF5DEvqb.cjs +160 -0
- package/dist/index-Dxfyt4d4.js +39 -0
- package/dist/index-WQwzsC7A.cjs +5 -0
- package/dist/index-ZuacEL1j.js +4732 -0
- package/dist/json-diff-viewer-D7z4zNvv.cjs +8 -0
- package/dist/json-diff-viewer-krslPepD.js +258 -0
- package/dist/lang-panel-BwIewMyw.js +215 -0
- package/dist/lang-panel-DT96k1xg.cjs +1 -0
- package/dist/manage-design-tokens-Caz_20VK.js +240 -0
- package/dist/manage-design-tokens-CrmLe7UT.cjs +1 -0
- package/dist/mark-as-template-D295ZQtU.js +156 -0
- package/dist/mark-as-template-W3LmpiqN.cjs +1 -0
- package/dist/models-5gOsRC56.cjs +1 -0
- package/dist/models-D95ZYr_x.js +70 -0
- package/dist/nested-path-selector-content-CKYYK-C5.js +87 -0
- package/dist/nested-path-selector-content-CoS_d3dc.cjs +1 -0
- package/dist/no-language-page-content-BvqRBP6y.js +42 -0
- package/dist/no-language-page-content-DkfeMl90.cjs +1 -0
- package/dist/no-language-page-dialog-BcEoqyQB.cjs +1 -0
- package/dist/no-language-page-dialog-PjNqTUpl.js +10 -0
- package/dist/page-creator-C4gc5NSC.cjs +1 -0
- package/dist/page-creator-DiOITEMw.js +795 -0
- package/dist/page-lock-BdYmCks0.cjs +1 -0
- package/dist/page-lock-Bfbs6RgL.js +30 -0
- package/dist/page-locked-dialog-B1FAtK92.cjs +1 -0
- package/dist/page-locked-dialog-B6MKTRfY.js +133 -0
- package/dist/page-manager-new-CHDueBDk.cjs +1 -0
- package/dist/page-manager-new-CzX22g2n.js +394 -0
- package/dist/page-manager-search-and-filter-CM0UMb6U.js +201 -0
- package/dist/page-manager-search-and-filter-DkkRIH86.cjs +1 -0
- package/dist/page-revisions-content-ChY-4f2V.cjs +1 -0
- package/dist/page-revisions-content-NH9JK4Ey.js +445 -0
- package/dist/pages.cjs +1 -0
- package/dist/pages.d.ts +491 -0
- package/dist/pages.js +27 -0
- package/dist/plugin-3ZKK6RXm.js +245 -0
- package/dist/plugin-C6rgJDNQ.cjs +22 -0
- package/dist/publish-pages-content-D9aixMN5.js +178 -0
- package/dist/publish-pages-content-x-JuSFJ9.cjs +1 -0
- package/dist/register-partial-type-BjtdfKHE.js +36 -0
- package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +26 -13
- package/dist/render.js +130 -124
- package/dist/rte-widget-modal-BaHIuEjF.cjs +1 -0
- package/dist/rte-widget-modal-DOJEXLIf.js +38 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +306 -7
- package/dist/runtime.js +44 -1
- package/dist/save-to-lib-Cgpxw8-g.cjs +1 -0
- package/dist/save-to-lib-eiOc_SSN.js +422 -0
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-BgRY82CT.cjs +16 -0
- package/dist/selected-block-display-CBFePS19.js +319 -0
- package/dist/seo-panel-C1-iMOR1.js +798 -0
- package/dist/seo-panel-DfAb8U7W.cjs +2 -0
- package/dist/shared-json-ld-B4PxAM_0.js +565 -0
- package/dist/shared-json-ld-DzG398hr.cjs +1 -0
- package/dist/slug-input-AwNJs9im.js +86 -0
- package/dist/slug-input-C_ijLQ_X.cjs +1 -0
- package/dist/supabase-actions.cjs +1 -0
- package/dist/supabase-actions.d.ts +284 -0
- package/dist/supabase-actions.js +524 -0
- package/dist/take-over-request-BNxcjY2j.cjs +1 -0
- package/dist/take-over-request-C4FeDtN_.js +63 -0
- package/dist/theme-panel-footer-Cq9pljro.cjs +1 -0
- package/dist/theme-panel-footer-uBQqSJXm.js +25 -0
- package/dist/translation-warning-modal-B64YqlbI.js +26 -0
- package/dist/translation-warning-modal-BZAcwM2_.cjs +1 -0
- package/dist/unmark-as-template-CZ9sQp_P.js +39 -0
- package/dist/unmark-as-template-EVvk0vmp.cjs +1 -0
- package/dist/unpublish-page-D4VwOlxc.js +27 -0
- package/dist/unpublish-page-bdSmwAVQ.cjs +1 -0
- package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
- package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
- package/dist/{tailwind.cjs → utils.cjs} +1 -1
- package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
- package/dist/utils.js +7 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +0 -6
- package/dist/web-blocks.js +248 -241
- package/dist/web-preview-Cio70gk5.cjs +1 -0
- package/dist/web-preview-Djy6WIyj.js +73 -0
- package/package.json +175 -105
- package/dist/IconPicker-CGWn9C4u.cjs +0 -1
- package/dist/IconPicker-QvxJ-4Ez.js +0 -64
- package/dist/apply-binding-DCno1xQL.js +0 -711
- package/dist/apply-binding-DvHNFLQD.cjs +0 -1
- package/dist/code-display-BZ1x7SqI.cjs +0 -1
- package/dist/code-editor-B28LoECM.cjs +0 -1
- package/dist/code-editor-CfG2FhJ-.js +0 -58
- package/dist/common-functions-BGzDsf1z.js +0 -14
- package/dist/common-functions-BZmyleS1.cjs +0 -1
- package/dist/css-import-modal-CENUYvcl.cjs +0 -13
- package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
- package/dist/index-CaGNHF7f.js +0 -12209
- package/dist/index-Gn6pJt2v.cjs +0 -166
- package/dist/mockServiceWorker.js +0 -307
- package/dist/plugin-B5627hMN.js +0 -195
- package/dist/plugin-UxTRfDum.cjs +0 -22
- package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
- package/dist/rte-widget-modal-Dte0od04.js +0 -41
- package/dist/tailwind.js +0 -7
- package/dist/tooltip-A4qGk781.cjs +0 -1
- package/dist/tooltip-tLiIOgjq.js +0 -1067
- package/dist/ui.cjs +0 -1
- package/dist/ui.d.ts +0 -415
- package/dist/ui.js +0 -129
- package/dist/vite.svg +0 -1
package/dist/render.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as O, b as N,
|
|
3
|
-
import {
|
|
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";
|
|
4
4
|
import { jsx as m } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import "
|
|
14
|
-
|
|
15
|
-
import ie from "@tailwindcss/container-queries";
|
|
16
|
-
async function oe(e) {
|
|
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";
|
|
8
|
+
import { createTailwindcss as X } from "@mhsdesign/jit-browser-tailwindcss";
|
|
9
|
+
import Y from "@tailwindcss/aspect-ratio";
|
|
10
|
+
import Z from "@tailwindcss/container-queries";
|
|
11
|
+
import ee from "@tailwindcss/forms";
|
|
12
|
+
import te from "@tailwindcss/typography";
|
|
13
|
+
import { c as ae, g as re } from "./get-chai-builder-theme-BYtp20KD.js";
|
|
14
|
+
async function ne(e) {
|
|
17
15
|
const t = {
|
|
18
16
|
pageProps: e.pageProps,
|
|
19
17
|
block: e.block,
|
|
@@ -21,45 +19,46 @@ async function oe(e) {
|
|
|
21
19
|
draft: e.draft,
|
|
22
20
|
inBuilder: !1
|
|
23
21
|
}, r = await e.dataProvider(t);
|
|
24
|
-
return
|
|
22
|
+
return P(r, "$metadata") && w(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, r.$metadata), e.children({
|
|
25
23
|
...q(r, "$metadata")
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
|
-
const
|
|
29
|
-
const { block: t, lang: r, fallbackLang: i, children: n, externalData: s, blocks: o, draft: a, pageProps: l, dataProviderMetadataCallback:
|
|
30
|
-
N(t, r === i ? "" : r,
|
|
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),
|
|
31
29
|
s,
|
|
32
|
-
{ index: _, key:
|
|
33
|
-
), g = E(t, !1),
|
|
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 = {
|
|
34
32
|
...f,
|
|
35
33
|
...g,
|
|
36
|
-
...
|
|
37
|
-
},
|
|
34
|
+
...x
|
|
35
|
+
}, v = {
|
|
38
36
|
blockProps: {},
|
|
39
37
|
inBuilder: !1,
|
|
40
38
|
lang: r || i,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
pageData: s,
|
|
40
|
+
...b
|
|
41
|
+
}, I = d(b, "_show", !0);
|
|
42
|
+
if (H(p) || !I) return null;
|
|
43
|
+
if (L) {
|
|
44
|
+
const D = d(c, "suspenseFallback", ie);
|
|
45
|
+
return /* @__PURE__ */ m(A, { fallback: u(D), children: /* @__PURE__ */ m(
|
|
46
|
+
ne,
|
|
48
47
|
{
|
|
49
48
|
lang: r,
|
|
50
49
|
pageProps: l,
|
|
51
|
-
block:
|
|
52
|
-
dataProvider:
|
|
53
|
-
...
|
|
50
|
+
block: b,
|
|
51
|
+
dataProvider: c.dataProvider,
|
|
52
|
+
...y ? { dataProviderMetadataCallback: y } : {},
|
|
54
53
|
draft: a,
|
|
55
|
-
children: (K) => p
|
|
56
|
-
...
|
|
54
|
+
children: (K) => u(p, {
|
|
55
|
+
...v,
|
|
57
56
|
...K,
|
|
58
57
|
children: n({
|
|
59
58
|
_id: t._id,
|
|
60
59
|
_type: t._type,
|
|
61
|
-
...
|
|
62
|
-
repeaterItems:
|
|
60
|
+
...B(f.repeaterItems) ? {
|
|
61
|
+
repeaterItems: C(f.repeaterItems, t),
|
|
63
62
|
$repeaterItemsKey: f.$repeaterItemsKey,
|
|
64
63
|
repeaterTotalItems: f.repeaterTotalItems ?? -1
|
|
65
64
|
} : {}
|
|
@@ -68,66 +67,66 @@ const se = () => /* @__PURE__ */ m("div", {}), le = (e) => {
|
|
|
68
67
|
}
|
|
69
68
|
) });
|
|
70
69
|
}
|
|
71
|
-
return /* @__PURE__ */ m(
|
|
72
|
-
...
|
|
70
|
+
return /* @__PURE__ */ m(A, { children: u(p, {
|
|
71
|
+
...v,
|
|
73
72
|
children: n({
|
|
74
73
|
_id: t._id,
|
|
75
74
|
_type: t._type,
|
|
76
|
-
...
|
|
77
|
-
repeaterItems:
|
|
75
|
+
...B(f.repeaterItems) ? {
|
|
76
|
+
repeaterItems: C(f.repeaterItems, t),
|
|
78
77
|
$repeaterItemsKey: f.$repeaterItemsKey,
|
|
79
78
|
repeaterTotalItems: f.repeaterTotalItems ?? -1
|
|
80
79
|
} : {}
|
|
81
80
|
})
|
|
82
81
|
}) });
|
|
83
|
-
},
|
|
82
|
+
}, F = (e) => {
|
|
84
83
|
const { blocks: t, parent: r, repeaterData: i, type: n } = e;
|
|
85
84
|
let s = W(
|
|
86
|
-
$(t, (a) =>
|
|
85
|
+
$(t, (a) => P(a, "_id") && (h(r) ? !a._parent : a._parent === r)),
|
|
87
86
|
"_id"
|
|
88
87
|
);
|
|
89
88
|
const o = (a) => $(t, (l) => l._parent === a).length > 0;
|
|
90
|
-
return (n === "Heading" || n === "Paragraph" || n === "Link") && (s = j(s)), U(s, (a) => a ? /* @__PURE__ */
|
|
91
|
-
|
|
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(
|
|
90
|
+
F,
|
|
92
91
|
{
|
|
93
92
|
...e,
|
|
94
93
|
parent: a._id,
|
|
95
|
-
key: `${
|
|
96
|
-
repeaterData: { index:
|
|
94
|
+
key: `${d(a, "_parent", "root")}-${a._id}-${k}`,
|
|
95
|
+
repeaterData: { index: k, dataKey: p }
|
|
97
96
|
}
|
|
98
|
-
)) : o(l) ? /* @__PURE__ */
|
|
99
|
-
|
|
97
|
+
)) : o(l) ? /* @__PURE__ */ u(
|
|
98
|
+
F,
|
|
100
99
|
{
|
|
101
100
|
...e,
|
|
102
101
|
parent: a._id,
|
|
103
|
-
key: `${
|
|
102
|
+
key: `${d(a, "_parent", "root")}-${a._id}`,
|
|
104
103
|
repeaterData: i,
|
|
105
104
|
type: a._type
|
|
106
105
|
}
|
|
107
106
|
) : null) : null);
|
|
108
107
|
}, V = (e, t, r) => h(r) ? {} : Object.entries(r).reduce((i, [n, s]) => {
|
|
109
108
|
const o = [];
|
|
110
|
-
let a =
|
|
109
|
+
let a = R(e, { _id: t });
|
|
111
110
|
for (; a; )
|
|
112
|
-
o.push(a), a =
|
|
113
|
-
const l =
|
|
114
|
-
return l && (i[n] =
|
|
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;
|
|
115
114
|
}, {});
|
|
116
|
-
function
|
|
115
|
+
function we(e) {
|
|
117
116
|
if (h(e.lang) && !h(e.fallbackLang))
|
|
118
117
|
throw new Error("lang prop is required when fallbackLang is provided");
|
|
119
118
|
if (h(e.blocks))
|
|
120
119
|
return null;
|
|
121
120
|
const t = e.lang ?? "en", r = e.fallbackLang ?? t;
|
|
122
|
-
return /* @__PURE__ */ m(
|
|
121
|
+
return /* @__PURE__ */ m(F, { ...e, lang: t, fallbackLang: r });
|
|
123
122
|
}
|
|
124
|
-
async function
|
|
123
|
+
async function se(e) {
|
|
125
124
|
const t = await e.dataProvider;
|
|
126
|
-
return
|
|
125
|
+
return P(t, "$metadata") && w(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, t.$metadata), e.children({
|
|
127
126
|
...q(t, "$metadata")
|
|
128
127
|
});
|
|
129
128
|
}
|
|
130
|
-
const
|
|
129
|
+
const le = () => /* @__PURE__ */ m("div", {}), de = async (e) => {
|
|
131
130
|
const {
|
|
132
131
|
block: t,
|
|
133
132
|
lang: r,
|
|
@@ -137,42 +136,44 @@ const de = () => /* @__PURE__ */ m("div", {}), ue = async (e) => {
|
|
|
137
136
|
blocks: o,
|
|
138
137
|
draft: a,
|
|
139
138
|
pageProps: l,
|
|
140
|
-
dataProviderMetadataCallback:
|
|
141
|
-
dataProviders:
|
|
142
|
-
} = e,
|
|
143
|
-
N(t, r === i ? "" : r,
|
|
139
|
+
dataProviderMetadataCallback: y,
|
|
140
|
+
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),
|
|
144
143
|
s,
|
|
145
|
-
{ index:
|
|
146
|
-
),
|
|
144
|
+
{ 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 = {
|
|
147
146
|
...g,
|
|
148
|
-
...
|
|
149
|
-
...
|
|
150
|
-
},
|
|
147
|
+
...x,
|
|
148
|
+
...L
|
|
149
|
+
}, I = {
|
|
151
150
|
blockProps: {},
|
|
152
151
|
inBuilder: !1,
|
|
153
152
|
lang: r || i,
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
pageData: s,
|
|
154
|
+
...v
|
|
155
|
+
}, D = d(v, "_show", !0);
|
|
156
156
|
if (H(_) || !D) return null;
|
|
157
|
-
if (
|
|
158
|
-
const K = c
|
|
159
|
-
return /* @__PURE__ */ m(
|
|
160
|
-
|
|
157
|
+
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(
|
|
160
|
+
se,
|
|
161
161
|
{
|
|
162
162
|
lang: r,
|
|
163
163
|
pageProps: l,
|
|
164
|
-
block:
|
|
164
|
+
block: v,
|
|
165
165
|
dataProvider: K,
|
|
166
|
-
...
|
|
166
|
+
...y ? { dataProviderMetadataCallback: y } : {},
|
|
167
167
|
draft: a,
|
|
168
|
-
children: (z) =>
|
|
169
|
-
...
|
|
168
|
+
children: (z) => u(_, {
|
|
169
|
+
...I,
|
|
170
|
+
draft: a,
|
|
170
171
|
...z,
|
|
171
172
|
children: n({
|
|
172
173
|
_id: t._id,
|
|
173
174
|
_type: t._type,
|
|
174
|
-
...
|
|
175
|
-
repeaterItems:
|
|
175
|
+
...B(g.repeaterItems) ? {
|
|
176
|
+
repeaterItems: C(g.repeaterItems, t),
|
|
176
177
|
$repeaterItemsKey: g.$repeaterItemsKey,
|
|
177
178
|
repeaterTotalItems: g.repeaterTotalItems ?? -1
|
|
178
179
|
} : {}
|
|
@@ -181,55 +182,59 @@ const de = () => /* @__PURE__ */ m("div", {}), ue = async (e) => {
|
|
|
181
182
|
}
|
|
182
183
|
) });
|
|
183
184
|
}
|
|
184
|
-
return
|
|
185
|
-
...
|
|
185
|
+
return u(_, {
|
|
186
|
+
...I,
|
|
187
|
+
draft: a,
|
|
186
188
|
children: n({
|
|
187
189
|
_id: t._id,
|
|
188
190
|
_type: t._type,
|
|
189
|
-
...
|
|
190
|
-
repeaterItems:
|
|
191
|
+
...B(g.repeaterItems) ? {
|
|
192
|
+
repeaterItems: C(g.repeaterItems, t),
|
|
191
193
|
$repeaterItemsKey: g.$repeaterItemsKey,
|
|
192
194
|
repeaterTotalItems: g.repeaterTotalItems ?? -1
|
|
193
195
|
} : {}
|
|
194
196
|
})
|
|
195
|
-
})
|
|
196
|
-
},
|
|
197
|
+
});
|
|
198
|
+
}, T = async (e) => {
|
|
197
199
|
const { blocks: t, parent: r, repeaterData: i, type: n } = e;
|
|
198
200
|
let s = W(
|
|
199
|
-
$(t, (a) =>
|
|
201
|
+
$(t, (a) => P(a, "_id") && (h(r) ? !a._parent : a._parent === r)),
|
|
200
202
|
"_id"
|
|
201
203
|
);
|
|
202
204
|
const o = (a) => $(t, (l) => l._parent === a).length > 0;
|
|
203
|
-
return (n === "Heading" || n === "Paragraph" || n === "Link") && (s = j(s)), U(s, (a) => a ? /* @__PURE__ */
|
|
204
|
-
|
|
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(
|
|
206
|
+
T,
|
|
205
207
|
{
|
|
206
208
|
...e,
|
|
207
209
|
parent: a._id,
|
|
208
|
-
key: `${
|
|
209
|
-
repeaterData: { index:
|
|
210
|
+
key: `${d(a, "_parent", "root")}-${a._id}-${k}`,
|
|
211
|
+
repeaterData: { index: k, dataKey: p }
|
|
210
212
|
}
|
|
211
|
-
)) : o(l) ? /* @__PURE__ */
|
|
212
|
-
|
|
213
|
+
)) : o(l) ? /* @__PURE__ */ u(
|
|
214
|
+
T,
|
|
213
215
|
{
|
|
214
216
|
...e,
|
|
215
217
|
parent: a._id,
|
|
216
|
-
key: `${
|
|
218
|
+
key: `${d(a, "_parent", "root")}-${a._id}`,
|
|
217
219
|
repeaterData: i,
|
|
218
220
|
type: a._type
|
|
219
221
|
}
|
|
220
222
|
) : null) : null);
|
|
221
223
|
};
|
|
222
|
-
async function
|
|
224
|
+
async function Ie(e) {
|
|
223
225
|
if (h(e.lang) && !h(e.fallbackLang))
|
|
224
226
|
throw new Error("lang prop is required when fallbackLang is provided");
|
|
225
227
|
if (h(e.blocks))
|
|
226
228
|
return null;
|
|
227
|
-
const t = e.lang ?? "en", r = e.fallbackLang ?? t
|
|
228
|
-
|
|
229
|
-
return
|
|
229
|
+
const t = e.lang ?? "en", r = e.fallbackLang ?? t;
|
|
230
|
+
if (e.dataProviders)
|
|
231
|
+
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));
|
|
230
235
|
}).reduce(
|
|
231
236
|
(s, o) => {
|
|
232
|
-
const a =
|
|
237
|
+
const a = S(o._type), l = {
|
|
233
238
|
pageProps: e.pageProps,
|
|
234
239
|
block: o,
|
|
235
240
|
lang: e.lang,
|
|
@@ -240,43 +245,43 @@ async function xe(e) {
|
|
|
240
245
|
},
|
|
241
246
|
{}
|
|
242
247
|
);
|
|
243
|
-
return /* @__PURE__ */ m(
|
|
248
|
+
return /* @__PURE__ */ m(T, { ...e, lang: t, fallbackLang: r, dataProviders: n });
|
|
244
249
|
}
|
|
245
|
-
function
|
|
246
|
-
const r = e.filter((
|
|
250
|
+
function Ce(e, t) {
|
|
251
|
+
const r = e.filter((i) => i._type === "GlobalBlock" || i._type === "PartialBlock");
|
|
247
252
|
for (let i = 0; i < r.length; i++) {
|
|
248
|
-
const n = r[i], s =
|
|
253
|
+
const n = r[i], s = d(n, "partialBlockId", d(n, "globalBlock", ""));
|
|
249
254
|
if (s === "") continue;
|
|
250
|
-
let o =
|
|
255
|
+
let o = Q(d(t, s, []));
|
|
251
256
|
n._parent && (o == null ? void 0 : o.length) > 0 && (o = o.map((l) => (h(l._parent) && (l._parent = n._parent), l)));
|
|
252
257
|
const a = e.indexOf(n);
|
|
253
258
|
e.splice(a, 1, ...o);
|
|
254
259
|
}
|
|
255
260
|
return e;
|
|
256
261
|
}
|
|
257
|
-
const
|
|
262
|
+
const $e = (e) => {
|
|
258
263
|
if (!e) return [];
|
|
259
264
|
try {
|
|
260
|
-
return JSON.parse(
|
|
265
|
+
return JSON.parse(ce(e)).filter((r) => !r._type.startsWith("@chai"));
|
|
261
266
|
} catch {
|
|
262
267
|
return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
|
|
263
268
|
}
|
|
264
269
|
};
|
|
265
|
-
function
|
|
270
|
+
function ce(e) {
|
|
266
271
|
const t = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
|
|
267
272
|
return e.replace(t, (r) => {
|
|
268
273
|
const i = decodeURIComponent(r), n = i.indexOf("public");
|
|
269
274
|
return n !== -1 ? i.substring(n + 6) : i;
|
|
270
275
|
});
|
|
271
276
|
}
|
|
272
|
-
async function
|
|
273
|
-
return await
|
|
277
|
+
async function pe(e, t = [], r = !1) {
|
|
278
|
+
return await X({
|
|
274
279
|
tailwindConfig: {
|
|
275
280
|
darkMode: "class",
|
|
276
281
|
safelist: t,
|
|
277
282
|
theme: {
|
|
278
283
|
extend: {
|
|
279
|
-
...
|
|
284
|
+
...re(),
|
|
280
285
|
keyframes: {
|
|
281
286
|
"accordion-down": {
|
|
282
287
|
from: {
|
|
@@ -301,7 +306,7 @@ async function ge(e, t = [], r = !1) {
|
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
},
|
|
304
|
-
plugins: [
|
|
309
|
+
plugins: [ee, te, Y, Z, ae],
|
|
305
310
|
corePlugins: { preflight: r }
|
|
306
311
|
}
|
|
307
312
|
}).generateStylesFromContent(
|
|
@@ -311,19 +316,20 @@ async function ge(e, t = [], r = !1) {
|
|
|
311
316
|
e
|
|
312
317
|
);
|
|
313
318
|
}
|
|
314
|
-
const
|
|
319
|
+
const ue = (e, t) => {
|
|
315
320
|
const r = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, n) => `#styles:${n.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
|
|
316
|
-
return
|
|
317
|
-
},
|
|
321
|
+
return pe([r], [], t);
|
|
322
|
+
}, Se = async (e, t = !1) => await ue(e, t);
|
|
318
323
|
export {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
Le as
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
Ie as AsyncRenderChaiBlocks,
|
|
325
|
+
we as RenderChaiBlocks,
|
|
326
|
+
Ae as applyChaiDataBinding,
|
|
327
|
+
Fe as applyDesignTokens,
|
|
328
|
+
Me as convertHTMLToChaiBlocks,
|
|
329
|
+
$e as convertToBlocks,
|
|
330
|
+
Le as getChaiThemeCssVariables,
|
|
331
|
+
Ce as getMergedPartialBlocks,
|
|
332
|
+
Se as getStylesForBlocks,
|
|
333
|
+
De as getThemeFontsCSSImport,
|
|
334
|
+
Ke as getThemeFontsLinkMarkup
|
|
329
335
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),p=({isOpen:m,onClose:i,editor:s,rteElement:f})=>{const a=t.usePageExternalData(),u=l=>{if(!s)return;const r=`{{${l}}}`;s.commands.focus();const{from:j,to:g}=s.state.selection;if(j!==g)s.chain().deleteSelection().insertContent(r).run();else{const{state:c}=s,n=c.selection.from,x=c.doc.textBetween(Math.max(0,n-1),n),o=c.doc.textBetween(n,Math.min(n+1,c.doc.content.size));let d="";n>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";o&&o!==" "&&!/[.,!?;:]/.test(o)&&(h=" "),s.chain().insertContent(d+r+h).run()}};return e.jsx(t.Dialog,{open:m,onOpenChange:l=>!l&&i(),children:e.jsxs(t.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(t.DialogHeader,{children:e.jsxs(t.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(t.NestedPathSelector,{data:a,onSelect:u})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(t.Button,{onClick:i,children:"Done"})})]})})};exports.default=p;
|
|
@@ -0,0 +1,38 @@
|
|
|
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-Ct7ElCGK.js";
|
|
3
|
+
const P = ({
|
|
4
|
+
isOpen: f,
|
|
5
|
+
onClose: i,
|
|
6
|
+
editor: t,
|
|
7
|
+
rteElement: x
|
|
8
|
+
}) => {
|
|
9
|
+
const a = D(), u = (c) => {
|
|
10
|
+
if (!t) return;
|
|
11
|
+
const r = `{{${c}}}`;
|
|
12
|
+
t.commands.focus();
|
|
13
|
+
const { from: p, to: g } = t.state.selection;
|
|
14
|
+
if (p !== g)
|
|
15
|
+
t.chain().deleteSelection().insertContent(r).run();
|
|
16
|
+
else {
|
|
17
|
+
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
|
+
let m = "";
|
|
21
|
+
o && o !== " " && !/[.,!?;:]/.test(o) && (m = " "), t.chain().insertContent(h + r + m).run();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
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: [
|
|
26
|
+
/* @__PURE__ */ e("span", { children: "Rich Text Editor" }),
|
|
27
|
+
a && Object.keys(a).length > 0 && /* @__PURE__ */ l("div", { className: "flex items-center", children: [
|
|
28
|
+
/* @__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
|
+
] })
|
|
31
|
+
] }) }),
|
|
32
|
+
x,
|
|
33
|
+
/* @__PURE__ */ e("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ e(B, { onClick: i, children: "Done" }) })
|
|
34
|
+
] }) });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
P as default
|
|
38
|
+
};
|
package/dist/runtime.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("
|
|
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;
|