@chaibuilder/sdk 0.1.7 → 0.1.8
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-4e50ad65.cjs +3 -0
- package/dist/{AddBlocks-0d80d14e.js → AddBlocks-619d3dde.js} +26 -27
- package/dist/{BrandingOptions-2eb3a20f.js → BrandingOptions-05634eee.js} +5 -4
- package/dist/BrandingOptions-d2a7778f.cjs +1 -0
- package/dist/{CanvasArea-366fc7f5.js → CanvasArea-8f96a9f5.js} +91 -90
- package/dist/{CanvasArea-35fe4de9.cjs → CanvasArea-f26157c0.cjs} +7 -7
- package/dist/CurrentPage-0663041c.cjs +1 -0
- package/dist/CurrentPage-d372a5a9.js +85 -0
- package/dist/Layers-57457feb.cjs +1 -0
- package/dist/{Layers-c375ab6b.js → Layers-5da1d796.js} +13 -12
- package/dist/{MarkAsGlobalBlock-3ecff4e8.js → MarkAsGlobalBlock-1a0d0725.js} +7 -6
- package/dist/MarkAsGlobalBlock-dd53daec.cjs +1 -0
- package/dist/PagesPanel-113739d6.cjs +1 -0
- package/dist/{PagesPanel-28b02d06.js → PagesPanel-42dba988.js} +5 -4
- package/dist/{ProjectPanel-e6e95d71.js → ProjectPanel-7e26e6a3.js} +6 -5
- package/dist/ProjectPanel-ee6b71ab.cjs +1 -0
- package/dist/Settings-9f28c157.cjs +1 -0
- package/dist/{Settings-4c13f136.js → Settings-cdaf197a.js} +5 -4
- package/dist/{SidePanels-0f011b5d.js → SidePanels-7757f767.js} +6 -5
- package/dist/SidePanels-ce2deb33.cjs +1 -0
- package/dist/{Topbar-d609b15e.js → Topbar-73c9aa97.js} +5 -4
- package/dist/Topbar-7600678e.cjs +1 -0
- package/dist/{add-page-modal-fb1e7f3d.js → add-page-modal-96a1f8dc.js} +18 -17
- package/dist/add-page-modal-eb896eef.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +48 -47
- package/dist/delete-page-modal-306dab3c.cjs +1 -0
- package/dist/{delete-page-modal-1e7c44c4.js → delete-page-modal-aabd460d.js} +5 -4
- package/dist/{Class-1fb4c0c4.js → html-to-json-eb4de645.js} +363 -190
- package/dist/html-to-json-feece010.cjs +1 -0
- package/dist/{index-0f2acc34.js → index-38bc7894.js} +1874 -1809
- package/dist/index-94612af5.cjs +2 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +20 -21
- package/dist/{page-viewer-791fb7c7.js → page-viewer-be5d5315.js} +9 -8
- package/dist/page-viewer-f60c4980.cjs +1 -0
- package/dist/{project-general-setting-b8508aa1.cjs → project-general-setting-bebd5cb1.cjs} +1 -1
- package/dist/{project-general-setting-ba6333d9.js → project-general-setting-cc9b43cd.js} +5 -4
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +12 -14
- package/dist/render.js +74 -71
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +38 -24
- package/dist/server.js +23 -16
- package/dist/{single-page-detail-69dd268b.js → single-page-detail-33436195.js} +6 -5
- package/dist/single-page-detail-584589e0.cjs +1 -0
- package/package.json +2 -1
- package/dist/AddBlocks-263e048b.cjs +0 -3
- package/dist/BrandingOptions-fe2c729f.cjs +0 -1
- package/dist/Class-6c695ccb.cjs +0 -1
- package/dist/Layers-ec26b885.cjs +0 -1
- package/dist/MarkAsGlobalBlock-b60aa4a5.cjs +0 -1
- package/dist/PagesPanel-27e831e4.cjs +0 -1
- package/dist/ProjectPanel-d77ca4b1.cjs +0 -1
- package/dist/Settings-f533682d.cjs +0 -1
- package/dist/SidePanels-8a461fbd.cjs +0 -1
- package/dist/Topbar-e3b28705.cjs +0 -1
- package/dist/add-page-modal-345f02a4.cjs +0 -1
- package/dist/delete-page-modal-83b69ad2.cjs +0 -1
- package/dist/html-to-json-01cc5fe0.cjs +0 -1
- package/dist/html-to-json-d20aafdd.js +0 -178
- package/dist/index-334beafe.cjs +0 -2
- package/dist/page-viewer-83157368.cjs +0 -1
- package/dist/single-page-detail-a186cd56.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Ke=Object.defineProperty;var Ve=(e,r,n)=>r in e?Ke(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var J=(e,r,n)=>(Ve(e,typeof r!="symbol"?r+"":r,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),v=require("lodash"),W=require("@radix-ui/react-icons"),X=require("./useBuilderProp-5e57d0c8.cjs"),h=require("./index-
|
|
1
|
+
"use strict";var Ke=Object.defineProperty;var Ve=(e,r,n)=>r in e?Ke(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var J=(e,r,n)=>(Ve(e,typeof r!="symbol"?r+"":r,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),v=require("lodash"),W=require("@radix-ui/react-icons"),X=require("./useBuilderProp-5e57d0c8.cjs"),h=require("./index-94612af5.cjs"),Ne=require("react-i18next"),se=require("./separator-a597dba7.cjs"),V=require("./dropdown-menu-84b2439e.cjs"),Ge=require("./label-167415e5.cjs"),G=require("./alert-dialog-4ce6ed22.cjs"),ee=require("jotai"),Xe=require("@floating-ui/dom"),ke=require("@floating-ui/react-dom"),Ze=require("react-dnd"),Je=require("@react-hookz/web"),Qe=require("@bobthered/tailwindcss-palette-generator"),et=require("react-wrap-balancer"),tt=require("tailwind-merge"),ie=require("./MODIFIERS-70fef873.cjs"),rt=require("@chaibuilder/blocks"),Ce=require("react-dom"),nt=require("./_commonjsHelpers-5a53b418.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-feece010.cjs");require("himalaya");require("redux-undo");require("sonner");require("lucide-react");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-label");require("@radix-ui/react-alert-dialog");const st=()=>{const{undoCount:e,redoCount:r,undo:n,redo:a}=h.useCanvasHistory();return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(X.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:t.jsxRuntimeExports.jsx(W.ResetIcon,{})}),t.jsxRuntimeExports.jsx(X.Button,{disabled:!r,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:t.jsxRuntimeExports.jsx(W.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ot(){const[e,r]=h.useDarkMode(),{t:n}=Ne.useTranslation();return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(Ge.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),t.jsxRuntimeExports.jsxs(V.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{r(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
2
2
|
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[t.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),t.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
|
|
3
|
-
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const Te=({landscape:e=!1})=>t.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[t.jsxRuntimeExports.jsx("g",{strokeWidth:0}),t.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),
|
|
3
|
+
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const Te=({landscape:e=!1})=>t.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[t.jsxRuntimeExports.jsx("g",{strokeWidth:0}),t.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),Ae=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:t.jsxRuntimeExports.jsx(W.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:t.jsxRuntimeExports.jsx(W.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:t.jsxRuntimeExports.jsx(Te,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:t.jsxRuntimeExports.jsx(Te,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:t.jsxRuntimeExports.jsx(W.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:t.jsxRuntimeExports.jsx(W.DesktopIcon,{}),width:1920}],it=({title:e,content:r,currentBreakpoint:n,breakpoint:a,width:u,icon:o,onClick:i})=>t.jsxRuntimeExports.jsxs(V.HoverCard,{children:[t.jsxRuntimeExports.jsx(V.HoverCardTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(X.Button,{onClick:()=>i(u),size:"sm",variant:a===n?"secondary":"ghost",children:o})}),t.jsxRuntimeExports.jsx(V.HoverCardContent,{className:"w-52 border-border",children:t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[t.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),t.jsxRuntimeExports.jsx("p",{className:"text-xs",children:r})]})})})]}),at=()=>{const[,e,r]=h.useCanvasWidth(),[n,a]=h.useSelectedBreakpoints(),u=o=>{n.includes(o)?n.length>2&&a(n.filter(i=>i!==o)):a(i=>[...i,o])};return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[v.map(Ae.filter(o=>v.includes(n,v.toUpper(o.breakpoint))),o=>g.createElement(it,{...o,onClick:r,key:o.breakpoint,currentBreakpoint:e})),t.jsxRuntimeExports.jsxs(V.DropdownMenu,{children:[t.jsxRuntimeExports.jsx(V.DropdownMenuTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:t.jsxRuntimeExports.jsx(W.DotsVerticalIcon,{className:"scale-90 transform"})})}),t.jsxRuntimeExports.jsxs(V.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[t.jsxRuntimeExports.jsx(V.DropdownMenuLabel,{children:"Breakpoints"}),t.jsxRuntimeExports.jsx(V.DropdownMenuSeparator,{}),v.map(Ae,o=>t.jsxRuntimeExports.jsx(V.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>u(v.toUpper(o.breakpoint)),checked:v.includes(n,v.toUpper(o.breakpoint)),children:o.title},o.breakpoint))]})]})]})},ct=()=>{const[e]=h.useSetAllBlocks(),{createSnapshot:r}=h.useCanvasHistory(),[,n]=h.useSelectedBlockIds(),[,a]=h.useSelectedStylingBlocks(),u=g.useCallback(()=>{e([]),n([]),a([]),r()},[e,r]);return t.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:t.jsxRuntimeExports.jsxs(G.AlertDialog,{children:[t.jsxRuntimeExports.jsx(G.AlertDialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsxs(X.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[t.jsxRuntimeExports.jsx(W.EraserIcon,{})," Clear"]})}),t.jsxRuntimeExports.jsxs(G.AlertDialogContent,{className:"border-border",children:[t.jsxRuntimeExports.jsxs(G.AlertDialogHeader,{children:[t.jsxRuntimeExports.jsx(G.AlertDialogTitle,{children:"Clear whole canvas?"}),t.jsxRuntimeExports.jsx(G.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),t.jsxRuntimeExports.jsxs(G.AlertDialogFooter,{children:[t.jsxRuntimeExports.jsx(G.AlertDialogCancel,{children:"Cancel"}),t.jsxRuntimeExports.jsx(G.AlertDialogAction,{onClick:u,children:"Yes"})]})]})]})})},lt=()=>{const e=h.useFeatureSupport("darkMode",!1),[r]=h.useCanvasZoom();return t.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"})]}):null,t.jsxRuntimeExports.jsx(at,{}),t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[t.jsxRuntimeExports.jsx(W.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",t.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[v.round(r,0),"%"]})]}),t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(st,{})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(ct,{})]})]})},fe={FRAMEWORK:"FRAMEWORK",STATIC:"STATIC",EMAIL:"EMAIL",PRESENTATION:"PRESENTATION",GRAPHIC:"GRAPHIC"},ut=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var
|
|
44
|
+
*/var Ie;function pt(){if(Ie)return O;Ie=1;var e=typeof Symbol=="function"&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,u=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,p=e?Symbol.for("react.context"):60110,y=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,x=e?Symbol.for("react.suspense"):60113,R=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,B=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,A=e?Symbol.for("react.fundamental"):60117,j=e?Symbol.for("react.responder"):60118,z=e?Symbol.for("react.scope"):60119;function q(l){if(typeof l=="object"&&l!==null){var $=l.$$typeof;switch($){case r:switch(l=l.type,l){case y:case f:case a:case o:case u:case x:return l;default:switch(l=l&&l.$$typeof,l){case p:case m:case B:case E:case i:return l;default:return $}}case n:return $}}}function N(l){return q(l)===f}return O.AsyncMode=y,O.ConcurrentMode=f,O.ContextConsumer=p,O.ContextProvider=i,O.Element=r,O.ForwardRef=m,O.Fragment=a,O.Lazy=B,O.Memo=E,O.Portal=n,O.Profiler=o,O.StrictMode=u,O.Suspense=x,O.isAsyncMode=function(l){return N(l)||q(l)===y},O.isConcurrentMode=N,O.isContextConsumer=function(l){return q(l)===p},O.isContextProvider=function(l){return q(l)===i},O.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===r},O.isForwardRef=function(l){return q(l)===m},O.isFragment=function(l){return q(l)===a},O.isLazy=function(l){return q(l)===B},O.isMemo=function(l){return q(l)===E},O.isPortal=function(l){return q(l)===n},O.isProfiler=function(l){return q(l)===o},O.isStrictMode=function(l){return q(l)===u},O.isSuspense=function(l){return q(l)===x},O.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===a||l===f||l===o||l===u||l===x||l===R||typeof l=="object"&&l!==null&&(l.$$typeof===B||l.$$typeof===E||l.$$typeof===i||l.$$typeof===p||l.$$typeof===m||l.$$typeof===A||l.$$typeof===j||l.$$typeof===z||l.$$typeof===w)},O.typeOf=q,O}var M={};/** @license React v16.13.1
|
|
45
45
|
* react-is.development.js
|
|
46
46
|
*
|
|
47
47
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the MIT license found in the
|
|
50
50
|
* LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/var
|
|
51
|
+
*/var _e;function ft(){return _e||(_e=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,u=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,p=e?Symbol.for("react.context"):60110,y=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,x=e?Symbol.for("react.suspense"):60113,R=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,B=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,A=e?Symbol.for("react.fundamental"):60117,j=e?Symbol.for("react.responder"):60118,z=e?Symbol.for("react.scope"):60119;function q(c){return typeof c=="string"||typeof c=="function"||c===a||c===f||c===o||c===u||c===x||c===R||typeof c=="object"&&c!==null&&(c.$$typeof===B||c.$$typeof===E||c.$$typeof===i||c.$$typeof===p||c.$$typeof===m||c.$$typeof===A||c.$$typeof===j||c.$$typeof===z||c.$$typeof===w)}function N(c){if(typeof c=="object"&&c!==null){var K=c.$$typeof;switch(K){case r:var ne=c.type;switch(ne){case y:case f:case a:case o:case u:case x:return ne;default:var we=ne&&ne.$$typeof;switch(we){case p:case m:case B:case E:case i:return we;default:return K}}case n:return K}}}var l=y,$=f,Y=p,U=i,ae=r,ce=m,te=a,le=B,ue=E,Q=n,de=o,H=u,Z=x,re=!1;function pe(c){return re||(re=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),s(c)||N(c)===y}function s(c){return N(c)===f}function d(c){return N(c)===p}function T(c){return N(c)===i}function k(c){return typeof c=="object"&&c!==null&&c.$$typeof===r}function b(c){return N(c)===m}function I(c){return N(c)===a}function S(c){return N(c)===B}function C(c){return N(c)===E}function _(c){return N(c)===n}function D(c){return N(c)===o}function P(c){return N(c)===u}function L(c){return N(c)===x}M.AsyncMode=l,M.ConcurrentMode=$,M.ContextConsumer=Y,M.ContextProvider=U,M.Element=ae,M.ForwardRef=ce,M.Fragment=te,M.Lazy=le,M.Memo=ue,M.Portal=Q,M.Profiler=de,M.StrictMode=H,M.Suspense=Z,M.isAsyncMode=pe,M.isConcurrentMode=s,M.isContextConsumer=d,M.isContextProvider=T,M.isElement=k,M.isForwardRef=b,M.isFragment=I,M.isLazy=S,M.isMemo=C,M.isPortal=_,M.isProfiler=D,M.isStrictMode=P,M.isSuspense=L,M.isValidElementType=q,M.typeOf=N}()),M}var Pe;function Le(){return Pe||(Pe=1,process.env.NODE_ENV==="production"?oe.exports=pt():oe.exports=ft()),oe.exports}/*
|
|
52
52
|
object-assign
|
|
53
53
|
(c) Sindre Sorhus
|
|
54
54
|
@license MIT
|
|
55
|
-
*/var xe,Oe;function xt(){if(Oe)return xe;Oe=1;var e=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function u(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var i={},p=0;p<10;p++)i["_"+String.fromCharCode(p)]=p;var y=Object.getOwnPropertyNames(i).map(function(m){return i[m]});if(y.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(m){f[m]=m}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return xe=u()?Object.assign:function(o,i){for(var p,y=a(o),f,m=1;m<arguments.length;m++){p=Object(arguments[m]);for(var x in p)r.call(p,x)&&(y[x]=p[x]);if(e){f=e(p);for(var R=0;R<f.length;R++)n.call(p,f[R])&&(y[f[R]]=p[f[R]])}}return y},xe}var me,Me;function Re(){if(Me)return me;Me=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return me=e,me}var he,De;function Fe(){return De||(De=1,he=Function.call.bind(Object.prototype.hasOwnProperty)),he}var ye,Be;function mt(){if(Be)return ye;Be=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var r=Re(),n={},a=Fe();e=function(o){var i="Warning: "+o;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}}}function u(o,i,p,y,f){if(process.env.NODE_ENV!=="production"){for(var m in o)if(a(o,m)){var x;try{if(typeof o[m]!="function"){var R=Error((y||"React class")+": "+p+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}x=o[m](i,m,y,p,null,r)}catch(B){x=B}if(x&&!(x instanceof Error)&&e((y||"React class")+": type specification of "+p+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof x+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),x instanceof Error&&!(x.message in n)){n[x.message]=!0;var E=f?f():"";e("Failed "+p+" type: "+x.message+(E??""))}}}}return u.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ye=u,ye}var ve,qe;function ht(){if(qe)return ve;qe=1;var e=Le(),r=xt(),n=Re(),a=Fe(),u=mt(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(p){var y="Warning: "+p;typeof console<"u"&&console.error(y);try{throw new Error(y)}catch{}});function i(){return null}return ve=function(p,y){var f=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function x(s){var d=s&&(f&&s[f]||s[m]);if(typeof d=="function")return d}var R="<<anonymous>>",E={array:j("array"),bigint:j("bigint"),bool:j("boolean"),func:j("function"),number:j("number"),object:j("object"),string:j("string"),symbol:j("symbol"),any:z(),arrayOf:q,element:N(),elementType:l(),instanceOf:$,node:ce(),objectOf:U,oneOf:Y,oneOfType:ae,shape:le,exact:ue};function B(s,d){return s===d?s!==0||1/s===1/d:s!==s&&d!==d}function w(s,d){this.message=s,this.data=d&&typeof d=="object"?d:{},this.stack=""}w.prototype=Error.prototype;function
|
|
56
|
-
Valid keys: `+JSON.stringify(Object.keys(s),null," "));var c=L(C,P,b,
|
|
55
|
+
*/var xe,Oe;function xt(){if(Oe)return xe;Oe=1;var e=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function u(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var i={},p=0;p<10;p++)i["_"+String.fromCharCode(p)]=p;var y=Object.getOwnPropertyNames(i).map(function(m){return i[m]});if(y.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(m){f[m]=m}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return xe=u()?Object.assign:function(o,i){for(var p,y=a(o),f,m=1;m<arguments.length;m++){p=Object(arguments[m]);for(var x in p)r.call(p,x)&&(y[x]=p[x]);if(e){f=e(p);for(var R=0;R<f.length;R++)n.call(p,f[R])&&(y[f[R]]=p[f[R]])}}return y},xe}var me,Me;function Re(){if(Me)return me;Me=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return me=e,me}var he,De;function Fe(){return De||(De=1,he=Function.call.bind(Object.prototype.hasOwnProperty)),he}var ye,Be;function mt(){if(Be)return ye;Be=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var r=Re(),n={},a=Fe();e=function(o){var i="Warning: "+o;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}}}function u(o,i,p,y,f){if(process.env.NODE_ENV!=="production"){for(var m in o)if(a(o,m)){var x;try{if(typeof o[m]!="function"){var R=Error((y||"React class")+": "+p+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}x=o[m](i,m,y,p,null,r)}catch(B){x=B}if(x&&!(x instanceof Error)&&e((y||"React class")+": type specification of "+p+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof x+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),x instanceof Error&&!(x.message in n)){n[x.message]=!0;var E=f?f():"";e("Failed "+p+" type: "+x.message+(E??""))}}}}return u.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ye=u,ye}var ve,qe;function ht(){if(qe)return ve;qe=1;var e=Le(),r=xt(),n=Re(),a=Fe(),u=mt(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(p){var y="Warning: "+p;typeof console<"u"&&console.error(y);try{throw new Error(y)}catch{}});function i(){return null}return ve=function(p,y){var f=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function x(s){var d=s&&(f&&s[f]||s[m]);if(typeof d=="function")return d}var R="<<anonymous>>",E={array:j("array"),bigint:j("bigint"),bool:j("boolean"),func:j("function"),number:j("number"),object:j("object"),string:j("string"),symbol:j("symbol"),any:z(),arrayOf:q,element:N(),elementType:l(),instanceOf:$,node:ce(),objectOf:U,oneOf:Y,oneOfType:ae,shape:le,exact:ue};function B(s,d){return s===d?s!==0||1/s===1/d:s!==s&&d!==d}function w(s,d){this.message=s,this.data=d&&typeof d=="object"?d:{},this.stack=""}w.prototype=Error.prototype;function A(s){if(process.env.NODE_ENV!=="production")var d={},T=0;function k(I,S,C,_,D,P,L){if(_=_||R,P=P||C,L!==n){if(y){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var K=_+":"+C;!d[K]&&T<3&&(o("You are manually calling a React.PropTypes validation function for the `"+P+"` prop on `"+_+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),d[K]=!0,T++)}}return S[C]==null?I?S[C]===null?new w("The "+D+" `"+P+"` is marked as required "+("in `"+_+"`, but its value is `null`.")):new w("The "+D+" `"+P+"` is marked as required in "+("`"+_+"`, but its value is `undefined`.")):null:s(S,C,_,D,P)}var b=k.bind(null,!1);return b.isRequired=k.bind(null,!0),b}function j(s){function d(T,k,b,I,S,C){var _=T[k],D=H(_);if(D!==s){var P=Z(_);return new w("Invalid "+I+" `"+S+"` of type "+("`"+P+"` supplied to `"+b+"`, expected ")+("`"+s+"`."),{expectedType:s})}return null}return A(d)}function z(){return A(i)}function q(s){function d(T,k,b,I,S){if(typeof s!="function")return new w("Property `"+S+"` of component `"+b+"` has invalid PropType notation inside arrayOf.");var C=T[k];if(!Array.isArray(C)){var _=H(C);return new w("Invalid "+I+" `"+S+"` of type "+("`"+_+"` supplied to `"+b+"`, expected an array."))}for(var D=0;D<C.length;D++){var P=s(C,D,b,I,S+"["+D+"]",n);if(P instanceof Error)return P}return null}return A(d)}function N(){function s(d,T,k,b,I){var S=d[T];if(!p(S)){var C=H(S);return new w("Invalid "+b+" `"+I+"` of type "+("`"+C+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return A(s)}function l(){function s(d,T,k,b,I){var S=d[T];if(!e.isValidElementType(S)){var C=H(S);return new w("Invalid "+b+" `"+I+"` of type "+("`"+C+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return A(s)}function $(s){function d(T,k,b,I,S){if(!(T[k]instanceof s)){var C=s.name||R,_=pe(T[k]);return new w("Invalid "+I+" `"+S+"` of type "+("`"+_+"` supplied to `"+b+"`, expected ")+("instance of `"+C+"`."))}return null}return A(d)}function Y(s){if(!Array.isArray(s))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),i;function d(T,k,b,I,S){for(var C=T[k],_=0;_<s.length;_++)if(B(C,s[_]))return null;var D=JSON.stringify(s,function(L,c){var K=Z(c);return K==="symbol"?String(c):c});return new w("Invalid "+I+" `"+S+"` of value `"+String(C)+"` "+("supplied to `"+b+"`, expected one of "+D+"."))}return A(d)}function U(s){function d(T,k,b,I,S){if(typeof s!="function")return new w("Property `"+S+"` of component `"+b+"` has invalid PropType notation inside objectOf.");var C=T[k],_=H(C);if(_!=="object")return new w("Invalid "+I+" `"+S+"` of type "+("`"+_+"` supplied to `"+b+"`, expected an object."));for(var D in C)if(a(C,D)){var P=s(C,D,b,I,S+"."+D,n);if(P instanceof Error)return P}return null}return A(d)}function ae(s){if(!Array.isArray(s))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),i;for(var d=0;d<s.length;d++){var T=s[d];if(typeof T!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+re(T)+" at index "+d+"."),i}function k(b,I,S,C,_){for(var D=[],P=0;P<s.length;P++){var L=s[P],c=L(b,I,S,C,_,n);if(c==null)return null;c.data&&a(c.data,"expectedType")&&D.push(c.data.expectedType)}var K=D.length>0?", expected one of type ["+D.join(", ")+"]":"";return new w("Invalid "+C+" `"+_+"` supplied to "+("`"+S+"`"+K+"."))}return A(k)}function ce(){function s(d,T,k,b,I){return Q(d[T])?null:new w("Invalid "+b+" `"+I+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return A(s)}function te(s,d,T,k,b){return new w((s||"React class")+": "+d+" type `"+T+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+b+"`.")}function le(s){function d(T,k,b,I,S){var C=T[k],_=H(C);if(_!=="object")return new w("Invalid "+I+" `"+S+"` of type `"+_+"` "+("supplied to `"+b+"`, expected `object`."));for(var D in s){var P=s[D];if(typeof P!="function")return te(b,I,S,D,Z(P));var L=P(C,D,b,I,S+"."+D,n);if(L)return L}return null}return A(d)}function ue(s){function d(T,k,b,I,S){var C=T[k],_=H(C);if(_!=="object")return new w("Invalid "+I+" `"+S+"` of type `"+_+"` "+("supplied to `"+b+"`, expected `object`."));var D=r({},T[k],s);for(var P in D){var L=s[P];if(a(s,P)&&typeof L!="function")return te(b,I,S,P,Z(L));if(!L)return new w("Invalid "+I+" `"+S+"` key `"+P+"` supplied to `"+b+"`.\nBad object: "+JSON.stringify(T[k],null," ")+`
|
|
56
|
+
Valid keys: `+JSON.stringify(Object.keys(s),null," "));var c=L(C,P,b,I,S+"."+P,n);if(c)return c}return null}return A(d)}function Q(s){switch(typeof s){case"number":case"string":case"undefined":return!0;case"boolean":return!s;case"object":if(Array.isArray(s))return s.every(Q);if(s===null||p(s))return!0;var d=x(s);if(d){var T=d.call(s),k;if(d!==s.entries){for(;!(k=T.next()).done;)if(!Q(k.value))return!1}else for(;!(k=T.next()).done;){var b=k.value;if(b&&!Q(b[1]))return!1}}else return!1;return!0;default:return!1}}function de(s,d){return s==="symbol"?!0:d?d["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&d instanceof Symbol:!1}function H(s){var d=typeof s;return Array.isArray(s)?"array":s instanceof RegExp?"object":de(d,s)?"symbol":d}function Z(s){if(typeof s>"u"||s===null)return""+s;var d=H(s);if(d==="object"){if(s instanceof Date)return"date";if(s instanceof RegExp)return"regexp"}return d}function re(s){var d=Z(s);switch(d){case"array":case"object":return"an "+d;case"boolean":case"date":case"regexp":return"a "+d;default:return d}}function pe(s){return!s.constructor||!s.constructor.name?R:s.constructor.name}return E.checkPropTypes=u,E.resetWarningCache=u.resetWarningCache,E.PropTypes=E,E},ve}var ge,$e;function yt(){if($e)return ge;$e=1;var e=Re();function r(){}function n(){}return n.resetWarningCache=r,ge=function(){function a(i,p,y,f,m,x){if(x!==e){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}}a.isRequired=a;function u(){return a}var o={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:u,element:a,elementType:a,instanceOf:u,node:a,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:n,resetWarningCache:r};return o.PropTypes=o,o},ge}if(process.env.NODE_ENV!=="production"){var vt=Le(),gt=!0;Ee.exports=ht()(vt.isElement,gt)}else Ee.exports=yt()();var Et=Ee.exports;const F=nt.getDefaultExportFromCjs(Et);let We,Ye;typeof document<"u"&&(We=document);typeof window<"u"&&(Ye=window);const Ue=g.createContext({document:We,window:Ye}),Se=()=>g.useContext(Ue),{Provider:jt,Consumer:Nt}=Ue;class ze extends g.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return g.Children.only(this.props.children)}}J(ze,"propTypes",{children:F.element.isRequired,contentDidMount:F.func.isRequired,contentDidUpdate:F.func.isRequired});class je extends g.Component{constructor(n,a){super(n,a);J(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});J(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});J(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=g.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const a=this.props.contentDidMount,u=this.props.contentDidUpdate,o=n.defaultView||n.parentView,i=t.jsxRuntimeExports.jsx(ze,{contentDidMount:a,contentDidUpdate:u,children:t.jsxRuntimeExports.jsx(jt,{value:{document:n,window:o},children:t.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),p=this.getMountTarget();return[Ce.createPortal(this.props.head,this.getDoc().head),Ce.createPortal(i,p)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,t.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}J(je,"propTypes",{style:F.object,head:F.node,initialContent:F.string,mountTarget:F.string,contentDidMount:F.func,contentDidUpdate:F.func,children:F.oneOfType([F.element,F.arrayOf(F.element)])}),J(je,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const bt=g.forwardRef((e,r)=>t.jsxRuntimeExports.jsx(je,{...e,forwardedRef:r})),Rt=({children:e})=>{const{document:r}=Se(),[n]=h.useSelectedBlockIds(),[a,u]=h.useSelectedStylingBlocks();return g.useEffect(()=>{setTimeout(()=>{if(!v.isEmpty(a))return;const o=He(r,v.first(n));if(o){const i=o.getAttribute("data-style-prop");if(i){const p=o.getAttribute("data-style-id"),y=o.getAttribute("data-block-parent");u([{id:p,prop:i,blockId:y}])}}},100)},[r,n,u,a]),t.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:e})},He=(e,r)=>e.querySelector(`[data-block-id="${r}"]`),St=()=>{const{window:e}=Se(),[r,n]=h.useSelectedBlockIds(),[,a]=h.useSelectedStylingBlocks(),{undo:u,redo:o}=h.useCanvasHistory(),i=h.useDuplicateBlocks(),[,p]=h.useCutBlockIds(),[,y]=h.useCopyBlockIds(),{pasteBlocks:f}=h.usePasteBlocks(),[,m]=h.usePreviewMode(),x=h.useRemoveBlocks(),{savePage:R}=h.useSavePage(),[E]=ee.useAtom(h.inlineEditingActiveAtom),[,B]=ee.useAtom(h.editLayerNameAtom),w=A=>{A.key==="Enter"&&(A.preventDefault(),r.length===1&&B(v.first(r)))};return g.useEffect(()=>{const A=j=>{if(j.key==="Escape"){n([]),a([]);return}if(w(j),!E&&(j.key==="Delete"||j.key==="Backspace")&&(j.preventDefault(),x(r)),j.ctrlKey||j.metaKey){if(["z","y","d","x","c","p","s","v"].includes(j.key)){if(E&&["x","z","v"].includes(j.key))return!0;j.preventDefault()}j.key==="s"&&(j.stopPropagation(),j.preventDefault(),R()),j.key==="z"&&u(),j.key==="y"&&o(),j.key==="d"&&i(r),j.key==="x"&&p(r),j.key==="c"&&y(r),j.key==="v"&&r.length>0&&f(r[0])}};return e.removeEventListener("keydown",A),e.addEventListener("keydown",A),()=>{e.removeEventListener("keydown",A)}},[r,n,u,x,m,o,i,p,y,f,E,R,e]),null},wt=({block:e,label:r})=>{const[,n]=Ze.useDrag(()=>({type:"CANVAS_BLOCK",item:e}));return t.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:n,onDragStart:()=>{console.log("drag start")},children:[t.jsxRuntimeExports.jsx(W.DragHandleDots2Icon,{}),r]})},kt=({selectedBlockElement:e,block:r})=>{const n=h.useRemoveBlocks(),a=h.useDuplicateBlocks(),[,u]=h.useSelectedBlockIds(),[,o]=h.useSelectedStylingBlocks(),{floatingStyles:i,refs:p,update:y}=ke.useFloating({placement:"top-start",middleware:[ke.shift(),Xe.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>y(),e!==null);const f=v.get(r,"_parent",null),m=v.isEmpty(v.get(r,"_name",""))?v.get(r,"_type",""):v.get(r,"_name","");return!e||!r?null:t.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:i,onClick:x=>{x.stopPropagation(),x.preventDefault()},onKeyDown:x=>x.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[t.jsxRuntimeExports.jsx(wt,{label:m,block:r}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[f&&t.jsxRuntimeExports.jsx(W.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{o([]),u([f])}}),h.canDuplicateBlock(v.get(r,"_type",""))?t.jsxRuntimeExports.jsx(W.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([r==null?void 0:r._id])}):null,h.canDeleteBlock(v.get(r,"_type",""))?t.jsxRuntimeExports.jsx(W.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([r==null?void 0:r._id])}):null]})]})},Ct=({model:e})=>{const[r]=h.useBrandingOptions(),[n]=h.useSelectedBlockIds(),[a]=h.useDarkMode(),[u]=h.useHighlightBlockId(),[o]=h.useSelectedStylingBlocks(),{document:i,window:p}=Se(),[y]=g.useState(i==null?void 0:i.getElementById("highlighted-block")),[f]=g.useState(i==null?void 0:i.getElementById("selected-block")),[m]=g.useState(i==null?void 0:i.getElementById("selected-styling-block"));g.useEffect(()=>{a?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[a,i]);const x=v.get(r,"headingFont","DM Sans"),R=v.get(r,"bodyFont","DM Sans");return g.useEffect(()=>{const E=v.get(r,"primaryColor","#000"),B=v.get(r,"secondaryColor","#FFF"),w=Qe.tailwindcssPaletteGenerator({colors:[E,B],names:["primary","secondary"]});w.primary.DEFAULT=E,w.secondary.DEFAULT=B;const A=v.get(r,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[x],body:[R]},extend:{borderRadius:{global:`${A||"0"}px`},colors:w}},plugins:[p.tailwind.plugin.withOptions(({prefix:j="ui"}={})=>({addVariant:z})=>{for(const q of["open","checked","selected","active","disabled"])z(`${j}-${q}`,[`&[data-headlessui-state~="${q}"]`,`:where([data-headlessui-state~="${q}"]) &`]),z(`${j}-not-${q}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${q}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${q}"])) &:not([data-headlessui-state])`])})]})},[r,p,x,R]),g.useEffect(()=>{f&&(f.textContent=`${v.map(n,E=>`[data-block-id="${E}"]`).join(",")}{
|
|
57
57
|
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
58
58
|
}`)},[n,f]),g.useEffect(()=>{y&&(y.textContent=u?`[data-style-id="${u}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[u,n,y]),g.useEffect(()=>{m&&(m.textContent=`${v.map(o,({id:E})=>`[data-style-id="${E}"]`).join(",")}{
|
|
59
59
|
outline: 1px solid orange !important; outline-offset: -1px;
|
|
60
|
-
}`)},[o,m]),g.useEffect(()=>{if(e==="section")return;const E=v.get(r,"
|
|
60
|
+
}`)},[o,m]),g.useEffect(()=>{if(e==="section")return;const E=v.get(r,"bodyTextLightColor","#64748b"),B=v.get(r,"bodyTextDarkColor","#94a3b8"),w=v.get(r,"bodyBgLightColor","#FFFFFF"),A=v.get(r,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${E}] bg-[${w}] dark:text-[${B}] dark:bg-[${A}]`},[r,i,e]),e==="page"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[x&&t.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${x.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&x!==R&&t.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),x&&t.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${x}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Tt=()=>{const{t:e}=Ne.useTranslation();return t.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:t.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:e("canvas_empty")})})},At=e=>{const r={};return Object.keys(e).forEach(n=>{v.isString(e[n])&&e[n].startsWith(ie.SLOT_KEY)&&(r[n]=e[n].replace(ie.SLOT_KEY,"").split(","))}),r},It=v.memoize(e=>{const r=e.replace(ie.STYLES_KEY,"").split(",");return tt.twMerge(r[0],r[1])});function _t(e,r){return v.get(e,`${r}_attrs`,{})}function Pt(e,r,n,a){const u={};return Object.keys(e).forEach(o=>{if(v.isString(e[o])&&e[o].startsWith(ie.STYLES_KEY)){const i=It(e[o]);u[o]={className:i,"data-style-prop":o,"data-block-parent":e._id,"data-style-id":`${o}-${e._id}`,onMouseEnter:r,onMouseLeave:n,onClick:a,..._t(e,o)}}}),u}function be({blocks:e}){const r=h.useAllBlocks(),[,n]=h.useHighlightBlockId(),[,a]=h.useSelectedStylingBlocks(),[,u]=h.useSelectedBlockIds(),o=g.useCallback(f=>{var x;const m=(x=f.currentTarget)==null?void 0:x.getAttribute("data-style-id");n(m||""),f.stopPropagation()},[n]),i=g.useCallback(f=>{n(""),f.stopPropagation()},[n]),p=g.useCallback(f=>{f.stopPropagation();const m=f.currentTarget;if(m.getAttribute("data-block-parent")){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}]),u([E])}else if(m.getAttribute("data-block-id")&&(u([m.getAttribute("data-block-id")]),m.getAttribute("data-block-parent"))){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}])}},[a,u]),y=g.useCallback(f=>Pt(f,o,i,p),[o,i]);return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:g.Children.toArray(e.map((f,m)=>{const x=At(f),R={};v.isEmpty(x)||Object.keys(x).forEach(A=>{R[A]=g.Children.toArray(x[A].map(j=>t.jsxRuntimeExports.jsx(be,{blocks:[v.find(r,{_id:j})]})))});const E=v.filter(r,{_parent:f._id});R.children=E.length?t.jsxRuntimeExports.jsx(be,{blocks:E}):null;const B=rt.getBlockComponent(f._type),w=(B==null?void 0:B.component)||null;return g.createElement(w,{blockProps:{onClick:p,"data-block-id":f._id,"data-block-type":f._type},...f,index:m,...y(f),...R,inBuilder:!0})}))})}const Ot=()=>{const e=h.useAllBlocks();return t.jsxRuntimeExports.jsx(et.Provider,{children:e.length?t.jsxRuntimeExports.jsx(be,{blocks:v.filter(e,r=>v.isEmpty(r._parent))}):t.jsxRuntimeExports.jsx(Tt,{})})},Mt=(e,r)=>e.querySelector(`[data-style-id="${r}"]`),Dt=()=>{const[e]=ee.useAtom(h.networkModeAtom),[r]=h.usePreviewMode(),[n]=h.useCanvasWidth(),[,a]=h.useSelectedBlockIds(),u=h.useSelectedBlock(),[,o]=h.useHighlightBlockId(),i=g.useRef(null),p=g.useRef(null),[y,f]=g.useState({width:0,height:0}),m=dt(y),[x,R]=g.useState(0),[E,B]=g.useState([]),[,w]=g.useState([]),[,A]=ee.useAtom(h.canvasIframeAtom),[j,z]=h.useSelectedStylingBlocks(),q=X.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:$,clientHeight:Y}=p.current;f({width:$,height:Y}),x===0&&R($)},[p,n,x]);const N=($,Y=0)=>{const{top:U}=$.getBoundingClientRect();return U+Y>=0&&U-Y<=window.innerHeight};g.useEffect(()=>{var $,Y;if(u&&u.type!=="Multiple"&&i.current){const U=He(i.current.contentDocument,u._id);U&&(N(U)||(Y=($=i.current)==null?void 0:$.contentWindow)==null||Y.scrollTo({top:U.offsetTop,behavior:"smooth"}),B([U]))}},[u]),g.useEffect(()=>{if(!v.isEmpty(j)&&i.current){const $=Mt(i.current.contentDocument,v.first(j).id);w($?[$]:[null])}else w([null])},[j]);const l=g.useMemo(()=>{let $=ut;return e==="offline"&&($=$.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/offline/tailwind.cdn.js"),$=$.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),$=$.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),$},[e]);return t.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),z([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:x>0&&!v.isEmpty(m)?{width:r?"100%":x}:{},ref:p,children:t.jsxRuntimeExports.jsxs(bt,{contentDidMount:()=>A(i.current),ref:i,id:"canvas-iframe",style:{width:`${n}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:l,children:[t.jsxRuntimeExports.jsx(St,{}),t.jsxRuntimeExports.jsx(kt,{block:u,selectedBlockElement:v.first(E)}),t.jsxRuntimeExports.jsx(Ct,{model:"page"}),t.jsxRuntimeExports.jsxs(Rt,{children:[q?t.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:t.jsxRuntimeExports.jsx(X.Skeleton,{className:"h-full"})}):t.jsxRuntimeExports.jsx(Ot,{}),t.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},Bt=g.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-4e50ad65.cjs"))),qt=()=>{const e=X.useBuilderProp("mode",fe.STATIC),[r,n]=ee.useAtom(h.addBlocksModalAtom),a={[fe.STATIC]:t.jsxRuntimeExports.jsx(Dt,{}),[fe.FRAMEWORK]:null}[e];return t.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[t.jsxRuntimeExports.jsx(lt,{}),t.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[t.jsxRuntimeExports.jsx(g.Suspense,{fallback:t.jsxRuntimeExports.jsx(X.Skeleton,{className:"h-full"}),children:t.jsxRuntimeExports.jsx(h.ErrorBoundary,{children:a})}),r?t.jsxRuntimeExports.jsx("div",{onClick:()=>n(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:t.jsxRuntimeExports.jsx("div",{onClick:u=>u.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:t.jsxRuntimeExports.jsx(Bt,{})})}):null]})]})};exports.default=qt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),t=require("./select-0e32300c.cjs"),i=require("lodash"),g=require("sonner"),j=require("react"),s=require("./index-94612af5.cjs");require("react-i18next");const q=require("lucide-react");require("@radix-ui/react-icons");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-feece010.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");const h=()=>{const{data:o}=s.useProject(),{data:n,isLoading:c}=s.usePages(),{syncState:l}=s.useSavePage(),x=s.useChangePage(),[u,a]=s.useCurrentPage();j.useEffect(()=>()=>a(null),[a]);const d=r=>{if(l!=="SAVED")g.toast.error("You have unsaved changes. Please save before changing the page.");else{const m=i.find(n,{uuid:r});x(m)}};return c||i.isEmpty(u)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(q.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(o.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(t.Select,{value:u||"",onValueChange:d,children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(t.SelectContent,{children:i.map(n,r=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=h;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
+
import { S as d, c as p, b as u, d as x, f as g } from "./select-7fddd7c3.js";
|
|
3
|
+
import { isEmpty as h, capitalize as f, map as j, find as y } from "lodash";
|
|
4
|
+
import { toast as P } from "sonner";
|
|
5
|
+
import { useEffect as v } from "react";
|
|
6
|
+
import { P as b, N as w, u as N, Q as S, R as k } from "./index-38bc7894.js";
|
|
7
|
+
import "react-i18next";
|
|
8
|
+
import { BriefcaseIcon as C } from "lucide-react";
|
|
9
|
+
import "@radix-ui/react-icons";
|
|
10
|
+
import "@radix-ui/react-select";
|
|
11
|
+
import "./utils-ac68b2c8.js";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "tailwind-merge";
|
|
14
|
+
import "i18next";
|
|
15
|
+
import "flagged";
|
|
16
|
+
import "react-dnd";
|
|
17
|
+
import "@minoru/react-dnd-treeview";
|
|
18
|
+
import "./useBuilderProp-81a14920.js";
|
|
19
|
+
import "@radix-ui/react-slot";
|
|
20
|
+
import "class-variance-authority";
|
|
21
|
+
import "@radix-ui/react-tooltip";
|
|
22
|
+
import "@radix-ui/react-toast";
|
|
23
|
+
import "jotai";
|
|
24
|
+
import "react-hotkeys-hook";
|
|
25
|
+
import "flat-to-nested";
|
|
26
|
+
import "./html-to-json-eb4de645.js";
|
|
27
|
+
import "./MODIFIERS-c2e02614.js";
|
|
28
|
+
import "himalaya";
|
|
29
|
+
import "redux-undo";
|
|
30
|
+
import "@react-hookz/web";
|
|
31
|
+
import "@chaibuilder/blocks";
|
|
32
|
+
const ie = () => {
|
|
33
|
+
const { data: i } = b(), { data: t, isLoading: o } = w(), { syncState: n } = N(), m = S(), [a, s] = k();
|
|
34
|
+
v(() => () => s(null), [s]);
|
|
35
|
+
const l = (r) => {
|
|
36
|
+
if (n !== "SAVED")
|
|
37
|
+
P.error("You have unsaved changes. Please save before changing the page.");
|
|
38
|
+
else {
|
|
39
|
+
const c = y(t, { uuid: r });
|
|
40
|
+
m(c);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return o || h(a) ? null : /* @__PURE__ */ e.jsx(
|
|
44
|
+
"nav",
|
|
45
|
+
{
|
|
46
|
+
className: "flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800",
|
|
47
|
+
"aria-label": "Breadcrumb",
|
|
48
|
+
children: /* @__PURE__ */ e.jsxs("ol", { className: "inline-flex items-center space-x-1 md:space-x-3", children: [
|
|
49
|
+
/* @__PURE__ */ e.jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ e.jsxs("div", { className: "inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
|
|
50
|
+
/* @__PURE__ */ e.jsx(C, { className: "w-4 h-4 mr-2" }),
|
|
51
|
+
f(i.name)
|
|
52
|
+
] }) }),
|
|
53
|
+
/* @__PURE__ */ e.jsx("li", { "aria-current": "page", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
54
|
+
/* @__PURE__ */ e.jsx(
|
|
55
|
+
"svg",
|
|
56
|
+
{
|
|
57
|
+
className: "mx-1 h-3 w-3 text-gray-400",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
60
|
+
fill: "none",
|
|
61
|
+
viewBox: "0 0 6 10",
|
|
62
|
+
children: /* @__PURE__ */ e.jsx(
|
|
63
|
+
"path",
|
|
64
|
+
{
|
|
65
|
+
stroke: "currentColor",
|
|
66
|
+
strokeLinecap: "round",
|
|
67
|
+
strokeLinejoin: "round",
|
|
68
|
+
strokeWidth: "2",
|
|
69
|
+
d: "m1 9 4-4-4-4"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ e.jsxs(d, { value: a || "", onValueChange: l, children: [
|
|
75
|
+
/* @__PURE__ */ e.jsx(p, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(u, { placeholder: "Page" }) }),
|
|
76
|
+
/* @__PURE__ */ e.jsx(x, { children: j(t, (r) => /* @__PURE__ */ e.jsx(g, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
|
|
77
|
+
] })
|
|
78
|
+
] }) })
|
|
79
|
+
] })
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
ie as default
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-94612af5.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-feece010.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-dd53daec.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import { nth as k, startsWith as H, has as P, map as v, isUndefined as L, find as V, isEmpty as F, includes as z } from "lodash";
|
|
3
|
-
import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as
|
|
3
|
+
import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as U, BorderAllIcon as q, BorderTopIcon as Q, TableIcon as Y, DropdownMenuIcon as W, RadiobuttonIcon as J, InputIcon as X, ButtonIcon as B, CheckboxIcon as Z, GroupIcon as ee, SpaceBetweenVerticallyIcon as se, ColumnsIcon as te, RowsIcon as y, TextIcon as C, SketchLogoIcon as ne, DividerHorizontalIcon as oe, CodeIcon as re, CursorTextIcon as ce, VideoIcon as ae, Link1Icon as le, HeadingIcon as ie, ImageIcon as de, TriangleRightIcon as xe, GlobeIcon as ue, CopyIcon as me, ClipboardCopyIcon as pe, ScissorsIcon as ge, ClipboardIcon as je, TrashIcon as he, DoubleArrowDownIcon as fe, StackIcon as Ie } from "@radix-ui/react-icons";
|
|
4
4
|
import { useDrop as be, useDragLayer as ke } from "react-dnd";
|
|
5
5
|
import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
|
|
6
6
|
import { useTranslation as Ce } from "react-i18next";
|
|
7
|
-
import { x as ve,
|
|
7
|
+
import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-38bc7894.js";
|
|
8
8
|
import { c as w } from "./utils-ac68b2c8.js";
|
|
9
9
|
import { useMemo as Fe, lazy as ze, useState as Ge, Suspense as $e, useCallback as S } from "react";
|
|
10
10
|
import { S as Ke } from "./MODIFIERS-c2e02614.js";
|
|
11
|
-
import { D as
|
|
12
|
-
import { C as
|
|
11
|
+
import { D as Ue, a as qe } from "./dialog-3d4e82ed.js";
|
|
12
|
+
import { C as Qe, a as Ye, b as We, c as d } from "./context-menu-e1c240ce.js";
|
|
13
13
|
import { u as T } from "./useBuilderProp-81a14920.js";
|
|
14
14
|
import { S as Je } from "./scroll-area-9f64a082.js";
|
|
15
15
|
import { useAtom as Xe } from "jotai";
|
|
@@ -17,7 +17,8 @@ import "i18next";
|
|
|
17
17
|
import "flagged";
|
|
18
18
|
import "react-hotkeys-hook";
|
|
19
19
|
import "flat-to-nested";
|
|
20
|
-
import "./
|
|
20
|
+
import "./html-to-json-eb4de645.js";
|
|
21
|
+
import "himalaya";
|
|
21
22
|
import "redux-undo";
|
|
22
23
|
import "@react-hookz/web";
|
|
23
24
|
import "@chaibuilder/blocks";
|
|
@@ -80,11 +81,11 @@ const N = (s) => {
|
|
|
80
81
|
case "Table":
|
|
81
82
|
return /* @__PURE__ */ e.jsx(Y, {});
|
|
82
83
|
case "TableHead":
|
|
83
|
-
return /* @__PURE__ */ e.jsx(
|
|
84
|
+
return /* @__PURE__ */ e.jsx(Q, {});
|
|
84
85
|
case "TableBody":
|
|
85
86
|
return /* @__PURE__ */ e.jsx(q, {});
|
|
86
87
|
case "TableRow":
|
|
87
|
-
return /* @__PURE__ */ e.jsx(
|
|
88
|
+
return /* @__PURE__ */ e.jsx(U, {});
|
|
88
89
|
case "TableCell":
|
|
89
90
|
return /* @__PURE__ */ e.jsx(K, {});
|
|
90
91
|
case "Box":
|
|
@@ -182,7 +183,7 @@ const es = (s) => {
|
|
|
182
183
|
}, ns = (s) => {
|
|
183
184
|
const t = s.depth * 10 + 16;
|
|
184
185
|
return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: t } });
|
|
185
|
-
}, os = ze(() => import("./MarkAsGlobalBlock-
|
|
186
|
+
}, os = ze(() => import("./MarkAsGlobalBlock-1a0d0725.js")), rs = () => {
|
|
186
187
|
const [s] = g(), [, t] = Ne();
|
|
187
188
|
return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
|
|
188
189
|
/* @__PURE__ */ e.jsx(ge, {}),
|
|
@@ -243,8 +244,8 @@ const es = (s) => {
|
|
|
243
244
|
}, is = ({ children: s, id: t = null }) => {
|
|
244
245
|
const [n, r] = Ge(!1);
|
|
245
246
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
246
|
-
/* @__PURE__ */ e.jsx(
|
|
247
|
-
/* @__PURE__ */ e.jsxs(
|
|
247
|
+
/* @__PURE__ */ e.jsx(Ue, { open: n, onOpenChange: r, children: n && /* @__PURE__ */ e.jsx(qe, { children: /* @__PURE__ */ e.jsx($e, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(os, { closeModal: () => r(!1), id: t }) }) }) }),
|
|
248
|
+
/* @__PURE__ */ e.jsxs(Qe, { children: [
|
|
248
249
|
/* @__PURE__ */ e.jsx(Ye, { children: s }),
|
|
249
250
|
/* @__PURE__ */ e.jsx(ls, { id: t, openMarkAsGlobalModal: () => r(!0) })
|
|
250
251
|
] })
|
|
@@ -272,7 +273,7 @@ function xs(s) {
|
|
|
272
273
|
};
|
|
273
274
|
});
|
|
274
275
|
}
|
|
275
|
-
const
|
|
276
|
+
const qs = () => {
|
|
276
277
|
const s = Ee(), [t] = Ae(), [n, r, c] = g(), [, a] = _e(), { t: l } = Ce(), { createSnapshot: x } = He(), j = Pe(), u = ds(), [, m] = Xe(Le), i = async (o, p) => {
|
|
277
278
|
const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ = xs(o);
|
|
278
279
|
t(_), f ? x() : (await u({
|
|
@@ -368,5 +369,5 @@ const Qs = () => {
|
|
|
368
369
|
) });
|
|
369
370
|
};
|
|
370
371
|
export {
|
|
371
|
-
|
|
372
|
+
qs as default
|
|
372
373
|
};
|
|
@@ -2,7 +2,7 @@ import { j as l } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import { GlobeIcon as m } from "@radix-ui/react-icons";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
4
|
import { B as i } from "./useBuilderProp-81a14920.js";
|
|
5
|
-
import { _ as c } from "./index-
|
|
5
|
+
import { _ as c } from "./index-38bc7894.js";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import { capitalize as p } from "lodash";
|
|
8
8
|
import "@radix-ui/react-slot";
|
|
@@ -19,15 +19,16 @@ import "react-dnd";
|
|
|
19
19
|
import "@minoru/react-dnd-treeview";
|
|
20
20
|
import "react-hotkeys-hook";
|
|
21
21
|
import "flat-to-nested";
|
|
22
|
-
import "./
|
|
22
|
+
import "./html-to-json-eb4de645.js";
|
|
23
23
|
import "./MODIFIERS-c2e02614.js";
|
|
24
|
+
import "himalaya";
|
|
24
25
|
import "redux-undo";
|
|
25
26
|
import "@react-hookz/web";
|
|
26
27
|
import "@chaibuilder/blocks";
|
|
27
28
|
import "sonner";
|
|
28
29
|
import "lucide-react";
|
|
29
|
-
const
|
|
30
|
-
const
|
|
30
|
+
const K = ({ id: o = null, closeModal: t }) => {
|
|
31
|
+
const a = c(), [e, s] = n("");
|
|
31
32
|
return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
32
33
|
/* @__PURE__ */ l.jsx("h1", { className: "text-lg font-bold", children: "Mark as Global" }),
|
|
33
34
|
/* @__PURE__ */ l.jsxs("div", { className: "py-2 text-sm", children: [
|
|
@@ -59,7 +60,7 @@ const J = ({ id: a = null, closeModal: t }) => {
|
|
|
59
60
|
i,
|
|
60
61
|
{
|
|
61
62
|
onClick: () => {
|
|
62
|
-
o
|
|
63
|
+
a(o, p(e)), t();
|
|
63
64
|
},
|
|
64
65
|
disabled: e.length <= 2,
|
|
65
66
|
variant: "default",
|
|
@@ -71,5 +72,5 @@ const J = ({ id: a = null, closeModal: t }) => {
|
|
|
71
72
|
] });
|
|
72
73
|
};
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
+
K as default
|
|
75
76
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-94612af5.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-feece010.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("react"),n=require("lodash"),x=require("./index-94612af5.cjs");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-feece010.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const a=r.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-eb896eef.cjs"))),o=r.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-f60c4980.cjs"))),q=()=>{const{data:s=[],isLoading:i}=x.usePages(),t=n.filter(s,u=>u.type==="STATIC");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(o,{isLoading:i,pages:t})})]})};exports.default=q;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import r, { Suspense as s } from "react";
|
|
3
3
|
import { filter as p } from "lodash";
|
|
4
|
-
import { N as a } from "./index-
|
|
4
|
+
import { N as a } from "./index-38bc7894.js";
|
|
5
5
|
import "i18next";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import "flagged";
|
|
@@ -19,14 +19,15 @@ import "@radix-ui/react-toast";
|
|
|
19
19
|
import "jotai";
|
|
20
20
|
import "react-hotkeys-hook";
|
|
21
21
|
import "flat-to-nested";
|
|
22
|
-
import "./
|
|
22
|
+
import "./html-to-json-eb4de645.js";
|
|
23
23
|
import "./MODIFIERS-c2e02614.js";
|
|
24
|
+
import "himalaya";
|
|
24
25
|
import "redux-undo";
|
|
25
26
|
import "@react-hookz/web";
|
|
26
27
|
import "@chaibuilder/blocks";
|
|
27
28
|
import "sonner";
|
|
28
29
|
import "lucide-react";
|
|
29
|
-
const d = r.lazy(() => import("./add-page-modal-
|
|
30
|
+
const d = r.lazy(() => import("./add-page-modal-96a1f8dc.js")), l = r.lazy(() => import("./page-viewer-be5d5315.js")), B = () => {
|
|
30
31
|
const { data: i = [], isLoading: e } = a(), m = p(i, (o) => o.type === "STATIC");
|
|
31
32
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
32
33
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
|
|
@@ -44,5 +45,5 @@ const d = r.lazy(() => import("./add-page-modal-fb1e7f3d.js")), l = r.lazy(() =>
|
|
|
44
45
|
] });
|
|
45
46
|
};
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
+
B as default
|
|
48
49
|
};
|
|
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import i, { useRef as x, useEffect as m, Suspense as n } from "react";
|
|
3
3
|
import { isEqual as j, isEmpty as b } from "lodash";
|
|
4
4
|
import { A as f, a as l, b as c, c as d } from "./accordion-c0176dc5.js";
|
|
5
|
-
import { O as h, P as g } from "./index-
|
|
5
|
+
import { O as h, P as g } from "./index-38bc7894.js";
|
|
6
6
|
import "@radix-ui/react-accordion";
|
|
7
7
|
import "@radix-ui/react-icons";
|
|
8
8
|
import "./utils-ac68b2c8.js";
|
|
@@ -21,18 +21,19 @@ import "@radix-ui/react-toast";
|
|
|
21
21
|
import "jotai";
|
|
22
22
|
import "react-hotkeys-hook";
|
|
23
23
|
import "flat-to-nested";
|
|
24
|
-
import "./
|
|
24
|
+
import "./html-to-json-eb4de645.js";
|
|
25
25
|
import "./MODIFIERS-c2e02614.js";
|
|
26
|
+
import "himalaya";
|
|
26
27
|
import "redux-undo";
|
|
27
28
|
import "@react-hookz/web";
|
|
28
29
|
import "@chaibuilder/blocks";
|
|
29
30
|
import "sonner";
|
|
30
31
|
import "lucide-react";
|
|
31
|
-
const N = i.lazy(() => import("./project-general-setting-
|
|
32
|
+
const N = i.lazy(() => import("./project-general-setting-cc9b43cd.js")), S = i.lazy(() => import("./project-seo-setting-01536592.js")), p = /* @__PURE__ */ e.jsx("div", { className: "px-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (t) => t && b(t.seoData) ? {
|
|
32
33
|
...t,
|
|
33
34
|
seoData: { title: "", description: "", image: "" }
|
|
34
35
|
} : t;
|
|
35
|
-
function
|
|
36
|
+
function $() {
|
|
36
37
|
const t = h(), { data: o } = g(), [r, a] = i.useState(
|
|
37
38
|
u(o || {})
|
|
38
39
|
), s = x(r);
|
|
@@ -61,5 +62,5 @@ function Z() {
|
|
|
61
62
|
] });
|
|
62
63
|
}
|
|
63
64
|
export {
|
|
64
|
-
|
|
65
|
+
$ as default
|
|
65
66
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("react"),x=require("lodash"),s=require("./accordion-0afd8143.cjs"),a=require("./index-94612af5.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-feece010.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-bebd5cb1.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-e3924578.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function j(){const t=a.useUpdateProject(),{data:o}=a.useProject(),[i,u]=r.useState(l(o||{})),n=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(o,n.current)||t.mutate(n.current,{onSuccess:()=>u(n.current)})},[n]),r.useEffect(()=>{n.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:u})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:u})})})]})]})})]})}exports.default=j;
|