@chaibuilder/sdk 1.0.8 → 1.0.10
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/LICENSE +28 -0
- package/README.md +123 -21
- package/dist/AddBlocks-tdvDe7xL.cjs +3 -0
- package/dist/{AddBlocks-9128ba6f.js → AddBlocks-xR2s2BVa.js} +47 -44
- package/dist/BrandingOptions-DpJ-oNnf.cjs +1 -0
- package/dist/{BrandingOptions-ea5c3818.js → BrandingOptions-cHK2bVZy.js} +14 -18
- package/dist/{CanvasArea-61ab734b.js → CanvasArea-2zqT1lSE.js} +492 -503
- package/dist/CanvasArea-Br8bBSeT.cjs +46 -0
- package/dist/ChaiBuilderEditor-SacH75l4.cjs +163 -0
- package/dist/{index-56a8abbc.js → ChaiBuilderEditor-h9bXC4l-.js} +11215 -15368
- package/dist/Class-_uCzl5v1.cjs +1 -0
- package/dist/{html-to-json-45e0e3b5.js → Class-l7qYbuoN.js} +185 -366
- package/dist/{CurrentPage-0b3bbd2f.js → CurrentPage-4lTETR2f.js} +27 -24
- package/dist/CurrentPage-nlUWJiUA.cjs +1 -0
- package/dist/{ImagesPanel-8b7a989d.cjs → ImagesPanel-6us7hiLN.cjs} +1 -1
- package/dist/{ImagesPanel-47ac13c3.js → ImagesPanel-oaHOD-Ex.js} +4 -4
- package/dist/Layers-Vw4XE6YB.cjs +1 -0
- package/dist/{Layers-f3e1f9dc.js → Layers-wOfijZnb.js} +42 -41
- package/dist/MarkAsGlobalBlock-1J_YyL1L.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-a3314fee.js → MarkAsGlobalBlock-xRyn29gC.js} +17 -20
- package/dist/{PagesPanel-13c05436.js → PagesPanel-82gCVzHS.js} +16 -13
- package/dist/PagesPanel-ZKRdK-mI.cjs +1 -0
- package/dist/ProjectPanel-kYg4KkJu.cjs +1 -0
- package/dist/{ProjectPanel-dbec2f4b.js → ProjectPanel-vz5WOyqZ.js} +22 -19
- package/dist/Settings-1E3Y_5r6.cjs +1 -0
- package/dist/{Settings-dd4fa69c.js → Settings-IuAF359L.js} +297 -296
- package/dist/SidePanels-WL1UioF2.cjs +1 -0
- package/dist/{SidePanels-857bc7bc.js → SidePanels-xssTWt4M.js} +34 -42
- package/dist/Topbar-3ozdWfSy.cjs +1 -0
- package/dist/{Topbar-3166b6aa.js → Topbar-H0f0EL6-.js} +33 -35
- package/dist/UnsplashImages-BoBBSi1a.cjs +1 -0
- package/dist/{UnsplashImages-4edb97e7.js → UnsplashImages-gPcBLjgB.js} +13 -14
- package/dist/UploadImages-T6kW0s3G.cjs +1 -0
- package/dist/{UploadImages-52181c3e.js → UploadImages-_ZyUU66E.js} +11 -12
- package/dist/{accordion-c0176dc5.js → accordion-oPUeqPCZ.js} +2 -2
- package/dist/{accordion-0afd8143.cjs → accordion-ynvFtV_p.cjs} +1 -1
- package/dist/{add-page-modal-74269b8b.js → add-page-modal-J1E7rh1U.js} +25 -22
- package/dist/add-page-modal-eiiUZCJX.cjs +1 -0
- package/dist/alert-dialog-GNfnpqFB.js +64 -0
- package/dist/alert-dialog-Mv0-wAvS.cjs +1 -0
- package/dist/{command-b1103666.cjs → command-ThdTuUxt.cjs} +1 -1
- package/dist/{command-6f260f61.js → command-VHca6CcN.js} +3 -3
- package/dist/confirm-alert-8EHe0OOd.cjs +1 -0
- package/dist/confirm-alert-b0e_BLhF.js +36 -0
- package/dist/{context-menu-e1c240ce.js → context-menu-8dC9uGXj.js} +2 -2
- package/dist/{context-menu-fec580f2.cjs → context-menu-IgLbIuth.cjs} +1 -1
- package/dist/controls-Ni5kEzLz.js +103 -0
- package/dist/controls-xUKa23ic.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -10
- package/dist/core.js +116 -69
- package/dist/delete-page-modal-TGTmRjyn.cjs +1 -0
- package/dist/{delete-page-modal-e4aa62c3.js → delete-page-modal-ysj4O0bM.js} +25 -22
- package/dist/{dialog-170eaad9.cjs → dialog-S_QbL1iq.cjs} +1 -1
- package/dist/{dialog-18207bef.js → dialog-jrw9DF1f.js} +2 -2
- package/dist/{dropdown-menu-ae3ed09b.js → dropdown-menu-S03K_fNs.js} +2 -2
- package/dist/{dropdown-menu-84b2439e.cjs → dropdown-menu-sMXR59cB.cjs} +1 -1
- package/dist/{form-25e1af37.js → form-dVpOAyRl.js} +2 -2
- package/dist/{form-ea21db6c.cjs → form-nRAvKPQj.cjs} +1 -1
- package/dist/{functions-83b1de8d.js → functions-nNTuSTsR.js} +1 -1
- package/dist/functions-pcUZhFJM.js +12 -0
- package/dist/{functions-f84d5e2a.cjs → functions-sCuB7nvZ.cjs} +1 -1
- package/dist/functions-uw7QP2kT.cjs +1 -0
- package/dist/html-to-json-P6GpbcQX.cjs +1 -0
- package/dist/html-to-json-pdHQfRkN.js +178 -0
- package/dist/index-8L3zCc6V.cjs +1 -0
- package/dist/index-cZ4uo6aT.js +2256 -0
- package/dist/{label-e770a087.js → label-KaP7MRrs.js} +2 -2
- package/dist/{label-167415e5.cjs → label-tFm8HZdb.cjs} +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +20 -13
- package/dist/lib.js +24 -23
- package/dist/{link-57de608a.js → link-6o6n2Tnd.js} +4 -4
- package/dist/link-ece8dZGH.cjs +1 -0
- package/dist/{page-viewer-40cfdbfc.js → page-viewer-84Giu0Rs.js} +29 -26
- package/dist/page-viewer-OdVEG83P.cjs +1 -0
- package/dist/{popover-f7addcf4.js → popover-a84pbVhQ.js} +2 -2
- package/dist/{popover-7cb9079b.cjs → popover-fKjgcRUx.cjs} +1 -1
- package/dist/{project-general-setting-d6f00a25.js → project-general-setting-8OEVVxzn.js} +20 -17
- package/dist/project-general-setting-laHNQPW5.cjs +1 -0
- package/dist/{project-seo-setting-d81fc1e3.js → project-seo-setting-9kD_stdI.js} +11 -12
- package/dist/project-seo-setting-F3Opt9Uj.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +7 -7
- package/dist/render.js +3 -3
- package/dist/{scroll-area-bb343b86.cjs → scroll-area-FiHvy-TZ.cjs} +1 -1
- package/dist/{scroll-area-83bd9e8f.js → scroll-area-ewXbxc3n.js} +2 -2
- package/dist/{select-0e32300c.cjs → select-7bjg-rr9.cjs} +1 -1
- package/dist/{select-7fddd7c3.js → select-POGdEDHT.js} +2 -2
- package/dist/{separator-a597dba7.cjs → separator-3Civ-6hb.cjs} +1 -1
- package/dist/{separator-a80d065b.js → separator-SctTn0Qi.js} +2 -2
- package/dist/server.d.ts +7 -10
- package/dist/server.js +0 -3
- package/dist/single-page-detail-X0TGlsT4.cjs +1 -0
- package/dist/{single-page-detail-fddaf0ec.js → single-page-detail-iXpavDy8.js} +32 -29
- package/dist/skeleton-CU_FIbg3.js +239 -0
- package/dist/skeleton-JHP9zwL2.cjs +1 -0
- package/dist/studio.cjs +1 -0
- package/dist/studio.d.ts +13 -0
- package/dist/studio.js +39 -0
- package/dist/{tabs-85caa1e8.js → tabs-Gb9v5dVb.js} +2 -2
- package/dist/{tabs-860e37aa.cjs → tabs-iWeaaVrg.cjs} +1 -1
- package/dist/{textarea-a338ede6.cjs → textarea-1kZEh7ki.cjs} +1 -1
- package/dist/{textarea-0750bcd2.js → textarea-b2QvVhrK.js} +2 -2
- package/dist/{toggle-00c9d11e.js → toggle-ASJRAaGP.js} +2 -2
- package/dist/{toggle-b90fed97.cjs → toggle-ehNIPmme.cjs} +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +69 -4
- package/dist/ui.js +272 -212
- package/dist/useAddBlock-1cMXaOVk.cjs +1 -0
- package/dist/useAddBlock-BOjrGBEO.js +86 -0
- package/dist/useAllBlocks-RU_Xw8j9.cjs +1 -0
- package/dist/useAllBlocks-lX6uVO39.js +20 -0
- package/dist/useChaiExternalData-4K9WxANa.js +6 -0
- package/dist/useChaiExternalData-DkyBJ81C.cjs +1 -0
- package/dist/useDarkMode-JWkrNFpH.js +23 -0
- package/dist/useDarkMode-zeTW_UUR.cjs +1 -0
- package/dist/useFeatureSupport-jWSuY7wk.js +16 -0
- package/dist/useFeatureSupport-tZ0QfBxp.cjs +1 -0
- package/dist/useHiddenBlocks-3MsGOJ1s.js +15 -0
- package/dist/useHiddenBlocks-oJuQDmTy.cjs +1 -0
- package/dist/useLanguage-O1uu2Bzu.js +216 -0
- package/dist/useLanguage-Y3qgAbgG.cjs +1 -0
- package/dist/useMarkAsGlobalBlock-DB5B1UP6.js +25 -0
- package/dist/useMarkAsGlobalBlock-toxRSLc_.cjs +1 -0
- package/dist/useUiLibraries-4hPOi8DI.js +12 -0
- package/dist/useUiLibraries-9FhQCpKo.cjs +1 -0
- package/package.json +19 -5
- package/dist/AddBlocks-d240ce44.cjs +0 -3
- package/dist/BrandingOptions-3bb00e4c.cjs +0 -1
- package/dist/CanvasArea-723e90e7.cjs +0 -46
- package/dist/CurrentPage-552ca7d3.cjs +0 -1
- package/dist/Layers-20a6cb66.cjs +0 -1
- package/dist/MarkAsGlobalBlock-75c82d33.cjs +0 -1
- package/dist/PagesPanel-01ce4305.cjs +0 -1
- package/dist/ProjectPanel-658f62f5.cjs +0 -1
- package/dist/Settings-f0a220d8.cjs +0 -1
- package/dist/SidePanels-fb3bc195.cjs +0 -1
- package/dist/Topbar-4f94475f.cjs +0 -1
- package/dist/UnsplashImages-98c085c2.cjs +0 -1
- package/dist/UploadImages-61ef83ad.cjs +0 -1
- package/dist/add-page-modal-25c623bf.cjs +0 -1
- package/dist/confirm-alert-c1fdf1e4.js +0 -35
- package/dist/confirm-alert-e1ea5110.cjs +0 -1
- package/dist/delete-page-modal-2cdd4b0c.cjs +0 -1
- package/dist/html-to-json-aadcbf66.cjs +0 -1
- package/dist/index-76f43d04.cjs +0 -164
- package/dist/link-24679521.cjs +0 -1
- package/dist/page-viewer-d73b7828.cjs +0 -1
- package/dist/project-general-setting-5714e3e8.cjs +0 -1
- package/dist/project-seo-setting-6eef8387.cjs +0 -1
- package/dist/single-page-detail-a3115735.cjs +0 -1
- package/dist/useBuilderProp-21feb2da.js +0 -296
- package/dist/useBuilderProp-adacf42f.cjs +0 -1
- package/dist/useChaiExternalData-192c7896.js +0 -5
- package/dist/useChaiExternalData-a90e8aac.cjs +0 -1
- /package/dist/{MODIFIERS-2f19c314.js → MODIFIERS-DsEzQ3aH.js} +0 -0
- /package/dist/{MODIFIERS-4716c669.cjs → MODIFIERS-Fx6WAZcw.cjs} +0 -0
- /package/dist/{jsx-runtime-5c3ac4f7.cjs → jsx-runtime-JYMCiFoE.cjs} +0 -0
- /package/dist/{jsx-runtime-944c88e2.js → jsx-runtime-Sp0orL4X.js} +0 -0
- /package/dist/{utils-ac68b2c8.js → utils-dze1SGvB.js} +0 -0
- /package/dist/{utils-3c452dd0.cjs → utils-qK_SjzzV.cjs} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Suraj Air
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name "Chai Builder" nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,41 +1,143 @@
|
|
|
1
|
-
# Chai Builder -
|
|
1
|
+
# Chai Builder - Low-Code Visual Builder
|
|
2
2
|
|
|
3
|
-
Chai Builder is
|
|
3
|
+
Chai Builder is an Open Source Low Code React + Tailwind CSS Builder to create beautiful content driven websites. The perfect tool for Startups and Indie-Hackers alike.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
- **Responsive Design**: Test and preview designs across various screen sizes to ensure responsiveness.
|
|
6
|
+
### Try Chai Builder:
|
|
7
|
+
|
|
8
|
+
[Demo Link](https://chaibuilder-demo.vercel.app)
|
|
11
9
|
|
|
10
|
+
Source Code (React App): [GitHub](https://github.com/surajair/demo)
|
|
12
11
|
|
|
13
|
-
## Usage
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
### Usage
|
|
16
14
|
|
|
15
|
+
> Please ensure `Tailwind CSS` is configured for your project depending on framework. [https://tailwindcss.com/docs/installation](https://tailwindcss.com/docs/installation)
|
|
16
|
+
|
|
17
|
+
Step 1: Install the package
|
|
17
18
|
```bash
|
|
18
|
-
|
|
19
|
+
npm install @chaibuilder/sdk @chaibuilder/blocks
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
Step 2: Add a custom tailwind config.
|
|
23
|
+
Create a new file: `tailwind.chaibuilder.config.ts` and add the following content.
|
|
24
|
+
```js
|
|
25
|
+
import type { Config } from "tailwindcss";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* NOTE: This file is only used for the ChaiBuilder UI.
|
|
29
|
+
* Any changes made here will only affect the ChaiBuilder UI and your website will not be affected.
|
|
30
|
+
*/
|
|
31
|
+
const config: Config = {
|
|
32
|
+
content: [
|
|
33
|
+
"./chai-blocks/**/*.{js,ts,jsx,tsx,mdx}",
|
|
34
|
+
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
|
35
|
+
"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}",
|
|
36
|
+
],
|
|
37
|
+
darkMode: "class",
|
|
38
|
+
theme: {
|
|
39
|
+
extend: {
|
|
40
|
+
colors: {
|
|
41
|
+
border: "hsl(var(--border))",
|
|
42
|
+
input: "hsl(var(--input))",
|
|
43
|
+
ring: "hsl(var(--ring))",
|
|
44
|
+
background: "hsl(var(--background))",
|
|
45
|
+
foreground: "hsl(var(--foreground))",
|
|
46
|
+
primary: {
|
|
47
|
+
DEFAULT: "hsl(var(--primary))",
|
|
48
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
49
|
+
},
|
|
50
|
+
secondary: {
|
|
51
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
52
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
53
|
+
},
|
|
54
|
+
destructive: {
|
|
55
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
56
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
57
|
+
},
|
|
58
|
+
muted: {
|
|
59
|
+
DEFAULT: "hsl(var(--muted))",
|
|
60
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
61
|
+
},
|
|
62
|
+
accent: {
|
|
63
|
+
DEFAULT: "hsl(var(--accent))",
|
|
64
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
65
|
+
},
|
|
66
|
+
popover: {
|
|
67
|
+
DEFAULT: "hsl(var(--popover))",
|
|
68
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
69
|
+
},
|
|
70
|
+
card: {
|
|
71
|
+
DEFAULT: "hsl(var(--card))",
|
|
72
|
+
foreground: "hsl(var(--card-foreground))",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
borderRadius: {
|
|
76
|
+
lg: `var(--radius)`,
|
|
77
|
+
md: `calc(var(--radius) - 2px)`,
|
|
78
|
+
sm: "calc(var(--radius) - 4px)",
|
|
79
|
+
},
|
|
80
|
+
keyframes: {
|
|
81
|
+
"accordion-down": {
|
|
82
|
+
from: { height: "0" },
|
|
83
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
84
|
+
},
|
|
85
|
+
"accordion-up": {
|
|
86
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
87
|
+
to: { height: "0" },
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
animation: {
|
|
91
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
92
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
// eslint-disable-next-line no-undef
|
|
97
|
+
plugins: [],
|
|
98
|
+
};
|
|
99
|
+
export default config;
|
|
22
100
|
|
|
23
|
-
```bash
|
|
24
|
-
npm run dev
|
|
25
101
|
```
|
|
26
102
|
|
|
27
|
-
|
|
103
|
+
Step 3: Create a new `chaibuilder.tailwind.css`
|
|
104
|
+
```css
|
|
105
|
+
@config "./tailwind.chaibuilder.config.ts";
|
|
106
|
+
|
|
107
|
+
@tailwind base;
|
|
108
|
+
@tailwind components;
|
|
109
|
+
@tailwind utilities;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Step 4: Add the component on the page.
|
|
113
|
+
```tsx
|
|
114
|
+
import "./chaibuilder.tailwind.css";
|
|
115
|
+
import "@chaibuilder/sdk/styles";
|
|
116
|
+
import {ChaiBuilderEditor} from "@chaibuilder/sdk";
|
|
117
|
+
|
|
118
|
+
const BuilderFullPage = () => {
|
|
119
|
+
return (
|
|
120
|
+
<ChaiBuilderEditor
|
|
121
|
+
logo={<h1>Your Logo</h1>}
|
|
122
|
+
blocks={[]}
|
|
123
|
+
onSaveBrandingOptions={(options) => console.log(options)}
|
|
124
|
+
onSavePage={pageData => console.log(pageData)}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
28
129
|
|
|
29
|
-
Visit `http://localhost:3000` in your browser to start using Chai Builder.
|
|
30
130
|
|
|
31
|
-
|
|
32
|
-
Chai Builder operates under a Fair Usage Policy. While this tool is available for free and open use, we kindly request users to employ it responsibly and ethically. The Fair Usage Policy for Chai Builder encompasses:
|
|
131
|
+
### Features
|
|
33
132
|
|
|
133
|
+
- **Visual Editor**: Easily tweak and fine-tune Tailwind CSS settings visually.
|
|
134
|
+
- **Customization**: Modify colors, spacing, typography, and more to match your design requirements.
|
|
135
|
+
- **Responsive Design**: Test and preview designs across various screen sizes to ensure responsiveness.
|
|
136
|
+
|
|
137
|
+
### In Progress
|
|
138
|
+
- **Live Preview**: See real-time changes in a live preview, enabling quick design decisions.
|
|
139
|
+
- **Sub Pages**: Global reusable blocks. Eg: Header, Footer etc
|
|
34
140
|
|
|
35
141
|
## Acknowledgments
|
|
36
142
|
|
|
37
143
|
Chai Builder stands on the shoulders of many open-source libraries and tools. We extend our gratitude to the developers and maintainers of these projects for their contributions.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
Feel free to adjust this to fit the specifics of your project, and add any additional sections or details as needed.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),s=require("lodash"),b=require("jotai"),w=require("./accordion-ynvFtV_p.cjs"),L=require("./scroll-area-FiHvy-TZ.cjs"),k=require("./tabs-iWeaaVrg.cjs"),y=require("./skeleton-JHP9zwL2.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),u=require("./ChaiBuilderEditor-SacH75l4.cjs"),q=require("./useAddBlock-1cMXaOVk.cjs");require("react-i18next");const A=require("@chaibuilder/blocks"),I=require("./useUiLibraries-9FhQCpKo.cjs"),P=require("lucide-react"),S=require("./utils-qK_SjzzV.cjs"),M=require("./useAllBlocks-RU_Xw8j9.cjs"),f=require("./textarea-1kZEh7ki.cjs"),F=require("./label-tFm8HZdb.cjs"),H=require("./html-to-json-P6GpbcQX.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./MODIFIERS-Fx6WAZcw.cjs");require("clsx");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./functions-uw7QP2kT.cjs");require("redux-undo");require("@react-hookz/web");require("./controls-xUKa23ic.cjs");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const D=({block:t})=>{const{type:r,icon:o,label:a}=t,{addCoreBlock:d,addPredefinedBlock:m}=q.useAddBlock(),[p]=u.useSelectedBlockIds(),[,x]=b.useAtom(u.activePanelAtom),[,l]=b.useAtom(u.addBlocksModalAtom),E=()=>{s.has(t,"blocks")?m(A.syncBlocksWithDefaults(t.blocks),s.first(p)):d(t,s.first(p)),l(!1),x("layers")},[,g,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(a||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:g,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[i.createElement(o||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:a||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:a||r})})]})]})},O=({block:t,closePopover:r})=>{var j;const[o,a]=i.useState(!1),d=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=q.useAddBlock(),[x]=u.useSelectedBlockIds(),[,l,E]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),g=i.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){m(t,s.first(x)),r();return}a(!0);const n=await d(t);s.isEmpty(n)||p(A.syncBlocksWithDefaults(n),s.first(x)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:l,onClick:o?()=>{}:g,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(P.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},U=()=>{const{data:t,isLoading:r}=I.useUILibraryBlocks(),o=A.useChaiBlocks(),a=s.filter(s.values(o),{category:"custom"}),d=s.groupBy(a,"group"),m=s.groupBy(t,"group"),[p,x]=i.useState(null),l=i.useMemo(()=>s.mergeWith(d,m,(n,h)=>{if(s.isArray(n)&&s.isArray(h))return[...n,...h]}),[d,m]),[,E]=b.useAtom(u.addBlocksModalAtom),[g,j]=i.useState("Navbar"),R=s.get(l,g,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):i.Children.toArray(s.map(l,(n,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);x(B)},onClick:()=>j(h),className:S.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",g===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:i.Children.toArray(R.map(n=>e.jsxRuntimeExports.jsx(O,{block:n,closePopover:()=>E(!1)})))})]})},z=()=>{const[t,r]=i.useState(""),{addPredefinedBlock:o}=q.useAddBlock(),[a]=u.useSelectedBlockIds(),[,d]=b.useAtom(u.addBlockOffCanvasAtom),[,m]=b.useAtom(u.activePanelAtom),[,p]=b.useAtom(u.addBlocksModalAtom),x=()=>{const l=H.getBlocksFromHTML(t);o([...l],s.first(a)||null),r(""),d(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(F.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:l=>l&&l.focus(),defaultValue:t,onChange:l=>r(l.target.value),rows:12,placeholder:`<div>
|
|
2
|
+
<h1>Enter code here</h1>
|
|
3
|
+
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(C.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},G=z,N=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],_=(t,r)=>{if(!t)return!s.includes(N,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(N,r)},K=()=>{const[t,r]=i.useState("core"),[o,a]=i.useState("basic"),d=A.useChaiBlocks(),[,m]=b.useAtom(u.showPredefinedBlockCategoryAtom),[,p]=b.useAtom(u.addBlocksModalAtom),[x]=u.useSelectedBlockIds(),l=M.useAllBlocks(),E=s.find(l,{_id:s.first(x)}),{data:g,isLoading:j}=I.useUILibraryBlocks(),R=s.groupBy(s.filter(d,c=>_(E,c.type)),"category"),n=s.uniq(s.map(R.core,"group"));i.useEffect(()=>{!s.includes(n,o)&&!s.isEmpty(n)&&!s.isEmpty(o)&&a(s.first(n))},[n,o]);const h=c=>a(T=>T===c?"":c),B=!j&&!s.isEmpty(g)||s.find(s.values(d),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(C.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:c=>{m(""),r(c)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(L.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:i.Children.toArray(s.map(n,c=>s.reject(s.filter(s.values(R.core),{group:c}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:c,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(c),className:"py-2 capitalize",children:c}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:i.Children.toArray(s.reject(s.filter(s.values(R.core),{group:c}),{hidden:!0}).map(T=>e.jsxRuntimeExports.jsx(D,{block:T})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(U,{})}),t==="html"&&e.jsxRuntimeExports.jsx(G,{})]})};exports.default=K;
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
2
|
-
import
|
|
3
|
-
import { has as
|
|
1
|
+
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
+
import T, { createElement as K, useState as j, useMemo as q, useCallback as V, useEffect as W, Suspense as Q } from "react";
|
|
3
|
+
import { has as R, first as b, filter as w, values as k, groupBy as I, mergeWith as $, isArray as H, get as J, map as L, isEmpty as B, find as M, uniq as X, includes as P, reject as E } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { A as
|
|
6
|
-
import { S as re } from "./scroll-area-
|
|
7
|
-
import { T as oe, a as te, b as A } from "./tabs-
|
|
8
|
-
import {
|
|
9
|
-
import { useDrag as
|
|
5
|
+
import { A as Y, a as Z, b as ee, c as se } from "./accordion-oPUeqPCZ.js";
|
|
6
|
+
import { S as re } from "./scroll-area-ewXbxc3n.js";
|
|
7
|
+
import { T as oe, a as te, b as A } from "./tabs-Gb9v5dVb.js";
|
|
8
|
+
import { T as le, a as ae, c as ce, u as ie, B as ne, S as de } from "./skeleton-CU_FIbg3.js";
|
|
9
|
+
import { useDrag as _, DragPreviewImage as O } from "react-dnd";
|
|
10
10
|
import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
|
|
11
|
-
import {
|
|
11
|
+
import { l as v, w as z, x as C, P as xe, Q as he } from "./ChaiBuilderEditor-h9bXC4l-.js";
|
|
12
|
+
import { u as F } from "./useAddBlock-BOjrGBEO.js";
|
|
12
13
|
import "react-i18next";
|
|
13
|
-
import { syncBlocksWithDefaults as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
14
|
+
import { syncBlocksWithDefaults as D, useChaiBlocks as G } from "@chaibuilder/blocks";
|
|
15
|
+
import { u as U } from "./useUiLibraries-4hPOi8DI.js";
|
|
16
|
+
import { Loader as fe } from "lucide-react";
|
|
17
|
+
import { c as ge } from "./utils-dze1SGvB.js";
|
|
18
|
+
import { u as be } from "./useAllBlocks-lX6uVO39.js";
|
|
19
|
+
import { C as je, c as ye, e as we, f as ke, g as Be, T as Te, d as ve, A as Ce, a as Ne } from "./textarea-b2QvVhrK.js";
|
|
20
|
+
import { L as Ae } from "./label-KaP7MRrs.js";
|
|
21
|
+
import { g as Ie } from "./html-to-json-pdHQfRkN.js";
|
|
19
22
|
import "@radix-ui/react-accordion";
|
|
20
23
|
import "@radix-ui/react-scroll-area";
|
|
21
24
|
import "@radix-ui/react-tabs";
|
|
22
|
-
import "@radix-ui/react-alert-dialog";
|
|
23
25
|
import "@radix-ui/react-slot";
|
|
24
26
|
import "class-variance-authority";
|
|
25
27
|
import "@radix-ui/react-tooltip";
|
|
26
28
|
import "@radix-ui/react-toast";
|
|
27
|
-
import "./MODIFIERS-
|
|
29
|
+
import "./MODIFIERS-DsEzQ3aH.js";
|
|
28
30
|
import "clsx";
|
|
29
31
|
import "react-dom";
|
|
30
32
|
import "@floating-ui/react-dom";
|
|
@@ -33,16 +35,17 @@ import "flagged";
|
|
|
33
35
|
import "@minoru/react-dnd-treeview";
|
|
34
36
|
import "react-hotkeys-hook";
|
|
35
37
|
import "flat-to-nested";
|
|
38
|
+
import "./functions-pcUZhFJM.js";
|
|
36
39
|
import "redux-undo";
|
|
37
40
|
import "@react-hookz/web";
|
|
38
|
-
import "
|
|
41
|
+
import "./controls-Ni5kEzLz.js";
|
|
39
42
|
import "tailwind-merge";
|
|
40
43
|
import "@radix-ui/react-label";
|
|
41
44
|
import "himalaya";
|
|
42
45
|
const Le = ({ block: s }) => {
|
|
43
|
-
const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] =
|
|
44
|
-
|
|
45
|
-
}, [, x, u] =
|
|
46
|
+
const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] = v(), [, n] = h(z), [, t] = h(C), f = () => {
|
|
47
|
+
R(s, "blocks") ? d(D(s.blocks), b(m)) : i(s, b(m)), t(!1), n("layers");
|
|
48
|
+
}, [, x, u] = _(() => ({
|
|
46
49
|
type: "CHAI_BLOCK",
|
|
47
50
|
item: s
|
|
48
51
|
}));
|
|
@@ -73,21 +76,21 @@ const Le = ({ block: s }) => {
|
|
|
73
76
|
] });
|
|
74
77
|
}, Pe = ({ block: s, closePopover: r }) => {
|
|
75
78
|
var u;
|
|
76
|
-
const [o, a] = j(!1), i = ie("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] =
|
|
79
|
+
const [o, a] = j(!1), i = ie("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = v(), [, t, f] = _(
|
|
77
80
|
() => ({
|
|
78
81
|
type: "CHAI_BLOCK",
|
|
79
82
|
item: s
|
|
80
83
|
}),
|
|
81
84
|
[s]
|
|
82
|
-
), x =
|
|
85
|
+
), x = V(
|
|
83
86
|
async (g) => {
|
|
84
|
-
if (g.stopPropagation(),
|
|
87
|
+
if (g.stopPropagation(), R(s, "component")) {
|
|
85
88
|
d(s, b(n)), r();
|
|
86
89
|
return;
|
|
87
90
|
}
|
|
88
91
|
a(!0);
|
|
89
92
|
const l = await i(s);
|
|
90
|
-
B(l) || m(
|
|
93
|
+
B(l) || m(D(l), b(n)), r();
|
|
91
94
|
},
|
|
92
95
|
[s]
|
|
93
96
|
);
|
|
@@ -108,7 +111,7 @@ const Le = ({ block: s }) => {
|
|
|
108
111
|
className: "relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
109
112
|
children: [
|
|
110
113
|
o && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
111
|
-
/* @__PURE__ */ e.jsx(
|
|
114
|
+
/* @__PURE__ */ e.jsx(fe, { className: "animate-spin", size: 15, color: "white" }),
|
|
112
115
|
" ",
|
|
113
116
|
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
114
117
|
] }),
|
|
@@ -118,10 +121,10 @@ const Le = ({ block: s }) => {
|
|
|
118
121
|
)
|
|
119
122
|
] });
|
|
120
123
|
}, Fe = () => {
|
|
121
|
-
const { data: s, isLoading: r } =
|
|
124
|
+
const { data: s, isLoading: r } = U(), o = G(), a = w(k(o), { category: "custom" }), i = I(a, "group"), d = I(s, "group"), [m, n] = j(null), t = q(() => $(i, d, (l, p) => {
|
|
122
125
|
if (H(l) && H(p))
|
|
123
126
|
return [...l, ...p];
|
|
124
|
-
}), [i, d]), [, f] = h(
|
|
127
|
+
}), [i, d]), [, f] = h(C), [x, u] = j("Navbar"), g = J(t, x, []);
|
|
125
128
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
|
|
126
129
|
/* @__PURE__ */ e.jsx("ul", { className: "sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2", children: r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
127
130
|
/* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
|
|
@@ -130,7 +133,7 @@ const Le = ({ block: s }) => {
|
|
|
130
133
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
131
134
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
132
135
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
|
|
133
|
-
] }) :
|
|
136
|
+
] }) : T.Children.toArray(
|
|
134
137
|
L(t, (l, p) => /* @__PURE__ */ e.jsx(
|
|
135
138
|
"li",
|
|
136
139
|
{
|
|
@@ -144,7 +147,7 @@ const Le = ({ block: s }) => {
|
|
|
144
147
|
n(y);
|
|
145
148
|
},
|
|
146
149
|
onClick: () => u(p),
|
|
147
|
-
className:
|
|
150
|
+
className: ge(
|
|
148
151
|
"-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",
|
|
149
152
|
x === p ? "bg-blue-500 text-white" : " text-gray-700 hover:bg-foreground/10"
|
|
150
153
|
),
|
|
@@ -152,12 +155,12 @@ const Le = ({ block: s }) => {
|
|
|
152
155
|
}
|
|
153
156
|
))
|
|
154
157
|
) }),
|
|
155
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children:
|
|
158
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: T.Children.toArray(
|
|
156
159
|
g.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => f(!1) }))
|
|
157
160
|
) })
|
|
158
161
|
] });
|
|
159
162
|
}, He = () => {
|
|
160
|
-
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] =
|
|
163
|
+
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] = v(), [, i] = h(xe), [, d] = h(z), [, m] = h(C), n = () => {
|
|
161
164
|
const t = Ie(s);
|
|
162
165
|
o([...t], b(a) || null), r(""), i(!1), d("layers"), m(!1);
|
|
163
166
|
};
|
|
@@ -169,7 +172,7 @@ const Le = ({ block: s }) => {
|
|
|
169
172
|
/* @__PURE__ */ e.jsx(Be, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
170
173
|
/* @__PURE__ */ e.jsx(Ae, { htmlFor: "current", className: "text-sm", children: "Enter HTML Code:" }),
|
|
171
174
|
/* @__PURE__ */ e.jsx(
|
|
172
|
-
|
|
175
|
+
Te,
|
|
173
176
|
{
|
|
174
177
|
autoFocus: !0,
|
|
175
178
|
tabIndex: 1,
|
|
@@ -184,9 +187,9 @@ const Le = ({ block: s }) => {
|
|
|
184
187
|
}
|
|
185
188
|
)
|
|
186
189
|
] }) }),
|
|
187
|
-
/* @__PURE__ */ e.jsxs(
|
|
190
|
+
/* @__PURE__ */ e.jsxs(ve, { className: "flex flex-col justify-end p-3", children: [
|
|
188
191
|
/* @__PURE__ */ e.jsx(ne, { disabled: s.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: "Import" }),
|
|
189
|
-
/* @__PURE__ */ e.jsxs(
|
|
192
|
+
/* @__PURE__ */ e.jsxs(Ce, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
|
|
190
193
|
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4" }),
|
|
191
194
|
/* @__PURE__ */ e.jsx(Ne, { className: "text-sm leading-4", children: "Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page." })
|
|
192
195
|
] })
|
|
@@ -197,12 +200,12 @@ const Le = ({ block: s }) => {
|
|
|
197
200
|
return !P(S, r);
|
|
198
201
|
const o = s._type;
|
|
199
202
|
return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(S, r);
|
|
200
|
-
},
|
|
201
|
-
const [s, r] = j("core"), [o, a] = j("basic"), i =
|
|
203
|
+
}, Cs = () => {
|
|
204
|
+
const [s, r] = j("core"), [o, a] = j("basic"), i = G(), [, d] = h(he), [, m] = h(C), [n] = v(), t = be(), f = M(t, { _id: b(n) }), { data: x, isLoading: u } = U(), g = I(
|
|
202
205
|
w(i, (c) => Ee(f, c.type)),
|
|
203
206
|
"category"
|
|
204
|
-
), l =
|
|
205
|
-
|
|
207
|
+
), l = X(L(g.core, "group"));
|
|
208
|
+
W(() => {
|
|
206
209
|
!P(l, o) && !B(l) && !B(o) && a(b(l));
|
|
207
210
|
}, [l, o]);
|
|
208
211
|
const p = (c) => a((N) => N === c ? "" : c), y = !u && !B(x) || M(k(i), { category: "custom" }) !== void 0;
|
|
@@ -239,23 +242,23 @@ const Le = ({ block: s }) => {
|
|
|
239
242
|
] })
|
|
240
243
|
}
|
|
241
244
|
),
|
|
242
|
-
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(
|
|
245
|
+
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(Y, { type: "single", value: o, className: "w-full px-3", children: T.Children.toArray(
|
|
243
246
|
L(
|
|
244
247
|
l,
|
|
245
248
|
(c) => E(w(k(g.core), { group: c }), {
|
|
246
249
|
hidden: !0
|
|
247
|
-
}).length ? /* @__PURE__ */ e.jsxs(
|
|
250
|
+
}).length ? /* @__PURE__ */ e.jsxs(Z, { value: c, className: "border-border", children: [
|
|
248
251
|
/* @__PURE__ */ e.jsx(ee, { onClick: () => p(c), className: "py-2 capitalize", children: c }),
|
|
249
|
-
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children:
|
|
252
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: T.Children.toArray(
|
|
250
253
|
E(w(k(g.core), { group: c }), { hidden: !0 }).map((N) => /* @__PURE__ */ e.jsx(Le, { block: N }))
|
|
251
254
|
) }) })
|
|
252
255
|
] }) : null
|
|
253
256
|
)
|
|
254
257
|
) }) }),
|
|
255
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(
|
|
258
|
+
s === "ui-blocks" && /* @__PURE__ */ e.jsx(Q, { fallback: /* @__PURE__ */ e.jsx(de, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
256
259
|
s === "html" && /* @__PURE__ */ e.jsx(Me, {})
|
|
257
260
|
] });
|
|
258
261
|
};
|
|
259
262
|
export {
|
|
260
|
-
|
|
263
|
+
Cs as default
|
|
261
264
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-JYMCiFoE.cjs"),C=require("react"),O=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./ChaiBuilderEditor-SacH75l4.cjs");require("react-i18next");const R=require("./skeleton-JHP9zwL2.cjs"),e=require("@chaibuilder/blocks"),k=require("lodash");require("./MODIFIERS-Fx6WAZcw.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./utils-qK_SjzzV.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./functions-uw7QP2kT.cjs");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");function P(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const r in i)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>i[r]})}}return t.default=i,Object.freeze(t)}const c=P(C),v=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],D=()=>{const i=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,r]=j.useBrandingOptions(),a=c.useRef(t);c.useEffect(()=>()=>{k.isEqual(t,a.current)||i(a.current)},[]);const p=({formData:l},u)=>{u&&(r(l),a.current=l)},{bodyFont:g,headingFont:f,primaryColor:b,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:h,secondaryColor:x,bodyBgLightColor:q,roundedCorners:S}=t,s={headingFont:e.SelectOption({title:"Heading font",default:f,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(S||5,10)}),primaryColor:e.Color({title:"Primary",default:b}),secondaryColor:e.Color({title:"Secondary",default:x}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:q}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:h}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:t,validator:O,onChange:p})})]})};exports.default=D;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { j as a } from "./jsx-runtime-
|
|
1
|
+
import { j as a } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import B from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import {
|
|
5
|
+
import { j as N } from "./ChaiBuilderEditor-h9bXC4l-.js";
|
|
6
6
|
import "react-i18next";
|
|
7
|
-
import { u as
|
|
8
|
-
import { SelectOption as p, Numeric as
|
|
9
|
-
import { isEqual as
|
|
10
|
-
import "./MODIFIERS-
|
|
7
|
+
import { u as j } from "./skeleton-CU_FIbg3.js";
|
|
8
|
+
import { SelectOption as p, Numeric as D, Color as e } from "@chaibuilder/blocks";
|
|
9
|
+
import { isEqual as P } from "lodash";
|
|
10
|
+
import "./MODIFIERS-DsEzQ3aH.js";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "@radix-ui/react-scroll-area";
|
|
13
13
|
import "react-dom";
|
|
@@ -17,21 +17,17 @@ import "i18next";
|
|
|
17
17
|
import "flagged";
|
|
18
18
|
import "react-dnd";
|
|
19
19
|
import "@minoru/react-dnd-treeview";
|
|
20
|
-
import "./utils-
|
|
20
|
+
import "./utils-dze1SGvB.js";
|
|
21
21
|
import "tailwind-merge";
|
|
22
22
|
import "react-hotkeys-hook";
|
|
23
23
|
import "flat-to-nested";
|
|
24
|
-
import "./
|
|
25
|
-
import "himalaya";
|
|
24
|
+
import "./functions-pcUZhFJM.js";
|
|
26
25
|
import "redux-undo";
|
|
27
26
|
import "@react-hookz/web";
|
|
28
|
-
import "@radix-ui/react-icons";
|
|
29
|
-
import "sonner";
|
|
30
|
-
import "lucide-react";
|
|
31
|
-
import "@radix-ui/react-alert-dialog";
|
|
32
27
|
import "@radix-ui/react-slot";
|
|
33
28
|
import "class-variance-authority";
|
|
34
29
|
import "@radix-ui/react-tooltip";
|
|
30
|
+
import "@radix-ui/react-icons";
|
|
35
31
|
import "@radix-ui/react-toast";
|
|
36
32
|
const d = [
|
|
37
33
|
{ title: "Roboto", value: "Roboto" },
|
|
@@ -83,11 +79,11 @@ const d = [
|
|
|
83
79
|
{ title: "Lustria", value: "Lustria" },
|
|
84
80
|
{ title: "Ovo", value: "Ovo" },
|
|
85
81
|
{ title: "Suranna", value: "Suranna" }
|
|
86
|
-
],
|
|
87
|
-
const m =
|
|
82
|
+
], rt = () => {
|
|
83
|
+
const m = j("onSaveBrandingOptions", async () => {
|
|
88
84
|
}), [o, v] = N(), r = s.useRef(o);
|
|
89
85
|
s.useEffect(() => () => {
|
|
90
|
-
|
|
86
|
+
P(o, r.current) || m(r.current);
|
|
91
87
|
}, []);
|
|
92
88
|
const c = ({ formData: t }, l) => {
|
|
93
89
|
l && (v(t), r.current = t);
|
|
@@ -112,7 +108,7 @@ const d = [
|
|
|
112
108
|
default: f,
|
|
113
109
|
options: d
|
|
114
110
|
}),
|
|
115
|
-
roundedCorners:
|
|
111
|
+
roundedCorners: D({
|
|
116
112
|
title: "Rounded Corner",
|
|
117
113
|
default: parseInt(O || 5, 10)
|
|
118
114
|
}),
|
|
@@ -162,5 +158,5 @@ const d = [
|
|
|
162
158
|
] });
|
|
163
159
|
};
|
|
164
160
|
export {
|
|
165
|
-
|
|
161
|
+
rt as default
|
|
166
162
|
};
|