react-tailwind-email-editor 0.0.6 → 0.0.7

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/index.mjs CHANGED
@@ -1,23 +1,26 @@
1
- import * as React9 from 'react';
2
- import React9__default, { createContext, useContext, useMemo, useEffect, useCallback, useState } from 'react';
1
+ import * as React10 from 'react';
2
+ import React10__default, { createContext, useContext, useMemo, useEffect, useCallback, useState } from 'react';
3
3
  import { useEditor, useNode, Element, Editor, Frame } from '@craftjs/core';
4
4
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
5
- import { ChevronDown, X, ChevronRight, Check, Circle, Table, Variable, Quote, Tag, Timer, Share2, List, PlayCircle, MousePointer2, Image, Type, Minus, ArrowUpDown, Columns, LayoutTemplate, PanelBottom, PanelTop, Layers, ChevronUp, Copy, Trash2, Settings2, Paintbrush, Move, ArrowUp, Palette, Settings, Undo2, Redo2, Eye, Code, Download } from 'lucide-react';
5
+ import { ChevronDown, X, ChevronRight, Check, Circle, Table, Variable, Quote, Tag, Timer, Share2, List, PlayCircle, MousePointer2, Image, Type, Minus, ArrowUpDown, Columns, LayoutTemplate, PanelBottom, PanelTop, Layers, ChevronUp, Copy, Trash2, Settings2, Paintbrush, Move, ArrowUp, Sun, Moon, Undo2, Redo2, Eye, Code, Download, Settings } from 'lucide-react';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
10
  import { cva } from 'class-variance-authority';
11
11
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
12
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
12
13
  import * as DialogPrimitive from '@radix-ui/react-dialog';
13
14
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
15
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
16
+ import * as LabelPrimitive from '@radix-ui/react-label';
14
17
 
15
18
  // src/components/editor/EmailEditor.tsx
16
19
  function cn(...inputs) {
17
20
  return twMerge(clsx(inputs));
18
21
  }
19
22
  var Accordion = AccordionPrimitive.Root;
20
- var AccordionItem = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
23
+ var AccordionItem = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
21
24
  AccordionPrimitive.Item,
