@chaibuilder/sdk 1.2.9 → 1.2.10-7.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +26 -21
  2. package/dist/CodeEditor-2fowVPcS.cjs +143 -0
  3. package/dist/CodeEditor-b6uePnTe.js +143 -0
  4. package/dist/STRINGS-RCf9qnaS.cjs +9 -0
  5. package/dist/STRINGS-t8UhMYZ6.js +10 -0
  6. package/dist/Topbar-O21Nrw2O.cjs +137 -0
  7. package/dist/Topbar-xFfdTq1m.js +137 -0
  8. package/dist/UnsplashImages-awQiGFMX.cjs +280 -0
  9. package/dist/UnsplashImages-qQmFIWEy.js +280 -0
  10. package/dist/UploadImages-a8Hl0tyg.cjs +170 -0
  11. package/dist/UploadImages-cudxJepv.js +170 -0
  12. package/dist/context-menu-VMB9i0d8.cjs +1074 -0
  13. package/dist/context-menu-mp3Gu2KA.js +1043 -0
  14. package/dist/controls-4t-C_rP2.cjs +233 -0
  15. package/dist/controls-fQIu127i.js +234 -0
  16. package/dist/core.cjs +135 -1
  17. package/dist/core.d.ts +344 -119
  18. package/dist/core.js +111 -88
  19. package/dist/iconBase-OGxLGBQ1.cjs +156 -0
  20. package/dist/iconBase-Ofd16yeE.js +157 -0
  21. package/dist/index-R7v8ZYnu.js +12110 -0
  22. package/dist/index-WHVUpVPa.cjs +12125 -0
  23. package/dist/jsx-runtime-_yxTjXEh.js +931 -0
  24. package/dist/jsx-runtime-vPqyLgmD.cjs +930 -0
  25. package/dist/mockServiceWorker.js +18 -10
  26. package/dist/plugin-RAiM74uD.cjs +116 -0
  27. package/dist/plugin-T1qbgBUO.js +55 -0
  28. package/dist/plugin-YcxlCmRm.js +117 -0
  29. package/dist/plugin-cYi6q9KC.cjs +54 -0
  30. package/dist/render.cjs +215 -1
  31. package/dist/render.d.ts +21 -40
  32. package/dist/render.js +190 -98
  33. package/dist/runtime.cjs +28 -0
  34. package/dist/runtime.d.ts +5 -0
  35. package/dist/runtime.js +21 -0
  36. package/dist/style.css +1524 -1
  37. package/dist/tailwind.cjs +80 -1
  38. package/dist/tailwind.d.ts +49 -8
  39. package/dist/tailwind.js +23 -25
  40. package/dist/ui.cjs +410 -1
  41. package/dist/ui.d.ts +3 -13
  42. package/dist/ui.js +374 -163
  43. package/dist/web-blocks.cjs +1246 -9
  44. package/dist/web-blocks.d.ts +1 -1
  45. package/dist/web-blocks.js +961 -789
  46. package/package.json +66 -83
  47. package/dist/AddBlocks-tMxKPoen.js +0 -225
  48. package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
  49. package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
  50. package/dist/BrandingOptions-QJJ1y5ez.js +0 -194
  51. package/dist/CanvasArea-mlNKmCOh.js +0 -1425
  52. package/dist/CanvasArea-xs4wM64L.cjs +0 -60
  53. package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
  54. package/dist/CurrentPage-lBy25sZn.js +0 -111
  55. package/dist/Functions-7jnEwJyw.js +0 -15
  56. package/dist/Functions-N3yhPYKY.cjs +0 -1
  57. package/dist/Layers-3Xs4A5i8.js +0 -404
  58. package/dist/Layers-eaHy5PK9.cjs +0 -1
  59. package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
  60. package/dist/MODIFIERS-RiXS5Mn1.js +0 -67
  61. package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
  62. package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
  63. package/dist/PagesPanel--BZhafnt.js +0 -69
  64. package/dist/PagesPanel-gGKCV394.cjs +0 -1
  65. package/dist/ProjectPanel-YcLkM-DW.js +0 -90
  66. package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
  67. package/dist/Settings-7wlLcvoh.cjs +0 -1
  68. package/dist/Settings-TAgX4hov.js +0 -2186
  69. package/dist/SidePanels-5H4j0mIs.cjs +0 -1
  70. package/dist/SidePanels-btVQQkVK.js +0 -349
  71. package/dist/Topbar-V8xCetWF.cjs +0 -1
  72. package/dist/Topbar-j4t4AgCq.js +0 -116
  73. package/dist/UnsplashImages-41Y3q5_Q.js +0 -200
  74. package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
  75. package/dist/UploadImages-DnQ95_NW.cjs +0 -1
  76. package/dist/UploadImages-xBg-kbKv.js +0 -138
  77. package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
  78. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
  79. package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
  80. package/dist/add-page-modal-cm8damU2.js +0 -108
  81. package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
  82. package/dist/confirm-alert-i4pM3mOt.js +0 -62
  83. package/dist/controls-Dy1qa8Dc.cjs +0 -1
  84. package/dist/controls-XPXGHKht.js +0 -182
  85. package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
  86. package/dist/delete-page-modal-YrIBvfFA.js +0 -88
  87. package/dist/email-blocks.cjs +0 -1
  88. package/dist/email-blocks.d.ts +0 -3
  89. package/dist/email-blocks.js +0 -274
  90. package/dist/form-OVmsLOrc.js +0 -125
  91. package/dist/form-VbouZlAW.cjs +0 -1
  92. package/dist/functions-Ox_svtKm.cjs +0 -1
  93. package/dist/functions-xIebp8Aw.js +0 -23
  94. package/dist/html-to-json-2PeOCVey.cjs +0 -1
  95. package/dist/html-to-json-57841sEK.js +0 -183
  96. package/dist/index-H6vIwGfD.cjs +0 -1
  97. package/dist/index-N50dZnlC.cjs +0 -206
  98. package/dist/index-e0c8PmRQ.js +0 -205
  99. package/dist/index-gi1LIOCw.cjs +0 -1
  100. package/dist/index-niHREMmR.js +0 -2938
  101. package/dist/index-pZhGT8uT.js +0 -41620
  102. package/dist/jsx-runtime-WbnYoNE9.js +0 -634
  103. package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
  104. package/dist/lib.cjs +0 -4
  105. package/dist/lib.d.ts +0 -78
  106. package/dist/lib.js +0 -1322
  107. package/dist/page-viewer-SLt8XgYv.cjs +0 -1
  108. package/dist/page-viewer-feqJr1QI.js +0 -115
  109. package/dist/project-general-setting-SgagORzW.js +0 -83
  110. package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
  111. package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
  112. package/dist/project-seo-setting-wxAGEkd_.js +0 -85
  113. package/dist/server.cjs +0 -1
  114. package/dist/server.d.ts +0 -299
  115. package/dist/server.js +0 -216
  116. package/dist/single-page-detail-IPod1o5P.cjs +0 -1
  117. package/dist/single-page-detail-dnWMyg6P.js +0 -222
  118. package/dist/studio.cjs +0 -1
  119. package/dist/studio.d.ts +0 -13
  120. package/dist/studio.js +0 -58
  121. package/dist/useAddBlockByDrop-_nwI4W3q.js +0 -20
  122. package/dist/useAddBlockByDrop-inkD7Lck.cjs +0 -1
  123. package/dist/utils-AvyFzbPC.js +0 -1075
  124. package/dist/utils-PTxFk6qT.cjs +0 -1
