@chaibuilder/sdk 1.1.14 → 1.1.16
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/dist/AddBlocks-1DrS62uN.js +222 -0
- package/dist/AddBlocks-jqRRefXj.cjs +1 -0
- package/dist/BrandingOptions-TRVyCvVq.cjs +1 -0
- package/dist/{BrandingOptions-4qzTYdj5.js → BrandingOptions-zFJ28xmJ.js} +18 -19
- package/dist/CanvasArea-5oxRxEDL.cjs +59 -0
- package/dist/CanvasArea-j8iIkWN-.js +1438 -0
- package/dist/{CurrentPage-zxrdTVsG.cjs → CurrentPage-CsENtl7b.cjs} +1 -1
- package/dist/{CurrentPage-spjJpQSM.js → CurrentPage-cNRrM2vd.js} +1 -1
- package/dist/{Layers-QNAlCI4j.js → Layers-6Fa_6Vy2.js} +2 -2
- package/dist/{Layers-YyBChBtg.cjs → Layers-r6pP4nDP.cjs} +1 -1
- package/dist/MarkAsGlobalBlock-CDmEHNx7.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-xOHhiMDl.js → MarkAsGlobalBlock-uhj0kGZo.js} +23 -23
- package/dist/{PagesPanel-BeJrveus.cjs → PagesPanel-UXqoXG-j.cjs} +1 -1
- package/dist/{PagesPanel--LI-BoSj.js → PagesPanel-s2qoPZc-.js} +2 -2
- package/dist/{ProjectPanel-VNj0jXca.js → ProjectPanel-9z6zVYBb.js} +2 -2
- package/dist/{ProjectPanel-MjcAymKT.cjs → ProjectPanel-izG3GYtn.cjs} +1 -1
- package/dist/Settings-iLeODb_n.js +2188 -0
- package/dist/Settings-olFxwKg4.cjs +1 -0
- package/dist/SidePanels-1QED7mo6.cjs +1 -0
- package/dist/{SidePanels-4lvmnnlw.js → SidePanels-CWAz1HdY.js} +125 -124
- package/dist/add-page-modal-rn0OScnT.cjs +1 -0
- package/dist/{add-page-modal-fZnKopNf.js → add-page-modal-vT0-45wi.js} +6 -7
- package/dist/controls-QnyBNkXG.cjs +36 -0
- package/dist/controls-kEuiMMDf.js +4600 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-P_KKu12n.cjs → delete-page-modal-EZ4gIG3s.cjs} +1 -1
- package/dist/{delete-page-modal-fRoXPfhG.js → delete-page-modal-hWmFarnh.js} +1 -1
- package/dist/index-Ge20J9Pa.cjs +206 -0
- package/dist/{index-CQz6j3ex.js → index-TWBwhGkh.js} +4957 -4262
- package/dist/mockServiceWorker.js +10 -18
- package/dist/{page-viewer-39ZtxLzx.js → page-viewer-TZC26UCW.js} +2 -2
- package/dist/{page-viewer-_lc8vqU4.cjs → page-viewer-yH4HdYhv.cjs} +1 -1
- package/dist/{project-general-setting-CCVuGyHh.js → project-general-setting-SjVbcwgp.js} +7 -8
- package/dist/project-general-setting-eEQDxjVm.cjs +1 -0
- package/dist/{project-seo-setting-Wo7E46w7.js → project-seo-setting-EhqUcTKy.js} +7 -8
- package/dist/project-seo-setting-N0OnBCvh.cjs +1 -0
- package/dist/single-page-detail-76T7ZZzC.cjs +1 -0
- package/dist/{single-page-detail-r1GJF00l.js → single-page-detail-ePzFhs8m.js} +47 -48
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +1 -1
- package/package.json +3 -2
- package/dist/AddBlocks-AG_J7s2Z.cjs +0 -1
- package/dist/AddBlocks-FsdsASNp.js +0 -222
- package/dist/BrandingOptions-xBuqDpj0.cjs +0 -1
- package/dist/CanvasArea-4m1-c1yq.cjs +0 -59
- package/dist/CanvasArea-U3egqewu.js +0 -1434
- package/dist/MarkAsGlobalBlock-LXDkmFUr.cjs +0 -1
- package/dist/Settings-BrYkhn3H.cjs +0 -1
- package/dist/Settings-LZJwbkO6.js +0 -2189
- package/dist/SidePanels-_5oUp-eI.cjs +0 -1
- package/dist/add-page-modal-rWhPuGd9.cjs +0 -1
- package/dist/controls-G0puEH71.js +0 -120
- package/dist/controls-aHZq-q4b.cjs +0 -1
- package/dist/index-1Dr-VtaT.cjs +0 -206
- package/dist/project-general-setting-LEzDhwoq.cjs +0 -1
- package/dist/project-seo-setting-orwH-Ufg.cjs +0 -1
- package/dist/single-page-detail-jkDYF7lW.cjs +0 -1
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Mock Service Worker
|
|
5
|
+
* Mock Service Worker.
|
|
6
6
|
* @see https://github.com/mswjs/msw
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const PACKAGE_VERSION = '2.3.0'
|
|
12
|
+
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
|
|
12
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
14
|
const activeClientIds = new Set()
|
|
14
15
|
|
|
@@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) {
|
|
|
48
49
|
case 'INTEGRITY_CHECK_REQUEST': {
|
|
49
50
|
sendToClient(client, {
|
|
50
51
|
type: 'INTEGRITY_CHECK_RESPONSE',
|
|
51
|
-
payload:
|
|
52
|
+
payload: {
|
|
53
|
+
packageVersion: PACKAGE_VERSION,
|
|
54
|
+
checksum: INTEGRITY_CHECKSUM,
|
|
55
|
+
},
|
|
52
56
|
})
|
|
53
57
|
break
|
|
54
58
|
}
|
|
@@ -121,11 +125,6 @@ async function handleRequest(event, requestId) {
|
|
|
121
125
|
if (client && activeClientIds.has(client.id)) {
|
|
122
126
|
;(async function () {
|
|
123
127
|
const responseClone = response.clone()
|
|
124
|
-
// When performing original requests, response body will
|
|
125
|
-
// always be a ReadableStream, even for 204 responses.
|
|
126
|
-
// But when creating a new Response instance on the client,
|
|
127
|
-
// the body for a 204 response must be null.
|
|
128
|
-
const responseBody = response.status === 204 ? null : responseClone.body
|
|
129
128
|
|
|
130
129
|
sendToClient(
|
|
131
130
|
client,
|
|
@@ -137,11 +136,11 @@ async function handleRequest(event, requestId) {
|
|
|
137
136
|
type: responseClone.type,
|
|
138
137
|
status: responseClone.status,
|
|
139
138
|
statusText: responseClone.statusText,
|
|
140
|
-
body:
|
|
139
|
+
body: responseClone.body,
|
|
141
140
|
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
142
141
|
},
|
|
143
142
|
},
|
|
144
|
-
[
|
|
143
|
+
[responseClone.body],
|
|
145
144
|
)
|
|
146
145
|
})()
|
|
147
146
|
}
|
|
@@ -207,13 +206,6 @@ async function getResponse(event, client, requestId) {
|
|
|
207
206
|
return passthrough()
|
|
208
207
|
}
|
|
209
208
|
|
|
210
|
-
// Bypass requests with the explicit bypass header.
|
|
211
|
-
// Such requests can be issued by "ctx.fetch()".
|
|
212
|
-
const mswIntention = request.headers.get('x-msw-intention')
|
|
213
|
-
if (['bypass', 'passthrough'].includes(mswIntention)) {
|
|
214
|
-
return passthrough()
|
|
215
|
-
}
|
|
216
|
-
|
|
217
209
|
// Notify the client that a request has been intercepted.
|
|
218
210
|
const requestBuffer = await request.arrayBuffer()
|
|
219
211
|
const clientMessage = await sendToClient(
|
|
@@ -245,7 +237,7 @@ async function getResponse(event, client, requestId) {
|
|
|
245
237
|
return respondWithMock(clientMessage.data)
|
|
246
238
|
}
|
|
247
239
|
|
|
248
|
-
case '
|
|
240
|
+
case 'PASSTHROUGH': {
|
|
249
241
|
return passthrough()
|
|
250
242
|
}
|
|
251
243
|
}
|
|
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
|
2
2
|
import s, { useState as p, Suspense as l } from "react";
|
|
3
3
|
import { ChevronRightIcon as c, GearIcon as u, HomeIcon as d, FileTextIcon as x } from "@radix-ui/react-icons";
|
|
4
4
|
import { b0 as g, b1 as h, b2 as f } from "./index-0OqmBgqo.js";
|
|
5
|
-
import { e as j, b, d as N } from "./index-
|
|
5
|
+
import { e as j, b, d as N } from "./index-TWBwhGkh.js";
|
|
6
6
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
7
7
|
import "@radix-ui/react-toggle";
|
|
8
8
|
import "class-variance-authority";
|
|
@@ -48,7 +48,7 @@ import "sonner";
|
|
|
48
48
|
import "./html-to-json-Y5M0N8PH.js";
|
|
49
49
|
import "himalaya";
|
|
50
50
|
import "lucide-react";
|
|
51
|
-
const v = s.lazy(() => import("./single-page-detail-
|
|
51
|
+
const v = s.lazy(() => import("./single-page-detail-ePzFhs8m.js")), P = ({ pageData: r }) => {
|
|
52
52
|
const [t, i] = p("CLOSE");
|
|
53
53
|
return /* @__PURE__ */ e.jsxs(
|
|
54
54
|
g,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-d55M5MRz.cjs"),x=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-d55M5MRz.cjs"),x=require("./index-Ge20J9Pa.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("./lodash-2us0VT8I.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-76T7ZZzC.cjs"))),j=({pageData:s})=>{const[r,i]=u.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:t=>{i(r==="PENDING"?"ALERT":t?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:t=>{t.stopPropagation(),i("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(n.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(n.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(m,{pageData:s,open:r,setOpen:i})})})]})},p=s=>{const[r]=x.useCurrentPage(),{data:i}=x.useProject(),t=x.useChangePage(),l=(i==null?void 0:i.homepage)===s.uuid,a=r===s.uuid,c=()=>t(s);return i?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${a?"bg-blue-200 ":""}`,onClick:c,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex text-sm items-center gap-x-1.5",children:[l?e.jsxRuntimeExports.jsx(n.HomeIcon,{}):e.jsxRuntimeExports.jsx(n.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(j,{pageData:s})]}):null},q=({pages:s,isLoading:r})=>r?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):s.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:u.Children.toArray(s.map(i=>e.jsxRuntimeExports.jsx(p,{...i})))});exports.default=q;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import * as l from "react";
|
|
3
3
|
import { bo as n } from "./index-0OqmBgqo.js";
|
|
4
|
-
import {
|
|
5
|
-
import { F as
|
|
6
|
-
import { b as x } from "./index-
|
|
4
|
+
import { R as c, F as d } from "./controls-kEuiMMDf.js";
|
|
5
|
+
import { F as u } from "./form-irY39wvJ.js";
|
|
6
|
+
import { b as x } from "./index-TWBwhGkh.js";
|
|
7
7
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
8
8
|
import "@radix-ui/react-toggle";
|
|
9
9
|
import "class-variance-authority";
|
|
@@ -39,7 +39,6 @@ import "redux-undo";
|
|
|
39
39
|
import "@chaibuilder/runtime";
|
|
40
40
|
import "@react-hookz/web";
|
|
41
41
|
import "react-i18next";
|
|
42
|
-
import "lodash";
|
|
43
42
|
import "@rjsf/core";
|
|
44
43
|
import "@rjsf/validator-ajv8";
|
|
45
44
|
import "i18next";
|
|
@@ -53,7 +52,7 @@ import "sonner";
|
|
|
53
52
|
import "./html-to-json-Y5M0N8PH.js";
|
|
54
53
|
import "himalaya";
|
|
55
54
|
import "lucide-react";
|
|
56
|
-
const
|
|
55
|
+
const jo = ({
|
|
57
56
|
_projectData: m,
|
|
58
57
|
seany: t
|
|
59
58
|
}) => {
|
|
@@ -71,10 +70,10 @@ const Po = ({
|
|
|
71
70
|
title: "Project Name",
|
|
72
71
|
default: o == null ? void 0 : o.name
|
|
73
72
|
}),
|
|
74
|
-
favicon:
|
|
73
|
+
favicon: d({ title: "Favicon", default: o == null ? void 0 : o.favicon })
|
|
75
74
|
};
|
|
76
|
-
return /* @__PURE__ */ i.jsx(n, { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ i.jsx(
|
|
75
|
+
return /* @__PURE__ */ i.jsx(n, { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ i.jsx(u, { properties: a, disabled: p, formData: m, onChange: e }) });
|
|
77
76
|
};
|
|
78
77
|
export {
|
|
79
|
-
|
|
78
|
+
jo as default
|
|
80
79
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),f=require("./index-d55M5MRz.cjs"),o=require("./controls-QnyBNkXG.cjs"),d=require("./form-6qGAOYI3.cjs"),m=require("./index-Ge20J9Pa.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("./lodash-2us0VT8I.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");function j(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const u=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,u.get?u:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const g=j(a),b=({_projectData:r,seany:i})=>{const{data:e,isLoading:u}=m.useProject();g.useEffect(()=>{e&&i(e)},[e,i]);const n=({formData:s},t)=>{i(l=>({...l,[t]:s[t]}))},c={name:o.Ry({title:"Project Name",default:e==null?void 0:e.name}),favicon:o.Fy({title:"Favicon",default:e==null?void 0:e.favicon})};return q.jsxRuntimeExports.jsx(f.ScrollArea,{className:"flex h-full select-none flex-col",children:q.jsxRuntimeExports.jsx(d.Form,{properties:c,disabled:u,formData:r,onChange:n})})};exports.default=b;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { j as s } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import {
|
|
2
|
+
import { P as c, R as u, x as g, F as x } from "./controls-kEuiMMDf.js";
|
|
3
3
|
import { F as v } from "./form-irY39wvJ.js";
|
|
4
4
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import "lodash";
|
|
7
6
|
import "@rjsf/core";
|
|
8
7
|
import "@rjsf/validator-ajv8";
|
|
9
8
|
import "./lodash-3gkdNK5u.js";
|
|
@@ -41,19 +40,19 @@ import "redux-undo";
|
|
|
41
40
|
import "@chaibuilder/runtime";
|
|
42
41
|
import "@react-hookz/web";
|
|
43
42
|
import "react-i18next";
|
|
44
|
-
const
|
|
43
|
+
const at = ({
|
|
45
44
|
_projectData: t,
|
|
46
45
|
seany: l
|
|
47
46
|
}) => {
|
|
48
47
|
var o, e, r, m, p, a;
|
|
49
48
|
const n = ({ formData: f }) => {
|
|
50
49
|
const i = { ...f };
|
|
51
|
-
i.seoData.title === void 0 && (i.seoData.title = ""), i.seoData.description === void 0 && (i.seoData.description = ""), i.seoData.image === void 0 && (i.seoData.image = ""), l((
|
|
52
|
-
...
|
|
50
|
+
i.seoData.title === void 0 && (i.seoData.title = ""), i.seoData.description === void 0 && (i.seoData.description = ""), i.seoData.image === void 0 && (i.seoData.image = ""), l((D) => ({
|
|
51
|
+
...D,
|
|
53
52
|
...i
|
|
54
53
|
}));
|
|
55
54
|
}, d = {
|
|
56
|
-
seoData:
|
|
55
|
+
seoData: c({
|
|
57
56
|
title: "",
|
|
58
57
|
default: {
|
|
59
58
|
title: ((o = t.seoData) == null ? void 0 : o.title) || "",
|
|
@@ -61,7 +60,7 @@ const st = ({
|
|
|
61
60
|
image: ((r = t.seoData) == null ? void 0 : r.image) || ""
|
|
62
61
|
},
|
|
63
62
|
properties: {
|
|
64
|
-
title:
|
|
63
|
+
title: u({
|
|
65
64
|
title: "Default Title",
|
|
66
65
|
default: ((m = t.seoData) == null ? void 0 : m.title) || ""
|
|
67
66
|
}),
|
|
@@ -79,5 +78,5 @@ const st = ({
|
|
|
79
78
|
return /* @__PURE__ */ s.jsx("div", { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ s.jsx(v, { properties: d, formData: t, onChange: n }) });
|
|
80
79
|
};
|
|
81
80
|
export {
|
|
82
|
-
|
|
81
|
+
at as default
|
|
83
82
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),i=require("./controls-QnyBNkXG.cjs"),D=require("./form-6qGAOYI3.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("react");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./lodash-2us0VT8I.cjs");require("./index-d55M5MRz.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const g=({_projectData:e,seany:n})=>{var t,u,o,s,q,a;const d=({formData:f})=>{const r={...f};r.seoData.title===void 0&&(r.seoData.title=""),r.seoData.description===void 0&&(r.seoData.description=""),r.seoData.image===void 0&&(r.seoData.image=""),n(m=>({...m,...r}))},c={seoData:i.Py({title:"",default:{title:((t=e.seoData)==null?void 0:t.title)||"",description:((u=e.seoData)==null?void 0:u.description)||"",image:((o=e.seoData)==null?void 0:o.image)||""},properties:{title:i.Ry({title:"Default Title",default:((s=e.seoData)==null?void 0:s.title)||""}),description:i.xy({title:"Default Description",default:((q=e.seoData)==null?void 0:q.description)||""}),image:i.Fy({title:"Social Media Image",default:((a=e.seoData)==null?void 0:a.image)||""})}})};return l.jsxRuntimeExports.jsx("div",{className:"flex h-full select-none flex-col",children:l.jsxRuntimeExports.jsx(D.Form,{properties:c,formData:e,onChange:d})})};exports.default=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-WUGKV8jN.cjs"),f=require("react"),c=require("./lodash-2us0VT8I.cjs"),w=require("@radix-ui/react-icons"),N=require("./index-d55M5MRz.cjs"),d=require("./controls-QnyBNkXG.cjs"),H=require("sonner"),p=require("./form-6qGAOYI3.cjs"),P=require("./index-Ge20J9Pa.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const z=f.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-EZ4gIG3s.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-dHRDZrA1.cjs"))),E=n=>{if(!c.isString(n)||!(n.includes("/[")&&n.includes("]")))return!1;const s=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,q=/^[a-zA-Z0-9_-]+$/;let e=!0;return n.split("/").forEach(u=>{e&&(u.includes("[[")&&u.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(u):u.includes("[")&&u.includes("]")?e=s.test(u):e=q.test(u))}),e},h=n=>n&&c.isEmpty(n.seoData)?{...n,seoData:{title:"",description:"",image:""}}:n,F=(n,o)=>{const s=!c.isEqual(c.omit(n,["seoData"]),c.omit(o,["seoData"])),q=!c.isEqual(h(o).seoData,h(n).seoData);return s||q},G=({open:n,setOpen:o,pageData:s})=>{const q=P.useQueryClient(),{data:e}=P.useProject(),u=P.useUpdatePage(),m=P.useUpdateProject("Homepage updated successfully."),[i,b]=f.useState(h(s)),[a,A]=f.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=F(i,s);f.useEffect(()=>{const l=!c.isEqual(h(s),i),t=(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage;o(l||t?"PENDING":"OPEN")},[e,s,i,a,o]);const R=()=>{if(j){if(s.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")){n==="ALERT"&&o("PENDING");return}u.mutate(i,{onSuccess:()=>{q.invalidateQueries({refetchType:"active",queryKey:["pages",e==null?void 0:e.uuid]}),o("CLOSE"),H.toast.success("Page updated successfully.")}})}a.isHomePage&&(e==null?void 0:e.homepage)!==s.uuid&&m.mutate({...e,homepage:s==null?void 0:s.uuid},{onSuccess:()=>o("CLOSE")})},y=({formData:l},t)=>{b(g=>{var C,S;if(!t)return g;const x={[t]:l[t]};return t==="name"?x.slug=c.kebabCase((C=l[t])==null?void 0:C.replace(/\d/g,"")):t==="slug"?x.slug=(S=l[t])==null?void 0:S.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):t==="seoData"&&(x.seoData={title:l[t].title||"",description:l[t].description||"",image:l[t].image||""}),{...g,...x}})},I=({formData:l},t)=>{A(g=>{const x={[t]:l[t]};return{...g,...x}})},v={name:d.Ry({title:"Page Name",default:i.name}),slug:d.Ry({title:"Page Slug",default:i.slug})},T={seoData:d.Py({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.Ry({title:"Meta Title",default:i.name}),description:d.xy({title:"Meta Description",default:i.slug}),image:d.Fy({title:"Social Media Image",default:""})}})},M={isHomePage:d.wy({title:"Set as homepage",default:a.isHomePage})};return r.jsxRuntimeExports.jsxs(N.ScrollArea,{className:"flex h-full select-none flex-col",children:[r.jsxRuntimeExports.jsx(L,{open:n==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:R,disabled:m.isPending||u.isPending}),r.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),r.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[r.jsxRuntimeExports.jsx(p.Form,{title:"Basic Details",formData:i,properties:v,onChange:y,disabled:u.isPending||m.isPending}),r.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),r.jsxRuntimeExports.jsx(p.Form,{title:"SEO Details",formData:i,properties:T,onChange:y,disabled:u.isPending||m.isPending}),(e==null?void 0:e.homepage)!==s.uuid&&s.type==="STATIC"?r.jsxRuntimeExports.jsx(p.Form,{formData:a,properties:M,onChange:I,disabled:u.isPending||m.isPending}):s.type==="STATIC"&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[r.jsxRuntimeExports.jsx(w.HomeIcon,{})," This is homepage"," "]}),i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")&&r.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",r.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),r.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[r.jsxRuntimeExports.jsx(N.Button,{className:"w-full",type:"submit",onClick:R,disabled:(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage?!1:c.isEmpty(i.name)||c.isEmpty(i.slug)||!j||u.isPending||m.isPending||i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||""),children:"Save"}),r.jsxRuntimeExports.jsx(z,{pageData:s,projectData:e})]})]})})]})};exports.default=G;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import I, { useState as
|
|
3
|
-
import { i as L, a as x, X as C, o as
|
|
4
|
-
import { HomeIcon as
|
|
5
|
-
import { bo as
|
|
6
|
-
import {
|
|
2
|
+
import I, { useState as A, useEffect as z } from "react";
|
|
3
|
+
import { i as L, a as x, X as C, o as j, a0 as B } from "./lodash-3gkdNK5u.js";
|
|
4
|
+
import { HomeIcon as F } from "@radix-ui/react-icons";
|
|
5
|
+
import { bo as G, B as Y } from "./index-0OqmBgqo.js";
|
|
6
|
+
import { R as g, P as q, x as X, F as Z, w as $ } from "./controls-kEuiMMDf.js";
|
|
7
7
|
import { toast as Q } from "sonner";
|
|
8
|
-
import { F as
|
|
9
|
-
import { h as U, b as V, i as _, c as K } from "./index-
|
|
8
|
+
import { F as P } from "./form-irY39wvJ.js";
|
|
9
|
+
import { h as U, b as V, i as _, c as K } from "./index-TWBwhGkh.js";
|
|
10
10
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
11
11
|
import "@radix-ui/react-toggle";
|
|
12
12
|
import "class-variance-authority";
|
|
@@ -40,7 +40,6 @@ import "redux-undo";
|
|
|
40
40
|
import "@chaibuilder/runtime";
|
|
41
41
|
import "@react-hookz/web";
|
|
42
42
|
import "react-i18next";
|
|
43
|
-
import "lodash";
|
|
44
43
|
import "@rjsf/core";
|
|
45
44
|
import "@rjsf/validator-ajv8";
|
|
46
45
|
import "i18next";
|
|
@@ -53,7 +52,7 @@ import "react-hotkeys-hook";
|
|
|
53
52
|
import "./html-to-json-Y5M0N8PH.js";
|
|
54
53
|
import "himalaya";
|
|
55
54
|
import "lucide-react";
|
|
56
|
-
const O = I.lazy(() => import("./delete-page-modal-
|
|
55
|
+
const O = I.lazy(() => import("./delete-page-modal-hWmFarnh.js")), J = I.lazy(() => import("./confirm-alert-ea5xpncD.js")), h = (r) => {
|
|
57
56
|
if (!L(r) || !(r.includes("/[") && r.includes("]")))
|
|
58
57
|
return !1;
|
|
59
58
|
const s = /^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/, u = /^[a-zA-Z0-9_-]+$/;
|
|
@@ -65,19 +64,19 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
65
64
|
...r,
|
|
66
65
|
seoData: { title: "", description: "", image: "" }
|
|
67
66
|
} : r, W = (r, m) => {
|
|
68
|
-
const s = !C(
|
|
67
|
+
const s = !C(j(r, ["seoData"]), j(m, ["seoData"])), u = !C(f(m).seoData, f(r).seoData);
|
|
69
68
|
return s || u;
|
|
70
|
-
},
|
|
71
|
-
const u = U(), { data: e } = V(), n = _(),
|
|
69
|
+
}, ke = ({ open: r, setOpen: m, pageData: s }) => {
|
|
70
|
+
const u = U(), { data: e } = V(), n = _(), a = K("Homepage updated successfully."), [i, T] = A(f(s)), [c, v] = A({
|
|
72
71
|
isHomePage: (e == null ? void 0 : e.homepage) === s.uuid
|
|
73
72
|
}), N = W(i, s);
|
|
74
73
|
z(() => {
|
|
75
|
-
const l = !C(f(s), i), o = (e == null ? void 0 : e.homepage) !== s.uuid &&
|
|
74
|
+
const l = !C(f(s), i), o = (e == null ? void 0 : e.homepage) !== s.uuid && c.isHomePage;
|
|
76
75
|
m(l || o ? "PENDING" : "OPEN");
|
|
77
|
-
}, [e, s, i,
|
|
76
|
+
}, [e, s, i, c, m]);
|
|
78
77
|
const S = () => {
|
|
79
78
|
if (N) {
|
|
80
|
-
if (s.type === "DYNAMIC" && !
|
|
79
|
+
if (s.type === "DYNAMIC" && !h((i == null ? void 0 : i.slug) || "")) {
|
|
81
80
|
r === "ALERT" && m("PENDING");
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
@@ -90,14 +89,14 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
},
|
|
92
|
+
c.isHomePage && (e == null ? void 0 : e.homepage) !== s.uuid && a.mutate({ ...e, homepage: s == null ? void 0 : s.uuid }, { onSuccess: () => m("CLOSE") });
|
|
93
|
+
}, y = ({ formData: l }, o) => {
|
|
95
94
|
T((p) => {
|
|
96
|
-
var
|
|
95
|
+
var b, E;
|
|
97
96
|
if (!o)
|
|
98
97
|
return p;
|
|
99
98
|
const d = { [o]: l[o] };
|
|
100
|
-
return o === "name" ? d.slug = B((
|
|
99
|
+
return o === "name" ? d.slug = B((b = l[o]) == null ? void 0 : b.replace(/\d/g, "")) : o === "slug" ? d.slug = (E = l[o]) == null ? void 0 : E.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_") : o === "seoData" && (d.seoData = {
|
|
101
100
|
title: l[o].title || "",
|
|
102
101
|
description: l[o].description || "",
|
|
103
102
|
image: l[o].image || ""
|
|
@@ -106,7 +105,7 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
106
105
|
...d
|
|
107
106
|
};
|
|
108
107
|
});
|
|
109
|
-
},
|
|
108
|
+
}, w = ({ formData: l }, o) => {
|
|
110
109
|
v((p) => {
|
|
111
110
|
const d = { [o]: l[o] };
|
|
112
111
|
return {
|
|
@@ -114,14 +113,14 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
114
113
|
...d
|
|
115
114
|
};
|
|
116
115
|
});
|
|
117
|
-
},
|
|
116
|
+
}, R = {
|
|
118
117
|
name: g({
|
|
119
118
|
title: "Page Name",
|
|
120
119
|
default: i.name
|
|
121
120
|
}),
|
|
122
121
|
slug: g({ title: "Page Slug", default: i.slug })
|
|
123
|
-
},
|
|
124
|
-
seoData:
|
|
122
|
+
}, H = {
|
|
123
|
+
seoData: q({
|
|
125
124
|
title: "",
|
|
126
125
|
description: "",
|
|
127
126
|
default: {
|
|
@@ -134,20 +133,20 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
134
133
|
title: "Meta Title",
|
|
135
134
|
default: i.name
|
|
136
135
|
}),
|
|
137
|
-
description:
|
|
136
|
+
description: X({
|
|
138
137
|
title: "Meta Description",
|
|
139
138
|
default: i.slug
|
|
140
139
|
}),
|
|
141
|
-
image:
|
|
140
|
+
image: Z({ title: "Social Media Image", default: "" })
|
|
142
141
|
}
|
|
143
142
|
})
|
|
144
|
-
},
|
|
145
|
-
isHomePage:
|
|
143
|
+
}, M = {
|
|
144
|
+
isHomePage: $({
|
|
146
145
|
title: "Set as homepage",
|
|
147
|
-
default:
|
|
146
|
+
default: c.isHomePage
|
|
148
147
|
})
|
|
149
148
|
};
|
|
150
|
-
return /* @__PURE__ */ t.jsxs(
|
|
149
|
+
return /* @__PURE__ */ t.jsxs(G, { className: "flex h-full select-none flex-col", children: [
|
|
151
150
|
/* @__PURE__ */ t.jsx(
|
|
152
151
|
J,
|
|
153
152
|
{
|
|
@@ -155,57 +154,57 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
155
154
|
title: "Do yo want to save changes?",
|
|
156
155
|
onCancel: () => m("CLOSE"),
|
|
157
156
|
onConfirm: S,
|
|
158
|
-
disabled:
|
|
157
|
+
disabled: a.isPending || n.isPending
|
|
159
158
|
}
|
|
160
159
|
),
|
|
161
160
|
/* @__PURE__ */ t.jsx("div", { className: "rounded-md bg-background/30 px-2.5 py-1", children: /* @__PURE__ */ t.jsx("h1", { className: "px-1 font-semibold", children: "Page Details" }) }),
|
|
162
161
|
/* @__PURE__ */ t.jsx("div", { className: "px-2.5 pt-2", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
163
162
|
/* @__PURE__ */ t.jsx(
|
|
164
|
-
|
|
163
|
+
P,
|
|
165
164
|
{
|
|
166
165
|
title: "Basic Details",
|
|
167
166
|
formData: i,
|
|
168
|
-
properties:
|
|
169
|
-
onChange:
|
|
170
|
-
disabled: n.isPending ||
|
|
167
|
+
properties: R,
|
|
168
|
+
onChange: y,
|
|
169
|
+
disabled: n.isPending || a.isPending
|
|
171
170
|
}
|
|
172
171
|
),
|
|
173
172
|
/* @__PURE__ */ t.jsx("div", { className: "h-2 w-full" }),
|
|
174
173
|
/* @__PURE__ */ t.jsx(
|
|
175
|
-
|
|
174
|
+
P,
|
|
176
175
|
{
|
|
177
176
|
title: "SEO Details",
|
|
178
177
|
formData: i,
|
|
179
|
-
properties:
|
|
180
|
-
onChange:
|
|
181
|
-
disabled: n.isPending ||
|
|
178
|
+
properties: H,
|
|
179
|
+
onChange: y,
|
|
180
|
+
disabled: n.isPending || a.isPending
|
|
182
181
|
}
|
|
183
182
|
),
|
|
184
183
|
(e == null ? void 0 : e.homepage) !== s.uuid && s.type === "STATIC" ? /* @__PURE__ */ t.jsx(
|
|
185
|
-
|
|
184
|
+
P,
|
|
186
185
|
{
|
|
187
|
-
formData:
|
|
188
|
-
properties:
|
|
189
|
-
onChange:
|
|
190
|
-
disabled: n.isPending ||
|
|
186
|
+
formData: c,
|
|
187
|
+
properties: M,
|
|
188
|
+
onChange: w,
|
|
189
|
+
disabled: n.isPending || a.isPending
|
|
191
190
|
}
|
|
192
191
|
) : s.type === "STATIC" && /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500", children: [
|
|
193
|
-
/* @__PURE__ */ t.jsx(
|
|
192
|
+
/* @__PURE__ */ t.jsx(F, {}),
|
|
194
193
|
" This is homepage",
|
|
195
194
|
" "
|
|
196
195
|
] }),
|
|
197
|
-
i.type === "DYNAMIC" && !
|
|
196
|
+
i.type === "DYNAMIC" && !h((i == null ? void 0 : i.slug) || "") && /* @__PURE__ */ t.jsxs("small", { className: "px-1 text-red-400", children: [
|
|
198
197
|
"Add dynamic ID in page slug Eg: ",
|
|
199
198
|
/* @__PURE__ */ t.jsx("i", { className: "underline", children: "some-url/[some-id]" })
|
|
200
199
|
] }),
|
|
201
200
|
/* @__PURE__ */ t.jsxs("div", { className: "my-2 flex w-full items-center justify-between gap-x-2 px-1", children: [
|
|
202
201
|
/* @__PURE__ */ t.jsx(
|
|
203
|
-
|
|
202
|
+
Y,
|
|
204
203
|
{
|
|
205
204
|
className: "w-full",
|
|
206
205
|
type: "submit",
|
|
207
206
|
onClick: S,
|
|
208
|
-
disabled: (e == null ? void 0 : e.homepage) !== s.uuid &&
|
|
207
|
+
disabled: (e == null ? void 0 : e.homepage) !== s.uuid && c.isHomePage ? !1 : x(i.name) || x(i.slug) || !N || n.isPending || a.isPending || i.type === "DYNAMIC" && !h((i == null ? void 0 : i.slug) || ""),
|
|
209
208
|
children: "Save"
|
|
210
209
|
}
|
|
211
210
|
),
|
|
@@ -215,5 +214,5 @@ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(()
|
|
|
215
214
|
] });
|
|
216
215
|
};
|
|
217
216
|
export {
|
|
218
|
-
|
|
217
|
+
ke as default
|
|
219
218
|
};
|
package/dist/studio.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-WUGKV8jN.cjs");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-WUGKV8jN.cjs");const e=require("./index-Ge20J9Pa.cjs");require("react");require("sonner");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-d55M5MRz.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("./lodash-2us0VT8I.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;
|
package/dist/studio.js
CHANGED
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "1.1.
|
|
8
|
+
"version": "1.1.16",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
76
|
-
"@chaibuilder/runtime": "0.1.
|
|
76
|
+
"@chaibuilder/runtime": "0.1.11",
|
|
77
77
|
"@floating-ui/dom": "1.4.5",
|
|
78
78
|
"@floating-ui/react-dom": "2.0.1",
|
|
79
79
|
"@mhsdesign/jit-browser-tailwindcss": "0.4.0",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"html-formatter": "0.1.9",
|
|
123
123
|
"i18next": "^23.2.8",
|
|
124
124
|
"jotai": "2.2.2",
|
|
125
|
+
"lodash": "^4.17.21",
|
|
125
126
|
"lodash-es": "4.17.21",
|
|
126
127
|
"lucide-react": "^0.244.0",
|
|
127
128
|
"nanoid": "^4.0.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),c=require("react"),t=require("./lodash-2us0VT8I.cjs"),g=require("jotai"),s=require("./index-d55M5MRz.cjs"),v=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),T=require("flagged"),q=require("lucide-react"),B=require("react-dnd"),A=require("./html-to-json-aAZkA0f5.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");const C=({block:r})=>{const{type:o,icon:l,label:d}=r,{addCoreBlock:x,addPredefinedBlock:m}=s.useAddBlock(),[j,p]=s.useSelectedBlockIds(),[,i]=s.useHighlightBlockId(),[,f]=g.useAtom(s.activePanelAtom),[,a]=g.useAtom(s.addBlocksModalAtom),n=()=>{t.has(r,"blocks")?m(b.syncBlocksWithDefaults(r.blocks),t.head(j)):x(r,t.head(j)),a(!1),f("layers")},h=T.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:n,type:"button",onDragStart:E=>{E.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{p([]),i(null),a(!1),f("layers")},200)},draggable:h?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(h?"cursor-grab":"cursor-pointer"),children:[c.createElement(l||v.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:d||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||o})})]})})},w=({block:r,closePopover:o})=>{var n;const[l,d]=c.useState(!1),x=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:j}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,i,f]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),a=c.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){m(r,t.head(p)),o();return}d(!0);const E=await x(r);t.isEmpty(E)||j(b.syncBlocksWithDefaults(E),t.head(p)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:f,src:"https://placehold.co/100x30/000000/FFF?text="+((n=r.name||r.label)==null?void 0:n.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:l?()=>{}:a,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(q.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):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:r.label})})]})]})},N=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),l=t.filter(t.values(o),{category:"custom"}),d=t.groupBy(l,"group"),x=t.groupBy(r,"group"),m=c.useMemo(()=>t.mergeWith(d,x,(a,n)=>{if(t.isArray(a)&&t.isArray(n))return[...a,...n]}),[d,x]),[,j]=g.useAtom(s.addBlocksModalAtom),[p,i]=c.useState(t.head(t.keys(m))||""),f=t.get(m,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:a=>i(a),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),c.Children.toArray(t.map(m,(a,n)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:n,children:n},n)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(f.map(a=>e.jsxRuntimeExports.jsx(w,{block:a,closePopover:()=>j(!1)})))})]})},S=()=>{const[r,o]=c.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,j]=g.useAtom(s.addBlocksModalAtom),p=()=>{const i=A.getBlocksFromHTML(r);l([...i],t.head(d)||null),o(""),x(!1),m("layers"),j(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:"Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code."})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:"Tailwind HTML snippet:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:r,onChange:i=>o(i.target.value),rows:12,placeholder:"Enter your code snippet here...",className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:r.trim()==="",onClick:()=>p(),size:"sm",className:"w-full",children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:"NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],I=(r,o)=>{if(!r)return!t.includes(k,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(k,o)},L=()=>{const[r,o]=c.useState("core"),[l,d]=c.useState("basic"),x=b.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[j]=s.useSelectedBlockIds(),p=s.useAllBlocks(),i=t.find(p,{_id:t.head(j)}),{data:f,isLoading:a}=s.useUILibraryBlocks(),n=t.groupBy(t.filter(x,u=>I(i,u.type)),"category"),h=t.uniq(t.map(n.core,"group"));c.useEffect(()=>{!t.includes(h,l)&&!t.isEmpty(h)&&!t.isEmpty(l)&&d(t.head(h))},[h,l]);const E=u=>d(R=>R===u?"":u),y=!a&&!t.isEmpty(f)||t.find(t.values(x),{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 flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:"Add block"}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r==="html"?"(Enter or paste TailwindCSS HTML snippet)":"(Click to add block to page)"})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:u=>{m(""),o(u)},value:r,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(y?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),y?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"Custom Blocks"}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:"Import "})]})}),r==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:l,className:"w-full px-3",children:c.Children.toArray(t.map(h,u=>t.reject(t.filter(t.values(n.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>E(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.Children.toArray(t.reject(t.filter(t.values(n.core),{group:u}),{hidden:!0}).map(R=>e.jsxRuntimeExports.jsx(C,{block:R})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(N,{})}),r==="html"&&e.jsxRuntimeExports.jsx(S,{})]})};exports.default=L;
|