22
25
  {
23
26
  ref,
@@ -26,7 +29,7 @@ var AccordionItem = React9.forwardRef(({ className, ...props }, ref) => /* @__PU
26
29
  }
27
30
  ));
28
31
  AccordionItem.displayName = "AccordionItem";
29
- var AccordionTrigger = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
32
+ var AccordionTrigger = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
30
33
  AccordionPrimitive.Trigger,
31
34
  {
32
35
  ref,
@@ -42,7 +45,7 @@ var AccordionTrigger = React9.forwardRef(({ className, children, ...props }, ref
42
45
  }
43
46
  ) }));
44
47
  AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
45
- var AccordionContent = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
48
+ var AccordionContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
46
49
  AccordionPrimitive.Content,
47
50
  {
48
51
  ref,
@@ -64,13 +67,16 @@ var EditorContext = createContext({
64
67
  templates: [],
65
68
  callbacks: {},
66
69
  htmlRenderers: {},
67
- title: "Email Editor",
70
+ title: "",
68
71
  showToolbar: true,
69
72
  showToolbox: true,
70
73
  showSettingsPanel: true
71
74
  });
72
75
  var useEditorConfig = () => useContext(EditorContext);
73
- var EditorProvider = ({ children, value }) => {
76
+ var EditorProvider = ({
77
+ children,
78
+ value
79
+ }) => {
74
80
  const mergedTheme = useMemo(
75
81
  () => ({ ...defaultTheme, ...value.theme }),
76
82
  [value.theme]
@@ -104,7 +110,7 @@ var ToolboxItem = ({ name, config }) => {
104
110
  };
105
111
  var Toolbox = () => {
106
112
  const { components } = useEditorConfig();
107
- const grouped = React9__default.useMemo(() => {
113
+ const grouped = React10__default.useMemo(() => {
108
114
  const map = {};
109
115
  for (const [name, config] of Object.entries(components)) {
110
116
  const cat = config.category || "Other";
@@ -114,7 +120,7 @@ var Toolbox = () => {
114
120
  return map;
115
121
  }, [components]);
116
122
  const categoryKeys = Object.keys(grouped);
117
- return /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsx(Accordion, { type: "multiple", defaultValue: categoryKeys, children: categoryKeys.map((category, idx) => /* @__PURE__ */ jsxs(
123
+ return /* @__PURE__ */ jsx("div", { className: "p-5", children: /* @__PURE__ */ jsx(Accordion, { type: "multiple", defaultValue: categoryKeys, children: categoryKeys.map((category, idx) => /* @__PURE__ */ jsxs(
118
124
  AccordionItem,
119
125
  {
120
126
  value: category,
@@ -161,7 +167,7 @@ var buttonVariants = cva(
161
167
  }
162
168
  }
163
169
  );
164
- var Button = React9.forwardRef(
170
+ var Button = React10.forwardRef(
165
171
  ({ className, variant, size, asChild = false, ...props }, ref) => {
166
172
  const Comp = asChild ? Slot : "button";
167
173
  return /* @__PURE__ */ jsx(
@@ -175,7 +181,7 @@ var Button = React9.forwardRef(
175
181
  }
176
182
  );
177
183
  Button.displayName = "Button";
178
- var ScrollArea = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
184
+ var ScrollArea = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
179
185
  ScrollAreaPrimitive.Root,
180
186
  {
181
187
  ref,
@@ -189,7 +195,7 @@ var ScrollArea = React9.forwardRef(({ className, children, ...props }, ref) => /
189
195
  }
190
196
  ));
191
197
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
192
- var ScrollBar = React9.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
198
+ var ScrollBar = React10.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
193
199
  ScrollAreaPrimitive.ScrollAreaScrollbar,
194
200
  {
195
201
  ref,
@@ -267,7 +273,7 @@ var SettingsPanel = () => {
267
273
  }
268
274
  };
269
275
  if (slots.settingsPanel && selected) {
270
- return React9__default.createElement(slots.settingsPanel, {
276
+ return React10__default.createElement(slots.settingsPanel, {
271
277
  selectedId: selected.id,
272
278
  selectedName: selected.displayName || selected.name,
273
279
  //@ts-ignore
@@ -280,7 +286,7 @@ var SettingsPanel = () => {
280
286
  }
281
287
  if (!selected) {
282
288
  if (slots.settingsEmptyState) {
283
- return React9__default.createElement(slots.settingsEmptyState);
289
+ return React10__default.createElement(slots.settingsEmptyState);
284
290
  }
285
291
  return /* @__PURE__ */ jsxs("div", { className: "p-6 text-center", children: [
286
292
  /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx(Layers, { className: "h-8 w-8 text-muted-foreground" }) }),
@@ -355,7 +361,7 @@ var SettingsPanel = () => {
355
361
  /* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4 text-muted-foreground" }),
356
362
  /* @__PURE__ */ jsx("span", { children: "Properties" })
357
363
  ] }) }),
358
- /* @__PURE__ */ jsx(AccordionContent, { className: "pb-4", children: React9__default.createElement(selected.settings) })
364
+ /* @__PURE__ */ jsx(AccordionContent, { className: "pb-4", children: React10__default.createElement(selected.settings) })
359
365
  ] }) }) : /* @__PURE__ */ jsxs("div", { className: "text-center text-muted-foreground text-sm py-8", children: [
360
366
  /* @__PURE__ */ jsx(Paintbrush, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
361
367
  /* @__PURE__ */ jsx("p", { children: "No editable properties" })
@@ -4087,9 +4093,46 @@ ${childrenHtml}
4087
4093
  };
4088
4094
  return renderNode("ROOT");
4089
4095
  };
4096
+ var Tabs = TabsPrimitive.Root;
4097
+ var TabsList = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4098
+ TabsPrimitive.List,
4099
+ {
4100
+ ref,
4101
+ className: cn(
4102
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
4103
+ className
4104
+ ),
4105
+ ...props
4106
+ }
4107
+ ));
4108
+ TabsList.displayName = TabsPrimitive.List.displayName;
4109
+ var TabsTrigger = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4110
+ TabsPrimitive.Trigger,
4111
+ {
4112
+ ref,
4113
+ className: cn(
4114
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
4115
+ className
4116
+ ),
4117
+ ...props
4118
+ }
4119
+ ));
4120
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
4121
+ var TabsContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4122
+ TabsPrimitive.Content,
4123
+ {
4124
+ ref,
4125
+ className: cn(
4126
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4127
+ className
4128
+ ),
4129
+ ...props
4130
+ }
4131
+ ));
4132
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
4090
4133
  var Dialog = DialogPrimitive.Root;
4091
4134
  var DialogPortal = DialogPrimitive.Portal;
4092
- var DialogOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4135
+ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4093
4136
  DialogPrimitive.Overlay,
4094
4137
  {
4095
4138
  ref,
@@ -4101,7 +4144,7 @@ var DialogOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PU
4101
4144
  }
4102
4145
  ));
4103
4146
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
4104
- var DialogContent = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
4147
+ var DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
4105
4148
  /* @__PURE__ */ jsx(DialogOverlay, {}),
4106
4149
  /* @__PURE__ */ jsxs(
4107
4150
  DialogPrimitive.Content,
@@ -4137,7 +4180,7 @@ var DialogHeader = ({
4137
4180
  }
4138
4181
  );
4139
4182
  DialogHeader.displayName = "DialogHeader";
4140
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4183
+ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4141
4184
  DialogPrimitive.Title,
4142
4185
  {
4143
4186
  ref,
@@ -4149,7 +4192,7 @@ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
4149
4192
  }
4150
4193
  ));
4151
4194
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
4152
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4195
+ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4153
4196
  DialogPrimitive.Description,
4154
4197
  {
4155
4198
  ref,
@@ -4160,7 +4203,7 @@ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @
4160
4203
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
4161
4204
  var DropdownMenu = DropdownMenuPrimitive.Root;
4162
4205
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
4163
- var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
4206
+ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
4164
4207
  DropdownMenuPrimitive.SubTrigger,
4165
4208
  {
4166
4209
  ref,
@@ -4177,7 +4220,7 @@ var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ..
4177
4220
  }
4178
4221
  ));
