@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,133 @@
|
|
|
1
|
+
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { D as A, d as C, e as T, f as w, p as F, L as v, I as L, A as _, B as D } from "./index-Ct7ElCGK.js";
|
|
3
|
+
import { ar as q, as as G, A as U, at as j } from "./index-ZuacEL1j.js";
|
|
4
|
+
import { useQueryClient as $, useMutation as B } from "@tanstack/react-query";
|
|
5
|
+
import { toast as P } from "sonner";
|
|
6
|
+
import { isEmpty as O, initial as M } from "lodash-es";
|
|
7
|
+
import { AlertCircle as Q } from "lucide-react";
|
|
8
|
+
import { useState as p } from "react";
|
|
9
|
+
import { useTranslation as V } from "react-i18next";
|
|
10
|
+
import { S as k } from "./slug-input-AwNJs9im.js";
|
|
11
|
+
const H = () => {
|
|
12
|
+
const s = q(), o = $(), g = G();
|
|
13
|
+
return B({
|
|
14
|
+
mutationFn: async ({ pageId: e, name: h, slug: r }) => {
|
|
15
|
+
const u = {
|
|
16
|
+
pageId: e,
|
|
17
|
+
name: h
|
|
18
|
+
};
|
|
19
|
+
return r && (u.slug = r), await g(s, {
|
|
20
|
+
action: "DUPLICATE_PAGE",
|
|
21
|
+
data: u
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onSuccess: () => {
|
|
25
|
+
o.invalidateQueries({
|
|
26
|
+
queryKey: [U.GET_WEBSITE_PAGES]
|
|
27
|
+
}), P.success("Page duplicated successfully");
|
|
28
|
+
},
|
|
29
|
+
onError: (e) => {
|
|
30
|
+
P.error("Failed to duplicate page", {
|
|
31
|
+
description: e.message || "An error occurred while duplicating the page"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, se = ({
|
|
36
|
+
page: s,
|
|
37
|
+
onClose: o,
|
|
38
|
+
closePanel: g = () => {
|
|
39
|
+
}
|
|
40
|
+
}) => {
|
|
41
|
+
const { t: e } = V(), { mutate: h, isPending: r } = H(), [u, i] = p(null), [m, I] = p(`${s.name} (Copy)`), x = j(), l = O(s.slug), [d, E] = p(l ? "" : `${s.slug.split("/").pop()}-copy`), y = l ? "" : M(s.slug.split("/")).join("/"), [N, f] = p(!1), b = (n) => {
|
|
42
|
+
if (n.preventDefault(), !m.trim()) {
|
|
43
|
+
i(e("Name is required"));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!l && !d.trim()) {
|
|
47
|
+
i(e("Slug is required"));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
i(null), f(!0);
|
|
51
|
+
const S = {
|
|
52
|
+
pageId: s.id,
|
|
53
|
+
name: m
|
|
54
|
+
};
|
|
55
|
+
l || (S.slug = `${y}/${d}`), h(S, {
|
|
56
|
+
onSuccess: (c) => {
|
|
57
|
+
f(!1), o(), x(c.id, g);
|
|
58
|
+
},
|
|
59
|
+
onError: (c) => {
|
|
60
|
+
f(!1), c.code === "SLUG_EXISTS" ? i(e("A page with this slug already exists. Please choose a different slug.")) : c.code === "INVALID_SLUG" ? i(e("The slug format is invalid. Please use only lowercase letters, numbers, and hyphens.")) : c.code === "PERMISSION_DENIED" ? i(e("You don't have permission to duplicate this page.")) : i(c.message || e("Failed to duplicate page. Please try again later."));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ t(A, { open: !!s, onOpenChange: o, children: /* @__PURE__ */ a(C, { className: "sm:max-w-[425px]", children: [
|
|
65
|
+
/* @__PURE__ */ a(T, { children: [
|
|
66
|
+
/* @__PURE__ */ t(w, { children: e("Duplicate Page") }),
|
|
67
|
+
/* @__PURE__ */ t(F, { children: e("Create a copy of the page with a new name and slug") })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ a("div", { className: "mb-4 rounded-md bg-gray-50 p-3", children: [
|
|
70
|
+
/* @__PURE__ */ a("h3", { className: "mb-1 text-sm font-medium", children: [
|
|
71
|
+
e("Duplicating:"),
|
|
72
|
+
":"
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col gap-1 text-sm text-gray-700", children: [
|
|
75
|
+
/* @__PURE__ */ a("div", { children: [
|
|
76
|
+
/* @__PURE__ */ a("span", { className: "font-medium", children: [
|
|
77
|
+
e("Name"),
|
|
78
|
+
":"
|
|
79
|
+
] }),
|
|
80
|
+
" ",
|
|
81
|
+
s.name
|
|
82
|
+
] }),
|
|
83
|
+
!l && /* @__PURE__ */ a("div", { children: [
|
|
84
|
+
/* @__PURE__ */ a("span", { className: "font-medium", children: [
|
|
85
|
+
e("Slug"),
|
|
86
|
+
":"
|
|
87
|
+
] }),
|
|
88
|
+
" ",
|
|
89
|
+
s.slug
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ a("div", { children: [
|
|
92
|
+
/* @__PURE__ */ a("span", { className: "font-medium", children: [
|
|
93
|
+
e("Type"),
|
|
94
|
+
":"
|
|
95
|
+
] }),
|
|
96
|
+
" ",
|
|
97
|
+
s.pageType
|
|
98
|
+
] })
|
|
99
|
+
] })
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ a("form", { onSubmit: b, className: "space-y-4", children: [
|
|
102
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
103
|
+
/* @__PURE__ */ t(v, { htmlFor: "name", className: "text-sm", children: e("Name") }),
|
|
104
|
+
/* @__PURE__ */ t(L, { id: "name", value: m, onChange: (n) => I(n.target.value), required: !0 })
|
|
105
|
+
] }),
|
|
106
|
+
!l && /* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
107
|
+
/* @__PURE__ */ t(v, { htmlFor: "slug", className: "text-sm", children: e("Slug") }),
|
|
108
|
+
/* @__PURE__ */ t(
|
|
109
|
+
k,
|
|
110
|
+
{
|
|
111
|
+
value: d,
|
|
112
|
+
onChange: (n) => E(n),
|
|
113
|
+
parentSlug: y,
|
|
114
|
+
onValidationChange: (n) => {
|
|
115
|
+
i(n ? null : e("Invalid slug"));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }),
|
|
120
|
+
u && /* @__PURE__ */ a(_, { variant: "destructive", className: "py-2", children: [
|
|
121
|
+
/* @__PURE__ */ t(Q, { className: "h-4 w-4" }),
|
|
122
|
+
/* @__PURE__ */ t("span", { className: "text-sm", children: u })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
|
|
125
|
+
/* @__PURE__ */ t(D, { type: "button", variant: "outline", onClick: o, disabled: r, children: e("Cancel") }),
|
|
126
|
+
/* @__PURE__ */ t(D, { type: "submit", disabled: !m.trim() || !l && !d.trim() || r || N, children: e(r || N ? "Duplicating..." : "Duplicate") })
|
|
127
|
+
] })
|
|
128
|
+
] })
|
|
129
|
+
] }) });
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
se as default
|
|
133
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-DF5DEvqb.cjs"),p=require("./index-WQwzsC7A.cjs"),N=require("@tanstack/react-query"),v=require("sonner"),P=require("lodash-es"),E=require("lucide-react"),g=require("react"),C=require("react-i18next"),A=require("./slug-input-C_ijLQ_X.cjs"),T=()=>{const t=p.useApiUrl(),u=N.useQueryClient(),h=p.useFetch();return N.useMutation({mutationFn:async({pageId:s,name:x,slug:r})=>{const o={pageId:s,name:x};return r&&(o.slug=r),await h(t,{action:"DUPLICATE_PAGE",data:o})},onSuccess:()=>{u.invalidateQueries({queryKey:[p.ACTIONS.GET_WEBSITE_PAGES]}),v.toast.success("Page duplicated successfully")},onError:s=>{v.toast.error("Failed to duplicate page",{description:s.message||"An error occurred while duplicating the page"})}})},w=({page:t,onClose:u,closePanel:h=()=>{}})=>{const{t:s}=C.useTranslation(),{mutate:x,isPending:r}=T(),[o,i]=g.useState(null),[d,D]=g.useState(`${t.name} (Copy)`),I=p.useChangePage(),n=P.isEmpty(t.slug),[m,b]=g.useState(n?"":`${t.slug.split("/").pop()}-copy`),f=n?"":P.initial(t.slug.split("/")).join("/"),[y,j]=g.useState(!1),q=l=>{if(l.preventDefault(),!d.trim()){i(s("Name is required"));return}if(!n&&!m.trim()){i(s("Slug is required"));return}i(null),j(!0);const S={pageId:t.id,name:d};n||(S.slug=`${f}/${m}`),x(S,{onSuccess:c=>{j(!1),u(),I(c.id,h)},onError:c=>{j(!1),c.code==="SLUG_EXISTS"?i(s("A page with this slug already exists. Please choose a different slug.")):c.code==="INVALID_SLUG"?i(s("The slug format is invalid. Please use only lowercase letters, numbers, and hyphens.")):c.code==="PERMISSION_DENIED"?i(s("You don't have permission to duplicate this page.")):i(c.message||s("Failed to duplicate page. Please try again later."))}})};return e.jsx(a.Dialog,{open:!!t,onOpenChange:u,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:s("Duplicate Page")}),e.jsx(a.DialogDescription,{children:s("Create a copy of the page with a new name and slug")})]}),e.jsxs("div",{className:"mb-4 rounded-md bg-gray-50 p-3",children:[e.jsxs("h3",{className:"mb-1 text-sm font-medium",children:[s("Duplicating:"),":"]}),e.jsxs("div",{className:"flex flex-col gap-1 text-sm text-gray-700",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Name"),":"]})," ",t.name]}),!n&&e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Slug"),":"]})," ",t.slug]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Type"),":"]})," ",t.pageType]})]})]}),e.jsxs("form",{onSubmit:q,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"name",className:"text-sm",children:s("Name")}),e.jsx(a.Input,{id:"name",value:d,onChange:l=>D(l.target.value),required:!0})]}),!n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"slug",className:"text-sm",children:s("Slug")}),e.jsx(A.SlugInput,{value:m,onChange:l=>b(l),parentSlug:f,onValidationChange:l=>{i(l?null:s("Invalid slug"))}})]}),o&&e.jsxs(a.Alert,{variant:"destructive",className:"py-2",children:[e.jsx(E.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:o})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(a.Button,{type:"button",variant:"outline",onClick:u,disabled:r,children:s("Cancel")}),e.jsx(a.Button,{type:"submit",disabled:!d.trim()||!n&&!m.trim()||r||y,children:s(r||y?"Duplicating...":"Duplicate")})]})]})]})})};exports.default=w;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { n as i, r as h, s as p, B as m, t as f, v as x, I as g } from "./index-Ct7ElCGK.js";
|
|
3
|
+
import { n as v } from "./index-ZuacEL1j.js";
|
|
4
|
+
import { get as w } from "lodash-es";
|
|
5
|
+
import { ChevronDown as b } from "lucide-react";
|
|
6
|
+
import { useRef as N, useEffect as y } from "react";
|
|
7
|
+
const D = ({
|
|
8
|
+
isDefaultLang: e,
|
|
9
|
+
searchQuery: s,
|
|
10
|
+
setSearchQuery: l
|
|
11
|
+
}) => /* @__PURE__ */ r(
|
|
12
|
+
g,
|
|
13
|
+
{
|
|
14
|
+
type: "text",
|
|
15
|
+
autoFocus: !0,
|
|
16
|
+
value: e ? s : "",
|
|
17
|
+
onChange: (o) => l(o.target.value),
|
|
18
|
+
placeholder: e ? "Search pages..." : "To search select default language",
|
|
19
|
+
disabled: !e,
|
|
20
|
+
onKeyDown: (o) => o.stopPropagation()
|
|
21
|
+
}
|
|
22
|
+
), S = ({
|
|
23
|
+
dynamicPage: e,
|
|
24
|
+
setDynamicPage: s,
|
|
25
|
+
searchQuery: l,
|
|
26
|
+
setSearchQuery: o,
|
|
27
|
+
dynamicPages: a
|
|
28
|
+
}) => {
|
|
29
|
+
const { selectedLang: n, fallbackLang: d } = i(), c = (n == null ? void 0 : n.length) === 0;
|
|
30
|
+
return /* @__PURE__ */ u(h, { children: [
|
|
31
|
+
/* @__PURE__ */ r(p, { asChild: !0, children: /* @__PURE__ */ u(
|
|
32
|
+
m,
|
|
33
|
+
{
|
|
34
|
+
variant: "ghost",
|
|
35
|
+
className: "h-max w-max rounded-md border border-[0px] border-gray-200 py-1 pl-4 text-sm hover:bg-gray-100 focus:outline-none focus:ring-0",
|
|
36
|
+
children: [
|
|
37
|
+
e ? w(e, "name") : "Select Page",
|
|
38
|
+
/* @__PURE__ */ r(b, { className: "ml-2 h-4 w-4" })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
) }),
|
|
42
|
+
/* @__PURE__ */ u(f, { className: "max-h-[75vh] w-96 divide-y p-0 shadow-xl", children: [
|
|
43
|
+
/* @__PURE__ */ r("div", { className: "bg-gray-50/30 p-1.5", children: /* @__PURE__ */ r(D, { isDefaultLang: c, searchQuery: l, setSearchQuery: o }) }),
|
|
44
|
+
(a == null ? void 0 : a.length) === 0 ? /* @__PURE__ */ r("div", { className: "flex h-24 items-center justify-center text-xs", children: "No pages found" }) : a == null ? void 0 : a.map((t) => /* @__PURE__ */ r(
|
|
45
|
+
x,
|
|
46
|
+
{
|
|
47
|
+
onClick: () => s(t),
|
|
48
|
+
disabled: c ? d !== t.lang : n !== t.lang,
|
|
49
|
+
className: `no-scrollbar flex cursor-pointer flex-col justify-start overflow-x-auto whitespace-nowrap ${t.id === (e == null ? void 0 : e.id) ? "bg-blue-50" : "hover:bg-gray-50"}`,
|
|
50
|
+
children: /* @__PURE__ */ r("div", { className: "w-full whitespace-nowrap px-2 py-[2px] text-xs", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-x-2", children: [
|
|
51
|
+
/* @__PURE__ */ r("span", { className: "font-medium", children: t.name }),
|
|
52
|
+
/* @__PURE__ */ r("span", { className: "truncate rounded-full border border-gray-300 px-2 py-[1px] font-mono text-xs font-medium text-gray-500", children: t.slug })
|
|
53
|
+
] }) })
|
|
54
|
+
},
|
|
55
|
+
t.id
|
|
56
|
+
))
|
|
57
|
+
] })
|
|
58
|
+
] });
|
|
59
|
+
}, k = () => {
|
|
60
|
+
const {
|
|
61
|
+
dynamicPage: e,
|
|
62
|
+
dynamicPages: s,
|
|
63
|
+
allLangPages: l,
|
|
64
|
+
selectedLang: o,
|
|
65
|
+
searchQuery: a,
|
|
66
|
+
updateDynamicPage: n,
|
|
67
|
+
updateSearchQuery: d,
|
|
68
|
+
onChangeLanguage: c
|
|
69
|
+
} = v(), t = N(void 0);
|
|
70
|
+
return y(() => {
|
|
71
|
+
t.current !== o && e && (c(), t.current = o);
|
|
72
|
+
}, [o, s]), /* @__PURE__ */ r("div", { className: "relative", children: /* @__PURE__ */ r(
|
|
73
|
+
S,
|
|
74
|
+
{
|
|
75
|
+
dynamicPage: e,
|
|
76
|
+
setDynamicPage: n,
|
|
77
|
+
searchQuery: a,
|
|
78
|
+
setSearchQuery: d,
|
|
79
|
+
dynamicPages: l
|
|
80
|
+
}
|
|
81
|
+
) });
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
k as default
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./index-DF5DEvqb.cjs"),x=require("./index-WQwzsC7A.cjs"),h=require("lodash-es"),p=require("lucide-react"),d=require("react"),g=({isDefaultLang:r,searchQuery:l,setSearchQuery:c})=>e.jsx(o.Input,{type:"text",autoFocus:!0,value:r?l:"",onChange:t=>c(t.target.value),placeholder:r?"Search pages...":"To search select default language",disabled:!r,onKeyDown:t=>t.stopPropagation()}),f=({dynamicPage:r,setDynamicPage:l,searchQuery:c,setSearchQuery:t,dynamicPages:n})=>{const{selectedLang:a,fallbackLang:i}=o.useLanguages(),u=(a==null?void 0:a.length)===0;return e.jsxs(o.DropdownMenu,{children:[e.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"ghost",className:"h-max w-max rounded-md border border-[0px] border-gray-200 py-1 pl-4 text-sm hover:bg-gray-100 focus:outline-none focus:ring-0",children:[r?h.get(r,"name"):"Select Page",e.jsx(p.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),e.jsxs(o.DropdownMenuContent,{className:"max-h-[75vh] w-96 divide-y p-0 shadow-xl",children:[e.jsx("div",{className:"bg-gray-50/30 p-1.5",children:e.jsx(g,{isDefaultLang:u,searchQuery:c,setSearchQuery:t})}),(n==null?void 0:n.length)===0?e.jsx("div",{className:"flex h-24 items-center justify-center text-xs",children:"No pages found"}):n==null?void 0:n.map(s=>e.jsx(o.DropdownMenuItem,{onClick:()=>l(s),disabled:u?i!==s.lang:a!==s.lang,className:`no-scrollbar flex cursor-pointer flex-col justify-start overflow-x-auto whitespace-nowrap ${s.id===(r==null?void 0:r.id)?"bg-blue-50":"hover:bg-gray-50"}`,children:e.jsx("div",{className:"w-full whitespace-nowrap px-2 py-[2px] text-xs",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx("span",{className:"font-medium",children:s.name}),e.jsx("span",{className:"truncate rounded-full border border-gray-300 px-2 py-[1px] font-mono text-xs font-medium text-gray-500",children:s.slug})]})})},s.id))]})]})},m=()=>{const{dynamicPage:r,dynamicPages:l,allLangPages:c,selectedLang:t,searchQuery:n,updateDynamicPage:a,updateSearchQuery:i,onChangeLanguage:u}=x.useDynamicPageSelector(),s=d.useRef(void 0);return d.useEffect(()=>{s.current!==t&&r&&(u(),s.current=t)},[t,l]),e.jsx("div",{className:"relative",children:e.jsx(f,{dynamicPage:r,setDynamicPage:a,searchQuery:n,setSearchQuery:i,dynamicPages:c})})};exports.default=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=[{family:"Roboto",url:"https://fonts.googleapis.com/css2?family=Roboto:ital,wdth,wght@0,75..100,100..900;1,75..100,100..900&display=swap",fallback:"sans-serif"},{family:"Inter",url:"https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap",fallback:"sans-serif"},{family:"DM Sans",url:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap",fallback:"sans-serif"},{family:"Open Sans",url:"https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap",fallback:"sans-serif"},{family:"Lato",url:"https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap",fallback:"sans-serif"},{family:"Montserrat",url:"https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap",fallback:"sans-serif"},{family:"Poppins",url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",fallback:"sans-serif"},{family:"Source Sans 3",url:"https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap",fallback:"sans-serif"},{family:"Nunito Sans",url:"https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap",fallback:"sans-serif"},{family:"Oswald",url:"https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap",fallback:"sans-serif"},{family:"Raleway",url:"https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap",fallback:"sans-serif"},{family:"Merriweather",url:"https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&display=swap",fallback:"serif"},{family:"Playfair Display",url:"https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap",fallback:"serif"}],t=(a,l)=>{s.unshift({family:a,...l})},i=()=>s,o=a=>s.find(l=>l.family===a),e=()=>s;exports.getAllRegisteredFonts=e;exports.getRegisteredFont=o;exports.registerChaiFont=t;exports.useRegisteredFonts=i;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const s = [
|
|
2
|
+
{
|
|
3
|
+
family: "Roboto",
|
|
4
|
+
url: "https://fonts.googleapis.com/css2?family=Roboto:ital,wdth,wght@0,75..100,100..900;1,75..100,100..900&display=swap",
|
|
5
|
+
fallback: "sans-serif"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
family: "Inter",
|
|
9
|
+
url: "https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap",
|
|
10
|
+
fallback: "sans-serif"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
family: "DM Sans",
|
|
14
|
+
url: "https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap",
|
|
15
|
+
fallback: "sans-serif"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
family: "Open Sans",
|
|
19
|
+
url: "https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap",
|
|
20
|
+
fallback: "sans-serif"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
family: "Lato",
|
|
24
|
+
url: "https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap",
|
|
25
|
+
fallback: "sans-serif"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
family: "Montserrat",
|
|
29
|
+
url: "https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap",
|
|
30
|
+
fallback: "sans-serif"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
family: "Poppins",
|
|
34
|
+
url: "https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",
|
|
35
|
+
fallback: "sans-serif"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
family: "Source Sans 3",
|
|
39
|
+
url: "https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap",
|
|
40
|
+
fallback: "sans-serif"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
family: "Nunito Sans",
|
|
44
|
+
url: "https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap",
|
|
45
|
+
fallback: "sans-serif"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
family: "Oswald",
|
|
49
|
+
url: "https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap",
|
|
50
|
+
fallback: "sans-serif"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
family: "Raleway",
|
|
54
|
+
url: "https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap",
|
|
55
|
+
fallback: "sans-serif"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
family: "Merriweather",
|
|
59
|
+
url: "https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&display=swap",
|
|
60
|
+
fallback: "serif"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
family: "Playfair Display",
|
|
64
|
+
url: "https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap",
|
|
65
|
+
fallback: "serif"
|
|
66
|
+
}
|
|
67
|
+
], t = (a, l) => {
|
|
68
|
+
s.unshift({
|
|
69
|
+
family: a,
|
|
70
|
+
...l
|
|
71
|
+
});
|
|
72
|
+
}, i = () => s, o = (a) => s.find((l) => l.family === a), f = () => s;
|
|
73
|
+
export {
|
|
74
|
+
f as a,
|
|
75
|
+
o as g,
|
|
76
|
+
t as r,
|
|
77
|
+
i as u
|
|
78
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const a=require("@tailwindcss/aspect-ratio"),n=require("@tailwindcss/forms"),d=require("@tailwindcss/typography"),i=require("tailwindcss-animate");function r(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}}const s=({content:o,theme:e})=>({darkMode:"class",content:[...o,"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],theme:{extend:{...r(),...e}},plugins:[i,d,n,a]});exports.getChaiBuilderTailwindConfig=s;exports.shadcnTheme=r;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
function
|
|
1
|
+
import a from "@tailwindcss/aspect-ratio";
|
|
2
|
+
import e from "@tailwindcss/forms";
|
|
3
|
+
import d from "@tailwindcss/typography";
|
|
4
|
+
import n from "tailwindcss-animate";
|
|
5
|
+
function i() {
|
|
6
6
|
return {
|
|
7
7
|
colors: {
|
|
8
8
|
border: "hsl(var(--border))",
|
|
@@ -60,15 +60,18 @@ function n() {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const h = ({ content: r, theme: o }) => ({
|
|
64
64
|
darkMode: "class",
|
|
65
65
|
content: [...r, "node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],
|
|
66
66
|
theme: {
|
|
67
|
-
extend:
|
|
67
|
+
extend: {
|
|
68
|
+
...i(),
|
|
69
|
+
...o
|
|
70
|
+
}
|
|
68
71
|
},
|
|
69
|
-
plugins: [d, e, a
|
|
72
|
+
plugins: [n, d, e, a]
|
|
70
73
|
});
|
|
71
74
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
h as g,
|
|
76
|
+
i as s
|
|
74
77
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as r, d as a, g as i } from "./plugin-3ZKK6RXm.js";
|
|
2
2
|
const t = r(function({ addBase: n, theme: o }) {
|
|
3
3
|
n({
|
|
4
4
|
"h1,h2,h3,h4,h5,h6": {
|
|
@@ -10,15 +10,15 @@ const t = r(function({ addBase: n, theme: o }) {
|
|
|
10
10
|
backgroundColor: o("colors.background")
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
}),
|
|
13
|
+
}), l = (n = a) => ({
|
|
14
14
|
container: {
|
|
15
15
|
center: !0,
|
|
16
16
|
padding: "1rem",
|
|
17
17
|
screens: { "2xl": "1400px" }
|
|
18
18
|
},
|
|
19
|
-
...
|
|
19
|
+
...i(n)
|
|
20
20
|
});
|
|
21
21
|
export {
|
|
22
22
|
t as c,
|
|
23
|
-
|
|
23
|
+
l as g
|
|
24
24
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("./plugin-C6rgJDNQ.cjs"),e=o.plugin(function({addBase:n,theme:i}){n({"h1,h2,h3,h4,h5,h6":{fontFamily:i("fontFamily.heading")},body:{fontFamily:i("fontFamily.body"),color:i("colors.foreground"),backgroundColor:i("colors.background")}})}),r=(n=o.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...o.getChaiThemeOptions(n)});exports.chaiBuilderPlugin=e;exports.getChaiBuilderTheme=r;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { has as n, isObject as O, set as l } from "lodash-es";
|
|
2
|
+
const e = (o, f) => {
|
|
3
|
+
const t = {
|
|
4
|
+
seo: {
|
|
5
|
+
keyword: "",
|
|
6
|
+
title: "",
|
|
7
|
+
description: "",
|
|
8
|
+
noIndex: !1,
|
|
9
|
+
noFollow: !1,
|
|
10
|
+
canonicalUrl: "",
|
|
11
|
+
ogTitle: "",
|
|
12
|
+
ogDescription: "",
|
|
13
|
+
jsonLD: "",
|
|
14
|
+
metaOther: ""
|
|
15
|
+
},
|
|
16
|
+
jsonLD: {},
|
|
17
|
+
metaOther: {}
|
|
18
|
+
};
|
|
19
|
+
o != null && o.defaultSeo && (n(o.defaultSeo, f) && O(o.defaultSeo[f]) ? t.seo = { ...t.seo, ...o.defaultSeo[f] } : t.seo = { ...t.seo, ...o.defaultSeo });
|
|
20
|
+
let d = {};
|
|
21
|
+
o != null && o.defaultJSONLD && (n(o.defaultJSONLD, f) && O(o.defaultJSONLD[f]) ? (d = o.defaultJSONLD[f], l(t, "seo.jsonLD", JSON.stringify(d))) : (d = o.defaultJSONLD, l(t, "seo.jsonLD", JSON.stringify(d))));
|
|
22
|
+
let s = {};
|
|
23
|
+
return o != null && o.defaultMetaTags && (n(o.defaultMetaTags, f) && O(o.defaultMetaTags[f]) ? (s = o.defaultMetaTags[f], l(t, "seo.metaOther", JSON.stringify(s))) : (s = o.defaultMetaTags, l(t, "seo.metaOther", JSON.stringify(s)))), { seo: t.seo, jsonLD: t.jsonLD, metaOther: s };
|
|
24
|
+
};
|
|
25
|
+
if (import.meta.vitest) {
|
|
26
|
+
const { it: o, expect: f } = import.meta.vitest;
|
|
27
|
+
o("should return default values", () => {
|
|
28
|
+
const t = e(
|
|
29
|
+
{
|
|
30
|
+
defaultSeo: {
|
|
31
|
+
keyword: "",
|
|
32
|
+
title: "",
|
|
33
|
+
description: "",
|
|
34
|
+
noIndex: !1,
|
|
35
|
+
noFollow: !1,
|
|
36
|
+
canonicalUrl: "",
|
|
37
|
+
ogTitle: "",
|
|
38
|
+
ogDescription: "",
|
|
39
|
+
jsonLD: ""
|
|
40
|
+
},
|
|
41
|
+
defaultJSONLD: {}
|
|
42
|
+
},
|
|
43
|
+
"en"
|
|
44
|
+
);
|
|
45
|
+
f(t).toEqual({
|
|
46
|
+
seo: {
|
|
47
|
+
keyword: "",
|
|
48
|
+
title: "",
|
|
49
|
+
description: "",
|
|
50
|
+
noIndex: !1,
|
|
51
|
+
noFollow: !1,
|
|
52
|
+
canonicalUrl: "",
|
|
53
|
+
ogTitle: "",
|
|
54
|
+
ogDescription: "",
|
|
55
|
+
jsonLD: "{}",
|
|
56
|
+
metaOther: ""
|
|
57
|
+
},
|
|
58
|
+
jsonLD: {},
|
|
59
|
+
metaOther: {}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
e as g
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("lodash-es"),l=(o,f)=>{const t={seo:{keyword:"",title:"",description:"",noIndex:!1,noFollow:!1,canonicalUrl:"",ogTitle:"",ogDescription:"",jsonLD:"",metaOther:""},jsonLD:{},metaOther:{}};o!=null&&o.defaultSeo&&(s.has(o.defaultSeo,f)&&s.isObject(o.defaultSeo[f])?t.seo={...t.seo,...o.defaultSeo[f]}:t.seo={...t.seo,...o.defaultSeo});let d={};o!=null&&o.defaultJSONLD&&(s.has(o.defaultJSONLD,f)&&s.isObject(o.defaultJSONLD[f])?(d=o.defaultJSONLD[f],s.set(t,"seo.jsonLD",JSON.stringify(d))):(d=o.defaultJSONLD,s.set(t,"seo.jsonLD",JSON.stringify(d))));let e={};return o!=null&&o.defaultMetaTags&&(s.has(o.defaultMetaTags,f)&&s.isObject(o.defaultMetaTags[f])?(e=o.defaultMetaTags[f],s.set(t,"seo.metaOther",JSON.stringify(e))):(e=o.defaultMetaTags,s.set(t,"seo.metaOther",JSON.stringify(e)))),{seo:t.seo,jsonLD:t.jsonLD,metaOther:e}};exports.getSeoDefaults=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("compressorjs"),m=require("sonner"),t=3*1024*1024,c=10*1024*1024;function s(e){const r=isNaN(e)?0:typeof e=="number"?e:parseInt(e);return r?r<1024?`${r.toFixed(2)} B`:r<1024*1024?`${(r/1024).toFixed(2)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`:"0 B"}function a(e){return new Promise((r,o)=>{if(e.size<=t){r(e);return}new n(e,{quality:.8,maxWidth:2048,maxHeight:2048,convertSize:t,success(i){r(i)},error(i){m.toast.error(`Failed to compress image. Image size is ${s(e.size)}, which exceeds the maximum allowed size of ${s(c)}.`),o(i)}})})}exports.compressImageIfNeeded=a;exports.formatFileSize=s;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import m from "compressorjs";
|
|
2
|
+
import { toast as n } from "sonner";
|
|
3
|
+
const t = 3 * 1024 * 1024, a = 10 * 1024 * 1024;
|
|
4
|
+
function i(e) {
|
|
5
|
+
const r = isNaN(e) ? 0 : typeof e == "number" ? e : parseInt(e);
|
|
6
|
+
return r ? r < 1024 ? `${r.toFixed(2)} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(2)} KB` : `${(r / (1024 * 1024)).toFixed(2)} MB` : "0 B";
|
|
7
|
+
}
|
|
8
|
+
function f(e) {
|
|
9
|
+
return new Promise((r, s) => {
|
|
10
|
+
if (e.size <= t) {
|
|
11
|
+
r(e);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
new m(e, {
|
|
15
|
+
quality: 0.8,
|
|
16
|
+
// 80% quality
|
|
17
|
+
maxWidth: 2048,
|
|
18
|
+
// Limit max width
|
|
19
|
+
maxHeight: 2048,
|
|
20
|
+
// Limit max height
|
|
21
|
+
convertSize: t,
|
|
22
|
+
// Try to keep under 3MB
|
|
23
|
+
success(o) {
|
|
24
|
+
r(o);
|
|
25
|
+
},
|
|
26
|
+
error(o) {
|
|
27
|
+
n.error(
|
|
28
|
+
`Failed to compress image. Image size is ${i(e.size)}, which exceeds the maximum allowed size of ${i(a)}.`
|
|
29
|
+
), s(o);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
f as c,
|
|
36
|
+
i as f
|
|
37
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsx as i, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { D as L, d as R } from "./index-Ct7ElCGK.js";
|
|
3
|
+
import { debounce as S } from "lodash-es";
|
|
4
|
+
import { Save as j, Copy as D, Loader as O } from "lucide-react";
|
|
5
|
+
import { memo as P, useState as m, useEffect as x, useMemo as r, useCallback as b } from "react";
|
|
6
|
+
import A from "react-filerobot-image-editor";
|
|
7
|
+
import { useTranslation as N } from "react-i18next";
|
|
8
|
+
const F = P(
|
|
9
|
+
({ imageUrl: d, onSave: c, onClose: u, defaultSavedImageName: y, isEditing: f = !1 }) => {
|
|
10
|
+
const { t: o } = N(), [v, s] = m(!1), [p, I] = m(!0), [w, C] = m(!1);
|
|
11
|
+
x(() => {
|
|
12
|
+
const e = new Image();
|
|
13
|
+
return e.src = d, e.onload = () => C(!0), () => {
|
|
14
|
+
e.onload = null;
|
|
15
|
+
};
|
|
16
|
+
}, [d]), x(() => {
|
|
17
|
+
const e = (t) => {
|
|
18
|
+
t.key === "Escape" && p && (t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation());
|
|
19
|
+
};
|
|
20
|
+
return document.addEventListener("keydown", e, !0), () => {
|
|
21
|
+
document.removeEventListener("keydown", e, !0);
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
const g = r(
|
|
25
|
+
() => S(async (e, t = !1) => {
|
|
26
|
+
s(!0);
|
|
27
|
+
const a = e.imageBase64;
|
|
28
|
+
await c(a, t), I(!1), s(!1);
|
|
29
|
+
}, 300),
|
|
30
|
+
[c]
|
|
31
|
+
), n = b(
|
|
32
|
+
(e, t = !1) => {
|
|
33
|
+
g(e, t);
|
|
34
|
+
},
|
|
35
|
+
[g]
|
|
36
|
+
), h = b(() => {
|
|
37
|
+
I(!1), u();
|
|
38
|
+
}, [u]), l = r(
|
|
39
|
+
() => ({
|
|
40
|
+
tabsIds: ["Adjust", "Annotate", "Watermark", "Finetune", "Resize", "Filters"],
|
|
41
|
+
toolsIds: ["Rotate"],
|
|
42
|
+
defaultTabId: "Adjust",
|
|
43
|
+
defaultToolId: "Rotate"
|
|
44
|
+
}),
|
|
45
|
+
[]
|
|
46
|
+
), T = r(
|
|
47
|
+
() => ({
|
|
48
|
+
colors: {
|
|
49
|
+
primary: "#000000",
|
|
50
|
+
secondary: "#000000",
|
|
51
|
+
tertiary: "#000000"
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
[]
|
|
55
|
+
), k = r(
|
|
56
|
+
() => f ? [
|
|
57
|
+
{
|
|
58
|
+
label: o("Update this file"),
|
|
59
|
+
onClick: (e, t) => t((...a) => {
|
|
60
|
+
s(!0), n(a[0], !1);
|
|
61
|
+
}),
|
|
62
|
+
icon: j
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: o("Save as new file"),
|
|
66
|
+
onClick: (e, t) => t((...a) => {
|
|
67
|
+
s(!0), n(a[0], !0);
|
|
68
|
+
}),
|
|
69
|
+
icon: D
|
|
70
|
+
}
|
|
71
|
+
] : [],
|
|
72
|
+
[f, n, o]
|
|
73
|
+
);
|
|
74
|
+
return /* @__PURE__ */ i(L, { open: !0, onOpenChange: (e) => !e && h(), children: /* @__PURE__ */ E(
|
|
75
|
+
R,
|
|
76
|
+
{
|
|
77
|
+
id: "chai-image-editor-container",
|
|
78
|
+
className: "flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4 p-0",
|
|
79
|
+
children: [
|
|
80
|
+
v && /* @__PURE__ */ i("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 text-white", children: /* @__PURE__ */ i(O, { className: "h-4 w-4 animate-spin" }) }),
|
|
81
|
+
p && w && /* @__PURE__ */ i(
|
|
82
|
+
A,
|
|
83
|
+
{
|
|
84
|
+
theme: T,
|
|
85
|
+
source: d,
|
|
86
|
+
onSave: n,
|
|
87
|
+
onClose: h,
|
|
88
|
+
Text: { text: o("Add text here") },
|
|
89
|
+
Rotate: { angle: 90, componentType: "slider" },
|
|
90
|
+
tabsIds: l.tabsIds,
|
|
91
|
+
defaultTabId: l.defaultTabId,
|
|
92
|
+
defaultToolId: l.defaultToolId,
|
|
93
|
+
savingPixelRatio: 20,
|
|
94
|
+
previewPixelRatio: 6,
|
|
95
|
+
defaultSavedImageName: y,
|
|
96
|
+
moreSaveOptions: k,
|
|
97
|
+
useZoomPresetsMenu: !0
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
) });
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
F.displayName = "ImageEditor";
|
|
106
|
+
export {
|
|
107
|
+
F as default
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("./index-DF5DEvqb.cjs"),S=require("lodash-es"),c=require("lucide-react"),a=require("react"),T=require("react-filerobot-image-editor"),k=require("react-i18next"),h=a.memo(({imageUrl:l,onSave:u,onClose:m,defaultSavedImageName:y,isEditing:f=!1})=>{const{t:n}=k.useTranslation(),[v,i]=a.useState(!1),[p,I]=a.useState(!0),[w,j]=a.useState(!1);a.useEffect(()=>{const e=new Image;return e.src=l,e.onload=()=>j(!0),()=>{e.onload=null}},[l]),a.useEffect(()=>{const e=t=>{t.key==="Escape"&&p&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[]);const g=a.useMemo(()=>S.debounce(async(e,t=!1)=>{i(!0);const s=e.imageBase64;await u(s,t),I(!1),i(!1)},300),[u]),r=a.useCallback((e,t=!1)=>{g(e,t)},[g]),x=a.useCallback(()=>{I(!1),m()},[m]),d=a.useMemo(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],toolsIds:["Rotate"],defaultTabId:"Adjust",defaultToolId:"Rotate"}),[]),C=a.useMemo(()=>({colors:{primary:"#000000",secondary:"#000000",tertiary:"#000000"}}),[]),E=a.useMemo(()=>f?[{label:n("Update this file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!1)}),icon:c.Save},{label:n("Save as new file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!0)}),icon:c.Copy}]:[],[f,r,n]);return o.jsx(b.Dialog,{open:!0,onOpenChange:e=>!e&&x(),children:o.jsxs(b.DialogContent,{id:"chai-image-editor-container",className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4 p-0",children:[v&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 text-white",children:o.jsx(c.Loader,{className:"h-4 w-4 animate-spin"})}),p&&w&&o.jsx(T,{theme:C,source:l,onSave:r,onClose:x,Text:{text:n("Add text here")},Rotate:{angle:90,componentType:"slider"},tabsIds:d.tabsIds,defaultTabId:d.defaultTabId,defaultToolId:d.defaultToolId,savingPixelRatio:20,previewPixelRatio:6,defaultSavedImageName:y,moreSaveOptions:E,useZoomPresetsMenu:!0})]})})});h.displayName="ImageEditor";exports.default=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("lodash-es"),s="#styles:",l=e=>{const n=["_type","_id","_parent","_bindings","_name"],o=["$loading","blockProps","inBuilder","lang","draft","pageProps","pageData","children"],r=t.keys(e.properties);if(t.intersection(r,n).length>0)throw new Error(`Reserved props are not allowed: ${t.intersection(r,n).join(", ")}`);if(t.intersection(r,o).length>0)throw new Error(`Runtime props are not allowed in schema: ${t.intersection(r,o).join(", ")}`);const i=t.get(e,"properties",{}),u={};return t.each(i,(p,a)=>{t.isEmpty(p.ui)||(u[a]={...p.ui},delete i[a].ui)}),{schema:t.isEmpty(i)?{}:{...t.omit(e,["ui"])},uiSchema:{...t.get(e,"ui",{}),...u}}},d=(e="")=>({type:"string",styles:!0,default:`${s},${e}`,ui:{"ui:widget":"hidden"}}),c=(e="")=>({type:"string",styles:!0,default:`${s},${e}`,ui:{"ui:widget":"hidden"}}),h=e=>(console.warn("runtimeProp is deprecated, use builderProp instead"),{runtime:!0,...e}),g=e=>({builderProp:!0,...e}),y=e=>`${s},${e}`;exports.StylesProp=d;exports.builderProp=g;exports.defaultChaiStyles=y;exports.registerChaiBlockSchema=l;exports.runtimeProp=h;exports.stylesProp=c;
|