package/README.md CHANGED
@@ -1,25 +1,27 @@
1
- # Chai Builder - Low-Code Visual Builder
1
+ # Chai Builder - Open Source Tailwind Builder
2
2
 
3
- Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder. Its a simple React component which can be integrated into any React based framework.
3
+ Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
4
+ It allows you to create web pages visually by dragging and dropping elements onto the canvas.
5
+ It is a simple React component that renders a full-fledged visual builder into any React application.
4
6
 
5
- ### Try Chai Builder:
6
- [Demo Link](https://chaibuilder-demo.vercel.app)
7
-    |    [GitHub](https://github.com/surajair/demo)
7
+ #### [View Demo](https://chaibuilder.com/demos/web)
8
+ #### [Documentation](https://chaibuilder.com/docs/sdk/introduction)
9
+ #### [API References](https://api-reference.chaibuilder.com)
8
10
 
9
11
  ---
10
12
 
11
- ### Getting Started:
13
+ ### Manual installation:
12
14
 
13
15
  Step 1: Install the packages
14
16
  ```bash
15
- npm install @chaibuilder/sdk @chaibuilder/runtime tailwindcss
17
+ npm install @chaibuilder/sdk
16
18
  ```
17
19
 
18
20
  Step 2: Add a custom tailwind config.
19
21
  Create a new file: `tailwind.chaibuilder.config.ts`. <br /> Pass the path to your source files.
20
22
  ```tsx
21
- import { chaiBuilderTailwindConfig } from "@chaibuilder/sdk/tailwind";
22
- export default chaiBuilderTailwindConfig(["./src/**/*.{js,ts,jsx,tsx}"]);
23
+ import { getChaiBuilderTailwindConfig } from "@chaibuilder/sdk/tailwind";
24
+ export default getChaiBuilderTailwindConfig(["./src/**/*.{js,ts,jsx,tsx}"]);
23
25
 
24
26
  ```
25
27
 
@@ -36,34 +38,37 @@ Step 4: Add the builder to your page.
36
38
  ```tsx
37
39
  import "./chaibuilder.tailwind.css";
38
40
  import "@chaibuilder/sdk/styles";
39
- import {ChaiBuilderEditor} from "@chaibuilder/sdk";
41
+ import {loadWebBlocks} from "@chaibuilder/sdk/web-blocks";
42
+ import { ChaiBuilderEditor } from "@chaibuilder/sdk";
43
+
44
+ loadWebBlocks();
40
45
 
41
46
  const BuilderFullPage = () => {
42
47
  return (
43
48
  <ChaiBuilderEditor
44
- blocks={[]}
45
- onSavePage={async (blocks) => await saveBlocks(blocks)}
46
- onSaveBrandingOptions={async (branding) => await saveBranding(branding)}
49
+ blocks={[{_type: 'Heading', _id: 'a', content: 'This is a heading', styles: '#styles:,text-3xl font-bold'}]}
50
+ onSave={async ({ blocks, providers, brandingOptions } ) => {
51
+ console.log(blocks, providers, brandingOptions );
52
+ return true
53
+ }}
47
54
  />
48
55
  );
49
56
  }
50
57
  ```
51
58
 
52
- Step 5: Render the blocks on your page.
59
+ ### Render the blocks on your page.
60
+
53
61
  ```tsx
54
- export default async () => {
55
- const styles = await getStylesForBlocks(blocks, brandingOptions);
56
- return <>
57
- <style>{styles}</style>
58
- <RenderChaiBlocks blocks={blocks} />
59
- </>
62
+ export default () => {
63
+ return <RenderChaiBlocks blocks={blocks}/>
60
64
  }
61
65
  ```
62
66
 
67
+ ---
63
68
  ## Support
64
69
  If you like the project, you can assist us in expanding. ChaiBuilder is a collaborative endeavor crafted by developers in their free time. We value every contribution, no matter how modest, as each one represents a significant step forward in various ways, particularly in fueling our drive to enhance this tool continually.
65
70
 
66
- <a href="https://www.buymeacoffee.com/chaibuilder" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
71
+ <a href="https://www.buymeacoffee.com/chaibuilder" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 117px !important;" ></a>
67
72
 
68
73
 
69
74
  ## Acknowledgments
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("./jsx-runtime-vPqyLgmD.cjs");
4
+ const Editor = require("@monaco-editor/react");
5
+ const contextMenu = require("./context-menu-VMB9i0d8.cjs");
6
+ const reactI18next = require("react-i18next");
7
+ const React = require("react");
8
+ const core = require("./index-WHVUpVPa.cjs");
9
+ const reactIcons = require("@radix-ui/react-icons");
10
+ const web = require("@react-hookz/web");
11
+ require("@radix-ui/react-switch");
12
+ require("@radix-ui/react-accordion");
13
+ require("class-variance-authority");
14
+ require("@radix-ui/react-alert-dialog");
15
+ require("@radix-ui/react-slot");
16
+ require("@radix-ui/react-label");
17
+ require("@radix-ui/react-scroll-area");
18
+ require("@radix-ui/react-tabs");
19
+ require("@radix-ui/react-tooltip");
20
+ require("@radix-ui/react-popover");
21
+ require("@radix-ui/react-hover-card");
22
+ require("@radix-ui/react-select");
23
+ require("@radix-ui/react-dropdown-menu");
24
+ require("@radix-ui/react-separator");
25
+ require("@radix-ui/react-toast");
26
+ require("cmdk");
27
+ require("@radix-ui/react-dialog");
28
+ require("@radix-ui/react-context-menu");
29
+ require("clsx");
30
+ require("tailwind-merge");
31
+ require("lodash-es");
32
+ require("jotai");
33
+ require("./iconBase-OGxLGBQ1.cjs");
34
+ require("@chaibuilder/runtime");
35
+ require("./plugin-RAiM74uD.cjs");
36
+ require("tree-model");
37
+ require("react-quill");
38
+ require("./STRINGS-RCf9qnaS.cjs");
39
+ require("flagged");
40
+ require("react-hotkeys-hook");
41
+ require("@floating-ui/dom");
42
+ require("@floating-ui/react-dom");
43
+ require("react-event-hook");
44
+ require("@tailwindcss/typography");
45
+ require("@tailwindcss/forms");
46
+ require("@tailwindcss/aspect-ratio");
47
+ require("react-wrap-balancer");
48
+ require("react-dom");
49
+ require("prop-types");
50
+ require("react-error-boundary");
51
+ require("re-resizable");
52
+ require("lucide-react");
53
+ require("@rjsf/validator-ajv8");
54
+ require("@rjsf/core");
55
+ require("./controls-4t-C_rP2.cjs");
56
+ require("react-arborist");
57
+ require("himalaya");
58
+ require("react-icons-picker");
59
+ require("react-autosuggest");
60
+ require("fuse.js");
61
+ require("i18next");
62
+ require("framer-motion");
63
+ const sanitizeHTML = (html) => {
64
+ const doc = document.createElement("div");
65
+ doc.innerHTML = html;
66
+ return doc.innerHTML;
67
+ };
68
+ function CodeEditor() {
69
+ const { t } = reactI18next.useTranslation();
70
+ const [dirty, setDirty] = React.useState(false);
71
+ const [code, setCode] = React.useState("");
72
+ const [codeEditor, setCodeEditor] = core.useCodeEditor();
73
+ const [ids] = core.useSelectedBlockIds();
74
+ const updateBlockProps = core.useUpdateBlocksProps();
75
+ const updateRealTime = core.useUpdateBlocksPropsRealtime();
76
+ const saveCodeContentRealTime = web.useThrottledCallback(
77
+ (value) => {
78
+ const html = sanitizeHTML(value);
79
+ updateRealTime([codeEditor.blockId], { [codeEditor.blockProp]: html });
80
+ },
81
+ [],
82
+ 300
83
+ );
84
+ const saveCodeContent = React.useCallback(() => {
85
+ if (dirty) {
86
+ const html = sanitizeHTML(code);
87
+ updateBlockProps([codeEditor.blockId], { [codeEditor.blockProp]: html });
88
+ }
89
+ }, [dirty, code]);
90
+ React.useEffect(() => {
91
+ if (!ids.includes(codeEditor == null ? void 0 : codeEditor.blockId)) {
92
+ saveCodeContent();
93
+ setCodeEditor(null);
94
+ }
95
+ }, [ids]);
96
+ const handleClickOutside = () => {
97
+ setCodeEditor(null);
98
+ };
99
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
100
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("button", { onClick: handleClickOutside, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
101
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
102
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
103
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
104
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { children: t("HTML Code Editor |") }),
105
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-xs text-gray-400", children: t("Scripts will be only executed in preview and live mode.") })
106
+ ] }),
107
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
108
+ contextMenu.Button,
109
+ {
110
+ onClick: () => setCodeEditor(null),
111
+ size: "sm",
112
+ variant: "destructive",
113
+ className: "h-6 w-fit",
114
+ children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon, {})
115
+ }
116
+ ) })
117
+ ] }),
118
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
119
+ Editor,
120
+ {
121
+ onMount: (editor) => {
122
+ editor.setValue(codeEditor.initialCode);
123
+ },
124
+ onChange: (value) => {
125
+ setDirty(true);
126
+ setCode(value);
127
+ saveCodeContentRealTime(value);
128
+ },
129
+ height: "100%",
130
+ defaultLanguage: "html",
131
+ theme: "vs-dark",
132
+ defaultValue: "",
133
+ options: {
134
+ minimap: {
135
+ enabled: false
136
+ }
137
+ }
138
+ }
139
+ )
140
+ ] })
141
+ ] });
142
+ }
143
+ exports.default = CodeEditor;
@@ -0,0 +1,143 @@
1
+ import { j as jsxRuntimeExports } from "./jsx-runtime-_yxTjXEh.js";
2
+ import Editor from "@monaco-editor/react";
3
+ import { B as Button } from "./context-menu-mp3Gu2KA.js";
4
+ import { useTranslation } from "react-i18next";
5
+ import { useState, useCallback, useEffect } from "react";
6
+ import { u as useCodeEditor, a as useSelectedBlockIds, b as useUpdateBlocksProps, c as useUpdateBlocksPropsRealtime } from "./index-R7v8ZYnu.js";
7
+ import { Cross2Icon } from "@radix-ui/react-icons";
8
+ import { useThrottledCallback } from "@react-hookz/web";
9
+ import "@radix-ui/react-switch";
10
+ import "@radix-ui/react-accordion";
11
+ import "class-variance-authority";
12
+ import "@radix-ui/react-alert-dialog";
13
+ import "@radix-ui/react-slot";
14
+ import "@radix-ui/react-label";
15
+ import "@radix-ui/react-scroll-area";
16
+ import "@radix-ui/react-tabs";
17
+ import "@radix-ui/react-tooltip";
18
+ import "@radix-ui/react-popover";
19
+ import "@radix-ui/react-hover-card";
20
+ import "@radix-ui/react-select";
21
+ import "@radix-ui/react-dropdown-menu";
22
+ import "@radix-ui/react-separator";
23
+ import "@radix-ui/react-toast";
24
+ import "cmdk";
25
+ import "@radix-ui/react-dialog";
26
+ import "@radix-ui/react-context-menu";
27
+ import "clsx";
28
+ import "tailwind-merge";
29
+ import "lodash-es";
30
+ import "jotai";
31
+ import "./iconBase-Ofd16yeE.js";
32
+ import "@chaibuilder/runtime";
33
+ import "./plugin-YcxlCmRm.js";
34
+ import "tree-model";
35
+ import "react-quill";
36
+ import "./STRINGS-t8UhMYZ6.js";
37
+ import "flagged";
38
+ import "react-hotkeys-hook";
39
+ import "@floating-ui/dom";
40
+ import "@floating-ui/react-dom";
41
+ import "react-event-hook";
42
+ import "@tailwindcss/typography";
43
+ import "@tailwindcss/forms";
44
+ import "@tailwindcss/aspect-ratio";
45
+ import "react-wrap-balancer";
46
+ import "react-dom";
47
+ import "prop-types";
48
+ import "react-error-boundary";
49
+ import "re-resizable";
50
+ import "lucide-react";
51
+ import "@rjsf/validator-ajv8";
52
+ import "@rjsf/core";
53
+ import "./controls-fQIu127i.js";
54
+ import "react-arborist";
55
+ import "himalaya";
56
+ import "react-icons-picker";
57
+ import "react-autosuggest";
58
+ import "fuse.js";
59
+ import "i18next";
60
+ import "framer-motion";
61
+ const sanitizeHTML = (html) => {
62
+ const doc = document.createElement("div");
63
+ doc.innerHTML = html;
64
+ return doc.innerHTML;
65
+ };
66
+ function CodeEditor() {
67
+ const { t } = useTranslation();
68
+ const [dirty, setDirty] = useState(false);
69
+ const [code, setCode] = useState("");
70
+ const [codeEditor, setCodeEditor] = useCodeEditor();
71
+ const [ids] = useSelectedBlockIds();
72
+ const updateBlockProps = useUpdateBlocksProps();
73
+ const updateRealTime = useUpdateBlocksPropsRealtime();
74
+ const saveCodeContentRealTime = useThrottledCallback(
75
+ (value) => {
76
+ const html = sanitizeHTML(value);
77
+ updateRealTime([codeEditor.blockId], { [codeEditor.blockProp]: html });
78
+ },
79
+ [],
80
+ 300
81
+ );
82
+ const saveCodeContent = useCallback(() => {
83
+ if (dirty) {
84
+ const html = sanitizeHTML(code);
85
+ updateBlockProps([codeEditor.blockId], { [codeEditor.blockProp]: html });
86
+ }
87
+ }, [dirty, code]);
88
+ useEffect(() => {
89
+ if (!ids.includes(codeEditor == null ? void 0 : codeEditor.blockId)) {
90
+ saveCodeContent();
91
+ setCodeEditor(null);
92
+ }
93
+ }, [ids]);
94
+ const handleClickOutside = () => {
95
+ setCodeEditor(null);
96
+ };
97
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
98
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleClickOutside, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
99
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
100
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
101
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
102
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("HTML Code Editor |") }),
103
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-gray-400", children: t("Scripts will be only executed in preview and live mode.") })
104
+ ] }),
105
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
106
+ Button,
107
+ {
108
+ onClick: () => setCodeEditor(null),
109
+ size: "sm",
110
+ variant: "destructive",
111
+ className: "h-6 w-fit",
112
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Cross2Icon, {})
113
+ }
114
+ ) })
115
+ ] }),
116
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
117
+ Editor,
118
+ {
119
+ onMount: (editor) => {
120
+ editor.setValue(codeEditor.initialCode);
121
+ },
122
+ onChange: (value) => {
123
+ setDirty(true);
124
+ setCode(value);
125
+ saveCodeContentRealTime(value);
126
+ },
127
+ height: "100%",
128
+ defaultLanguage: "html",
129
+ theme: "vs-dark",
130
+ defaultValue: "",
131
+ options: {
132
+ minimap: {
133
+ enabled: false
134
+ }
135
+ }
136
+ }
137
+ )
138
+ ] })
139
+ ] });
140
+ }
141
+ export {
142
+ CodeEditor as default
143
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ const STYLES_KEY = "#styles:";
3
+ const SLOT_KEY = "#slots:";
4
+ const I18N_KEY = "#i18n";
5
+ const ROOT_TEMP_KEY = "__ADD_BLOCK_INTERNAL_ROOT";
6
+ exports.I18N_KEY = I18N_KEY;
7
+ exports.ROOT_TEMP_KEY = ROOT_TEMP_KEY;
8
+ exports.SLOT_KEY = SLOT_KEY;
9
+ exports.STYLES_KEY = STYLES_KEY;
@@ -0,0 +1,10 @@
1
+ const STYLES_KEY = "#styles:";
2
+ const SLOT_KEY = "#slots:";
3
+ const I18N_KEY = "#i18n";
4
+ const ROOT_TEMP_KEY = "__ADD_BLOCK_INTERNAL_ROOT";
5
+ export {
6
+ I18N_KEY as I,
7
+ ROOT_TEMP_KEY as R,
8
+ STYLES_KEY as S,
9
+ SLOT_KEY as a
10
+ };
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("./jsx-runtime-vPqyLgmD.cjs");
4
+ const React = require("react");
5
+ const contextMenu = require("./context-menu-VMB9i0d8.cjs");
6
+ const core = require("./index-WHVUpVPa.cjs");
7
+ const reactI18next = require("react-i18next");
8
+ const iconBase = require("./iconBase-OGxLGBQ1.cjs");
9
+ const reactIcons = require("@radix-ui/react-icons");
10
+ require("@radix-ui/react-switch");
11
+ require("@radix-ui/react-accordion");
12
+ require("class-variance-authority");
13
+ require("@radix-ui/react-alert-dialog");
14
+ require("@radix-ui/react-slot");
15
+ require("@radix-ui/react-label");
16
+ require("@radix-ui/react-scroll-area");
17
+ require("@radix-ui/react-tabs");
18
+ require("@radix-ui/react-tooltip");
19
+ require("@radix-ui/react-popover");
20
+ require("@radix-ui/react-hover-card");
21
+ require("@radix-ui/react-select");
22
+ require("@radix-ui/react-dropdown-menu");
23
+ require("@radix-ui/react-separator");
24
+ require("@radix-ui/react-toast");
25
+ require("cmdk");
26
+ require("@radix-ui/react-dialog");
27
+ require("@radix-ui/react-context-menu");
28
+ require("clsx");
29
+ require("tailwind-merge");
30
+ require("lodash-es");
31
+ require("jotai");
32
+ require("@chaibuilder/runtime");
33
+ require("./plugin-RAiM74uD.cjs");
34
+ require("@react-hookz/web");
35
+ require("tree-model");
36
+ require("react-quill");
37
+ require("./STRINGS-RCf9qnaS.cjs");
38
+ require("flagged");
39
+ require("react-hotkeys-hook");
40
+ require("@floating-ui/dom");
41
+ require("@floating-ui/react-dom");
42
+ require("react-event-hook");
43
+ require("@tailwindcss/typography");
44
+ require("@tailwindcss/forms");
45
+ require("@tailwindcss/aspect-ratio");
46
+ require("react-wrap-balancer");
47
+ require("react-dom");
48
+ require("prop-types");
49
+ require("react-error-boundary");
50
+ require("re-resizable");
51
+ require("lucide-react");
52
+ require("@rjsf/validator-ajv8");
53
+ require("@rjsf/core");
54
+ require("./controls-4t-C_rP2.cjs");
55
+ require("react-arborist");
56
+ require("himalaya");
57
+ require("react-icons-picker");
58
+ require("react-autosuggest");
59
+ require("fuse.js");
60
+ require("i18next");
61
+ require("framer-motion");
62
+ const SaveButton = () => {
63
+ const { savePage, saveState } = core.useSavePage();
64
+ const { t } = reactI18next.useTranslation();
65
+ const button = /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
66
+ contextMenu.Button,
67
+ {
68
+ disabled: saveState === "SAVING",
69
+ onClick: (e) => {
70
+ e.preventDefault();
71
+ savePage();
72
+ },
73
+ className: iconBase.cn(
74
+ "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
75
+ // UNSAVED sate
76
+ "bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
77
+ {
78
+ "animate-pulse bg-gray-300 text-gray-900": saveState === "SAVING",
79
+ "bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white": saveState === "SAVED"
80
+ }
81
+ ),
82
+ size: "sm",
83
+ variant: "outline",
84
+ children: [
85
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(core.FaCheck, { className: "text-sm text-white" }),
86
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-sm", children: saveState === "SAVING" ? t("saving") : saveState === "SAVED" ? t("saved") : t("unsaved") })
87
+ ]
88
+ }
89
+ );
90
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex items-center", children: button });
91
+ };
92
+ const Preview = function Preview2() {
93
+ const preview = core.useBuilderProp("previewComponent");
94
+ const [, setPreviewMode] = core.usePreviewMode();
95
+ const { t } = reactI18next.useTranslation();
96
+ if (!preview)
97
+ return null;
98
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
99
+ contextMenu.Button,
100
+ {
101
+ onClick: (e) => {
102
+ e.preventDefault();
103
+ setPreviewMode(true);
104
+ },
105
+ className: `flex h-auto w-fit items-center gap-x-2 p-1 px-2`,
106
+ size: "sm",
107
+ variant: "outline",
108
+ children: [
109
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EyeOpenIcon, { className: "text-xs" }),
110
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-sm", children: t("preview") })
111
+ ]
112
+ }
113
+ );
114
+ };
115
+ const Topbar = () => {
116
+ const leftComponents = core.useBuilderProp("topBarComponents.left", []);
117
+ const centerComponents = core.useBuilderProp("topBarComponents.center", []);
118
+ const rightComponents = core.useBuilderProp("topBarComponents.right", []);
119
+ const editable = core.useBuilderProp("editable", true);
120
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
121
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-2 font-bold", children: React.Children.toArray(
122
+ leftComponents.map((Component) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton, { className: "h-10" }), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Component, {}) }))
123
+ ) }) }),
124
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-2", children: React.Children.toArray(
125
+ centerComponents.map((Component) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton, { className: "h-10" }), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Component, {}) }))
126
+ ) }),
127
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-1", children: [
128
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Preview, {}),
129
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator, { orientation: "vertical" }),
130
+ editable ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(SaveButton, {}) : null,
131
+ React.Children.toArray(
132
+ rightComponents.map((Component) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton, { className: "h-10" }), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Component, {}) }))
133
+ )
134
+ ] })
135
+ ] });
136
+ };
137
+ exports.default = Topbar;
@@ -0,0 +1,137 @@
1
+ import { j as jsxRuntimeExports } from "./jsx-runtime-_yxTjXEh.js";
2
+ import React__default, { Suspense } from "react";
3
+ import { B as Button, a as Skeleton, b as Separator } from "./context-menu-mp3Gu2KA.js";
4
+ import { e as useSavePage, F as FaCheck, d as useBuilderProp, f as usePreviewMode } from "./index-R7v8ZYnu.js";
5
+ import { useTranslation } from "react-i18next";
6
+ import { c as cn } from "./iconBase-Ofd16yeE.js";
7
+ import { EyeOpenIcon } from "@radix-ui/react-icons";
8
+ import "@radix-ui/react-switch";
9
+ import "@radix-ui/react-accordion";
10
+ import "class-variance-authority";
11
+ import "@radix-ui/react-alert-dialog";
12
+ import "@radix-ui/react-slot";
13
+ import "@radix-ui/react-label";
14
+ import "@radix-ui/react-scroll-area";
15
+ import "@radix-ui/react-tabs";
16
+ import "@radix-ui/react-tooltip";
17
+ import "@radix-ui/react-popover";
18
+ import "@radix-ui/react-hover-card";
19
+ import "@radix-ui/react-select";
20
+ import "@radix-ui/react-dropdown-menu";
21
+ import "@radix-ui/react-separator";
22
+ import "@radix-ui/react-toast";
23
+ import "cmdk";
24
+ import "@radix-ui/react-dialog";
25
+ import "@radix-ui/react-context-menu";
26
+ import "clsx";
27
+ import "tailwind-merge";
28
+ import "lodash-es";
29
+ import "jotai";
30
+ import "@chaibuilder/runtime";
31
+ import "./plugin-YcxlCmRm.js";
32
+ import "@react-hookz/web";
33
+ import "tree-model";
34
+ import "react-quill";
35
+ import "./STRINGS-t8UhMYZ6.js";
36
+ import "flagged";
37
+ import "react-hotkeys-hook";
38
+ import "@floating-ui/dom";
39
+ import "@floating-ui/react-dom";
40
+ import "react-event-hook";
41
+ import "@tailwindcss/typography";
42
+ import "@tailwindcss/forms";
43
+ import "@tailwindcss/aspect-ratio";
44
+ import "react-wrap-balancer";
45
+ import "react-dom";
46
+ import "prop-types";
47
+ import "react-error-boundary";
48
+ import "re-resizable";
49
+ import "lucide-react";
50
+ import "@rjsf/validator-ajv8";
51
+ import "@rjsf/core";
52
+ import "./controls-fQIu127i.js";
53
+ import "react-arborist";
54
+ import "himalaya";
55
+ import "react-icons-picker";
56
+ import "react-autosuggest";
57
+ import "fuse.js";
58
+ import "i18next";
59
+ import "framer-motion";
60
+ const SaveButton = () => {
61
+ const { savePage, saveState } = useSavePage();
62
+ const { t } = useTranslation();
63
+ const button = /* @__PURE__ */ jsxRuntimeExports.jsxs(
64
+ Button,
65
+ {
66
+ disabled: saveState === "SAVING",
67
+ onClick: (e) => {
68
+ e.preventDefault();
69
+ savePage();
70
+ },
71
+ className: cn(
72
+ "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
73
+ // UNSAVED sate
74
+ "bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
75
+ {
76
+ "animate-pulse bg-gray-300 text-gray-900": saveState === "SAVING",
77
+ "bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white": saveState === "SAVED"
78
+ }
79
+ ),
80
+ size: "sm",
81
+ variant: "outline",
82
+ children: [
83
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FaCheck, { className: "text-sm text-white" }),
84
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: saveState === "SAVING" ? t("saving") : saveState === "SAVED" ? t("saved") : t("unsaved") })
85
+ ]
86
+ }
87
+ );
88
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: button });
89
+ };
90
+ const Preview = function Preview2() {
91
+ const preview = useBuilderProp("previewComponent");
92
+ const [, setPreviewMode] = usePreviewMode();
93
+ const { t } = useTranslation();
94
+ if (!preview)
95
+ return null;
96
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
97
+ Button,
98
+ {
99
+ onClick: (e) => {
100
+ e.preventDefault();
101
+ setPreviewMode(true);
102
+ },
103
+ className: `flex h-auto w-fit items-center gap-x-2 p-1 px-2`,
104
+ size: "sm",
105
+ variant: "outline",
106
+ children: [
107
+ /* @__PURE__ */ jsxRuntimeExports.jsx(EyeOpenIcon, { className: "text-xs" }),
108
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: t("preview") })
109
+ ]
110
+ }
111
+ );
112
+ };
113
+ const Topbar = () => {
114
+ const leftComponents = useBuilderProp("topBarComponents.left", []);
115
+ const centerComponents = useBuilderProp("topBarComponents.center", []);
116
+ const rightComponents = useBuilderProp("topBarComponents.right", []);
117
+ const editable = useBuilderProp("editable", true);
118
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
119
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-2 font-bold", children: React__default.Children.toArray(
120
+ leftComponents.map((Component) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-10" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {}) }))
121
+ ) }) }),
122
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-2", children: React__default.Children.toArray(
123
+ centerComponents.map((Component) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-10" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {}) }))
124
+ ) }),
125
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-1", children: [
126
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Preview, {}),
127
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { orientation: "vertical" }),
128
+ editable ? /* @__PURE__ */ jsxRuntimeExports.jsx(SaveButton, {}) : null,
129
+ React__default.Children.toArray(
130
+ rightComponents.map((Component) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-10" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {}) }))
131
+ )
132
+ ] })
133
+ ] });
134
+ };
135
+ export {
136
+ Topbar as default
137
+ };