4179
4222
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
4180
- var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4223
+ var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4181
4224
  DropdownMenuPrimitive.SubContent,
4182
4225
  {
4183
4226
  ref,
@@ -4189,7 +4232,7 @@ var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) =>
4189
4232
  }
4190
4233
  ));
4191
4234
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
4192
- var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
4235
+ var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
4193
4236
  DropdownMenuPrimitive.Content,
4194
4237
  {
4195
4238
  ref,
@@ -4202,7 +4245,7 @@ var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...pro
4202
4245
  }
4203
4246
  ) }));
4204
4247
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
4205
- var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
4248
+ var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
4206
4249
  DropdownMenuPrimitive.Item,
4207
4250
  {
4208
4251
  ref,
@@ -4215,7 +4258,7 @@ var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) =
4215
4258
  }
4216
4259
  ));
4217
4260
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
4218
- var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
4261
+ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
4219
4262
  DropdownMenuPrimitive.CheckboxItem,
4220
4263
  {
4221
4264
  ref,
@@ -4232,7 +4275,7 @@ var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked
4232
4275
  }
4233
4276
  ));
4234
4277
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
4235
- var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
4278
+ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
4236
4279
  DropdownMenuPrimitive.RadioItem,
4237
4280
  {
4238
4281
  ref,
@@ -4248,7 +4291,7 @@ var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }
4248
4291
  }
4249
4292
  ));
4250
4293
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
4251
- var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
4294
+ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
4252
4295
  DropdownMenuPrimitive.Label,
4253
4296
  {
4254
4297
  ref,
@@ -4261,7 +4304,7 @@ var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref)
4261
4304
  }
4262
4305
  ));
4263
4306
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
4264
- var DropdownMenuSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4307
+ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4265
4308
  DropdownMenuPrimitive.Separator,
4266
4309
  {
4267
4310
  ref,
@@ -4270,10 +4313,135 @@ var DropdownMenuSeparator = React9.forwardRef(({ className, ...props }, ref) =>
4270
4313
  }
4271
4314
  ));
4272
4315
  DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
