@chaibuilder/sdk 1.1.2 → 1.1.4
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-P3qHuE5J.cjs → AddBlocks-Wsoku0Sm.cjs} +1 -1
- package/dist/{AddBlocks-imyQSCbI.js → AddBlocks-rteGefHR.js} +20 -20
- package/dist/{BrandingOptions-tSNtQ1Kv.js → BrandingOptions-4l1Yo42i.js} +1 -1
- package/dist/{BrandingOptions-_2XBEPab.cjs → BrandingOptions-CqVvc-GC.cjs} +1 -1
- package/dist/CanvasArea-_WcM6PCy.js +1426 -0
- package/dist/CanvasArea-jzvQJnbQ.cjs +59 -0
- package/dist/{CurrentPage-hHwsHam-.cjs → CurrentPage-8AWFWOJ8.cjs} +1 -1
- package/dist/{CurrentPage-uRwS0DQC.js → CurrentPage-tnHIOkX2.js} +5 -5
- package/dist/{Layers-eXMT1ncm.js → Layers-6PHQWIbV.js} +15 -15
- package/dist/{Layers--5nyqOjK.cjs → Layers-jsOPQbVU.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-aqik3ouc.js → MarkAsGlobalBlock-9pfqCgrO.js} +1 -1
- package/dist/{MarkAsGlobalBlock-p_wvHkQZ.cjs → MarkAsGlobalBlock-bXkERbl2.cjs} +1 -1
- package/dist/{PagesPanel-WZgw7xVs.cjs → PagesPanel-Zvy5ZKPf.cjs} +1 -1
- package/dist/{PagesPanel-xRUnAMIb.js → PagesPanel-cmJ1UiP0.js} +3 -3
- package/dist/{ProjectPanel-FC03TiyG.cjs → ProjectPanel-4BsxvZu-.cjs} +1 -1
- package/dist/{ProjectPanel-8l4Bi3Kh.js → ProjectPanel-VxbDdgA2.js} +5 -5
- package/dist/Settings-AJet4HbF.cjs +1 -0
- package/dist/{Settings-4v3M1bRS.js → Settings-zzs6KaRd.js} +294 -303
- package/dist/{SidePanels-0xaw3Td6.js → SidePanels-UGgpWdPF.js} +9 -9
- package/dist/{SidePanels-5e5q3c7J.cjs → SidePanels-_8tt1l6S.cjs} +1 -1
- package/dist/{Topbar-ZjAs5fDc.cjs → Topbar-geYx1fCH.cjs} +1 -1
- package/dist/{Topbar-Jc74a6oE.js → Topbar-zw_KlpKs.js} +5 -5
- package/dist/{UnsplashImages-nXceZLmd.cjs → UnsplashImages-C4_dg08Y.cjs} +1 -1
- package/dist/{UnsplashImages-_PxEYx5c.js → UnsplashImages-yk5eowZf.js} +4 -4
- package/dist/{UploadImages-tcQb5NZu.cjs → UploadImages-hLrNjSXF.cjs} +1 -1
- package/dist/{UploadImages-zzSgKmP9.js → UploadImages-ioTAmtvl.js} +10 -10
- package/dist/{add-page-modal-K5isTZOT.js → add-page-modal-31-dJjna.js} +3 -3
- package/dist/{add-page-modal-JRSQ_N56.cjs → add-page-modal-Gsa-gnsn.cjs} +1 -1
- package/dist/{confirm-alert-2JxcNf3T.js → confirm-alert-c7sRVjK8.js} +1 -1
- package/dist/{confirm-alert-mzlwOW9w.cjs → confirm-alert-zqK8LIx8.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -25
- package/dist/core.js +51 -55
- package/dist/{delete-page-modal-x81Ed4jF.js → delete-page-modal-5xqoPPl3.js} +2 -2
- package/dist/{delete-page-modal-c8nB2y7w.cjs → delete-page-modal-jEsSWzKN.cjs} +1 -1
- package/dist/{form-TQ7vwDYO.js → form-5tYo3gKa.js} +1 -1
- package/dist/{form-bSW-Pkw9.cjs → form-hHv26OT7.cjs} +1 -1
- package/dist/{index-HjvZqhVh.js → index-K_TiChPs.js} +4 -4
- package/dist/index-LLhN-70p.cjs +1 -0
- package/dist/{index-ORFlyrBx.js → index-pJPfM9Bm.js} +874 -878
- package/dist/{index-7NRFGya_.cjs → index-rdttRR05.cjs} +2 -2
- package/dist/{page-viewer-huD5B1om.cjs → page-viewer-DJqp04Tr.cjs} +1 -1
- package/dist/{page-viewer-fFaDQOOI.js → page-viewer-Oku6zrcm.js} +3 -3
- package/dist/{project-general-setting-rH_1r38b.js → project-general-setting-hrJZUYnV.js} +3 -3
- package/dist/{project-general-setting-rNNI-K6l.cjs → project-general-setting-rVhljgfP.cjs} +1 -1
- package/dist/{project-seo-setting-cERASO9j.cjs → project-seo-setting-Xg6cVYXo.cjs} +1 -1
- package/dist/{project-seo-setting-k0HlefUD.js → project-seo-setting-fwyxNcY-.js} +2 -2
- package/dist/{single-page-detail-CrgTQFUX.js → single-page-detail-1UCpERBU.js} +4 -4
- package/dist/{single-page-detail-52_cuxNe.cjs → single-page-detail-ilh1I9gv.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +41 -41
- package/dist/{useAddBlockByDrop-UA_Iw_4l.js → useAddBlockByDrop-UJ6QE7aE.js} +1 -1
- package/dist/{useAddBlockByDrop-DPV32UHP.cjs → useAddBlockByDrop-jJ_MnZ5y.cjs} +1 -1
- package/package.json +1 -1
- package/dist/CanvasArea-UtFK5IS6.cjs +0 -58
- package/dist/CanvasArea-dkwSFbQA.js +0 -1412
- package/dist/Settings-kcmKFymH.cjs +0 -1
- package/dist/index-zkc4SQCu.cjs +0 -1
package/dist/studio.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import { C as pi } from "./index-
|
|
2
|
+
import { C as pi } from "./index-K_TiChPs.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "sonner";
|
|
5
5
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
6
6
|
import "i18next";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-pJPfM9Bm.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
10
10
|
import "class-variance-authority";
|
|
11
11
|
import "./utils-PPBbw5bk.js";
|
package/dist/ui.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-LLhN-70p.cjs");require("./jsx-runtime-WUGKV8jN.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("lodash");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");exports.Accordion=e.Accordion;exports.AccordionContent=e.AccordionContent;exports.AccordionItem=e.AccordionItem;exports.AccordionTrigger=e.AccordionTrigger;exports.Alert=e.Alert;exports.AlertDescription=e.AlertDescription;exports.AlertDialog=e.AlertDialog;exports.AlertDialogAction=e.AlertDialogAction;exports.AlertDialogCancel=e.AlertDialogCancel;exports.AlertDialogContent=e.AlertDialogContent;exports.AlertDialogDescription=e.AlertDialogDescription;exports.AlertDialogFooter=e.AlertDialogFooter;exports.AlertDialogHeader=e.AlertDialogHeader;exports.AlertDialogTitle=e.AlertDialogTitle;exports.AlertDialogTrigger=e.AlertDialogTrigger;exports.AlertTitle=e.AlertTitle;exports.Badge=e.Badge;exports.Button=e.Button;exports.Card=e.Card;exports.CardContent=e.CardContent;exports.CardDescription=e.CardDescription;exports.CardFooter=e.CardFooter;exports.CardHeader=e.CardHeader;exports.CardTitle=e.CardTitle;exports.Command=e.Command;exports.CommandDialog=e.CommandDialog;exports.CommandEmpty=e.CommandEmpty;exports.CommandGroup=e.CommandGroup;exports.CommandInput=e.CommandInput;exports.CommandItem=e.CommandItem;exports.CommandList=e.CommandList;exports.CommandSeparator=e.CommandSeparator;exports.CommandShortcut=e.CommandShortcut;exports.ContextMenu=e.ContextMenu;exports.ContextMenuCheckboxItem=e.ContextMenuCheckboxItem;exports.ContextMenuContent=e.ContextMenuContent;exports.ContextMenuGroup=e.ContextMenuGroup;exports.ContextMenuItem=e.ContextMenuItem;exports.ContextMenuLabel=e.ContextMenuLabel;exports.ContextMenuPortal=e.ContextMenuPortal;exports.ContextMenuRadioGroup=e.ContextMenuRadioGroup;exports.ContextMenuRadioItem=e.ContextMenuRadioItem;exports.ContextMenuSeparator=e.ContextMenuSeparator;exports.ContextMenuShortcut=e.ContextMenuShortcut;exports.ContextMenuSub=e.ContextMenuSub;exports.ContextMenuSubContent=e.ContextMenuSubContent;exports.ContextMenuSubTrigger=e.ContextMenuSubTrigger;exports.ContextMenuTrigger=e.ContextMenuTrigger;exports.Dialog=e.Dialog;exports.DialogContent=e.DialogContent;exports.DialogDescription=e.DialogDescription;exports.DialogFooter=e.DialogFooter;exports.DialogHeader=e.DialogHeader;exports.DialogTitle=e.DialogTitle;exports.DialogTrigger=e.DialogTrigger;exports.DropdownMenu=e.DropdownMenu;exports.DropdownMenuCheckboxItem=e.DropdownMenuCheckboxItem;exports.DropdownMenuContent=e.DropdownMenuContent;exports.DropdownMenuGroup=e.DropdownMenuGroup;exports.DropdownMenuItem=e.DropdownMenuItem;exports.DropdownMenuLabel=e.DropdownMenuLabel;exports.DropdownMenuPortal=e.DropdownMenuPortal;exports.DropdownMenuRadioGroup=e.DropdownMenuRadioGroup;exports.DropdownMenuRadioItem=e.DropdownMenuRadioItem;exports.DropdownMenuSeparator=e.DropdownMenuSeparator;exports.DropdownMenuShortcut=e.DropdownMenuShortcut;exports.DropdownMenuSub=e.DropdownMenuSub;exports.DropdownMenuSubContent=e.DropdownMenuSubContent;exports.DropdownMenuSubTrigger=e.DropdownMenuSubTrigger;exports.DropdownMenuTrigger=e.DropdownMenuTrigger;exports.HoverCard=e.HoverCard;exports.HoverCardContent=e.HoverCardContent;exports.HoverCardTrigger=e.HoverCardTrigger;exports.IconPickerField=e.IconPickerField;exports.ImagePickerField=e.ImagePickerField;exports.Input=e.Input;exports.Label=e.Label;exports.LinkField=e.LinkField;exports.Menubar=e.Menubar;exports.MenubarCheckboxItem=e.MenubarCheckboxItem;exports.MenubarContent=e.MenubarContent;exports.MenubarGroup=e.MenubarGroup;exports.MenubarItem=e.MenubarItem;exports.MenubarLabel=e.MenubarLabel;exports.MenubarMenu=e.MenubarMenu;exports.MenubarPortal=e.MenubarPortal;exports.MenubarRadioGroup=e.MenubarRadioGroup;exports.MenubarRadioItem=e.MenubarRadioItem;exports.MenubarSeparator=e.MenubarSeparator;exports.MenubarShortcut=e.MenubarShortcut;exports.MenubarSub=e.MenubarSub;exports.MenubarSubContent=e.MenubarSubContent;exports.MenubarSubTrigger=e.MenubarSubTrigger;exports.MenubarTrigger=e.MenubarTrigger;exports.Popover=e.Popover;exports.PopoverContent=e.PopoverContent;exports.PopoverTrigger=e.PopoverTrigger;exports.RTEField=e.RichTextEditorField;exports.ScrollArea=e.ScrollArea;exports.ScrollBar=e.ScrollBar;exports.Select=e.Select;exports.SelectContent=e.SelectContent;exports.SelectGroup=e.SelectGroup;exports.SelectItem=e.SelectItem;exports.SelectLabel=e.SelectLabel;exports.SelectSeparator=e.SelectSeparator;exports.SelectTrigger=e.SelectTrigger;exports.SelectValue=e.SelectValue;exports.Separator=e.Separator;exports.Sheet=e.Sheet;exports.SheetClose=e.SheetClose;exports.SheetContent=e.SheetContent;exports.SheetDescription=e.SheetDescription;exports.SheetFooter=e.SheetFooter;exports.SheetHeader=e.SheetHeader;exports.SheetTitle=e.SheetTitle;exports.SheetTrigger=e.SheetTrigger;exports.Skeleton=e.Skeleton;exports.Switch=e.Switch;exports.Tabs=e.Tabs;exports.TabsContent=e.TabsContent;exports.TabsList=e.TabsList;exports.TabsTrigger=e.TabsTrigger;exports.Textarea=e.Textarea;exports.Toaster=e.Toaster;exports.Toggle=e.Toggle;exports.Tooltip=e.Tooltip;exports.TooltipContent=e.TooltipContent;exports.TooltipPortal=e.TooltipPortal;exports.TooltipProvider=e.TooltipProvider;exports.TooltipTrigger=e.TooltipTrigger;exports.badgeVariants=e.badgeVariants;exports.buttonVariants=e.buttonVariants;exports.reducer=e.reducer;exports.toast=e.toast;exports.toggleVariants=e.toggleVariants;exports.useToast=e.useToast;
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bh as J, bk as K, bi as j, bj as y, bw as z, bG as N, D as O, ap as Q, K as U, F as W, I as X, J as Y, G as Z, H as _, E as $, bx as aa, bH as ea, B as oa, bq as ta, bt as ra, bs as sa, bv as na, br as ia, bJ as ba, b3 as pa, ck as ua, b6 as la, b7 as ma, b4 as ca, b8 as da, b5 as Ca, cm as ga, cl as Ma, bB as Sa, cn as Da, bA as Ta, cs as xa, bz as Aa, cp as Ia, ct as ha, cx as wa, co as Pa, cq as Fa, cr as Ga, cu as ka, cv as Ha, cw as La, bC as va, ak as Ra, al as Ba, ao as Ea, b9 as Va, am as fa, an as qa, ba as Ja, aN as Ka, aS as ja, aP as ya, cb as za, c8 as Na, aQ as Oa, cc as Qa, cg as Ua, c9 as Wa, aR as Xa, ca as Ya, cd as Za, ce as _a, cf as $a, aO as ae, aK as ee, aM as oe, aL as te, be as re, bf as se, bl as ne, aI as ie, bg as be, bL as pe, bS as ue, bO as le, bY as me, bP as ce, bR as de, bM as Ce, bV as ge, bT as Me, bU as Se, bQ as De, b_ as Te, bZ as xe, bW as Ae, bX as Ie, bN as he, b0 as we, b2 as Pe, b1 as Fe, bd as Ge, bo as ke, bK as He, aq as Le, at as ve, aB as Re, au as Be, aC as Ee, b$ as Ve, ar as fe, as as qe, aH as Je, c0 as Ke, c2 as je, c3 as ye, c7 as ze, c5 as Ne, c4 as Oe, c6 as Qe, c1 as Ue, S as We, aJ as Xe, ax as Ye, aA as Ze, ay as _e, az as $e, bu as ao, C as eo, aF as oo, aD as to, aG as ro, bm as so, T as no, aE as io, bI as bo, bF as po, ch as uo, cj as lo, bE as mo, ci as co } from "./index-pJPfM9Bm.js";
|
|
2
2
|
import "./jsx-runtime-NV737rRe.js";
|
|
3
3
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
4
4
|
import "react";
|
|
@@ -37,10 +37,10 @@ import "@chaibuilder/runtime";
|
|
|
37
37
|
import "@react-hookz/web";
|
|
38
38
|
import "react-i18next";
|
|
39
39
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
J as Accordion,
|
|
41
|
+
K as AccordionContent,
|
|
42
42
|
j as AccordionItem,
|
|
43
|
-
|
|
43
|
+
y as AccordionTrigger,
|
|
44
44
|
z as Alert,
|
|
45
45
|
N as AlertDescription,
|
|
46
46
|
O as AlertDialog,
|
|
@@ -63,9 +63,9 @@ export {
|
|
|
63
63
|
ba as CardTitle,
|
|
64
64
|
pa as Command,
|
|
65
65
|
ua as CommandDialog,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
la as CommandEmpty,
|
|
67
|
+
ma as CommandGroup,
|
|
68
|
+
ca as CommandInput,
|
|
69
69
|
da as CommandItem,
|
|
70
70
|
Ca as CommandList,
|
|
71
71
|
ga as CommandSeparator,
|
|
@@ -75,26 +75,26 @@ export {
|
|
|
75
75
|
Ta as ContextMenuContent,
|
|
76
76
|
xa as ContextMenuGroup,
|
|
77
77
|
Aa as ContextMenuItem,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Ia as ContextMenuLabel,
|
|
79
|
+
ha as ContextMenuPortal,
|
|
80
|
+
wa as ContextMenuRadioGroup,
|
|
81
81
|
Pa as ContextMenuRadioItem,
|
|
82
82
|
Fa as ContextMenuSeparator,
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
Ga as ContextMenuShortcut,
|
|
84
|
+
ka as ContextMenuSub,
|
|
85
85
|
Ha as ContextMenuSubContent,
|
|
86
86
|
La as ContextMenuSubTrigger,
|
|
87
|
-
|
|
87
|
+
va as ContextMenuTrigger,
|
|
88
88
|
Ra as Dialog,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
Ba as DialogContent,
|
|
90
|
+
Ea as DialogDescription,
|
|
91
|
+
Va as DialogFooter,
|
|
92
|
+
fa as DialogHeader,
|
|
93
|
+
qa as DialogTitle,
|
|
94
|
+
Ja as DialogTrigger,
|
|
95
|
+
Ka as DropdownMenu,
|
|
96
96
|
ja as DropdownMenuCheckboxItem,
|
|
97
|
-
|
|
97
|
+
ya as DropdownMenuContent,
|
|
98
98
|
za as DropdownMenuGroup,
|
|
99
99
|
Na as DropdownMenuItem,
|
|
100
100
|
Oa as DropdownMenuLabel,
|
|
@@ -117,9 +117,9 @@ export {
|
|
|
117
117
|
be as LinkField,
|
|
118
118
|
pe as Menubar,
|
|
119
119
|
ue as MenubarCheckboxItem,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
le as MenubarContent,
|
|
121
|
+
me as MenubarGroup,
|
|
122
|
+
ce as MenubarItem,
|
|
123
123
|
de as MenubarLabel,
|
|
124
124
|
Ce as MenubarMenu,
|
|
125
125
|
ge as MenubarPortal,
|
|
@@ -129,26 +129,26 @@ export {
|
|
|
129
129
|
Te as MenubarShortcut,
|
|
130
130
|
xe as MenubarSub,
|
|
131
131
|
Ae as MenubarSubContent,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
Ie as MenubarSubTrigger,
|
|
133
|
+
he as MenubarTrigger,
|
|
134
|
+
we as Popover,
|
|
135
135
|
Pe as PopoverContent,
|
|
136
136
|
Fe as PopoverTrigger,
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
Ge as RTEField,
|
|
138
|
+
ke as ScrollArea,
|
|
139
139
|
He as ScrollBar,
|
|
140
140
|
Le as Select,
|
|
141
|
-
|
|
141
|
+
ve as SelectContent,
|
|
142
142
|
Re as SelectGroup,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
Be as SelectItem,
|
|
144
|
+
Ee as SelectLabel,
|
|
145
|
+
Ve as SelectSeparator,
|
|
146
|
+
fe as SelectTrigger,
|
|
147
|
+
qe as SelectValue,
|
|
148
|
+
Je as Separator,
|
|
149
|
+
Ke as Sheet,
|
|
150
150
|
je as SheetClose,
|
|
151
|
-
|
|
151
|
+
ye as SheetContent,
|
|
152
152
|
ze as SheetDescription,
|
|
153
153
|
Ne as SheetFooter,
|
|
154
154
|
Oe as SheetHeader,
|
|
@@ -171,7 +171,7 @@ export {
|
|
|
171
171
|
bo as badgeVariants,
|
|
172
172
|
po as buttonVariants,
|
|
173
173
|
uo as reducer,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
lo as toast,
|
|
175
|
+
mo as toggleVariants,
|
|
176
|
+
co as useToast
|
|
177
177
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback as n } from "react";
|
|
2
2
|
import { has as s } from "lodash";
|
|
3
|
-
import { O as a, i as u } from "./index-
|
|
3
|
+
import { O as a, i as u } from "./index-pJPfM9Bm.js";
|
|
4
4
|
const B = () => {
|
|
5
5
|
const { addCoreBlock: r } = a(), l = u("getExternalPredefinedBlock");
|
|
6
6
|
return n(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react"),u=require("lodash"),t=require("./index-
|
|
1
|
+
"use strict";const n=require("react"),u=require("lodash"),t=require("./index-LLhN-70p.cjs"),a=()=>{const{addCoreBlock:r}=t.useAddBlock(),l=t.useBuilderProp("getExternalPredefinedBlock");return n.useCallback(async s=>{const{block:o,dropTargetId:e,relativeIndex:c}=s;if(u.has(o,"format")){const d=await l(o);return r({blocks:d},e===0?null:e,c)}return r(o,e===0?null:e,c)},[r])};exports.useAddBlockByDrop=a;
|
package/package.json
CHANGED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";var We=Object.defineProperty;var $e=(t,e,n)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var U=(t,e,n)=>($e(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),p=require("lodash"),P=require("@radix-ui/react-icons"),o=require("./index-zkc4SQCu.cjs"),He=require("react-i18next"),W=require("jotai"),fe=require("react-dom"),X=require("./MODIFIERS-WFzDQfiT.cjs"),J=require("./index-7NRFGya_.cjs"),Ue=require("react-quill"),ze=require("./useAddBlockByDrop-DPV32UHP.cjs"),Ye=require("flagged"),Ke=require("@floating-ui/dom"),xe=require("@floating-ui/react-dom"),Ve=require("react-dnd"),Xe=require("@react-hookz/web"),Je=require("@bobthered/tailwindcss-palette-generator"),Ze=require("react-wrap-balancer"),Ge=require("tailwind-merge"),Qe=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");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("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const et=()=>{const{undoCount:t,redoCount:e,undo:n,redo:a}=o.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!t,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!e,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function tt(){const[t,e]=o.useDarkMode(),{t:n}=He.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(o.Switch,{id:"dark-mode-switch",checked:t,onCheckedChange:()=>{e(!t)},className:`${t?"bg-violet-600":"bg-violet-300"}
|
|
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:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${t?"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 he=({landscape:t=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:t?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.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"}})]}),ge=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(P.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:s.jsxRuntimeExports.jsx(P.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(he,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(he,{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:s.jsxRuntimeExports.jsx(P.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(P.DesktopIcon,{}),width:1920}],nt=({title:t,content:e,currentBreakpoint:n,breakpoint:a,width:d,icon:r,onClick:l})=>s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>l(d),size:"sm",variant:a===n?"secondary":"ghost",children:r})}),s.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:t}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:e})]})})})]}),st=()=>{const[,t,e]=o.useCanvasWidth(),[n,a]=o.useSelectedBreakpoints(),d=r=>{n.includes(r)?n.length>2&&a(n.filter(l=>l!==r)):a(l=>[...l,r])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[p.map(ge.filter(r=>p.includes(n,p.toUpper(r.breakpoint))),r=>m.createElement(nt,{...r,onClick:e,key:r.breakpoint,currentBreakpoint:t})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(P.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),p.map(ge,r=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>d(p.toUpper(r.breakpoint)),checked:p.includes(n,p.toUpper(r.breakpoint)),children:r.title},r.breakpoint))]})]})]})},rt=()=>{const[t]=o.useSetAllBlocks(),{createSnapshot:e}=o.useCanvasHistory(),[,n]=o.useSelectedBlockIds(),[,a]=o.useSelectedStylingBlocks(),d=m.useCallback(()=>{t([]),n([]),a([]),e()},[t,e]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(P.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:d,children:"Yes"})]})]})]})})},ot=()=>{const t=o.useFeatureSupport("darkMode",!1),[e]=o.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[t?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(tt,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(st,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(P.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[p.round(e,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(et,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(rt,{})]})]})},it=`<!doctype html>
|
|
4
|
-
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
|
-
<head>
|
|
6
|
-
<meta charset="UTF-8">
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
-
<script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
|
|
9
|
-
<style>
|
|
10
|
-
html { height: 100%; overflow:auto; }
|
|
11
|
-
body { height: 100%; }
|
|
12
|
-
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
13
|
-
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
14
|
-
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
15
|
-
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
16
|
-
html{
|
|
17
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
18
|
-
scrollbar-width: none; /* Firefox */
|
|
19
|
-
}
|
|
20
|
-
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
21
|
-
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
22
|
-
|
|
23
|
-
html::-webkit-scrollbar { width: 0 !important }
|
|
24
|
-
.aspect-auto{aspect-ratio: auto;}
|
|
25
|
-
.aspect-square{aspect-ratio: 1/1;}
|
|
26
|
-
.aspect-video{aspect-ratio: 16/9;}
|
|
27
|
-
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
28
|
-
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
29
|
-
a{ pointer-events: none !important; }
|
|
30
|
-
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
31
|
-
[contenteditable="true"] {
|
|
32
|
-
outline: none;
|
|
33
|
-
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
34
|
-
-webkit-user-select: text;
|
|
35
|
-
-moz-user-select: text;
|
|
36
|
-
user-select: text;
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
39
|
-
<style id="hidden-blocks"></style>
|
|
40
|
-
<style id="selected-block"></style>
|
|
41
|
-
<style id="selected-styling-block"></style>
|
|
42
|
-
<style id="highlighted-block"></style>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body class="font-body antialiased h-full">
|
|
46
|
-
<div class="frame-root"></div>
|
|
47
|
-
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
48
|
-
</body>
|
|
49
|
-
</html>`,at=t=>{const[e]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[a,d]=m.useState({}),r=m.useCallback(()=>{const{width:l,height:c}=t;if(l<e){const h=parseFloat((l/e).toString());let f={};c&&(f={height:c+2*c*(1-h)}),d({transform:`scale(${h})`,transformOrigin:"top left",...f,maxWidth:"none"}),n(h*100)}else d({}),n(100)},[e,t,n]);return m.useEffect(()=>{r()},[e,t,n,r]),a};var G={exports:{}};/*
|
|
50
|
-
object-assign
|
|
51
|
-
(c) Sindre Sorhus
|
|
52
|
-
@license MIT
|
|
53
|
-
*/var ne,me;function lt(){if(me)return ne;me=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function d(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var l={},c=0;c<10;c++)l["_"+String.fromCharCode(c)]=c;var h=Object.getOwnPropertyNames(l).map(function(g){return l[g]});if(h.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(g){f[g]=g}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ne=d()?Object.assign:function(r,l){for(var c,h=a(r),f,g=1;g<arguments.length;g++){c=Object(arguments[g]);for(var x in c)e.call(c,x)&&(h[x]=c[x]);if(t){f=t(c);for(var b=0;b<f.length;b++)n.call(c,f[b])&&(h[f[b]]=c[f[b]])}}return h},ne}var se,ye;function de(){if(ye)return se;ye=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return se=t,se}var re,ve;function we(){return ve||(ve=1,re=Function.call.bind(Object.prototype.hasOwnProperty)),re}var oe,je;function ct(){if(je)return oe;je=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var e=de(),n={},a=we();t=function(r){var l="Warning: "+r;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}}}function d(r,l,c,h,f){if(process.env.NODE_ENV!=="production"){for(var g in r)if(a(r,g)){var x;try{if(typeof r[g]!="function"){var b=Error((h||"React class")+": "+c+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}x=r[g](l,g,h,c,null,e)}catch(M){x=M}if(x&&!(x instanceof Error)&&t((h||"React class")+": type specification of "+c+" `"+g+"` 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 w=f?f():"";t("Failed "+c+" type: "+x.message+(w??""))}}}}return d.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},oe=d,oe}var ie,be;function dt(){if(be)return ie;be=1;var t=J.reactIsExports,e=lt(),n=de(),a=we(),d=ct(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(c){var h="Warning: "+c;typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}});function l(){return null}return ie=function(c,h){var f=typeof Symbol=="function"&&Symbol.iterator,g="@@iterator";function x(i){var u=i&&(f&&i[f]||i[g]);if(typeof u=="function")return u}var b="<<anonymous>>",w={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:z(),arrayOf:_,element:ee(),elementType:te(),instanceOf:A,node:Pe(),objectOf:F,oneOf:N,oneOfType:qe,shape:Me,exact:Le};function M(i,u){return i===u?i!==0||1/i===1/u:i!==i&&u!==u}function S(i,u){this.message=i,this.data=u&&typeof u=="object"?u:{},this.stack=""}S.prototype=Error.prototype;function D(i){if(process.env.NODE_ENV!=="production")var u={},R=0;function E(C,j,k,T,I,B,L){if(T=T||b,B=B||k,L!==n){if(h){var O=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 O.name="Invariant Violation",O}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Y=T+":"+k;!u[Y]&&R<3&&(r("You are manually calling a React.PropTypes validation function for the `"+B+"` prop on `"+T+"`. 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."),u[Y]=!0,R++)}}return j[k]==null?C?j[k]===null?new S("The "+I+" `"+B+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new S("The "+I+" `"+B+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:i(j,k,T,I,B)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function v(i){function u(R,E,y,C,j,k){var T=R[E],I=$(T);if(I!==i){var B=V(T);return new S("Invalid "+C+" `"+j+"` of type "+("`"+B+"` supplied to `"+y+"`, expected ")+("`"+i+"`."),{expectedType:i})}return null}return D(u)}function z(){return D(l)}function _(i){function u(R,E,y,C,j){if(typeof i!="function")return new S("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var k=R[E];if(!Array.isArray(k)){var T=$(k);return new S("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var I=0;I<k.length;I++){var B=i(k,I,y,C,j+"["+I+"]",n);if(B instanceof Error)return B}return null}return D(u)}function ee(){function i(u,R,E,y,C){var j=u[R];if(!c(j)){var k=$(j);return new S("Invalid "+y+" `"+C+"` of type "+("`"+k+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return D(i)}function te(){function i(u,R,E,y,C){var j=u[R];if(!t.isValidElementType(j)){var k=$(j);return new S("Invalid "+y+" `"+C+"` of type "+("`"+k+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return D(i)}function A(i){function u(R,E,y,C,j){if(!(R[E]instanceof i)){var k=i.name||b,T=Fe(R[E]);return new S("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+k+"`."))}return null}return D(u)}function N(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("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])."):r("Invalid argument supplied to oneOf, expected an array.")),l;function u(R,E,y,C,j){for(var k=R[E],T=0;T<i.length;T++)if(M(k,i[T]))return null;var I=JSON.stringify(i,function(L,O){var Y=V(O);return Y==="symbol"?String(O):O});return new S("Invalid "+C+" `"+j+"` of value `"+String(k)+"` "+("supplied to `"+y+"`, expected one of "+I+"."))}return D(u)}function F(i){function u(R,E,y,C,j){if(typeof i!="function")return new S("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var k=R[E],T=$(k);if(T!=="object")return new S("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var I in k)if(a(k,I)){var B=i(k,I,y,C,j+"."+I,n);if(B instanceof Error)return B}return null}return D(u)}function qe(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var u=0;u<i.length;u++){var R=i[u];if(typeof R!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Ne(R)+" at index "+u+"."),l}function E(y,C,j,k,T){for(var I=[],B=0;B<i.length;B++){var L=i[B],O=L(y,C,j,k,T,n);if(O==null)return null;O.data&&a(O.data,"expectedType")&&I.push(O.data.expectedType)}var Y=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new S("Invalid "+k+" `"+T+"` supplied to "+("`"+j+"`"+Y+"."))}return D(E)}function Pe(){function i(u,R,E,y,C){return Z(u[R])?null:new S("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return D(i)}function pe(i,u,R,E,y){return new S((i||"React class")+": "+u+" type `"+R+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Me(i){function u(R,E,y,C,j){var k=R[E],T=$(k);if(T!=="object")return new S("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var I in i){var B=i[I];if(typeof B!="function")return pe(y,C,j,I,V(B));var L=B(k,I,y,C,j+"."+I,n);if(L)return L}return null}return D(u)}function Le(i){function u(R,E,y,C,j){var k=R[E],T=$(k);if(T!=="object")return new S("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var I=e({},R[E],i);for(var B in I){var L=i[B];if(a(i,B)&&typeof L!="function")return pe(y,C,j,B,V(L));if(!L)return new S("Invalid "+C+" `"+j+"` key `"+B+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(R[E],null," ")+`
|
|
54
|
-
Valid keys: `+JSON.stringify(Object.keys(i),null," "));var O=L(k,B,y,C,j+"."+B,n);if(O)return O}return null}return D(u)}function Z(i){switch(typeof i){case"number":case"string":case"undefined":return!0;case"boolean":return!i;case"object":if(Array.isArray(i))return i.every(Z);if(i===null||c(i))return!0;var u=x(i);if(u){var R=u.call(i),E;if(u!==i.entries){for(;!(E=R.next()).done;)if(!Z(E.value))return!1}else for(;!(E=R.next()).done;){var y=E.value;if(y&&!Z(y[1]))return!1}}else return!1;return!0;default:return!1}}function _e(i,u){return i==="symbol"?!0:u?u["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&u instanceof Symbol:!1}function $(i){var u=typeof i;return Array.isArray(i)?"array":i instanceof RegExp?"object":_e(u,i)?"symbol":u}function V(i){if(typeof i>"u"||i===null)return""+i;var u=$(i);if(u==="object"){if(i instanceof Date)return"date";if(i instanceof RegExp)return"regexp"}return u}function Ne(i){var u=V(i);switch(u){case"array":case"object":return"an "+u;case"boolean":case"date":case"regexp":return"a "+u;default:return u}}function Fe(i){return!i.constructor||!i.constructor.name?b:i.constructor.name}return w.checkPropTypes=d,w.resetWarningCache=d.resetWarningCache,w.PropTypes=w,w},ie}var ae,Ee;function ut(){if(Ee)return ae;Ee=1;var t=de();function e(){}function n(){}return n.resetWarningCache=e,ae=function(){function a(l,c,h,f,g,x){if(x!==t){var b=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 b.name="Invariant Violation",b}}a.isRequired=a;function d(){return a}var r={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:d,element:a,elementType:a,instanceOf:d,node:a,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:n,resetWarningCache:e};return r.PropTypes=r,r},ae}var $t=G.exports;if(process.env.NODE_ENV!=="production"){var pt=J.reactIsExports,ft=!0;G.exports=dt()(pt.isElement,ft)}else G.exports=ut()();var xt=G.exports;const q=X.getDefaultExportFromCjs(xt);let Se,Ce;typeof document<"u"&&(Se=document);typeof window<"u"&&(Ce=window);const Te=m.createContext({document:Se,window:Ce}),Q=()=>m.useContext(Te),{Provider:ht,Consumer:Ht}=Te;class Be extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}U(Be,"propTypes",{children:q.element.isRequired,contentDidMount:q.func.isRequired,contentDidUpdate:q.func.isRequired});class le extends m.Component{constructor(n,a){super(n,a);U(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});U(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});U(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.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,d=this.props.contentDidUpdate,r=n.defaultView||n.parentView,l=s.jsxRuntimeExports.jsx(Be,{contentDidMount:a,contentDidUpdate:d,children:s.jsxRuntimeExports.jsx(ht,{value:{document:n,window:r},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),c=this.getMountTarget();return[fe.createPortal(this.props.head,this.getDoc().head),fe.createPortal(l,c)]}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,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}U(le,"propTypes",{style:q.object,head:q.node,initialContent:q.string,mountTarget:q.string,contentDidMount:q.func,contentDidUpdate:q.func,children:q.oneOfType([q.element,q.arrayOf(q.element)])}),U(le,"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 gt=m.forwardRef((t,e)=>s.jsxRuntimeExports.jsx(le,{...t,forwardedRef:e}));let H=null,K=[],Ie=null;function De(t){const e=window.getComputedStyle(t),n=parseInt(e.paddingLeft,10),a=parseInt(e.paddingTop,10),d=parseInt(e.paddingRight,10),r=parseInt(e.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:d,paddingBottom:r}}const ke=(t,e,n)=>{if(!H)return;const a=t.getBoundingClientRect(),d=H==null?void 0:H.getElementById("placeholder"),{paddingLeft:r,paddingTop:l,paddingRight:c,paddingBottom:h}=De(t);d.style.width=e==="vertical"?a.width-r-c+"px":"2px",d.style.height=e==="vertical"?"5px":a.height-l-h+"px",d.style.display="block";const f=K.reduce((g,x)=>Math.abs(x-n)<Math.abs(g-n)?x:g);Ie=K.indexOf(f),d.style.top=t.offsetTop+(e==="vertical"?f:0)+"px",d.style.left=t.offsetLeft+(e==="horizontal"?f:0)+"px"},mt=t=>{const e=Ae(t),n=t.getBoundingClientRect(),a=Array.from(t.children);a.filter(l=>l.getAttribute("data-dnd")!=="ignore");const{paddingLeft:d,paddingTop:r}=De(t);K=[e==="vertical"?d:r],K=[...K,...a.map(l=>{const c=l.getBoundingClientRect();return e==="vertical"?c.top-n.top+c.height:c.left-n.left+c.width})]};function Ae(t){const e=window.getComputedStyle(t).display,n=e==="block"?"vertical":"horizontal";return e==="flex"&&t.style.flexDirection==="column"?"vertical":n}const yt=p.throttle(t=>{const e=t.target,n=Ae(e);if(n==="vertical"){const a=t.clientY-e.offsetTop;ke(e,n,a)}else{const a=t.clientX-e.offsetLeft;ke(e,n,a)}},200),vt=t=>{t.preventDefault(),t.stopPropagation(),yt(t)};function Re(){const t=H==null?void 0:H.getElementById("placeholder");t.style.display="none"}const jt=()=>{const{document:t}=Q(),[e,n]=W.useAtom(o.draggingFlagAtom),a=ze.useAddBlockByDrop(),d=Ye.useFeature("dnd");return H=t,{isDragging:e,"data-dnd":"branch",onDragOver:d?vt:p.noop,onDrop:d?r=>{const l=JSON.parse(r.dataTransfer.getData("text/plain"));let c=r.target.getAttribute("data-block-id");c===null&&(c=r.target.parentElement.getAttribute("data-block-id")),a({block:l,dropTargetId:c||null,relativeIndex:Ie}),n(!1),setTimeout(()=>Re(),300)}:p.noop,onDragEnter:d?r=>{const l=r;l.stopPropagation(),l.preventDefault(),K=[];const c=l.target;mt(c),c.classList.add("outline","outline-blue-500","outline-4","-outline-offset-4"),n(!0)}:p.noop,onDragLeave:d?r=>{const l=r;l.stopPropagation(),l.preventDefault(),l.target.classList.remove("outline","outline-blue-500","outline-4","-outline-offset-4")}:p.noop,onMouseOut:d?()=>{n(!1),Re()}:p.noop}};function ue(t){return t.getAttribute("data-block-id")?t:t.closest("[data-block-id]")}function bt(t){t.container.innerHTML="",t.container.parentNode.removeChild(t.container);var e=document.querySelector(".ql-toolbar");e&&e.parentNode.removeChild(e),t=null}const Et=()=>{const t=["Heading","Paragraph","Text","Link","Span","Button"],e=o.useUpdateBlocksProps(),[,n]=o.useSelectedBlockIds(),[,a]=o.useHighlightBlockId(),[d,r]=W.useAtom(o.inlineEditingActiveAtom);return l=>{var b;if(d)return;const c=ue(l.target),h=c.getAttribute("data-block-type");if(!h||!t.includes(h))return;const f=c.cloneNode(!0);c.style.display="none",Array.from(f.attributes).forEach(w=>{w.name!=="class"&&f.removeAttribute(w.name)}),h==="Text"&&(f.style.display="inline-block"),c.parentNode.insertBefore(f,c.nextSibling);const g=new Ue.Quill(f,{placeholder:"Type here..."});function x(){const w=g.getText(0,g.getLength());e([c.getAttribute("data-block-id")],{content:w}),c.removeAttribute("style"),f.removeEventListener("blur",x,!0),bt(g),r(""),a("")}f.addEventListener("blur",x,!0),g.focus(),(b=f.querySelector(".ql-clipboard"))==null||b.remove(),n([]),r(c.getAttribute("data-block-id"))}},kt=()=>{const[,t]=o.useSelectedStylingBlocks(),[,e]=o.useSelectedBlockIds(),[n]=W.useAtom(o.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const d=ue(a.target);if(d.getAttribute("data-block-parent")){const r=d.getAttribute("data-style-prop"),l=d.getAttribute("data-style-id"),c=d.getAttribute("data-block-parent");t([{id:l,prop:r,blockId:c}]),e([c])}else d.getAttribute("data-block-id")&&e([d.getAttribute("data-block-id")])}},Rt=p.throttle((t,e)=>{const n=ue(t.target);n.getAttribute("data-style-id")&&e(n.getAttribute("data-style-id"))},100),wt=()=>{const[,t]=o.useHighlightBlockId(),[e]=W.useAtom(o.inlineEditingActiveAtom);return n=>{e||Rt(n,t)}},St=({children:t})=>{const{document:e}=Q(),[n]=o.useSelectedBlockIds(),[a,d]=o.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!p.isEmpty(a))return;const f=Oe(e,p.first(n));if(f){const g=f.getAttribute("data-style-prop");if(g){const x=f.getAttribute("data-style-id"),b=f.getAttribute("data-block-parent");d([{id:x,prop:g,blockId:b}])}}},100)},[e,n,d,a]);const r=Et(),l=kt(),c=wt(),h=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:l,onDoubleClick:r,onMouseMove:c,...p.omit(h,"isDragging"),className:"relative h-screen max-w-full "+(h.isDragging?"dragging":""),children:t})},Oe=(t,e)=>t.querySelector(`[data-block-id="${e}"]`),Ct=()=>{const{window:t}=Q(),[e,n]=o.useSelectedBlockIds(),[,a]=o.useSelectedStylingBlocks(),{undo:d,redo:r}=o.useCanvasHistory(),l=o.useDuplicateBlocks(),[,c]=o.useCutBlockIds(),[,h]=o.useCopyBlockIds(),{pasteBlocks:f}=o.usePasteBlocks(),[,g]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:b}=o.useSavePage(),[w]=W.useAtom(o.inlineEditingActiveAtom),[,M]=W.useAtom(o.editLayerNameAtom),S=D=>{D.key==="Enter"&&(D.preventDefault(),e.length===1&&M(p.first(e)))};return m.useEffect(()=>{const D=v=>{if(v.key==="Escape"){n([]),a([]);return}if(S(v),!w&&(v.key==="Delete"||v.key==="Backspace")&&(v.preventDefault(),x(e)),v.ctrlKey||v.metaKey){if(["z","y","d","x","c","p","s","v"].includes(v.key)){if(w&&["x","z","v"].includes(v.key))return!0;v.preventDefault()}v.key==="s"&&(v.stopPropagation(),v.preventDefault(),b()),v.key==="z"&&d(),v.key==="y"&&r(),v.key==="d"&&l(e),v.key==="x"&&c(e),v.key==="c"&&h(e),v.key==="v"&&e.length>0&&f(e[0])}};return t.removeEventListener("keydown",D),t.addEventListener("keydown",D),()=>{t.removeEventListener("keydown",D)}},[e,n,d,x,g,r,l,c,h,f,w,b,t]),null},Tt=({block:t,label:e})=>{const[,n]=Ve.useDrag(()=>({type:"CANVAS_BLOCK",item:t}));return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:n,onDragStart:()=>{console.log("drag start")},children:[s.jsxRuntimeExports.jsx(P.DragHandleDots2Icon,{}),e]})},Bt=({selectedBlockElement:t,block:e})=>{const n=o.useRemoveBlocks(),a=o.useDuplicateBlocks(),[,d]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),{floatingStyles:l,refs:c,update:h}=xe.useFloating({placement:"top-start",middleware:[xe.shift(),Ke.flip()],elements:{reference:t}});Xe.useResizeObserver(t,()=>h(),t!==null);const f=p.get(e,"_parent",null),g=p.isEmpty(p.get(e,"_name",""))?p.get(e,"_type",""):p.get(e,"_name","");return!t||!e?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:c.setFloating,style:l,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:[s.jsxRuntimeExports.jsx(Tt,{label:g,block:e}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[f&&s.jsxRuntimeExports.jsx(P.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{r([]),d([f])}}),o.canDuplicateBlock(p.get(e,"_type",""))?s.jsxRuntimeExports.jsx(P.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([e==null?void 0:e._id])}):null,o.canDeleteBlock(p.get(e,"_type",""))?s.jsxRuntimeExports.jsx(P.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([e==null?void 0:e._id])}):null]})]})},It=({model:t})=>{const[e]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[a]=o.useDarkMode(),[d]=o.useHighlightBlockId(),[r]=o.useSelectedStylingBlocks(),{document:l,window:c}=Q(),[h]=m.useState(l==null?void 0:l.getElementById("highlighted-block")),[f]=m.useState(l==null?void 0:l.getElementById("selected-block")),[g]=m.useState(l==null?void 0:l.getElementById("selected-styling-block"));m.useEffect(()=>{a?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[a,l]);const x=p.get(e,"headingFont","DM Sans"),b=p.get(e,"bodyFont","DM Sans");return m.useEffect(()=>{const w=p.get(e,"primaryColor","#000"),M=p.get(e,"secondaryColor","#FFF"),S=Je.tailwindcssPaletteGenerator({colors:[w,M],names:["primary","secondary"]});S.primary.DEFAULT=w,S.secondary.DEFAULT=M;const D=p.get(e,"roundedCorners","0");!c||!c.tailwind||(c.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[x],body:[b]},extend:{borderRadius:{global:`${D||"0"}px`},colors:S}},plugins:[c.tailwind.plugin.withOptions(({prefix:v="ui"}={})=>({addVariant:z})=>{for(const _ of["open","checked","selected","active","disabled"])z(`${v}-${_}`,[`&[data-headlessui-state~="${_}"]`,`:where([data-headlessui-state~="${_}"]) &`]),z(`${v}-not-${_}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${_}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${_}"])) &:not([data-headlessui-state])`])})]})},[e,c,x,b]),m.useEffect(()=>{f&&(f.textContent=`${p.map(n,w=>`[data-block-id="${w}"]`).join(",")}{
|
|
55
|
-
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
56
|
-
}`)},[n,f]),m.useEffect(()=>{h&&(h.textContent=d?`[data-style-id="${d}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[d,n,h]),m.useEffect(()=>{g&&(g.textContent=`${p.map(r,({id:w})=>`[data-style-id="${w}"]`).join(",")}{
|
|
57
|
-
outline: 1px solid orange !important; outline-offset: -1px;
|
|
58
|
-
}`)},[r,g]),m.useEffect(()=>{if(t==="section")return;const w=p.get(e,"bodyTextLightColor","#64748b"),M=p.get(e,"bodyTextDarkColor","#94a3b8"),S=p.get(e,"bodyBgLightColor","#FFFFFF"),D=p.get(e,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${w}] bg-[${S}] dark:text-[${M}] dark:bg-[${D}]`},[e,l,t]),t==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[x&&s.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"}),b&&x!==b&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${b.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),x&&s.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},Dt=t=>{const e={};return Object.keys(t).forEach(n=>{p.isString(t[n])&&t[n].startsWith(X.SLOT_KEY)&&(e[n]=t[n].replace(X.SLOT_KEY,"").split(","))}),e},At=p.memoize(t=>{const e=t.replace(X.STYLES_KEY,"").split(",");return Ge.twMerge(e[0],e[1])});function Ot(t,e){return p.get(t,`${e}_attrs`,{})}function qt(t){const e={};return Object.keys(t).forEach(n=>{if(p.isString(t[n])&&t[n].startsWith(X.STYLES_KEY)){const a=At(t[n]);e[n]={className:a,"data-style-prop":n,"data-block-parent":t._id,"data-style-id":`${n}-${t._id}`,...Ot(t,n)}}}),e}function Pt(t,e){const n=p.get(t,"_bindings",{});return p.isEmpty(n)?{...t}:(p.each(n,(a,d)=>{p.isString(a)&&p.get(e,a,null)&&(t[d]=p.get(e,a,null))}),t)}function ce({blocks:t}){const e=o.useAllBlocks(),n=m.useCallback(r=>qt(r),[]),[a]=J.useChaiExternalData(),[d]=o.useAtom(o.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(t.map((r,l)=>{if(d===r._id)return null;const c=Dt(r),h={};p.isEmpty(c)||Object.keys(c).forEach(b=>{h[b]=m.Children.toArray(c[b].map(w=>s.jsxRuntimeExports.jsx(ce,{blocks:[p.find(e,{_id:w})]})))});const f=p.filter(e,{_parent:r._id});h.children=f.length?s.jsxRuntimeExports.jsx(ce,{blocks:f}):null;const g=Qe.getBlockComponent(r._type),x=p.get(g,"component",null);return p.isNull(x)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${r==null?void 0:r._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(x,{blockProps:{"data-block-id":r._id,"data-block-type":r._type,"data-dnd":o.canAddChildBlock(r._type)?"branch":"leaf"},inBuilder:!0,index:l,...Pt(r,a),...n(r),...h})})}))})}const Mt=()=>{const t=o.useAllBlocks();return s.jsxRuntimeExports.jsx(Ze.Provider,{children:p.isEmpty(t)?null:s.jsxRuntimeExports.jsx(J.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ce,{blocks:p.filter(t,e=>p.isEmpty(e._parent))})})})},Lt=(t,e)=>t.querySelector(`[data-style-id="${e}"]`),_t=()=>{const[t]=W.useAtom(o.networkModeAtom),[e]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,a]=o.useSelectedBlockIds(),d=o.useSelectedBlock(),[,r]=o.useHighlightBlockId(),l=m.useRef(null),c=m.useRef(null),[h,f]=m.useState({width:0,height:0}),g=at(h),[x,b]=m.useState(0),[w,M]=m.useState([]),[,S]=m.useState([]),[,D]=W.useAtom(o.canvasIframeAtom),[v,z]=o.useSelectedStylingBlocks(),_=o.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:A,clientHeight:N}=c.current;f({width:A,height:N}),x===0&&b(A)},[c,n,x]);const ee=(A,N=0)=>{const{top:F}=A.getBoundingClientRect();return F+N>=0&&F-N<=window.innerHeight};m.useEffect(()=>{var A,N;if(d&&d.type!=="Multiple"&&l.current){const F=Oe(l.current.contentDocument,d._id);F&&(ee(F)||(N=(A=l.current)==null?void 0:A.contentWindow)==null||N.scrollTo({top:F.offsetTop,behavior:"smooth"}),M([F]))}},[d]),m.useEffect(()=>{if(!p.isEmpty(v)&&l.current){const A=Lt(l.current.contentDocument,p.first(v).id);S(A?[A]:[null])}else S([null])},[v]);const te=m.useMemo(()=>{let A=it;return t==="offline"&&(A=A.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),A=A.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),A=A.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),A},[t]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),z([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full",style:x>0&&!p.isEmpty(g)?{width:e?"100%":x}:{},ref:c,children:s.jsxRuntimeExports.jsxs(gt,{contentDidMount:()=>D(l.current),ref:l,id:"canvas-iframe",style:{width:`${n}px`,...g},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:te,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(Bt,{block:d,selectedBlockElement:p.first(w)}),s.jsxRuntimeExports.jsx(It,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:_?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-P3qHuE5J.cjs"))),Ft=()=>{const[t,e]=W.useAtom(o.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(ot,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(J.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(_t,{})})}),t?s.jsxRuntimeExports.jsx("div",{onClick:()=>e(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.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:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
|