@chaibuilder/sdk 4.0.0-beta.7 → 4.0.0-beta.9
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 +5 -8
- package/dist/{2SSKDMRQ-hL7THuKW.js → 2SSKDMRQ-CdFBQR2o.js} +2 -2
- package/dist/{2SSKDMRQ-DDOgISWg.cjs → 2SSKDMRQ-CuQ42ST6.cjs} +1 -1
- package/dist/{AP7HFJJL-tcAhVllC.cjs → AP7HFJJL-DcnEb4BE.cjs} +1 -1
- package/dist/{AP7HFJJL-BsLQ13V_.js → AP7HFJJL-bDlWX5Yx.js} +1 -1
- package/dist/{IconPicker-FLSVAZxx.js → IconPicker-CNwplOGy.js} +2 -2
- package/dist/{IconPicker-J1KLNrSB.cjs → IconPicker-FpyYsxOf.cjs} +1 -1
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-BTj8AXV6.cjs → WDYDFRGG-BxLmjulP.cjs} +1 -1
- package/dist/{WDYDFRGG-Yi0eNS2V.js → WDYDFRGG-CWq7H6Qk.js} +2 -2
- package/dist/{actions-registery-CtQSSexG.cjs → actions-registery-BRgseJas.cjs} +16 -16
- package/dist/{actions-registery-DqrFhSMp.js → actions-registery-DRV8xywr.js} +180 -181
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +112 -51
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-Dozn833d.js → active-in-another-tab-C392ZWQc.js} +3 -3
- package/dist/{active-in-another-tab-BtAiatqq.cjs → active-in-another-tab-DEWOFgY5.cjs} +1 -1
- package/dist/{add-new-language-page-DD-CAoAQ.js → add-new-language-page-BL2F_Cu7.js} +4 -4
- package/dist/{add-new-language-page-9AMizlES.cjs → add-new-language-page-DBWd0wDY.cjs} +1 -1
- package/dist/{add-new-page-BS9vPnFG.cjs → add-new-page-DYrQeKCi.cjs} +1 -1
- package/dist/{add-new-page-uZKCk9eB.js → add-new-page-QVlyJhn9.js} +2 -2
- package/dist/{ai-panel-content-CK4XOkEh.js → ai-panel-content-CCOluPtK.js} +4 -4
- package/dist/{ai-panel-content-PovaKJaj.cjs → ai-panel-content-DCZRBa6s.cjs} +1 -1
- package/dist/{ai-panel-default-lang-B37k5ADH.cjs → ai-panel-default-lang-C3t0elrO.cjs} +2 -2
- package/dist/{ai-panel-default-lang-BtLjUl9d.js → ai-panel-default-lang-Crz7QAxl.js} +4 -4
- package/dist/{ai-panel-other-lang-CdQmASqv.cjs → ai-panel-other-lang-BRkr4Te3.cjs} +1 -1
- package/dist/{ai-panel-other-lang-Dp1MNaLi.js → ai-panel-other-lang-DIF8PYLh.js} +4 -4
- package/dist/{ai-prompt-input-BT-mEdTX.js → ai-prompt-input-D4dqy8L2.js} +2 -2
- package/dist/{ai-prompt-input-Dtym4w8J.cjs → ai-prompt-input-Ybgvrvd6.cjs} +1 -1
- package/dist/{ai-translation-prompt-B-lH7emI.cjs → ai-translation-prompt-Ck12Bfl6.cjs} +1 -1
- package/dist/{ai-translation-prompt-B17GK1QR.js → ai-translation-prompt-eZ4Sllva.js} +2 -2
- package/dist/{apply-binding-BvWfJCSZ.js → apply-binding-CLU6Xp4K.js} +77 -81
- package/dist/apply-binding-NvZX_rJe.cjs +1 -0
- package/dist/{code-display-DloSPyPr.cjs → code-display-9Onx6RCq.cjs} +1 -1
- package/dist/{code-display-Ck81Id9K.js → code-display-oa1j0ri7.js} +1 -1
- package/dist/{code-editor-EZT2pMsU.js → code-editor-D45h29W1.js} +1 -1
- package/dist/{code-editor-CUeNiMzA.cjs → code-editor-DH8eU4WL.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-CS7C6h9Q.js → continue-editing-in-this-client-BRrIvSrl.js} +3 -3
- package/dist/{continue-editing-in-this-client-DMZOc36k.cjs → continue-editing-in-this-client-DgZ9Q18G.cjs} +1 -1
- package/dist/core-8lkXy4lC.cjs +1 -0
- package/dist/core-BvsZwF26.js +52 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +143 -172
- package/dist/core.js +22 -34
- package/dist/{css-import-modal-s7t5gZQo.js → css-import-modal-BhLPzQH8.js} +5 -4
- package/dist/css-import-modal-C2-oVwFv.cjs +13 -0
- package/dist/{delete-design-token-C1smbx4E.js → delete-design-token-D4Q5-Xql.js} +1 -1
- package/dist/{delete-design-token-Mbw_6sYI.cjs → delete-design-token-DJSQluQ6.cjs} +1 -1
- package/dist/{delete-page-B7J3t0FN.cjs → delete-page-BxbsKhY5.cjs} +1 -1
- package/dist/{delete-page-2GfBi8Iv.js → delete-page-xHdZT-7c.js} +3 -3
- package/dist/{design-token-usage-DyO3xM-F.js → design-token-usage-7wgmVSWI.js} +2 -2
- package/dist/{design-token-usage-BoGOULG8.cjs → design-token-usage-KZ4pilLm.cjs} +1 -1
- package/dist/{digital-asset-manager-Cz3Nlrzl.js → digital-asset-manager-BmbVU7fX.js} +4 -4
- package/dist/{digital-asset-manager-DDk2ucTE.cjs → digital-asset-manager-a1fqrQVH.cjs} +1 -1
- package/dist/{duplicate-page-BwAY4Ssm.js → duplicate-page-5uIno9Yh.js} +4 -4
- package/dist/{duplicate-page-Dw3U4wTT.cjs → duplicate-page-BBTxn_o1.cjs} +1 -1
- package/dist/{dynamic-page-selector-CvBFyX2F.cjs → dynamic-page-selector-C1ef0i2I.cjs} +1 -1
- package/dist/{dynamic-page-selector-sViJuQlU.js → dynamic-page-selector-rhvhg7ol.js} +3 -3
- package/dist/{image-editor-BgGQuESa.js → image-editor-BXYZDa0s.js} +1 -1
- package/dist/{image-editor-AIsccrqC.cjs → image-editor-rqUgAO8V.cjs} +1 -1
- package/dist/{index-B7eWP_hB.js → index-Be9lAaD7.js} +421 -425
- package/dist/index-BhqugjzS.cjs +160 -0
- package/dist/index-CNEEEgTV.cjs +5 -0
- package/dist/{index-RYr8kQdI.js → index-mjuSGlPU.js} +5136 -5613
- package/dist/{json-diff-viewer-B2A78udz.cjs → json-diff-viewer-C9qmLiaq.cjs} +1 -1
- package/dist/{json-diff-viewer-Svw-kbhe.js → json-diff-viewer-aVwY7_hZ.js} +3 -3
- package/dist/{lang-panel-Bnc-9wkM.js → lang-panel-BTWk23Mw.js} +4 -4
- package/dist/{lang-panel-AmEkoWid.cjs → lang-panel-Bo1ZWYfu.cjs} +1 -1
- package/dist/{manage-design-tokens-BBkh1t4w.js → manage-design-tokens-id8bylgO.js} +4 -4
- package/dist/manage-design-tokens-lUMCgjdS.cjs +1 -0
- package/dist/{mark-as-template-CE6tRoQy.cjs → mark-as-template-BYXBDXMv.cjs} +1 -1
- package/dist/{mark-as-template-0CPzZnk-.js → mark-as-template-hv3WD852.js} +3 -3
- package/dist/{nested-path-selector-content-kGznHufl.js → nested-path-selector-content-B8z90MFF.js} +2 -2
- package/dist/{nested-path-selector-content-SmfjElr-.cjs → nested-path-selector-content-DgFFXcTD.cjs} +1 -1
- package/dist/{no-language-page-content-B4bQLc4K.cjs → no-language-page-content-6Kk8UjFX.cjs} +1 -1
- package/dist/{no-language-page-content-DXsAPDZd.js → no-language-page-content-DMACzysm.js} +3 -3
- package/dist/{no-language-page-dialog-BpPqmw9a.js → no-language-page-dialog-D4n_XYUq.js} +2 -2
- package/dist/{no-language-page-dialog-BC8NHzK2.cjs → no-language-page-dialog-mBH-fthh.cjs} +1 -1
- package/dist/{page-creator-82qTbBj4.cjs → page-creator-CGglYnYg.cjs} +1 -1
- package/dist/{page-creator-Bazn6yH4.js → page-creator-CgsOF0Eg.js} +4 -4
- package/dist/{page-lock-CRFyqKZE.js → page-lock-CUCEBnJb.js} +2 -2
- package/dist/{page-lock-D2iFZDUK.cjs → page-lock-Hsi61Mk5.cjs} +1 -1
- package/dist/{page-locked-dialog-xLqvKzax.cjs → page-locked-dialog-DSxbAMpt.cjs} +1 -1
- package/dist/{page-locked-dialog-GKfQEOmk.js → page-locked-dialog-bHvbFllT.js} +3 -3
- package/dist/{page-manager-new-Bn2QKjbf.cjs → page-manager-new-CBfFl5rL.cjs} +1 -1
- package/dist/{page-manager-new-DItY2hjd.js → page-manager-new-Cifc526h.js} +8 -8
- package/dist/{page-manager-search-and-filter-CPa8IXdd.js → page-manager-search-and-filter-CLJss6pV.js} +3 -3
- package/dist/{page-manager-search-and-filter-Dc4ky-qV.cjs → page-manager-search-and-filter-mEKl-UKh.cjs} +1 -1
- package/dist/page-revisions-content-C95dQJyx.cjs +1 -0
- package/dist/{page-revisions-content-CH-PZK0O.js → page-revisions-content-DvL4ya9g.js} +75 -67
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +146 -92
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-BzJDObqr.cjs → publish-pages-content-B-6vSkql.cjs} +1 -1
- package/dist/{publish-pages-content-CSJCFElu.js → publish-pages-content-B8-IZW_U.js} +4 -4
- package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-CX_JkRJn.js} +78 -78
- package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +14 -15
- package/dist/render.js +3 -3
- package/dist/{rte-widget-modal-5T81P_hg.js → rte-widget-modal-1SbY5bcQ.js} +7 -7
- package/dist/{rte-widget-modal-BfXcA7OP.cjs → rte-widget-modal-CyKwtbOG.cjs} +1 -1
- package/dist/runtime-client.cjs +1 -0
- package/dist/runtime-client.d.ts +158 -0
- package/dist/runtime-client.js +32 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +92 -240
- package/dist/runtime.js +72 -72
- package/dist/{save-to-lib-MtWKSVeN.js → save-to-lib-BKcBfjfi.js} +3 -3
- package/dist/{save-to-lib-DGAdSa-0.cjs → save-to-lib-BmPh_Vns.cjs} +1 -1
- package/dist/{selected-block-display-CB1-hVR5.js → selected-block-display-B3hHlcLA.js} +3 -3
- package/dist/{selected-block-display-DLt_nMn9.cjs → selected-block-display-BCvTNcp2.cjs} +1 -1
- package/dist/{seo-panel-CRzzw4FW.js → seo-panel-D3EyOYij.js} +3 -3
- package/dist/{seo-panel-_kGXE9MC.cjs → seo-panel-DVClgzX9.cjs} +1 -1
- package/dist/{shared-json-ld-DoRgzDPC.cjs → shared-json-ld-BRgJTv0m.cjs} +1 -1
- package/dist/{shared-json-ld-CXukkDeS.js → shared-json-ld-DSPadwbY.js} +3 -3
- package/dist/{slug-input-Dp187Tiy.cjs → slug-input-B39SPBdP.cjs} +1 -1
- package/dist/{slug-input-CeEQ0zyv.js → slug-input-C3UrwSkt.js} +2 -2
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-C9J3_rev.js → take-over-request-DfAlPvpE.js} +3 -3
- package/dist/{take-over-request-CXuakFBm.cjs → take-over-request-Tq9-gOCV.cjs} +1 -1
- package/dist/{theme-panel-footer-DvwsyHNQ.js → theme-panel-footer-DIy4baYU.js} +3 -3
- package/dist/{theme-panel-footer-CWZ0qs13.cjs → theme-panel-footer-DQzjVBBP.cjs} +1 -1
- package/dist/{translation-warning-modal-_aBp5ZZQ.js → translation-warning-modal-BHwLZZOw.js} +2 -2
- package/dist/{translation-warning-modal-DEt_ExQp.cjs → translation-warning-modal-Ckwt5Skc.cjs} +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +598 -0
- package/dist/types.js +1 -0
- package/dist/{unmark-as-template-BYL5naYx.cjs → unmark-as-template-BKA-sNZr.cjs} +1 -1
- package/dist/{unmark-as-template-JN-cDUV_.js → unmark-as-template-CbgifSbI.js} +3 -3
- package/dist/{unpublish-page-B06iZEIO.cjs → unpublish-page-BqzvOD76.cjs} +1 -1
- package/dist/{unpublish-page-DqwBY2yI.js → unpublish-page-DXQpAkvc.js} +3 -3
- package/dist/utils.d.ts +5 -5
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +214 -214
- package/dist/{web-preview-h39D3TUh.js → web-preview-DH7Yv-jg.js} +2 -2
- package/dist/{web-preview-wRgRY3Tv.cjs → web-preview-DShy13AM.cjs} +1 -1
- package/package.json +13 -7
- package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
- package/dist/core-Dr7QYemB.js +0 -56
- package/dist/core-Y0lXLwkq.cjs +0 -1
- package/dist/css-import-modal-kHB0ramf.cjs +0 -13
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-BwH1mRm_.cjs +0 -5
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/index-xYnNKovy.cjs +0 -160
- package/dist/manage-design-tokens-B2fG80bi.cjs +0 -1
- package/dist/page-revisions-content-CcLFI4YK.cjs +0 -1
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { get as c, each as B, has as u, set as o, cloneDeep as k, omitBy as h } from "lodash-es";
|
|
2
|
+
import { useMemo as d } from "react";
|
|
3
|
+
const r = {}, P = () => r, p = (e) => d(() => c(r, e, null), [e]), i = (e) => c(r, e, null), f = (e) => {
|
|
4
|
+
const t = c(r, `${e}.schema.properties`, {}), s = {};
|
|
5
|
+
return B(t, (n, a) => {
|
|
6
|
+
u(n, "block") || o(s, a, n.default);
|
|
7
|
+
}), s;
|
|
8
|
+
}, S = (e) => c(r, `${e}.i18nProps`, []), D = (e) => c(r, `${e}.aiProps`, []), I = (e) => {
|
|
9
|
+
const t = i(e);
|
|
10
|
+
if (!t)
|
|
11
|
+
return null;
|
|
12
|
+
const s = k(t.schema), n = c(s, "properties", {}), a = h(n, (l) => (l == null ? void 0 : l.styles) === !0);
|
|
13
|
+
o(s, "properties", a);
|
|
14
|
+
const g = c(r, `${e}.uiSchema`, {});
|
|
15
|
+
return { schema: s, uiSchema: g };
|
|
16
|
+
}, R = (e) => e.map((t) => u(r, t._type) ? { ...f(t._type), ...t } : t), m = (e, t) => {
|
|
17
|
+
const s = c(r, t.type);
|
|
18
|
+
s ? o(r, t.type, { ...s, component: e, ...t }) : o(r, t.type, { component: e, ...t });
|
|
19
|
+
}, _ = (e, t) => {
|
|
20
|
+
m(e, { ...t, category: t.category || "core" });
|
|
21
|
+
}, $ = (e, t) => {
|
|
22
|
+
const s = c(r, t.type);
|
|
23
|
+
s ? o(r, t.type, { ...s, component: e, ...t }) : o(r, t.type, { component: e, ...t });
|
|
24
|
+
}, v = (e, t) => {
|
|
25
|
+
const s = i(e);
|
|
26
|
+
o(r, e, { ...s, dataProvider: t });
|
|
27
|
+
}, x = (e, t) => {
|
|
28
|
+
const s = i(e);
|
|
29
|
+
o(r, e, { ...s, component: t });
|
|
30
|
+
}, E = (e, t) => ({
|
|
31
|
+
type: "null",
|
|
32
|
+
block: e,
|
|
33
|
+
prop: t,
|
|
34
|
+
default: null,
|
|
35
|
+
runtime: !0,
|
|
36
|
+
ui: { "ui:widget": "hidden" }
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
I as a,
|
|
40
|
+
f as b,
|
|
41
|
+
E as c,
|
|
42
|
+
S as d,
|
|
43
|
+
i as e,
|
|
44
|
+
$ as f,
|
|
45
|
+
D as g,
|
|
46
|
+
x as h,
|
|
47
|
+
R as i,
|
|
48
|
+
P as j,
|
|
49
|
+
_ as r,
|
|
50
|
+
v as s,
|
|
51
|
+
p as u
|
|
52
|
+
};
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BhqugjzS.cjs"),o=require("./common-functions-B3a4xKt_.cjs"),i=require("./apply-binding-NvZX_rJe.cjs"),a=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.PERMISSIONS=e.PERMISSIONS;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.generateBlockId=o.generateUUID;exports.mergeClasses=o.cn;exports.convertHTMLToChaiBlocks=i.getBlocksFromHTML;exports.getBlocksFromHTML=i.getBlocksFromHTML;exports.i18n=a;
|
package/dist/core.d.ts
CHANGED
|
@@ -1,37 +1,10 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
2
|
import { default as default_2 } from 'react';
|
|
4
3
|
import { DragEvent as DragEvent_2 } from 'react';
|
|
5
4
|
import { default as i18n } from 'i18next';
|
|
6
5
|
import { JSX } from 'react/jsx-runtime';
|
|
7
6
|
import * as React_2 from 'react';
|
|
8
7
|
|
|
9
|
-
declare type AddBlockTab = {
|
|
10
|
-
id: string;
|
|
11
|
-
tab: React.ComponentType;
|
|
12
|
-
tabContent: React.ComponentType;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
declare type AskAiResponse = {
|
|
16
|
-
blocks?: Array<{
|
|
17
|
-
_id: string;
|
|
18
|
-
} & Partial<ChaiBlock>>;
|
|
19
|
-
usage?: Record<any, number>;
|
|
20
|
-
error?: any;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
declare type BlocksWithDesignTokens = Record<string, string>;
|
|
24
|
-
|
|
25
|
-
declare type BorderRadiusValue = false | string;
|
|
26
|
-
|
|
27
|
-
declare type Breakpoint = {
|
|
28
|
-
title: string;
|
|
29
|
-
content: string;
|
|
30
|
-
breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | string;
|
|
31
|
-
icon: default_2.ReactNode | Element;
|
|
32
|
-
width: number;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
8
|
export declare const ChaiAddBlocksDialog: () => JSX.Element;
|
|
36
9
|
|
|
37
10
|
export declare const ChaiAddBlocksPanel: ({ className, showHeading, parentId, position, fromSidebar, }: {
|
|
@@ -42,28 +15,19 @@ export declare const ChaiAddBlocksPanel: ({ className, showHeading, parentId, po
|
|
|
42
15
|
fromSidebar?: boolean;
|
|
43
16
|
}) => JSX.Element;
|
|
44
17
|
|
|
18
|
+
declare type ChaiAskAiResponse = {
|
|
19
|
+
blocks?: Array<{
|
|
20
|
+
_id: string;
|
|
21
|
+
} & Partial<ChaiBlock>>;
|
|
22
|
+
usage?: Record<any, number>;
|
|
23
|
+
error?: any;
|
|
24
|
+
};
|
|
25
|
+
|
|
45
26
|
export declare const ChaiAskAiUserPrompt: ({ blockId }: {
|
|
46
27
|
blockId: string | undefined;
|
|
47
28
|
}) => JSX.Element;
|
|
48
29
|
|
|
49
|
-
declare type
|
|
50
|
-
url: string;
|
|
51
|
-
id?: string;
|
|
52
|
-
thumbnailUrl?: string;
|
|
53
|
-
description?: string;
|
|
54
|
-
width?: number;
|
|
55
|
-
height?: number;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export declare type ChaiBlock<T = Record<string, any>> = {
|
|
59
|
-
_id: string;
|
|
60
|
-
_name?: string;
|
|
61
|
-
_parent?: string | null | undefined;
|
|
62
|
-
_type: string;
|
|
63
|
-
_libBlock?: string;
|
|
64
|
-
} & T;
|
|
65
|
-
|
|
66
|
-
declare type ChaiBlock_2<T = Record<string, any>> = {
|
|
30
|
+
declare type ChaiBlock<T = Record<string, any>> = {
|
|
67
31
|
_id: string;
|
|
68
32
|
_name?: string;
|
|
69
33
|
_parent?: string | null | undefined;
|
|
@@ -82,6 +46,16 @@ export declare function ChaiBlockPropsEditor(): JSX.Element;
|
|
|
82
46
|
|
|
83
47
|
export declare function ChaiBlockStyleEditor(): JSX.Element | null;
|
|
84
48
|
|
|
49
|
+
declare type ChaiBlocksWithDesignTokens = Record<string, string>;
|
|
50
|
+
|
|
51
|
+
declare type ChaiBreakpoint = {
|
|
52
|
+
title: string;
|
|
53
|
+
content: string;
|
|
54
|
+
breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | string;
|
|
55
|
+
icon: default_2.ReactNode | Element;
|
|
56
|
+
width: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
85
59
|
export declare const ChaiBuilderCanvas: default_2.FC;
|
|
86
60
|
|
|
87
61
|
/**
|
|
@@ -101,13 +75,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
101
75
|
/**
|
|
102
76
|
* User
|
|
103
77
|
*/
|
|
104
|
-
user?:
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
email: string;
|
|
108
|
-
avatar?: string;
|
|
109
|
-
role?: string;
|
|
110
|
-
};
|
|
78
|
+
user?: ChaiUserInfo;
|
|
111
79
|
/**
|
|
112
80
|
* Permissions
|
|
113
81
|
*/
|
|
@@ -124,14 +92,10 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
124
92
|
* Theme presets
|
|
125
93
|
*/
|
|
126
94
|
themePresets?: Record<string, Partial<ChaiThemeValues>>[];
|
|
127
|
-
/**
|
|
128
|
-
* Theme options
|
|
129
|
-
*/
|
|
130
|
-
themeOptions?: (defaultThemeOptions: ChaiBuilderThemeOptions) => ChaiBuilderThemeOptions;
|
|
131
95
|
/**
|
|
132
96
|
* Theme
|
|
133
97
|
*/
|
|
134
|
-
theme?:
|
|
98
|
+
theme?: ChaiThemeValues;
|
|
135
99
|
/**
|
|
136
100
|
* Builder theme
|
|
137
101
|
*/
|
|
@@ -174,7 +138,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
174
138
|
/**
|
|
175
139
|
* Breakpoints
|
|
176
140
|
*/
|
|
177
|
-
breakpoints?:
|
|
141
|
+
breakpoints?: ChaiBreakpoint[];
|
|
178
142
|
/**
|
|
179
143
|
* Loading state
|
|
180
144
|
*/
|
|
@@ -186,7 +150,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
186
150
|
/**
|
|
187
151
|
* Ask AI callback
|
|
188
152
|
*/
|
|
189
|
-
askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[], lang: string) => Promise<
|
|
153
|
+
askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[], lang: string) => Promise<ChaiAskAiResponse>;
|
|
190
154
|
/**
|
|
191
155
|
* Get partial blocks
|
|
192
156
|
* @returns {Record<string, { type: string; name: string; description?: string }>}
|
|
@@ -208,7 +172,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
208
172
|
* onSave callback function
|
|
209
173
|
* @param saveData
|
|
210
174
|
*/
|
|
211
|
-
onSave?: ({ blocks, theme, autoSave }:
|
|
175
|
+
onSave?: ({ blocks, theme, autoSave }: ChaiSavePageData) => Promise<boolean | Error>;
|
|
212
176
|
/**
|
|
213
177
|
* onSaveStateChange callback function
|
|
214
178
|
* @param syncStatus
|
|
@@ -226,15 +190,15 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
226
190
|
/**
|
|
227
191
|
* Languages
|
|
228
192
|
*/
|
|
229
|
-
languages?:
|
|
193
|
+
languages?: string[];
|
|
230
194
|
/**
|
|
231
195
|
* Page Types props
|
|
232
196
|
*/
|
|
233
|
-
pageTypes?:
|
|
197
|
+
pageTypes?: ChaiPageType[];
|
|
234
198
|
/**
|
|
235
199
|
* Search page type items
|
|
236
200
|
*/
|
|
237
|
-
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<
|
|
201
|
+
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<Pick<ChaiPage_2, "id" | "slug" | "name">[] | Error>;
|
|
238
202
|
/**
|
|
239
203
|
* Collections
|
|
240
204
|
*/
|
|
@@ -264,23 +228,14 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
264
228
|
designTokens?: boolean;
|
|
265
229
|
};
|
|
266
230
|
structureRules?: StructureRule[];
|
|
267
|
-
designTokens?:
|
|
268
|
-
siteWideUsage?:
|
|
231
|
+
designTokens?: ChaiDesignTokens;
|
|
232
|
+
siteWideUsage?: ChaiSiteWideUsageData;
|
|
269
233
|
/**
|
|
270
234
|
* Screen to small message component
|
|
271
235
|
*/
|
|
272
236
|
smallScreenComponent?: ReactComponentType;
|
|
273
237
|
}
|
|
274
238
|
|
|
275
|
-
declare type ChaiBuilderThemeOptions = {
|
|
276
|
-
fontFamily: false | Record<VariableKey, string>;
|
|
277
|
-
borderRadius: BorderRadiusValue;
|
|
278
|
-
colors: false | {
|
|
279
|
-
group: string;
|
|
280
|
-
items: Record<VariableKey, [HSLColor, HSLColor]>;
|
|
281
|
-
}[];
|
|
282
|
-
};
|
|
283
|
-
|
|
284
239
|
declare type ChaiCollectoin = {
|
|
285
240
|
id: string;
|
|
286
241
|
name: string;
|
|
@@ -298,6 +253,13 @@ export declare const ChaiDefaultBlocks: ({ parentId, position, gridCols, disable
|
|
|
298
253
|
disableBlockGroupsSidebar?: boolean;
|
|
299
254
|
}) => JSX.Element;
|
|
300
255
|
|
|
256
|
+
declare interface ChaiDesignTokens {
|
|
257
|
+
[uniqueId: string]: {
|
|
258
|
+
name: string;
|
|
259
|
+
value: string;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
301
263
|
/**
|
|
302
264
|
* @component ChaiDraggableBlock
|
|
303
265
|
* @description
|
|
@@ -367,18 +329,103 @@ export declare type ChaiLibraryBlock<T = Record<string, any>> = {
|
|
|
367
329
|
description?: string;
|
|
368
330
|
} & T;
|
|
369
331
|
|
|
370
|
-
declare
|
|
332
|
+
export declare const ChaiOutline: () => JSX.Element;
|
|
333
|
+
|
|
334
|
+
declare type ChaiPage = {
|
|
371
335
|
id: string;
|
|
336
|
+
slug: string;
|
|
337
|
+
lang: string;
|
|
372
338
|
name: string;
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
339
|
+
pageType: string;
|
|
340
|
+
blocks: ChaiBlock[];
|
|
341
|
+
createdAt: string;
|
|
342
|
+
lastSaved: string;
|
|
343
|
+
dynamic: boolean;
|
|
344
|
+
online: boolean;
|
|
345
|
+
seo: ChaiPageSeo;
|
|
346
|
+
app: string;
|
|
347
|
+
primaryPage?: string | null;
|
|
348
|
+
currentEditor?: string | null;
|
|
349
|
+
changes: object[];
|
|
350
|
+
parent?: string | null;
|
|
351
|
+
libRefId?: string | null;
|
|
352
|
+
dynamicSlugCustom?: string | null;
|
|
353
|
+
metadata?: object;
|
|
354
|
+
jsonld?: object;
|
|
355
|
+
globalJsonLds?: string[];
|
|
356
|
+
links?: string;
|
|
357
|
+
partialBlocks?: string;
|
|
358
|
+
designTokens?: ChaiDesignTokens;
|
|
379
359
|
};
|
|
380
360
|
|
|
381
|
-
|
|
361
|
+
declare interface ChaiPage_2 {
|
|
362
|
+
id: string;
|
|
363
|
+
name: string;
|
|
364
|
+
slug: string;
|
|
365
|
+
pageType: string;
|
|
366
|
+
parent: string | null;
|
|
367
|
+
children?: ChaiPage_2[];
|
|
368
|
+
isTemplate?: boolean;
|
|
369
|
+
dynamic?: boolean;
|
|
370
|
+
[key: string]: any;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare type ChaiPageProps<T = Record<string, any>> = {
|
|
374
|
+
slug: string;
|
|
375
|
+
searchParams?: Record<string, string>;
|
|
376
|
+
} & T;
|
|
377
|
+
|
|
378
|
+
declare type ChaiPageSeo = {
|
|
379
|
+
title?: string;
|
|
380
|
+
description?: string;
|
|
381
|
+
ogTitle?: string;
|
|
382
|
+
ogDescription?: string;
|
|
383
|
+
ogImage?: string;
|
|
384
|
+
canonicalUrl?: string;
|
|
385
|
+
noIndex?: boolean;
|
|
386
|
+
noFollow?: boolean;
|
|
387
|
+
jsonLD?: string;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
declare type ChaiPageType = {
|
|
391
|
+
key: string;
|
|
392
|
+
helpText?: string;
|
|
393
|
+
icon?: string;
|
|
394
|
+
hasSlug?: boolean;
|
|
395
|
+
name: string | (() => Promise<string>);
|
|
396
|
+
dynamicSegments?: string;
|
|
397
|
+
dynamicSlug?: string;
|
|
398
|
+
getDynamicPages?: ({ query, uuid, }: {
|
|
399
|
+
query?: string;
|
|
400
|
+
uuid?: string;
|
|
401
|
+
}) => Promise<Pick<ChaiPage, "id" | "name" | "slug" | "primaryPage">[]>;
|
|
402
|
+
search?: (query: string) => Promise<Pick<ChaiPage, "id" | "name" | "slug">[] | Error>;
|
|
403
|
+
resolveLink?: (id: string, draft?: boolean, lang?: string) => Promise<string>;
|
|
404
|
+
onCreate?: (data: Partial<ChaiPage> & {
|
|
405
|
+
id: string;
|
|
406
|
+
}) => Promise<void>;
|
|
407
|
+
onUpdate?: (data: Partial<ChaiPage> & {
|
|
408
|
+
id: string;
|
|
409
|
+
}) => Promise<void>;
|
|
410
|
+
onDelete?: (data: Pick<ChaiPage, "id">) => Promise<void>;
|
|
411
|
+
dataProvider?: (args: {
|
|
412
|
+
lang: string;
|
|
413
|
+
draft: boolean;
|
|
414
|
+
inBuilder: boolean;
|
|
415
|
+
pageProps: ChaiPageProps;
|
|
416
|
+
}) => Promise<Record<string, any>>;
|
|
417
|
+
defaultSeo?: () => Record<string, any>;
|
|
418
|
+
defaultJSONLD?: () => Record<string, any>;
|
|
419
|
+
defaultMetaTags?: () => Record<string, string>;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
declare type ChaiSavePageData = {
|
|
423
|
+
autoSave: boolean;
|
|
424
|
+
blocks: ChaiBlock[];
|
|
425
|
+
theme?: ChaiThemeValues;
|
|
426
|
+
needTranslations?: boolean;
|
|
427
|
+
designTokens: ChaiDesignTokens;
|
|
428
|
+
};
|
|
382
429
|
|
|
383
430
|
export declare const ChaiScreenSizes: ({ openDelay, canvas, tooltip, buttonClass, activeButtonClass, }: {
|
|
384
431
|
openDelay?: number;
|
|
@@ -388,21 +435,14 @@ export declare const ChaiScreenSizes: ({ openDelay, canvas, tooltip, buttonClass
|
|
|
388
435
|
activeButtonClass?: string;
|
|
389
436
|
}) => JSX.Element;
|
|
390
437
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
position: "top" | "bottom";
|
|
400
|
-
}>;
|
|
401
|
-
label: string;
|
|
402
|
-
panel?: ComponentType;
|
|
403
|
-
width?: number;
|
|
404
|
-
isInternal?: boolean;
|
|
405
|
-
icon?: React.ReactNode;
|
|
438
|
+
declare interface ChaiSiteWideUsageData {
|
|
439
|
+
[pageId: string]: {
|
|
440
|
+
name: string;
|
|
441
|
+
isPartial: boolean;
|
|
442
|
+
partialBlocks: string[];
|
|
443
|
+
links: string[];
|
|
444
|
+
designTokens: ChaiBlocksWithDesignTokens;
|
|
445
|
+
};
|
|
406
446
|
}
|
|
407
447
|
|
|
408
448
|
export declare const ChaiThemeConfigPanel: React_2.FC<ThemeConfigProps>;
|
|
@@ -433,7 +473,6 @@ export declare type ChaiThemeValues = {
|
|
|
433
473
|
"card-foreground": [HexColor, HexColor];
|
|
434
474
|
popover: [HexColor, HexColor];
|
|
435
475
|
"popover-foreground": [HexColor, HexColor];
|
|
436
|
-
[key: string]: [HexColor, HexColor];
|
|
437
476
|
};
|
|
438
477
|
};
|
|
439
478
|
|
|
@@ -445,12 +484,12 @@ export declare const ChaiUILibrariesPanel: ({ parentId, position, fromSidebar, }
|
|
|
445
484
|
|
|
446
485
|
export declare const ChaiUndoRedo: () => JSX.Element;
|
|
447
486
|
|
|
448
|
-
declare
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
487
|
+
declare type ChaiUserInfo = {
|
|
488
|
+
id: string;
|
|
489
|
+
email: string;
|
|
490
|
+
name: string;
|
|
491
|
+
avatar?: string;
|
|
492
|
+
};
|
|
454
493
|
|
|
455
494
|
declare type FilterOptions = {
|
|
456
495
|
id: string;
|
|
@@ -485,30 +524,10 @@ declare type HexColor = string;
|
|
|
485
524
|
|
|
486
525
|
declare type HSLColor = string;
|
|
487
526
|
|
|
488
|
-
declare type HTMLString = string;
|
|
489
|
-
|
|
490
527
|
export { i18n }
|
|
491
528
|
|
|
492
|
-
declare type MediaManagerProps = {
|
|
493
|
-
assetId?: string;
|
|
494
|
-
close: () => void;
|
|
495
|
-
onSelect: (assets: ChaiAsset | ChaiAsset[]) => void;
|
|
496
|
-
mode?: "image" | "video" | "audio";
|
|
497
|
-
};
|
|
498
|
-
|
|
499
529
|
export declare const mergeClasses: (...inputs: ClassValue[]) => string;
|
|
500
530
|
|
|
501
|
-
declare type PageType = {
|
|
502
|
-
key: string;
|
|
503
|
-
name: string;
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
declare type PageTypeItem = {
|
|
507
|
-
id: string;
|
|
508
|
-
name: string;
|
|
509
|
-
slug?: string;
|
|
510
|
-
};
|
|
511
|
-
|
|
512
531
|
export declare const PERMISSIONS: {
|
|
513
532
|
ADD_BLOCK: string;
|
|
514
533
|
DELETE_BLOCK: string;
|
|
@@ -526,50 +545,6 @@ export declare const PERMISSIONS: {
|
|
|
526
545
|
|
|
527
546
|
declare type ReactComponentType = default_2.ComponentType<any>;
|
|
528
547
|
|
|
529
|
-
export declare const registerBlockSettingField: (id: string, component: React.ComponentType<any>) => void;
|
|
530
|
-
|
|
531
|
-
export declare const registerBlockSettingTemplate: (id: string, component: React.ComponentType<any>) => void;
|
|
532
|
-
|
|
533
|
-
export declare const registerBlockSettingWidget: (id: string, component: React.ComponentType<any>) => void;
|
|
534
|
-
|
|
535
|
-
export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
|
|
536
|
-
|
|
537
|
-
export declare const registerChaiLibrary: <T extends Record<string, any> = Record<string, any>>(id: string, library: Omit<ChaiLibraryConfig<T>, "id">) => void;
|
|
538
|
-
|
|
539
|
-
export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
|
|
540
|
-
|
|
541
|
-
export declare const registerChaiPreImportHTMLHook: (fn: (code: string) => Promise<string>) => void;
|
|
542
|
-
|
|
543
|
-
export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
|
|
544
|
-
|
|
545
|
-
export declare const registerChaiSidebarPanel: (panelId: string, panelOptions: Omit<ChaiSidebarPanel, "id">) => void;
|
|
546
|
-
|
|
547
|
-
export declare const registerChaiTopBar: (component: React.ComponentType) => void;
|
|
548
|
-
|
|
549
|
-
declare type SavePageData = {
|
|
550
|
-
autoSave: boolean;
|
|
551
|
-
blocks: ChaiBlock[];
|
|
552
|
-
theme?: ChaiThemeValues;
|
|
553
|
-
needTranslations?: boolean;
|
|
554
|
-
designTokens: DesignTokens;
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
declare type SaveToLibraryProps = {
|
|
558
|
-
blockId: string;
|
|
559
|
-
blocks: ChaiBlock[];
|
|
560
|
-
close: () => void;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
declare interface SiteWideUsage {
|
|
564
|
-
[pageId: string]: {
|
|
565
|
-
name: string;
|
|
566
|
-
isPartial: boolean;
|
|
567
|
-
partialBlocks: string[];
|
|
568
|
-
links: string[];
|
|
569
|
-
designTokens: BlocksWithDesignTokens;
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
|
|
573
548
|
declare type SortOptions = {
|
|
574
549
|
id: string;
|
|
575
550
|
name: string;
|
|
@@ -593,8 +568,4 @@ declare interface ThemeConfigProps {
|
|
|
593
568
|
className?: string;
|
|
594
569
|
}
|
|
595
570
|
|
|
596
|
-
export declare const useMediaManagerComponent: () => ComponentType<MediaManagerProps>;
|
|
597
|
-
|
|
598
|
-
declare type VariableKey = string;
|
|
599
|
-
|
|
600
571
|
export { }
|
package/dist/core.js
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
import { aW as
|
|
2
|
-
import { g as
|
|
3
|
-
import { g as
|
|
4
|
-
import {
|
|
5
|
-
import { default as W } from "i18next";
|
|
1
|
+
import { aW as e, aK as i, aS as o, aX as r, aL as l, aM as t, aN as C, aI as h, aU as d, aY as c, aZ as n, a_ as k, aO as B, aP as g, aT as m, aQ as p, aR as S, aV as f, aj as u, a$ as M } from "./index-mjuSGlPU.js";
|
|
2
|
+
import { g as A, c as E } from "./common-functions-D2lMFR6K.js";
|
|
3
|
+
import { g as T, g as x } from "./apply-binding-CLU6Xp4K.js";
|
|
4
|
+
import { default as U } from "i18next";
|
|
6
5
|
export {
|
|
7
|
-
|
|
6
|
+
e as ChaiAddBlocksDialog,
|
|
8
7
|
i as ChaiAddBlocksPanel,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
o as ChaiAskAiUserPrompt,
|
|
9
|
+
r as ChaiBlockAttributesEditor,
|
|
10
|
+
l as ChaiBlockPropsEditor,
|
|
11
|
+
t as ChaiBlockStyleEditor,
|
|
13
12
|
C as ChaiBuilderCanvas,
|
|
14
13
|
h as ChaiBuilderEditor,
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
d as ChaiDarkModeSwitcher,
|
|
15
|
+
c as ChaiDefaultBlocks,
|
|
17
16
|
n as ChaiDraggableBlock,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
k as ChaiExportCodeModal,
|
|
18
|
+
B as ChaiImportHTML,
|
|
19
|
+
g as ChaiOutline,
|
|
21
20
|
m as ChaiScreenSizes,
|
|
22
21
|
p as ChaiThemeConfigPanel,
|
|
23
22
|
S as ChaiUILibrariesPanel,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
E as registerBlockSettingField,
|
|
33
|
-
H as registerBlockSettingTemplate,
|
|
34
|
-
U as registerBlockSettingWidget,
|
|
35
|
-
v as registerChaiAddBlockTab,
|
|
36
|
-
D as registerChaiLibrary,
|
|
37
|
-
y as registerChaiMediaManager,
|
|
38
|
-
O as registerChaiPreImportHTMLHook,
|
|
39
|
-
R as registerChaiSaveToLibrary,
|
|
40
|
-
j as registerChaiSidebarPanel,
|
|
41
|
-
F as registerChaiTopBar,
|
|
42
|
-
N as useMediaManagerComponent
|
|
23
|
+
f as ChaiUndoRedo,
|
|
24
|
+
u as PERMISSIONS,
|
|
25
|
+
T as convertHTMLToChaiBlocks,
|
|
26
|
+
A as generateBlockId,
|
|
27
|
+
x as getBlocksFromHTML,
|
|
28
|
+
M as getClassValueAndUnit,
|
|
29
|
+
U as i18n,
|
|
30
|
+
E as mergeClasses
|
|
43
31
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as i, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { B as y } from "./register-chai-top-bar-
|
|
3
|
-
import { D as T, d as V, e as N, f as R, p as E, L as D, T as I, q as A } from "./index-
|
|
2
|
+
import { B as y } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
3
|
+
import { D as T, d as V, e as N, f as R, p as E, L as D, T as I, q as A } from "./index-mjuSGlPU.js";
|
|
4
|
+
import "lodash-es";
|
|
4
5
|
import * as b from "culori";
|
|
5
6
|
import { a as L } from "./fonts-DRly3Wzd.js";
|
|
6
7
|
import * as x from "react";
|
|
@@ -214,7 +215,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", H = (o) => `hsl(${d(o
|
|
|
214
215
|
--foreground: hsl(37.50 36.36% 95.69%);
|
|
215
216
|
--primary: rgb(46, 125, 50);
|
|
216
217
|
--primary-foreground: #ffffff;
|
|
217
|
-
}`,
|
|
218
|
+
}`, Q = ({ open: o, onOpenChange: e, onImport: s }) => {
|
|
218
219
|
const [r, t] = x.useState(""), [l, n] = x.useState(null), [m, h] = x.useState(!1), { t: a } = P(), p = async () => {
|
|
219
220
|
h(!0), n(null);
|
|
220
221
|
try {
|
|
@@ -302,5 +303,5 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", H = (o) => `hsl(${d(o
|
|
|
302
303
|
] }) });
|
|
303
304
|
};
|
|
304
305
|
export {
|
|
305
|
-
|
|
306
|
+
Q as CssImportModal
|
|
306
307
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("./register-chai-top-bar-DWTuRU53.cjs"),f=require("./index-BhqugjzS.cjs");require("lodash-es");const T=require("culori"),V=require("./fonts-B-Xt29pe.cjs"),N=require("react"),R=require("react-i18next");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const b=j(T),C=j(N),d=e=>e?e%1===0?e:e.toFixed(4):"0",q=e=>`hsl(${d(e.h)} ${d(e.s*100)}% ${d(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=b.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=b.converter("hsl")(r);return t==="4"?q(s):`${d(s.h)} ${d(s.s*100)}% ${d(s.l*100)}%`}case"rgb":return b.formatRgb(r);case"oklch":{const s=b.converter("oklch")(r);return`oklch(${d(s.l)} ${d(s.c)} ${d(s.h)})`}case"hex":return b.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},x=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=w(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),$();const r=v(e,":root"),s=v(e,".dark"),c=u(r,"--font-sans")||u(r,"--font-family")||u(r,"--font-heading")||u(r,"--font-body"),a=D(c);o.fontFamily={heading:a,body:a};const h=u(r,"--radius")||u(r,"--border-radius")||"0.5rem";o.borderRadius=P(h),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=u(r,`--${i}`),g=u(s,`--${i}`);if(p||g){const l=p?k(p):"#000000",S=g?k(g):l;o.colors[i]=[l,S]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),$()}return o},v=(e,o)=>{var r,s;const t=new RegExp(`${F(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},u=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${F(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},k=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return x(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return x(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[,r,s,c]=t,a=`hsl(${r} ${s}% ${c}%)`;return x(a)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const c=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return x(c)||"#000000"}}return x(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=V.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(c=>c.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},$=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),F=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,w=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
|
|
2
|
+
--background: 0 0% 100%;
|
|
3
|
+
--foreground: oklch(0.52 0.13 144.17);
|
|
4
|
+
--primary: #3e2723;
|
|
5
|
+
--primary-foreground: #ffffff;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dark {
|
|
9
|
+
--background: 222.2 84% 4.9%;
|
|
10
|
+
--foreground: hsl(37.50 36.36% 95.69%);
|
|
11
|
+
--primary: rgb(46, 125, 50);
|
|
12
|
+
--primary-foreground: #ffffff;
|
|
13
|
+
}`,_=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=C.useState(""),[c,a]=C.useState(null),[h,m]=C.useState(!1),{t:i}=R.useTranslation(),p=async()=>{m(!0),a(null);try{const l=w(r);if(!l.isValid){a(l.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),m(!1);return}const S=I(r);if(!B(S)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),m(!1);return}t(S),s(""),a(null),o(!1)}catch(l){console.error("Error importing CSS:",l),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{m(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(f.Dialog,{open:e,onOpenChange:o,children:n.jsxs(f.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(f.DialogHeader,{children:[n.jsx(f.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(f.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(f.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(f.Textarea,{id:"css-input",placeholder:M,value:r,onChange:l=>s(l.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:h})]}),c&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:c})})]}),n.jsxs(f.DialogFooter,{className:"gap-2",children:[n.jsx(y.Button,{variant:"outline",onClick:g,disabled:h,children:i("Cancel")}),n.jsx(y.Button,{onClick:p,disabled:!r.trim()||h,children:i(h?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=_;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as e, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { E as i, F as n, G as c, H as d, I as m, J as h, K as g, M as u, O as x } from "./index-
|
|
2
|
+
import { E as i, F as n, G as c, H as d, I as m, J as h, K as g, M as u, O as x } from "./index-mjuSGlPU.js";
|
|
3
3
|
import { useTranslation as D } from "react-i18next";
|
|
4
4
|
const N = ({ tokenName: l, tokenValue: s, onDelete: a, children: o }) => {
|
|
5
5
|
const { t: r } = D();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-BhqugjzS.cjs"),i=require("react-i18next"),a=({tokenName:r,tokenValue:l,onDelete:n,children:o})=>{const{t:s}=i.useTranslation();return e.jsxs(t.AlertDialog,{children:[e.jsx(t.AlertDialogTrigger,{asChild:!0,children:o}),e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs(t.AlertDialogTitle,{className:"text-base",children:[s("Delete"),' "',r,'"?']}),e.jsx(t.AlertDialogDescription,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 pt-1 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("This action cannot be undone. This will permanently remove the design token from your project.")}),e.jsxs("div",{className:"rounded-md border bg-muted/50 p-3",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:s("Token classes")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:l})]})]})})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{className:"h-7 text-xs",children:s("Cancel")}),e.jsx(t.AlertDialogAction,{onClick:n,className:"h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",children:s("Delete")})]})]})]})};exports.default=a;
|