4273
- var TopBar = () => {
4274
- const { actions, query, canUndo, canRedo } = useEditor((state, query2) => ({
4275
- canUndo: state.options.enabled && query2.history.canUndo(),
4276
- canRedo: state.options.enabled && query2.history.canRedo()
4316
+ var Popover = PopoverPrimitive.Root;
4317
+ var PopoverTrigger = PopoverPrimitive.Trigger;
4318
+ var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
4319
+ PopoverPrimitive.Content,
4320
+ {
4321
+ ref,
4322
+ align,
4323
+ sideOffset,
4324
+ className: cn(
4325
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
4326
+ className
4327
+ ),
4328
+ ...props
4329
+ }
4330
+ ) }));
4331
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
4332
+ var labelVariants = cva(
4333
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
4334
+ );
4335
+ var Label2 = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4336
+ LabelPrimitive.Root,
4337
+ {
4338
+ ref,
4339
+ className: cn(labelVariants(), className),
4340
+ ...props
4341
+ }
4342
+ ));
4343
+ Label2.displayName = LabelPrimitive.Root.displayName;
4344
+ var COLOR_PRESETS = [
4345
+ { name: "Blue", hsl: "222.2 47.4% 11.2%" },
4346
+ { name: "Indigo", hsl: "243 75% 59%" },
4347
+ { name: "Emerald", hsl: "160 84% 39%" },
4348
+ { name: "Rose", hsl: "346 77% 50%" },
4349
+ { name: "Amber", hsl: "32 95% 44%" },
4350
+ { name: "Violet", hsl: "263 70% 50%" },
4351
+ { name: "Cyan", hsl: "192 91% 36%" },
4352
+ { name: "Slate", hsl: "215 20% 35%" }
4353
+ ];
4354
+ var ColorCustomizer = ({ value, onColorChange }) => {
4355
+ const [customColor, setCustomColor] = useState("#1e293b");
4356
+ const applyColor = (hsl) => {
4357
+ onColorChange(hsl);
4358
+ };
4359
+ const hexToHsl = (hex) => {
4360
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
4361
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
4362
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
4363
+ const max = Math.max(r, g, b);
4364
+ const min = Math.min(r, g, b);
4365
+ let h = 0;
4366
+ let s = 0;
4367
+ const l = (max + min) / 2;
4368
+ if (max !== min) {
4369
+ const d = max - min;
4370
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
4371
+ switch (max) {
4372
+ case r:
4373
+ h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
4374
+ break;
4375
+ case g:
4376
+ h = ((b - r) / d + 2) / 6;
4377
+ break;
4378
+ case b:
4379
+ h = ((r - g) / d + 4) / 6;
4380
+ break;
4381
+ }
4382
+ }
4383
+ return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`;
4384
+ };
4385
+ return /* @__PURE__ */ jsxs(Popover, { children: [
4386
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "gap-2 h-8 text-xs", children: [
4387
+ /* @__PURE__ */ jsx(Paintbrush, { className: "h-3.5 w-3.5" }),
4388
+ "Primary"
4389
+ ] }) }),
4390
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-64", align: "end", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4391
+ /* @__PURE__ */ jsx(Label2, { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Primary Color" }),
4392
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-2", children: COLOR_PRESETS.map((preset) => /* @__PURE__ */ jsxs(
4393
+ "button",
4394
+ {
4395
+ type: "button",
4396
+ onClick: () => applyColor(preset.hsl),
4397
+ className: "group flex flex-col items-center gap-1",
4398
+ title: preset.name,
4399
+ children: [
4400
+ /* @__PURE__ */ jsx(
4401
+ "div",
4402
+ {
4403
+ className: "w-8 h-8 rounded-full border-2 transition-all shadow-sm",
4404
+ style: {
4405
+ backgroundColor: `hsl(${preset.hsl})`,
4406
+ borderColor: value === preset.hsl ? "hsl(var(--foreground))" : "transparent"
4407
+ }
4408
+ }
4409
+ ),
4410
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: preset.name })
4411
+ ]
4412
+ },
4413
+ preset.name
4414
+ )) }),
4415
+ /* @__PURE__ */ jsxs("div", { className: "pt-2 border-t border-border", children: [
4416
+ /* @__PURE__ */ jsx(Label2, { className: "text-xs text-muted-foreground mb-1.5 block", children: "Custom Color" }),
4417
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
4418
+ /* @__PURE__ */ jsx(
4419
+ "input",
4420
+ {
4421
+ type: "color",
4422
+ value: customColor,
4423
+ onChange: (e) => {
4424
+ setCustomColor(e.target.value);
4425
+ applyColor(hexToHsl(e.target.value));
4426
+ },
4427
+ className: "w-10 h-8 rounded border border-border cursor-pointer bg-background"
4428
+ }
4429
+ ),
4430
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground font-mono", children: customColor })
4431
+ ] })
4432
+ ] })
4433
+ ] }) })
4434
+ ] });
4435
+ };
4436
+ var TopBar = ({
4437
+ isDarkMode,
4438
+ onToggleDarkMode,
4439
+ primaryColor,
4440
+ onPrimaryColorChange
4441
+ }) => {
4442
+ const { actions, query, canUndo, canRedo } = useEditor((state, queryCtx) => ({
4443
+ canUndo: state.options.enabled && queryCtx.history.canUndo(),
4444
+ canRedo: state.options.enabled && queryCtx.history.canRedo()
4277
4445
  }));
4278
4446
  const { title, logo, templates, callbacks, slots, htmlRenderers } = useEditorConfig();
4279
4447
  const [showCode, setShowCode] = useState(false);
@@ -4343,7 +4511,7 @@ var TopBar = () => {
4343
4511
  }
4344
4512
  };
4345
4513
  if (slots.toolbar) {
4346
- return React9__default.createElement(slots.toolbar, {
4514
+ return React10__default.createElement(slots.toolbar, {
4347
4515
  onExport: getHtml,
4348
4516
  onPreview: getHtml,
4349
4517
  onClear: handleClearCanvas,
@@ -4352,21 +4520,23 @@ var TopBar = () => {
4352
4520
  });
4353
4521
  }
4354
4522
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4355
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b bg-background", children: [
4356
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
4357
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4358
- logo || /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg bg-gradient-to-br from-primary to-primary/60 flex items-center justify-center", children: /* @__PURE__ */ jsx(Palette, { className: "h-4 w-4 text-primary-foreground" }) }),
4359
- /* @__PURE__ */ jsxs("div", { children: [
4360
- /* @__PURE__ */ jsx("h1", { className: "text-sm font-bold leading-tight", children: title }),
4361
- /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground", children: "Drag & Drop Builder" })
4362
- ] })
4363
- ] }),
4364
- /* @__PURE__ */ jsx("div", { className: "h-6 w-px bg-border" }),
4523
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 border-b border-border bg-background", children: [
4524
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
4525
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx("h1", { className: "text-sm font-semibold text-foreground", children: title }) }),
4526
+ /* @__PURE__ */ jsx("div", { className: "h-5 w-px bg-border" }),
4365
4527
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
4366
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "gap-2", children: [
4367
- /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-4 w-4" }),
4368
- "Templates"
4369
- ] }) }),
4528
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
4529
+ Button,
4530
+ {
4531
+ variant: "outline",
4532
+ size: "sm",
4533
+ className: "gap-1.5 h-8 text-xs",
4534
+ children: [
4535
+ /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-3.5 w-3.5" }),
4536
+ "Templates"
4537
+ ]
4538
+ }
4539
+ ) }),
4370
4540
  /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", className: "w-56", children: [
4371
4541
  /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Quick Start Templates" }),
4372
4542
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
@@ -4376,7 +4546,7 @@ var TopBar = () => {
4376
4546
  className: "gap-2",
4377
4547
  onClick: () => handleLoadTemplate(template),
4378
4548
  children: [
4379
- template.icon && React9__default.createElement(template.icon, {
4549
+ template.icon && React10__default.createElement(template.icon, {
4380
4550
  className: "h-4 w-4 text-muted-foreground"
4381
4551
  }),
4382
4552
  /* @__PURE__ */ jsxs("div", { children: [
@@ -4399,8 +4569,28 @@ var TopBar = () => {
4399
4569
  ] })
4400
4570
  ] })
4401
4571
  ] }),
4402
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4403
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-muted rounded-md p-0.5", children: [
4572
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
4573
+ /* @__PURE__ */ jsxs(
4574
+ Button,
4575
+ {
4576
+ variant: "outline",
4577
+ size: "sm",
4578
+ onClick: onToggleDarkMode,
4579
+ className: "gap-1.5 h-8 text-xs",
4580
+ children: [
4581
+ isDarkMode ? /* @__PURE__ */ jsx(Sun, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Moon, { className: "h-3.5 w-3.5" }),
4582
+ isDarkMode ? "Light" : "Dark"
4583
+ ]
4584
+ }
4585
+ ),
4586
+ /* @__PURE__ */ jsx(
4587
+ ColorCustomizer,
4588
+ {
4589
+ value: primaryColor,
4590
+ onColorChange: onPrimaryColorChange
4591
+ }
4592
+ ),
4593
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 bg-muted rounded-md p-0.5", children: [
4404
4594
  /* @__PURE__ */ jsx(
4405
4595
  Button,
4406
4596
  {
@@ -4408,9 +4598,9 @@ var TopBar = () => {
4408
4598
  size: "sm",
4409
4599
  disabled: !canUndo,
4410
4600
  onClick: () => actions.history.undo(),
4411
- className: "h-8 w-8 p-0",
4601
+ className: "h-7 w-7 p-0",
4412
4602
  title: "Undo",
4413
- children: /* @__PURE__ */ jsx(Undo2, { className: "h-4 w-4" })
4603
+ children: /* @__PURE__ */ jsx(Undo2, { className: "h-3.5 w-3.5" })
4414
4604
  }
4415
4605
  ),
4416
4606
  /* @__PURE__ */ jsx(
@@ -4420,22 +4610,21 @@ var TopBar = () => {
4420
4610
  size: "sm",
4421
4611
  disabled: !canRedo,
4422
4612
  onClick: () => actions.history.redo(),
4423
- className: "h-8 w-8 p-0",
4613
+ className: "h-7 w-7 p-0",
4424
4614
  title: "Redo",
4425
- children: /* @__PURE__ */ jsx(Redo2, { className: "h-4 w-4" })
4615
+ children: /* @__PURE__ */ jsx(Redo2, { className: "h-3.5 w-3.5" })
4426
4616
  }
4427
4617
  )
4428
4618
  ] }),
4429
- /* @__PURE__ */ jsx("div", { className: "w-px h-6 bg-border" }),
4430
4619
  /* @__PURE__ */ jsxs(
4431
4620
  Button,
4432
4621
  {
4433
4622
  variant: "outline",
4434
4623
  size: "sm",
4435
4624
  onClick: handlePreview,
4436
- className: "gap-2",
4625
+ className: "gap-1.5 h-8 text-xs",
4437
4626
  children: [
4438
- /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" }),
4627
+ /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5" }),
4439
4628
  " Preview"
4440
4629
  ]
4441
4630
  }
@@ -4443,13 +4632,12 @@ var TopBar = () => {
4443
4632
  /* @__PURE__ */ jsxs(
4444
4633
  Button,
4445
4634
  {
4446
- variant: "default",
4447
4635
  size: "sm",
4448
4636
  onClick: handleExport,
4449
- className: "gap-2",
4637
+ className: "gap-1.5 h-8 text-xs",
4450
4638
  children: [
4451
- /* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }),
4452
- " Export HTML"
4639
+ /* @__PURE__ */ jsx(Code, { className: "h-3.5 w-3.5" }),
4640
+ " Export"
4453
4641
  ]
4454
4642
  }
4455
4643
  )
@@ -4460,7 +4648,7 @@ var TopBar = () => {
4460
4648
  /* @__PURE__ */ jsx(DialogTitle, { children: "Export HTML" }),
4461
4649
  /* @__PURE__ */ jsx(DialogDescription, { children: "Copy this HTML code to use in your email client or system." })
4462
4650
  ] }),
4463
- slots.exportDialog ? React9__default.createElement(slots.exportDialog, {
4651
+ slots.exportDialog ? React10__default.createElement(slots.exportDialog, {
4464
4652
  html: htmlCode,
4465
4653
  onClose: () => setShowCode(false)
4466
4654
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -4479,53 +4667,98 @@ var TopBar = () => {
4479
4667
  ] }) }),
4480
4668
  /* @__PURE__ */ jsx(Dialog, { open: showPreview, onOpenChange: setShowPreview, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-5xl max-h-[90vh]", children: [
4481
4669
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
4482
- /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center justify-between", children: [
4483
- /* @__PURE__ */ jsx("span", { children: "Email Preview" }),
4484
- /* @__PURE__ */ jsx("div", { className: "flex gap-1 bg-muted rounded-lg p-1" })
4485
- ] }),
4670
+ /* @__PURE__ */ jsx(DialogTitle, { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx("span", { children: "Email Preview" }) }),
4486
4671
  /* @__PURE__ */ jsx(DialogDescription, { children: "Preview how your email will look in email clients." })
4487
4672
  ] }),
4488
- slots.previewDialog ? React9__default.createElement(slots.previewDialog, {
4673
+ slots.previewDialog ? React10__default.createElement(slots.previewDialog, {
4489
4674
  html: htmlCode,
4490
4675
  onClose: () => setShowPreview(false)
4491
4676
  }) : /* @__PURE__ */ jsx(ScrollArea, { className: "h-[600px]", children: /* @__PURE__ */ jsx(
4492
4677
  "div",
4493
4678
  {
4494
4679
  className: `mx-auto transition-all duration-300 ${previewDevice === "mobile" ? "max-w-[375px]" : "max-w-full"}`,
4495
- children: /* @__PURE__ */ jsx("div", { className: "border rounded-lg bg-muted/30 overflow-hidden", children: /* @__PURE__ */ jsx(
4496
- "iframe",
4497
- {
4498
- srcDoc: htmlCode,
4499
- className: "w-full min-h-[500px] bg-white",
4500
- title: "Email Preview",
4501
- style: {
4502
- height: previewDevice === "mobile" ? "667px" : "600px"
4680
+ children: /* @__PURE__ */ jsxs("div", { className: "border rounded-lg bg-muted/30 overflow-hidden", children: [
4681
+ previewDevice === "mobile" && /* @__PURE__ */ jsx("div", { className: "h-6 bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-16 h-1 bg-muted-foreground/30 rounded-full" }) }),
4682
+ /* @__PURE__ */ jsx(
4683
+ "iframe",
4684
+ {
4685
+ srcDoc: htmlCode,
4686
+ className: "w-full min-h-[500px] bg-white",
4687
+ title: "Email Preview",
4688
+ style: {
4689
+ height: previewDevice === "mobile" ? "667px" : "600px"
4690
+ }
4503
4691
  }
4504
- }
4505
- ) })
4692
+ )
4693
+ ] })
4506
4694
  }
4507
4695
  ) })
4508
4696
  ] }) })
4509
4697
  ] });
4510
4698
  };
4511
- var defaultEmailContent = /* @__PURE__ */ jsxs(Element, { is: Paper, canvas: true, children: [
4512
- /* @__PURE__ */ jsx(EmailHeader, {}),
4513
- /* @__PURE__ */ jsxs(Element, { is: Container, canvas: true, children: [
4514
- /* @__PURE__ */ jsx(
4515
- TextBlock,
4516
- {
4517
- text: "Thank you for your business! Please find your invoice details below.",
4518
- fontSize: 16,
4519
- align: "center"
4520
- }
4521
- ),
4522
- /* @__PURE__ */ jsx(Spacer, { height: 10 }),
4523
- /* @__PURE__ */ jsx(InvoiceTable, {}),
4524
- /* @__PURE__ */ jsx(Spacer, { height: 20 }),
4525
- /* @__PURE__ */ jsx(EmailButton, { text: "Pay Now", href: "#" })
4526
- ] }),
4527
- /* @__PURE__ */ jsx(EmailFooter, {})
4528
- ] });
4699
+ var LeftSidebar = ({ setActiveTab, activeTab }) => {
4700
+ const { components, slots } = useEditorConfig();
4701
+ const { selectedNodeId } = useEditor((state) => ({
4702
+ //@ts-ignore
4703
+ selectedNodeId: state.events.selected[0]
4704
+ }));
4705
+ useEffect(() => {
4706
+ if (selectedNodeId) {
4707
+ setActiveTab("properties");
4708
+ }
4709
+ }, [selectedNodeId]);
4710
+ const categories = useMemo(() => {
4711
+ return Object.keys(components).reduce((acc, k) => {
4712
+ const cat = components[k].category || "Other";
4713
+ if (!acc.includes(cat)) acc.push(cat);
4714
+ return acc;
4715
+ }, []);
4716
+ }, [components]);
4717
+ return /* @__PURE__ */ jsx("div", { className: "h-full flex flex-col bg-background border-r border-border", children: /* @__PURE__ */ jsxs(
4718
+ Tabs,
4719
+ {
4720
+ value: activeTab,
4721
+ onValueChange: (value) => setActiveTab(value),
4722
+ className: "flex-1 flex flex-col",
4723
+ children: [
4724
+ /* @__PURE__ */ jsx("div", { className: "px-2 pt-2 border-b border-border", children: /* @__PURE__ */ jsxs(TabsList, { className: "w-full h-9 bg-muted/50", children: [
4725
+ /* @__PURE__ */ jsxs(
4726
+ TabsTrigger,
4727
+ {
4728
+ value: "components",
4729
+ className: "flex-1 gap-1.5 text-xs data-[state=active]:bg-background",
4730
+ children: [
4731
+ /* @__PURE__ */ jsx(Layers, { className: "h-3.5 w-3.5" }),
4732
+ "Components"
4733
+ ]
4734
+ }
4735
+ ),
4736
+ /* @__PURE__ */ jsxs(
4737
+ TabsTrigger,
4738
+ {
4739
+ value: "properties",
4740
+ className: "flex-1 gap-1.5 text-xs data-[state=active]:bg-background",
4741
+ children: [
4742
+ /* @__PURE__ */ jsx(Settings, { className: "h-3.5 w-3.5" }),
4743
+ "Properties"
4744
+ ]
4745
+ }
4746
+ )
4747
+ ] }) }),
4748
+ /* @__PURE__ */ jsx(TabsContent, { value: "components", className: "flex-1 mt-0 ", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full max-h-[180vh] ", children: slots.toolbox ? React10__default.createElement(slots.toolbox, { components, categories }) : /* @__PURE__ */ jsx(Toolbox, {}) }) }),
4749
+ /* @__PURE__ */ jsx(TabsContent, { value: "properties", className: "flex-1 mt-0 ", children: /* @__PURE__ */ jsx("div", { className: "h-full", children: /* @__PURE__ */ jsx(SettingsPanel, {}) }) })
4750
+ ]
4751
+ }
4752
+ ) });
4753
+ };
4754
+ var defaultEmailContent = /* @__PURE__ */ jsx(Element, { is: Paper, canvas: true });
4755
+ var getReadablePrimaryForeground = (primaryHsl) => {
4756
+ var _a;
4757
+ const lightness = Number.parseFloat(
4758
+ ((_a = primaryHsl.trim().split(/\s+/)[2]) == null ? void 0 : _a.replace("%", "")) || "50"
4759
+ );
4760
+ return lightness > 60 ? "222.2 47.4% 11.2%" : "210 40% 98%";
4761
+ };
4529
4762
  var EmailEditor = ({
4530
4763
  components: userComponents,
4531
4764
  replaceBuiltins = false,
@@ -4540,20 +4773,69 @@ var EmailEditor = ({
4540
4773
  htmlRenderers = {},
4541
4774
  showToolbar = true,
4542
4775
  showToolbox = true,
4543
- showSettingsPanel = true,
4776
+ darkMode = true,
4544
4777
  className,
4545
4778
  style
4546
4779
  }) => {
4780
+ var _a, _b, _c, _d;
4547
4781
  const mergedComponents = useMemo(() => {
4548
4782
  if (replaceBuiltins) return userComponents || {};
4549
4783
  return { ...DEFAULT_COMPONENTS, ...userComponents || {} };
4550
4784
  }, [userComponents, replaceBuiltins]);
4785
+ const [activeTab, setActiveTab] = useState(
4786
+ "components"
4787
+ );
4551
4788
  const resolver = useMemo(() => {
4552
4789
  const res = buildResolver(mergedComponents);
4553
4790
  res.Paper = Paper;
4554
4791
  return res;
4555
4792
  }, [mergedComponents]);
4556
4793
  const renderNodeFn = slots.renderNode || RenderNode;
4794
+ const [isDarkMode, setIsDarkMode] = useState(!darkMode);
4795
+ const [primaryColor, setPrimaryColor] = useState(
4796
+ (_a = theme.colors) == null ? void 0 : _a.primary
4797
+ );
4798
+ useEffect(() => {
4799
+ var _a2;
4800
+ setPrimaryColor((_a2 = theme.colors) == null ? void 0 : _a2.primary);
4801
+ }, [(_b = theme.colors) == null ? void 0 : _b.primary]);
4802
+ const primaryForeground = useMemo(() => {
4803
+ var _a2;
4804
+ if ((_a2 = theme.colors) == null ? void 0 : _a2.primaryForeground) return theme.colors.primaryForeground;
4805
+ if (!primaryColor) return void 0;
4806
+ return getReadablePrimaryForeground(primaryColor);
4807
+ }, [primaryColor, (_c = theme.colors) == null ? void 0 : _c.primaryForeground]);
4808
+ const themeColorVars = useMemo(() => {
4809
+ const colors = theme.colors || {};
4810
+ return {
4811
+ background: colors.background,
4812
+ foreground: colors.foreground,
4813
+ border: colors.border,
4814
+ muted: colors.muted,
4815
+ "muted-foreground": colors.mutedForeground,
4816
+ destructive: colors.destructive,
4817
+ "panel-background": colors.panelBackground,
4818
+ "canvas-background": colors.canvasBackground
4819
+ };
4820
+ }, [theme.colors]);
4821
+ const editorStyle = useMemo(() => {
4822
+ const cssVars = { ...style || {} };
4823
+ Object.entries(themeColorVars).forEach(([token, value]) => {
4824
+ if (value) cssVars[`--${token}`] = value;
4825
+ });
4826
+ if (primaryColor) cssVars["--primary"] = primaryColor;
4827
+ if (primaryForeground) cssVars["--primary-foreground"] = primaryForeground;
4828
+ if (theme.borderRadius) cssVars["--radius"] = `${theme.borderRadius}px`;
4829
+ if (theme.fontFamily) cssVars.fontFamily = theme.fontFamily;
4830
+ return cssVars;
4831
+ }, [
4832
+ style,
4833
+ themeColorVars,
4834
+ primaryColor,
4835
+ primaryForeground,
4836
+ theme.borderRadius,
4837
+ theme.fontFamily
4838
+ ]);
4557
4839
  return /* @__PURE__ */ jsx(
4558
4840
  EditorProvider,
4559
4841
  {
@@ -4568,51 +4850,54 @@ var EmailEditor = ({
4568
4850
  logo,
4569
4851
  showToolbar,
4570
4852
  showToolbox,
4571
- showSettingsPanel
4853
+ showSettingsPanel: false
4572
4854
  },
4573
4855
  children: /* @__PURE__ */ jsx(
4574
4856
  "div",
4575
4857
  {
4576
- className: `h-screen flex flex-col bg-muted/30 ${className || ""}`,
4577
- style,
4858
+ className: `h-screen flex flex-col ${isDarkMode ? "dark" : ""} bg-background text-foreground ${className || ""}`,
4859
+ style: editorStyle,
4578
4860
  children: /* @__PURE__ */ jsxs(Editor, { resolver, onRender: renderNodeFn, children: [
4579
- showToolbar && /* @__PURE__ */ jsx(TopBar, {}),
4580
- /* @__PURE__ */ jsxs("div", { className: "flex-1 flex overflow-hidden", children: [
4581
- showToolbox && /* @__PURE__ */ jsxs("div", { className: "w-72 border-r bg-background flex flex-col", children: [
4582
- /* @__PURE__ */ jsxs("div", { className: "p-4 border-b", children: [
4583
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4584
- /* @__PURE__ */ jsx(Palette, { className: "h-4 w-4 text-primary" }),
4585
- /* @__PURE__ */ jsx("span", { className: "font-semibold text-sm", children: "Components" })
4586
- ] }),
4587
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "Drag components to canvas" })
4588
- ] }),
4589
- /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: slots.toolbox ? React9__default.createElement(slots.toolbox, {
4590
- components: mergedComponents,
4591
- categories: Object.keys(mergedComponents).reduce((acc, k) => {
4592
- const cat = mergedComponents[k].category || "Other";
4593
- if (!acc.includes(cat)) acc.push(cat);
4594
- return acc;
4595
- }, [])
4596
- }) : /* @__PURE__ */ jsx(Toolbox, {}) })
4597
- ] }),
4861
+ showToolbar && /* @__PURE__ */ jsx(
4862
+ TopBar,
4863
+ {
4864
+ isDarkMode,
4865
+ onToggleDarkMode: () => setIsDarkMode((prev) => !prev),
4866
+ primaryColor,
4867
+ onPrimaryColorChange: (primaryHsl) => {
4868
+ var _a2;
4869
+ setPrimaryColor(primaryHsl);
4870
+ (_a2 = callbacks.onColorChange) == null ? void 0 : _a2.call(callbacks, primaryHsl);
4871
+ }
4872
+ }
4873
+ ),
4874
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex", children: [
4875
+ showToolbox && /* @__PURE__ */ jsx("div", { className: "w-auto max-w-96 flex-shrink-0", children: /* @__PURE__ */ jsx(
4876
+ LeftSidebar,
4877
+ {
4878
+ setActiveTab,
4879
+ activeTab
4880
+ }
4881
+ ) }),
4598
4882
  /* @__PURE__ */ jsx(
4599
4883
  "div",
4600
4884
  {
4601
- className: "flex-1 overflow-auto p-8 craftjs-renderer",
4602
- style: { backgroundColor: "#e5e5e5" },
4603
- children: initialState ? /* @__PURE__ */ jsx(Frame, { data: initialState, children: defaultEmailContent }) : /* @__PURE__ */ jsx(Frame, { children: defaultContent || defaultEmailContent })
4885
+ className: "flex-1 overflow-auto craftjs-renderer",
4886
+ style: {
4887
+ backgroundColor: ((_d = theme.colors) == null ? void 0 : _d.canvasBackground) || "hsl(var(--muted))"
4888
+ },
4889
+ children: /* @__PURE__ */ jsx(
4890
+ "div",
4891
+ {
4892
+ className: "p-8",
4893
+ onClick: () => {
4894
+ setActiveTab("properties");
4895
+ },
4896
+ children: /* @__PURE__ */ jsx(Frame, { data: initialState, children: defaultEmailContent })
4897
+ }
4898
+ )
4604
4899
  }
4605
- ),
4606
- showSettingsPanel && /* @__PURE__ */ jsxs("div", { className: "w-80 border-l bg-background flex flex-col", children: [
4607
- /* @__PURE__ */ jsxs("div", { className: "p-4 border-b", children: [
4608
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4609
- /* @__PURE__ */ jsx(Settings, { className: "h-4 w-4 text-primary" }),
4610
- /* @__PURE__ */ jsx("span", { className: "font-semibold text-sm", children: "Properties" })
4611
- ] }),
4612
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "Edit selected component" })
4613
- ] }),
4614
- /* @__PURE__ */ jsx(SettingsPanel, {})
4615
- ] })
4900
+ )
4616
4901
  ] })
4617
4902
  ] })
4618
4903
  }