@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
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { n as le, ac as re, ad as ie, a5 as de, ae as y, B as g, V as ce, D as q, d as G, e as j, f as L, p as z, q as P, r as oe, s as ue, t as me, v as U, af as he } from "./index-Ct7ElCGK.js";
|
|
3
|
+
import { ar as R, as as A, A as b, aw as $, az as fe, ap as I, ax as C, ay as w } from "./index-ZuacEL1j.js";
|
|
4
|
+
import { useQuery as pe, useQueryClient as O, useMutation as H } from "@tanstack/react-query";
|
|
5
|
+
import { format as D, formatDistanceToNow as xe } from "date-fns";
|
|
6
|
+
import { isEmpty as ge } from "lodash-es";
|
|
7
|
+
import { FileJson as Ne, CloudOff as be, Undo2 as J, Trash as Q, X as ye, Rocket as ve, Save as we, MoreHorizontal as De } from "lucide-react";
|
|
8
|
+
import * as v from "react";
|
|
9
|
+
import { useEffect as F, useState as Se, Suspense as Ee, lazy as Ce } from "react";
|
|
10
|
+
function Re(t) {
|
|
11
|
+
const s = R(), n = A();
|
|
12
|
+
return pe({
|
|
13
|
+
queryKey: [b.GET_PAGE_REVISIONS, t],
|
|
14
|
+
queryFn: async () => await n(s, {
|
|
15
|
+
action: b.GET_PAGE_REVISIONS,
|
|
16
|
+
data: { pageId: t }
|
|
17
|
+
}),
|
|
18
|
+
enabled: !!t,
|
|
19
|
+
refetchOnMount: !0
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const Ae = () => {
|
|
23
|
+
const t = R(), s = A(), n = O();
|
|
24
|
+
return H({
|
|
25
|
+
mutationFn: async (i) => await s(t, {
|
|
26
|
+
action: b.DELETE_PAGE_REVISION,
|
|
27
|
+
data: { revisionId: i }
|
|
28
|
+
}),
|
|
29
|
+
onSuccess: () => {
|
|
30
|
+
n.invalidateQueries({
|
|
31
|
+
queryKey: ["revisions"]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, Ie = () => {
|
|
36
|
+
const t = R(), s = A(), n = O();
|
|
37
|
+
return H({
|
|
38
|
+
mutationFn: async ({ revisionId: i, discardCurrent: l }) => await s(t, {
|
|
39
|
+
action: b.RESTORE_PAGE_REVISION,
|
|
40
|
+
data: { revisionId: i, discardCurrent: l }
|
|
41
|
+
}),
|
|
42
|
+
onSuccess: () => {
|
|
43
|
+
n.invalidateQueries({
|
|
44
|
+
queryKey: ["revisions"]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}, Oe = Ce(() => import("./json-diff-viewer-krslPepD.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600", children: [
|
|
49
|
+
/* @__PURE__ */ a("span", { className: "relative flex h-2 w-2", children: [
|
|
50
|
+
/* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
|
|
51
|
+
/* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Draft" })
|
|
54
|
+
] }) : t === "live" ? /* @__PURE__ */ a("span", { className: "flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary", children: [
|
|
55
|
+
/* @__PURE__ */ a("span", { className: "relative flex h-2 w-2", children: [
|
|
56
|
+
/* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75" }),
|
|
57
|
+
/* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-green-500" })
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Live" })
|
|
60
|
+
] }) : t === "published" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600", children: [
|
|
61
|
+
/* @__PURE__ */ e(ve, { className: "h-3 w-3" }),
|
|
62
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Published" })
|
|
63
|
+
] }) : t === "unsaved" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600", children: [
|
|
64
|
+
/* @__PURE__ */ e(we, { className: "h-3 w-3" }),
|
|
65
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Unsaved changes" })
|
|
66
|
+
] }) : /* @__PURE__ */ e("span", { className: "rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600", children: t });
|
|
67
|
+
function ke({ compare: t, setCompare: s }) {
|
|
68
|
+
const { data: n } = $(), { saveState: i } = ce(), [l] = fe();
|
|
69
|
+
if (!n) return null;
|
|
70
|
+
const d = !!t.find((o) => {
|
|
71
|
+
var r;
|
|
72
|
+
return (r = o == null ? void 0 : o.uid) == null ? void 0 : r.startsWith("draft:");
|
|
73
|
+
}), u = t.length >= 2 && !d, m = i === "UNSAVED";
|
|
74
|
+
return /* @__PURE__ */ a("div", { className: "relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50", children: [
|
|
75
|
+
/* @__PURE__ */ a("div", { className: "flex-1 space-y-1", children: [
|
|
76
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-sm font-medium leading-none", children: [
|
|
77
|
+
/* @__PURE__ */ e(N, { tag: "draft" }),
|
|
78
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children: "Currently editing" })
|
|
79
|
+
] }) }),
|
|
80
|
+
/* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(l.lastSaved) && /* @__PURE__ */ a("span", { children: [
|
|
81
|
+
"Last updated",
|
|
82
|
+
" ",
|
|
83
|
+
xe(new Date(l.lastSaved), {
|
|
84
|
+
addSuffix: !0
|
|
85
|
+
})
|
|
86
|
+
] }) }),
|
|
87
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 pt-0.5", children: m ? /* @__PURE__ */ e(N, { tag: "unsaved" }) : null })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ e(
|
|
90
|
+
K,
|
|
91
|
+
{
|
|
92
|
+
checked: d,
|
|
93
|
+
disabled: u,
|
|
94
|
+
onChange: () => {
|
|
95
|
+
s(d ? t.filter((o) => o.uid !== `draft:${n == null ? void 0 : n.id}`) : [
|
|
96
|
+
...t,
|
|
97
|
+
{ uid: `draft:${n == null ? void 0 : n.id}`, label: "draft", item: { createdAt: Date.now() } }
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
function Me() {
|
|
105
|
+
return /* @__PURE__ */ e("div", { className: "mt-2 space-y-2", children: Array.from({ length: 5 }).map((t, s) => /* @__PURE__ */ a("div", { className: "flex items-start gap-3 rounded-md border p-2", children: [
|
|
106
|
+
/* @__PURE__ */ a("div", { className: "flex-1 space-y-1", children: [
|
|
107
|
+
/* @__PURE__ */ e(y, { className: "h-4 w-3/4" }),
|
|
108
|
+
/* @__PURE__ */ e(y, { className: "h-3 w-1/2" }),
|
|
109
|
+
/* @__PURE__ */ e(y, { className: "mt-1 h-5 w-20" })
|
|
110
|
+
] }),
|
|
111
|
+
/* @__PURE__ */ e(y, { className: "h-8 w-8 rounded-full" })
|
|
112
|
+
] }, s)) });
|
|
113
|
+
}
|
|
114
|
+
function V({
|
|
115
|
+
revision: t,
|
|
116
|
+
isLatest: s,
|
|
117
|
+
onRestore: n,
|
|
118
|
+
onDelete: i,
|
|
119
|
+
revisionNumber: l,
|
|
120
|
+
compare: d,
|
|
121
|
+
setCompare: u,
|
|
122
|
+
pageId: m
|
|
123
|
+
}) {
|
|
124
|
+
const { data: o } = I(t.currentEditor), r = (o == null ? void 0 : o.name) || "Unknown", f = !!d.find((h) => {
|
|
125
|
+
var x;
|
|
126
|
+
return s ? (x = h == null ? void 0 : h.uid) == null ? void 0 : x.startsWith("live") : (h == null ? void 0 : h.uid) === t.uid;
|
|
127
|
+
}), S = d.length >= 2 && !f;
|
|
128
|
+
return /* @__PURE__ */ a("div", { className: "relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50", children: [
|
|
129
|
+
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3", children: [
|
|
130
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("p", { className: "flex items-center gap-1 text-xs leading-none", children: [
|
|
131
|
+
/* @__PURE__ */ e(N, { tag: s ? "live" : `#${l}` }),
|
|
132
|
+
t.type === "published" ? "Published" : "Draft",
|
|
133
|
+
" by ",
|
|
134
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children: r })
|
|
135
|
+
] }) }),
|
|
136
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-x-3", children: [
|
|
137
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: t.type === "published" ? /* @__PURE__ */ e(N, { tag: "published" }) : /* @__PURE__ */ e(N, { tag: "draft" }) }),
|
|
138
|
+
/* @__PURE__ */ e("div", { className: "flex items-center text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("span", { className: "leading-tight", children: D(t.createdAt, "MMM d, h:mm a") }) })
|
|
139
|
+
] })
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(C, { permissions: [w.RESTORE_REVISION, w.DELETE_REVISION], children: /* @__PURE__ */ e(_e, { revision: t, onRestore: n, onDelete: i }) }) }),
|
|
142
|
+
/* @__PURE__ */ e(
|
|
143
|
+
K,
|
|
144
|
+
{
|
|
145
|
+
checked: f,
|
|
146
|
+
disabled: S,
|
|
147
|
+
onChange: () => {
|
|
148
|
+
u(
|
|
149
|
+
f ? d.filter((h) => s ? h.uid !== `live:${m}` : h.uid !== t.uid) : [
|
|
150
|
+
...d,
|
|
151
|
+
{
|
|
152
|
+
uid: s ? `live:${m}` : t.uid,
|
|
153
|
+
label: s ? "live" : `#${l}`,
|
|
154
|
+
item: t
|
|
155
|
+
}
|
|
156
|
+
].sort((h, x) => new Date(h.item.createdAt).getTime() - new Date(x.item.createdAt).getTime())
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] });
|
|
162
|
+
}
|
|
163
|
+
function Te({ compare: t, setCompare: s, pageId: n }) {
|
|
164
|
+
const [i, l] = Se(!1), [d, u] = t;
|
|
165
|
+
if (t.length === 0) return null;
|
|
166
|
+
const m = ({ tab: o }) => /* @__PURE__ */ a("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
|
|
167
|
+
/* @__PURE__ */ e(N, { tag: o.label }),
|
|
168
|
+
/* @__PURE__ */ e(
|
|
169
|
+
"button",
|
|
170
|
+
{
|
|
171
|
+
className: "z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",
|
|
172
|
+
style: { lineHeight: 1 },
|
|
173
|
+
onClick: () => s(t.filter((r) => r.uid !== o.uid)),
|
|
174
|
+
"aria-label": "Remove selection 1",
|
|
175
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3 w-3" })
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] });
|
|
179
|
+
return /* @__PURE__ */ a("div", { className: "mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm", children: [
|
|
180
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-x-2 text-xs", children: [
|
|
181
|
+
/* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "Compare" }),
|
|
182
|
+
d && /* @__PURE__ */ e(m, { tab: d }),
|
|
183
|
+
/* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "with" }),
|
|
184
|
+
u ? /* @__PURE__ */ e(m, { tab: u }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-2 pb-0.5 pt-2", children: [
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
g,
|
|
189
|
+
{
|
|
190
|
+
size: "sm",
|
|
191
|
+
className: "h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",
|
|
192
|
+
variant: "outline",
|
|
193
|
+
onClick: () => s([]),
|
|
194
|
+
children: /* @__PURE__ */ e("span", { children: " Clear" })
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ a(
|
|
198
|
+
g,
|
|
199
|
+
{
|
|
200
|
+
size: "sm",
|
|
201
|
+
className: "h-6 gap-1 rounded px-2 text-xs leading-none",
|
|
202
|
+
variant: "default",
|
|
203
|
+
onClick: () => l(!0),
|
|
204
|
+
disabled: t.length < 2,
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ e(Ne, { className: "h-2.5 w-2.5" }),
|
|
207
|
+
/* @__PURE__ */ e("span", { className: "pt-0.5", children: "Show JSON Diff" })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] }),
|
|
212
|
+
i && (t == null ? void 0 : t.length) > 1 && n && /* @__PURE__ */ e(
|
|
213
|
+
Ee,
|
|
214
|
+
{
|
|
215
|
+
fallback: /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ e("span", { className: "text-sm", children: "Loading diff viewer..." }) }),
|
|
216
|
+
children: /* @__PURE__ */ e(Oe, { open: i, onOpenChange: l, compare: t })
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
function K({ checked: t, disabled: s, onChange: n, label: i = "Compare" }) {
|
|
222
|
+
return /* @__PURE__ */ e("div", { className: "absolute bottom-2 right-2", children: /* @__PURE__ */ a("label", { className: `flex cursor-pointer items-center gap-x-1 text-[11px] ${s ? "opacity-50" : ""}`, children: [
|
|
223
|
+
/* @__PURE__ */ e(
|
|
224
|
+
"input",
|
|
225
|
+
{
|
|
226
|
+
type: "checkbox",
|
|
227
|
+
className: "h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",
|
|
228
|
+
checked: t,
|
|
229
|
+
disabled: s,
|
|
230
|
+
onChange: n
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ e("span", { className: "select-none leading-tight", children: i })
|
|
234
|
+
] }) });
|
|
235
|
+
}
|
|
236
|
+
function _e({ revision: t, onRestore: s, onDelete: n }) {
|
|
237
|
+
return /* @__PURE__ */ a(oe, { children: [
|
|
238
|
+
/* @__PURE__ */ e(ue, { asChild: !0, children: /* @__PURE__ */ a(g, { variant: "ghost", size: "icon", className: "h-5 w-5", children: [
|
|
239
|
+
/* @__PURE__ */ e(De, { className: "h-4 w-4" }),
|
|
240
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "More options" })
|
|
241
|
+
] }) }),
|
|
242
|
+
/* @__PURE__ */ a(me, { align: "end", className: "text-xs", children: [
|
|
243
|
+
/* @__PURE__ */ e(C, { permission: w.RESTORE_REVISION, children: /* @__PURE__ */ a(U, { onClick: s, className: "cursor-pointer text-sm", children: [
|
|
244
|
+
/* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
|
|
245
|
+
/* @__PURE__ */ e("span", { children: "Restore this version" })
|
|
246
|
+
] }) }),
|
|
247
|
+
/* @__PURE__ */ e(C, { permission: w.DELETE_REVISION, children: t.uid !== "current" && /* @__PURE__ */ a(p, { children: [
|
|
248
|
+
/* @__PURE__ */ e(he, {}),
|
|
249
|
+
/* @__PURE__ */ a(U, { onClick: n, className: "cursor-pointer text-destructive", children: [
|
|
250
|
+
/* @__PURE__ */ e(Q, { className: "mr-2 h-4 w-4" }),
|
|
251
|
+
/* @__PURE__ */ e("span", { children: "Delete this version" })
|
|
252
|
+
] })
|
|
253
|
+
] }) })
|
|
254
|
+
] })
|
|
255
|
+
] });
|
|
256
|
+
}
|
|
257
|
+
function Ue({
|
|
258
|
+
open: t,
|
|
259
|
+
onOpenChange: s,
|
|
260
|
+
revision: n,
|
|
261
|
+
onRestore: i,
|
|
262
|
+
isRestoring: l
|
|
263
|
+
}) {
|
|
264
|
+
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), u = (d == null ? void 0 : d.name) || "Unknown";
|
|
265
|
+
return n ? /* @__PURE__ */ e(
|
|
266
|
+
q,
|
|
267
|
+
{
|
|
268
|
+
open: t,
|
|
269
|
+
onOpenChange: (m) => {
|
|
270
|
+
l || s(m);
|
|
271
|
+
},
|
|
272
|
+
children: /* @__PURE__ */ a(G, { className: "sm:max-w-md", children: [
|
|
273
|
+
/* @__PURE__ */ a(j, { children: [
|
|
274
|
+
/* @__PURE__ */ e(L, { children: "Restore Revision" }),
|
|
275
|
+
/* @__PURE__ */ a(z, { children: [
|
|
276
|
+
"You are about to restore to revision ",
|
|
277
|
+
n.uid.substring(0, 8),
|
|
278
|
+
" from",
|
|
279
|
+
" ",
|
|
280
|
+
D(n.createdAt, "MMM d, yyyy 'at' h:mm a"),
|
|
281
|
+
" by ",
|
|
282
|
+
u
|
|
283
|
+
] })
|
|
284
|
+
] }),
|
|
285
|
+
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "How would you like to handle your current edits?" }) }),
|
|
286
|
+
/* @__PURE__ */ a(P, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
287
|
+
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: l, children: l ? /* @__PURE__ */ a(p, { children: [
|
|
288
|
+
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
289
|
+
"Saving as draft..."
|
|
290
|
+
] }) : /* @__PURE__ */ a(p, { children: [
|
|
291
|
+
/* @__PURE__ */ e(be, { className: "mr-2 h-4 w-4" }),
|
|
292
|
+
"Save as draft"
|
|
293
|
+
] }) }),
|
|
294
|
+
/* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled: l, children: l ? /* @__PURE__ */ a(p, { children: [
|
|
295
|
+
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
296
|
+
"Discarding current..."
|
|
297
|
+
] }) : /* @__PURE__ */ a(p, { children: [
|
|
298
|
+
/* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
|
|
299
|
+
"Discard current"
|
|
300
|
+
] }) })
|
|
301
|
+
] })
|
|
302
|
+
] })
|
|
303
|
+
}
|
|
304
|
+
) : null;
|
|
305
|
+
}
|
|
306
|
+
function Fe({
|
|
307
|
+
open: t,
|
|
308
|
+
onOpenChange: s,
|
|
309
|
+
revision: n,
|
|
310
|
+
onDelete: i,
|
|
311
|
+
isDeleting: l
|
|
312
|
+
}) {
|
|
313
|
+
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), u = (d == null ? void 0 : d.name) || "Unknown";
|
|
314
|
+
return n ? /* @__PURE__ */ e(
|
|
315
|
+
q,
|
|
316
|
+
{
|
|
317
|
+
open: t,
|
|
318
|
+
onOpenChange: (m) => {
|
|
319
|
+
l || s(m);
|
|
320
|
+
},
|
|
321
|
+
children: /* @__PURE__ */ a(G, { className: "sm:max-w-md", children: [
|
|
322
|
+
/* @__PURE__ */ a(j, { children: [
|
|
323
|
+
/* @__PURE__ */ e(L, { children: "Delete Revision" }),
|
|
324
|
+
/* @__PURE__ */ a(z, { children: [
|
|
325
|
+
"You are about to delete revision ",
|
|
326
|
+
n.uid.substring(0, 8),
|
|
327
|
+
" from",
|
|
328
|
+
" ",
|
|
329
|
+
D(n.createdAt, "MMM d, yyyy 'at' h:mm a"),
|
|
330
|
+
" by ",
|
|
331
|
+
u
|
|
332
|
+
] })
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This action cannot be undone. Are you sure you want to proceed?" }) }),
|
|
335
|
+
/* @__PURE__ */ a(P, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
336
|
+
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: l, children: "Cancel" }),
|
|
337
|
+
/* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: l, children: l ? /* @__PURE__ */ a(p, { children: [
|
|
338
|
+
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
339
|
+
"Deleting..."
|
|
340
|
+
] }) : /* @__PURE__ */ a(p, { children: [
|
|
341
|
+
/* @__PURE__ */ e(Q, { className: "mr-2 h-4 w-4" }),
|
|
342
|
+
"Delete Revision"
|
|
343
|
+
] }) })
|
|
344
|
+
] })
|
|
345
|
+
] })
|
|
346
|
+
}
|
|
347
|
+
) : null;
|
|
348
|
+
}
|
|
349
|
+
function He({ isOpen: t }) {
|
|
350
|
+
var T, _;
|
|
351
|
+
const [s, n] = v.useState([]), [i, l] = v.useState(null), [d, u] = v.useState(!1), [m, o] = v.useState(!1), { data: r } = $(), { data: f, isFetching: S, error: h, refetch: x } = Re(r == null ? void 0 : r.id), { mutate: B, isPending: W } = Ae(), { mutate: Y, isPending: X } = Ie(), Z = O(), { selectedLang: ee, fallbackLang: te } = le(), ae = ee || te;
|
|
352
|
+
F(() => n([]), [r == null ? void 0 : r.id]);
|
|
353
|
+
const ne = (c) => {
|
|
354
|
+
i && Y(
|
|
355
|
+
{ revisionId: i.uid, discardCurrent: c },
|
|
356
|
+
{
|
|
357
|
+
onSuccess: () => {
|
|
358
|
+
u(!1), l(null), Z.invalidateQueries({
|
|
359
|
+
queryKey: [b.GET_DRAFT_PAGE]
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
}, k = (c) => {
|
|
365
|
+
l(c), u(!0);
|
|
366
|
+
}, M = (c) => {
|
|
367
|
+
l(c), o(!0);
|
|
368
|
+
}, se = () => {
|
|
369
|
+
i && B(i.uid, {
|
|
370
|
+
/**
|
|
371
|
+
* Callback for when deletion of a revision is successful. Closes the
|
|
372
|
+
* delete dialog and resets the selected revision to null.
|
|
373
|
+
*/
|
|
374
|
+
onSuccess: () => {
|
|
375
|
+
o(!1), l(null);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
return F(() => {
|
|
380
|
+
t && x();
|
|
381
|
+
}, [t, x]), /* @__PURE__ */ a(p, { children: [
|
|
382
|
+
/* @__PURE__ */ a(re, { children: [
|
|
383
|
+
/* @__PURE__ */ e(ie, { children: "Revision History" }),
|
|
384
|
+
(r == null ? void 0 : r.createdAt) && /* @__PURE__ */ a("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
385
|
+
"Page created on ",
|
|
386
|
+
D(new Date(r.createdAt), "MMM d, yyyy 'at' h:mm a")
|
|
387
|
+
] })
|
|
388
|
+
] }),
|
|
389
|
+
S ? /* @__PURE__ */ e(Me, {}) : h ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "Failed to load revisions. Please try again." }) : /* @__PURE__ */ a("div", { className: "mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2", children: [
|
|
390
|
+
/* @__PURE__ */ e(Te, { lang: ae, compare: s, setCompare: n, pageId: r == null ? void 0 : r.id }),
|
|
391
|
+
/* @__PURE__ */ e(ke, { compare: s, setCompare: n }),
|
|
392
|
+
(T = f == null ? void 0 : f.filter((c) => c.uid === "current")) == null ? void 0 : T.map((c, E) => /* @__PURE__ */ e(
|
|
393
|
+
V,
|
|
394
|
+
{
|
|
395
|
+
pageId: r == null ? void 0 : r.id,
|
|
396
|
+
revision: c,
|
|
397
|
+
isLatest: !0,
|
|
398
|
+
onRestore: () => k(c),
|
|
399
|
+
onDelete: () => M(c),
|
|
400
|
+
revisionNumber: E,
|
|
401
|
+
compare: s,
|
|
402
|
+
setCompare: n
|
|
403
|
+
},
|
|
404
|
+
c.uid
|
|
405
|
+
)),
|
|
406
|
+
/* @__PURE__ */ e(de, { className: "min-h-0 flex-1", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: (_ = f == null ? void 0 : f.filter((c) => c.uid !== "current")) == null ? void 0 : _.map((c, E) => /* @__PURE__ */ e(
|
|
407
|
+
V,
|
|
408
|
+
{
|
|
409
|
+
pageId: r == null ? void 0 : r.id,
|
|
410
|
+
revision: c,
|
|
411
|
+
isLatest: c.uid === "current",
|
|
412
|
+
onRestore: () => k(c),
|
|
413
|
+
onDelete: () => M(c),
|
|
414
|
+
revisionNumber: E + 1,
|
|
415
|
+
compare: s,
|
|
416
|
+
setCompare: n
|
|
417
|
+
},
|
|
418
|
+
c.uid
|
|
419
|
+
)) }) })
|
|
420
|
+
] }),
|
|
421
|
+
/* @__PURE__ */ e(
|
|
422
|
+
Ue,
|
|
423
|
+
{
|
|
424
|
+
open: d,
|
|
425
|
+
onOpenChange: u,
|
|
426
|
+
revision: i,
|
|
427
|
+
onRestore: ne,
|
|
428
|
+
isRestoring: X
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
/* @__PURE__ */ e(
|
|
432
|
+
Fe,
|
|
433
|
+
{
|
|
434
|
+
open: m,
|
|
435
|
+
onOpenChange: o,
|
|
436
|
+
revision: i,
|
|
437
|
+
onDelete: se,
|
|
438
|
+
isDeleting: W
|
|
439
|
+
}
|
|
440
|
+
)
|
|
441
|
+
] });
|
|
442
|
+
}
|
|
443
|
+
export {
|
|
444
|
+
He as default
|
|
445
|
+
};
|
package/dist/pages.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-WQwzsC7A.cjs");exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.PermissionChecker=e.PermissionChecker;exports.useActivePage=e.useActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiCurrentPage=e.useChaiCurrentPage;exports.useChaiUserInfo=e.useChaiUserInfo;exports.useClearAll=e.useClearAll;exports.useFallbackLang=e.useFallbackLang;exports.useFetch=e.useFetch;exports.useGotoPage=e.useGotoPage;exports.useLanguagePages=e.useLanguagePages;exports.usePageTypes=e.usePageTypes;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useUserRoleAndPermissions;exports.useWebsitePages=e.useWebsitePages;exports.useWebsiteSetting=e.useWebsiteSetting;
|