@savvycal/mjml-editor 0.0.1 → 0.0.3
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/README.md +191 -0
- package/dist/components/editor/BlockIcon.d.ts +7 -0
- package/dist/components/editor/BlockIcon.d.ts.map +1 -0
- package/dist/components/editor/BlockInspector.d.ts +6 -0
- package/dist/components/editor/BlockInspector.d.ts.map +1 -0
- package/dist/components/editor/BlockInspector.js +380 -0
- package/dist/components/editor/EditorCanvas.d.ts +11 -0
- package/dist/components/editor/EditorCanvas.d.ts.map +1 -0
- package/dist/components/editor/EditorCanvas.js +116 -0
- package/dist/components/editor/FontEditor.d.ts +2 -0
- package/dist/components/editor/FontEditor.d.ts.map +1 -0
- package/dist/components/editor/FontEditor.js +227 -0
- package/dist/components/editor/GlobalStylesPanel.d.ts +7 -0
- package/dist/components/editor/GlobalStylesPanel.d.ts.map +1 -0
- package/dist/components/editor/GlobalStylesPanel.js +310 -0
- package/dist/components/editor/InteractivePreview.d.ts +8 -0
- package/dist/components/editor/InteractivePreview.d.ts.map +1 -0
- package/dist/components/editor/InteractivePreview.js +130 -0
- package/dist/components/editor/LiquidAutocomplete.d.ts +10 -0
- package/dist/components/editor/LiquidAutocomplete.d.ts.map +1 -0
- package/dist/components/editor/LiquidAutocomplete.js +70 -0
- package/dist/components/editor/LiquidInput.d.ts +12 -0
- package/dist/components/editor/LiquidInput.d.ts.map +1 -0
- package/dist/components/editor/LiquidInput.js +185 -0
- package/dist/components/editor/MjmlEditor.d.ts +22 -0
- package/dist/components/editor/MjmlEditor.d.ts.map +1 -0
- package/dist/components/editor/MjmlEditor.js +137 -0
- package/dist/components/editor/OutlineTree.d.ts +7 -0
- package/dist/components/editor/OutlineTree.d.ts.map +1 -0
- package/dist/components/editor/OutlineTree.js +282 -0
- package/dist/components/editor/SourceEditor.d.ts +2 -0
- package/dist/components/editor/SourceEditor.d.ts.map +1 -0
- package/dist/components/editor/SourceEditor.js +70 -0
- package/dist/components/editor/SourcePreview.d.ts +7 -0
- package/dist/components/editor/SourcePreview.d.ts.map +1 -0
- package/dist/components/editor/SourcePreview.js +69 -0
- package/dist/components/editor/TiptapEditor.d.ts +12 -0
- package/dist/components/editor/TiptapEditor.d.ts.map +1 -0
- package/dist/components/editor/TiptapEditor.js +330 -0
- package/dist/components/editor/VisualEditor.d.ts +7 -0
- package/dist/components/editor/VisualEditor.d.ts.map +1 -0
- package/dist/components/editor/VisualEditor.js +51 -0
- package/dist/components/editor/visual-blocks/VisualBlock.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualBlock.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualBlock.js +34 -0
- package/dist/components/editor/visual-blocks/VisualButton.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualButton.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualButton.js +111 -0
- package/dist/components/editor/visual-blocks/VisualColumn.d.ts +8 -0
- package/dist/components/editor/visual-blocks/VisualColumn.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualColumn.js +44 -0
- package/dist/components/editor/visual-blocks/VisualDivider.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualDivider.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualDivider.js +41 -0
- package/dist/components/editor/visual-blocks/VisualImage.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualImage.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualImage.js +48 -0
- package/dist/components/editor/visual-blocks/VisualRaw.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualRaw.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualRaw.js +32 -0
- package/dist/components/editor/visual-blocks/VisualSection.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualSection.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualSection.js +131 -0
- package/dist/components/editor/visual-blocks/VisualSocial.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualSocial.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualSocial.js +62 -0
- package/dist/components/editor/visual-blocks/VisualSpacer.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualSpacer.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualSpacer.js +30 -0
- package/dist/components/editor/visual-blocks/VisualText.d.ts +7 -0
- package/dist/components/editor/visual-blocks/VisualText.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/VisualText.js +103 -0
- package/dist/components/editor/visual-blocks/helpers.d.ts +13 -0
- package/dist/components/editor/visual-blocks/helpers.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/helpers.js +44 -0
- package/dist/components/editor/visual-blocks/useResolvedAttributes.d.ts +7 -0
- package/dist/components/editor/visual-blocks/useResolvedAttributes.d.ts.map +1 -0
- package/dist/components/editor/visual-blocks/useResolvedAttributes.js +12 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +26 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +54 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +7 -0
- package/dist/components/ui/floating-panel.d.ts +12 -0
- package/dist/components/ui/floating-panel.d.ts.map +1 -0
- package/dist/components/ui/floating-panel.js +54 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +26 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +23 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +39 -0
- package/dist/components/ui/resizable-split-pane.d.ts +10 -0
- package/dist/components/ui/resizable-split-pane.d.ts.map +1 -0
- package/dist/components/ui/resizable-split-pane.js +65 -0
- package/dist/components/ui/scroll-area.d.ts +10 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +69 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +145 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +68 -0
- package/dist/components/ui/theme-toggle.d.ts +2 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +58 -0
- package/dist/components.css +365 -0
- package/dist/context/EditorContext.d.ts +40 -0
- package/dist/context/EditorContext.d.ts.map +1 -0
- package/dist/context/EditorContext.js +576 -0
- package/dist/context/LiquidSchemaContext.d.ts +10 -0
- package/dist/context/LiquidSchemaContext.d.ts.map +1 -0
- package/dist/context/LiquidSchemaContext.js +16 -0
- package/dist/context/ThemeContext.d.ts +29 -0
- package/dist/context/ThemeContext.d.ts.map +1 -0
- package/dist/context/ThemeContext.js +55 -0
- package/dist/extensions/LiquidHighlight.d.ts +3 -0
- package/dist/extensions/LiquidHighlight.d.ts.map +1 -0
- package/dist/extensions/LiquidHighlight.js +58 -0
- package/dist/extensions/LiquidSuggestion.d.ts +18 -0
- package/dist/extensions/LiquidSuggestion.d.ts.map +1 -0
- package/dist/extensions/LiquidSuggestion.js +119 -0
- package/dist/hooks/useFontLoader.d.ts +6 -0
- package/dist/hooks/useFontLoader.d.ts.map +1 -0
- package/dist/hooks/useFontLoader.js +21 -0
- package/dist/hooks/useStyleLoader.d.ts +11 -0
- package/dist/hooks/useStyleLoader.d.ts.map +1 -0
- package/dist/hooks/useStyleLoader.js +26 -0
- package/dist/index.d.ts +6 -150
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -57452
- package/dist/lib/html-utils.d.ts +23 -0
- package/dist/lib/html-utils.d.ts.map +1 -0
- package/dist/lib/html-utils.js +25 -0
- package/dist/lib/mjml/attributes.d.ts +100 -0
- package/dist/lib/mjml/attributes.d.ts.map +1 -0
- package/dist/lib/mjml/attributes.js +105 -0
- package/dist/lib/mjml/parser.d.ts +67 -0
- package/dist/lib/mjml/parser.d.ts.map +1 -0
- package/dist/lib/mjml/parser.js +184 -0
- package/dist/lib/mjml/parser.test.d.ts +2 -0
- package/dist/lib/mjml/parser.test.d.ts.map +1 -0
- package/dist/lib/mjml/renderer.d.ts +23 -0
- package/dist/lib/mjml/renderer.d.ts.map +1 -0
- package/dist/lib/mjml/renderer.js +75 -0
- package/dist/lib/mjml/schema.d.ts +21 -0
- package/dist/lib/mjml/schema.d.ts.map +1 -0
- package/dist/lib/mjml/schema.js +1307 -0
- package/dist/lib/mjml/scopeCSS.d.ts +21 -0
- package/dist/lib/mjml/scopeCSS.d.ts.map +1 -0
- package/dist/lib/mjml/scopeCSS.js +67 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +8 -0
- package/dist/preset.css +150 -0
- package/dist/types/liquid.d.ts +28 -0
- package/dist/types/liquid.d.ts.map +1 -0
- package/dist/types/mjml.d.ts +101 -0
- package/dist/types/mjml.d.ts.map +1 -0
- package/package.json +14 -10
- package/dist/styles.css +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import * as n from "@radix-ui/react-tabs";
|
|
4
|
+
import { cn as s } from "../../lib/utils.js";
|
|
5
|
+
function d({
|
|
6
|
+
className: t,
|
|
7
|
+
...e
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ r(
|
|
10
|
+
n.Root,
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "tabs",
|
|
13
|
+
className: s("flex flex-col gap-2", t),
|
|
14
|
+
...e
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function l({
|
|
19
|
+
className: t,
|
|
20
|
+
...e
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ r(
|
|
23
|
+
n.List,
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "tabs-list",
|
|
26
|
+
className: s(
|
|
27
|
+
"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
|
|
28
|
+
t
|
|
29
|
+
),
|
|
30
|
+
...e
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function c({
|
|
35
|
+
className: t,
|
|
36
|
+
...e
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */ r(
|
|
39
|
+
n.Trigger,
|
|
40
|
+
{
|
|
41
|
+
"data-slot": "tabs-trigger",
|
|
42
|
+
className: s(
|
|
43
|
+
"text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:border-border-strong dark:data-[state=active]:text-foreground dark:data-[state=active]:bg-input/30 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
44
|
+
t
|
|
45
|
+
),
|
|
46
|
+
...e
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function u({
|
|
51
|
+
className: t,
|
|
52
|
+
...e
|
|
53
|
+
}) {
|
|
54
|
+
return /* @__PURE__ */ r(
|
|
55
|
+
n.Content,
|
|
56
|
+
{
|
|
57
|
+
"data-slot": "tabs-content",
|
|
58
|
+
className: s("flex-1 outline-none", t),
|
|
59
|
+
...e
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
d as Tabs,
|
|
65
|
+
u as TabsContent,
|
|
66
|
+
l as TabsList,
|
|
67
|
+
c as TabsTrigger
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/theme-toggle.tsx"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,4CAwD1B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Moon as n, Sun as m, Monitor as c } from "lucide-react";
|
|
3
|
+
import { Button as d } from "./button.js";
|
|
4
|
+
import { useTheme as a } from "../../context/ThemeContext.js";
|
|
5
|
+
import { Popover as l, PopoverTrigger as g, PopoverContent as h } from "./popover.js";
|
|
6
|
+
function v() {
|
|
7
|
+
const { theme: o, resolvedTheme: s, setTheme: r } = a();
|
|
8
|
+
return /* @__PURE__ */ t(l, { children: [
|
|
9
|
+
/* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e(
|
|
10
|
+
d,
|
|
11
|
+
{
|
|
12
|
+
variant: "ghost",
|
|
13
|
+
size: "icon-sm",
|
|
14
|
+
className: "h-7 w-7 rounded-md text-foreground-muted hover:text-foreground hover:bg-accent",
|
|
15
|
+
title: "Toggle theme",
|
|
16
|
+
children: s === "dark" ? /* @__PURE__ */ e(n, { className: "h-4 w-4" }) : /* @__PURE__ */ e(m, { className: "h-4 w-4" })
|
|
17
|
+
}
|
|
18
|
+
) }),
|
|
19
|
+
/* @__PURE__ */ t(h, { align: "end", className: "w-36 p-1", children: [
|
|
20
|
+
/* @__PURE__ */ t(
|
|
21
|
+
"button",
|
|
22
|
+
{
|
|
23
|
+
onClick: () => r("light"),
|
|
24
|
+
className: `flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm ${o === "light" ? "bg-accent text-foreground" : "text-foreground-muted hover:bg-accent hover:text-foreground"}`,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ e(m, { className: "h-4 w-4" }),
|
|
27
|
+
"Light"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
onClick: () => r("dark"),
|
|
35
|
+
className: `flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm ${o === "dark" ? "bg-accent text-foreground" : "text-foreground-muted hover:bg-accent hover:text-foreground"}`,
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ e(n, { className: "h-4 w-4" }),
|
|
38
|
+
"Dark"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ t(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
onClick: () => r("system"),
|
|
46
|
+
className: `flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm ${o === "system" ? "bg-accent text-foreground" : "text-foreground-muted hover:bg-accent hover:text-foreground"}`,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ e(c, { className: "h-4 w-4" }),
|
|
49
|
+
"System"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
v as ThemeToggle
|
|
58
|
+
};
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component styles for @savvycal/mjml-editor
|
|
3
|
+
*
|
|
4
|
+
* Import this file in your app's CSS AFTER the preset and tailwindcss:
|
|
5
|
+
*
|
|
6
|
+
* @import "@savvycal/mjml-editor/preset.css";
|
|
7
|
+
* @import "tailwindcss";
|
|
8
|
+
* @import "tw-animate-css";
|
|
9
|
+
* @import "@savvycal/mjml-editor/components.css";
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/* Base CSS variable defaults at :root level */
|
|
13
|
+
:root {
|
|
14
|
+
--radius: 0.5rem;
|
|
15
|
+
|
|
16
|
+
/* Core backgrounds */
|
|
17
|
+
--background: var(--color-white);
|
|
18
|
+
--background-subtle: var(--color-zinc-50);
|
|
19
|
+
--canvas: oklch(0.975 0.005 250);
|
|
20
|
+
--surface: var(--color-white);
|
|
21
|
+
|
|
22
|
+
/* Foregrounds */
|
|
23
|
+
--foreground: var(--color-zinc-950);
|
|
24
|
+
--foreground-muted: var(--color-zinc-600);
|
|
25
|
+
--foreground-subtle: var(--color-zinc-500);
|
|
26
|
+
|
|
27
|
+
/* Card/Popover */
|
|
28
|
+
--card: var(--color-white);
|
|
29
|
+
--card-foreground: var(--color-zinc-950);
|
|
30
|
+
--popover: var(--color-white);
|
|
31
|
+
--popover-foreground: var(--color-zinc-950);
|
|
32
|
+
|
|
33
|
+
/* Primary */
|
|
34
|
+
--primary: var(--color-zinc-900);
|
|
35
|
+
--primary-foreground: var(--color-zinc-50);
|
|
36
|
+
|
|
37
|
+
/* Secondary */
|
|
38
|
+
--secondary: var(--color-zinc-100);
|
|
39
|
+
--secondary-foreground: var(--color-zinc-900);
|
|
40
|
+
|
|
41
|
+
/* Muted */
|
|
42
|
+
--muted: var(--color-zinc-100);
|
|
43
|
+
--muted-foreground: var(--color-zinc-600);
|
|
44
|
+
|
|
45
|
+
/* Accent */
|
|
46
|
+
--accent: oklch(0.97 0.005 250);
|
|
47
|
+
--accent-foreground: var(--color-zinc-950);
|
|
48
|
+
|
|
49
|
+
/* Borders */
|
|
50
|
+
--border: var(--color-zinc-200);
|
|
51
|
+
--border-subtle: var(--color-zinc-200);
|
|
52
|
+
--border-strong: var(--color-zinc-300);
|
|
53
|
+
|
|
54
|
+
/* Focus/Selection */
|
|
55
|
+
--ring: oklch(0.55 0.15 250);
|
|
56
|
+
--selection: oklch(0.92 0.03 250);
|
|
57
|
+
--selection-foreground: oklch(0.35 0.12 250);
|
|
58
|
+
--input: var(--color-zinc-300);
|
|
59
|
+
|
|
60
|
+
/* Destructive */
|
|
61
|
+
--destructive: oklch(0.55 0.22 25);
|
|
62
|
+
|
|
63
|
+
/* Inspector */
|
|
64
|
+
--inspector: var(--color-zinc-50);
|
|
65
|
+
--inspector-header: var(--color-white);
|
|
66
|
+
|
|
67
|
+
/* Toolbar */
|
|
68
|
+
--toolbar: var(--color-white);
|
|
69
|
+
--toolbar-border: var(--color-zinc-200);
|
|
70
|
+
|
|
71
|
+
/* Block states */
|
|
72
|
+
--block-hover: oklch(0.97 0.02 250);
|
|
73
|
+
--block-selected: oklch(0.40 0.15 250);
|
|
74
|
+
--block-selected-bg: oklch(0.96 0.02 250);
|
|
75
|
+
|
|
76
|
+
/* Chart colors */
|
|
77
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
78
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
79
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
80
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
81
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
82
|
+
|
|
83
|
+
/* Sidebar */
|
|
84
|
+
--sidebar: var(--color-zinc-50);
|
|
85
|
+
--sidebar-foreground: var(--color-zinc-950);
|
|
86
|
+
--sidebar-primary: var(--color-zinc-900);
|
|
87
|
+
--sidebar-primary-foreground: var(--color-zinc-50);
|
|
88
|
+
--sidebar-accent: var(--color-zinc-100);
|
|
89
|
+
--sidebar-accent-foreground: var(--color-zinc-900);
|
|
90
|
+
--sidebar-border: var(--color-zinc-200);
|
|
91
|
+
--sidebar-ring: oklch(0.55 0.15 250);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Dark mode at root level (for Radix UI portals that render outside .mjml-editor) */
|
|
95
|
+
:root.dark, .dark {
|
|
96
|
+
--background: var(--color-zinc-950);
|
|
97
|
+
--background-subtle: var(--color-zinc-900);
|
|
98
|
+
--canvas: oklch(0.10 0.005 250);
|
|
99
|
+
--surface: var(--color-zinc-800);
|
|
100
|
+
--foreground: var(--color-zinc-50);
|
|
101
|
+
--foreground-muted: var(--color-zinc-400);
|
|
102
|
+
--foreground-subtle: var(--color-zinc-500);
|
|
103
|
+
--card: var(--color-zinc-900);
|
|
104
|
+
--card-foreground: var(--color-zinc-50);
|
|
105
|
+
--popover: var(--color-zinc-900);
|
|
106
|
+
--popover-foreground: var(--color-zinc-50);
|
|
107
|
+
--primary: var(--color-zinc-50);
|
|
108
|
+
--primary-foreground: var(--color-zinc-950);
|
|
109
|
+
--secondary: var(--color-zinc-800);
|
|
110
|
+
--secondary-foreground: var(--color-zinc-200);
|
|
111
|
+
--muted: var(--color-zinc-800);
|
|
112
|
+
--muted-foreground: var(--color-zinc-400);
|
|
113
|
+
--accent: var(--color-zinc-800);
|
|
114
|
+
--accent-foreground: var(--color-zinc-50);
|
|
115
|
+
--border: var(--color-zinc-700);
|
|
116
|
+
--border-subtle: var(--color-zinc-800);
|
|
117
|
+
--border-strong: var(--color-zinc-600);
|
|
118
|
+
--ring: oklch(0.60 0.15 250);
|
|
119
|
+
--selection: oklch(0.25 0.06 250);
|
|
120
|
+
--selection-foreground: oklch(0.75 0.12 250);
|
|
121
|
+
--input: var(--color-zinc-800);
|
|
122
|
+
--destructive: oklch(0.60 0.22 25);
|
|
123
|
+
--inspector: var(--color-zinc-950);
|
|
124
|
+
--inspector-header: var(--color-zinc-900);
|
|
125
|
+
--toolbar: var(--color-zinc-950);
|
|
126
|
+
--toolbar-border: var(--color-zinc-800);
|
|
127
|
+
--block-hover: oklch(0.20 0.03 250);
|
|
128
|
+
--block-selected: oklch(0.50 0.15 250);
|
|
129
|
+
--block-selected-bg: oklch(0.22 0.04 250);
|
|
130
|
+
--chart-1: oklch(0.70 0.20 41);
|
|
131
|
+
--chart-2: oklch(0.65 0.12 185);
|
|
132
|
+
--chart-3: oklch(0.50 0.08 227);
|
|
133
|
+
--chart-4: oklch(0.80 0.17 84);
|
|
134
|
+
--chart-5: oklch(0.75 0.17 70);
|
|
135
|
+
--sidebar: var(--color-zinc-950);
|
|
136
|
+
--sidebar-foreground: var(--color-zinc-50);
|
|
137
|
+
--sidebar-primary: var(--color-zinc-50);
|
|
138
|
+
--sidebar-primary-foreground: var(--color-zinc-950);
|
|
139
|
+
--sidebar-accent: var(--color-zinc-800);
|
|
140
|
+
--sidebar-accent-foreground: var(--color-zinc-200);
|
|
141
|
+
--sidebar-border: var(--color-zinc-800);
|
|
142
|
+
--sidebar-ring: oklch(0.60 0.15 250);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Scoped CSS variable defaults - applied to .mjml-editor container */
|
|
146
|
+
.mjml-editor {
|
|
147
|
+
--radius: 0.5rem;
|
|
148
|
+
|
|
149
|
+
/* Core backgrounds */
|
|
150
|
+
--background: var(--color-white);
|
|
151
|
+
--background-subtle: var(--color-zinc-50);
|
|
152
|
+
--canvas: oklch(0.975 0.005 250);
|
|
153
|
+
--surface: var(--color-white);
|
|
154
|
+
|
|
155
|
+
/* Foregrounds */
|
|
156
|
+
--foreground: var(--color-zinc-950);
|
|
157
|
+
--foreground-muted: var(--color-zinc-600);
|
|
158
|
+
--foreground-subtle: var(--color-zinc-500);
|
|
159
|
+
|
|
160
|
+
/* Card/Popover */
|
|
161
|
+
--card: var(--color-white);
|
|
162
|
+
--card-foreground: var(--color-zinc-950);
|
|
163
|
+
--popover: var(--color-white);
|
|
164
|
+
--popover-foreground: var(--color-zinc-950);
|
|
165
|
+
|
|
166
|
+
/* Primary */
|
|
167
|
+
--primary: var(--color-zinc-900);
|
|
168
|
+
--primary-foreground: var(--color-zinc-50);
|
|
169
|
+
|
|
170
|
+
/* Secondary */
|
|
171
|
+
--secondary: var(--color-zinc-100);
|
|
172
|
+
--secondary-foreground: var(--color-zinc-900);
|
|
173
|
+
|
|
174
|
+
/* Muted */
|
|
175
|
+
--muted: var(--color-zinc-100);
|
|
176
|
+
--muted-foreground: var(--color-zinc-600);
|
|
177
|
+
|
|
178
|
+
/* Accent */
|
|
179
|
+
--accent: oklch(0.97 0.005 250);
|
|
180
|
+
--accent-foreground: var(--color-zinc-950);
|
|
181
|
+
|
|
182
|
+
/* Borders */
|
|
183
|
+
--border: var(--color-zinc-200);
|
|
184
|
+
--border-subtle: var(--color-zinc-200);
|
|
185
|
+
--border-strong: var(--color-zinc-300);
|
|
186
|
+
|
|
187
|
+
/* Focus/Selection */
|
|
188
|
+
--ring: oklch(0.55 0.15 250);
|
|
189
|
+
--selection: oklch(0.92 0.03 250);
|
|
190
|
+
--selection-foreground: oklch(0.35 0.12 250);
|
|
191
|
+
--input: var(--color-zinc-300);
|
|
192
|
+
|
|
193
|
+
/* Destructive */
|
|
194
|
+
--destructive: oklch(0.55 0.22 25);
|
|
195
|
+
|
|
196
|
+
/* Inspector */
|
|
197
|
+
--inspector: var(--color-zinc-50);
|
|
198
|
+
--inspector-header: var(--color-white);
|
|
199
|
+
|
|
200
|
+
/* Toolbar */
|
|
201
|
+
--toolbar: var(--color-white);
|
|
202
|
+
--toolbar-border: var(--color-zinc-200);
|
|
203
|
+
|
|
204
|
+
/* Block states */
|
|
205
|
+
--block-hover: oklch(0.97 0.02 250);
|
|
206
|
+
--block-selected: oklch(0.40 0.15 250);
|
|
207
|
+
--block-selected-bg: oklch(0.96 0.02 250);
|
|
208
|
+
|
|
209
|
+
/* Chart colors */
|
|
210
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
211
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
212
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
213
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
214
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
215
|
+
|
|
216
|
+
/* Sidebar */
|
|
217
|
+
--sidebar: var(--color-zinc-50);
|
|
218
|
+
--sidebar-foreground: var(--color-zinc-950);
|
|
219
|
+
--sidebar-primary: var(--color-zinc-900);
|
|
220
|
+
--sidebar-primary-foreground: var(--color-zinc-50);
|
|
221
|
+
--sidebar-accent: var(--color-zinc-100);
|
|
222
|
+
--sidebar-accent-foreground: var(--color-zinc-900);
|
|
223
|
+
--sidebar-border: var(--color-zinc-200);
|
|
224
|
+
--sidebar-ring: oklch(0.55 0.15 250);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Dark mode - when .mjml-editor has .dark class or is inside .dark */
|
|
228
|
+
.mjml-editor.dark,
|
|
229
|
+
.dark .mjml-editor {
|
|
230
|
+
/* Core backgrounds */
|
|
231
|
+
--background: var(--color-zinc-950);
|
|
232
|
+
--background-subtle: var(--color-zinc-900);
|
|
233
|
+
--canvas: oklch(0.10 0.005 250);
|
|
234
|
+
--surface: var(--color-zinc-800);
|
|
235
|
+
|
|
236
|
+
/* Foregrounds */
|
|
237
|
+
--foreground: var(--color-zinc-50);
|
|
238
|
+
--foreground-muted: var(--color-zinc-400);
|
|
239
|
+
--foreground-subtle: var(--color-zinc-500);
|
|
240
|
+
|
|
241
|
+
/* Card/Popover */
|
|
242
|
+
--card: var(--color-zinc-900);
|
|
243
|
+
--card-foreground: var(--color-zinc-50);
|
|
244
|
+
--popover: var(--color-zinc-900);
|
|
245
|
+
--popover-foreground: var(--color-zinc-50);
|
|
246
|
+
|
|
247
|
+
/* Primary - inverted */
|
|
248
|
+
--primary: var(--color-zinc-50);
|
|
249
|
+
--primary-foreground: var(--color-zinc-950);
|
|
250
|
+
|
|
251
|
+
/* Secondary */
|
|
252
|
+
--secondary: var(--color-zinc-800);
|
|
253
|
+
--secondary-foreground: var(--color-zinc-200);
|
|
254
|
+
|
|
255
|
+
/* Muted */
|
|
256
|
+
--muted: var(--color-zinc-800);
|
|
257
|
+
--muted-foreground: var(--color-zinc-400);
|
|
258
|
+
|
|
259
|
+
/* Accent */
|
|
260
|
+
--accent: var(--color-zinc-800);
|
|
261
|
+
--accent-foreground: var(--color-zinc-50);
|
|
262
|
+
|
|
263
|
+
/* Borders */
|
|
264
|
+
--border: var(--color-zinc-700);
|
|
265
|
+
--border-subtle: var(--color-zinc-800);
|
|
266
|
+
--border-strong: var(--color-zinc-600);
|
|
267
|
+
|
|
268
|
+
/* Focus/Selection */
|
|
269
|
+
--ring: oklch(0.60 0.15 250);
|
|
270
|
+
--selection: oklch(0.25 0.06 250);
|
|
271
|
+
--selection-foreground: oklch(0.75 0.12 250);
|
|
272
|
+
--input: var(--color-zinc-800);
|
|
273
|
+
|
|
274
|
+
/* Destructive */
|
|
275
|
+
--destructive: oklch(0.60 0.22 25);
|
|
276
|
+
|
|
277
|
+
/* Inspector */
|
|
278
|
+
--inspector: var(--color-zinc-950);
|
|
279
|
+
--inspector-header: var(--color-zinc-900);
|
|
280
|
+
|
|
281
|
+
/* Toolbar */
|
|
282
|
+
--toolbar: var(--color-zinc-950);
|
|
283
|
+
--toolbar-border: var(--color-zinc-800);
|
|
284
|
+
|
|
285
|
+
/* Block states */
|
|
286
|
+
--block-hover: oklch(0.20 0.03 250);
|
|
287
|
+
--block-selected: oklch(0.50 0.15 250);
|
|
288
|
+
--block-selected-bg: oklch(0.22 0.04 250);
|
|
289
|
+
|
|
290
|
+
/* Chart colors - adjusted for dark bg */
|
|
291
|
+
--chart-1: oklch(0.70 0.20 41);
|
|
292
|
+
--chart-2: oklch(0.65 0.12 185);
|
|
293
|
+
--chart-3: oklch(0.50 0.08 227);
|
|
294
|
+
--chart-4: oklch(0.80 0.17 84);
|
|
295
|
+
--chart-5: oklch(0.75 0.17 70);
|
|
296
|
+
|
|
297
|
+
/* Sidebar */
|
|
298
|
+
--sidebar: var(--color-zinc-950);
|
|
299
|
+
--sidebar-foreground: var(--color-zinc-50);
|
|
300
|
+
--sidebar-primary: var(--color-zinc-50);
|
|
301
|
+
--sidebar-primary-foreground: var(--color-zinc-950);
|
|
302
|
+
--sidebar-accent: var(--color-zinc-800);
|
|
303
|
+
--sidebar-accent-foreground: var(--color-zinc-200);
|
|
304
|
+
--sidebar-border: var(--color-zinc-800);
|
|
305
|
+
--sidebar-ring: oklch(0.60 0.15 250);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/* Force light mode within .light scope (e.g., email canvas preview) */
|
|
309
|
+
.mjml-editor.dark .light,
|
|
310
|
+
.dark .mjml-editor .light {
|
|
311
|
+
--background: var(--color-white);
|
|
312
|
+
--background-subtle: var(--color-zinc-50);
|
|
313
|
+
--canvas: oklch(0.975 0.005 250);
|
|
314
|
+
--surface: var(--color-white);
|
|
315
|
+
--foreground: var(--color-zinc-950);
|
|
316
|
+
--foreground-muted: var(--color-zinc-600);
|
|
317
|
+
--foreground-subtle: var(--color-zinc-500);
|
|
318
|
+
--card: var(--color-white);
|
|
319
|
+
--card-foreground: var(--color-zinc-950);
|
|
320
|
+
--popover: var(--color-white);
|
|
321
|
+
--popover-foreground: var(--color-zinc-950);
|
|
322
|
+
--primary: var(--color-zinc-900);
|
|
323
|
+
--primary-foreground: var(--color-zinc-50);
|
|
324
|
+
--secondary: var(--color-zinc-100);
|
|
325
|
+
--secondary-foreground: var(--color-zinc-900);
|
|
326
|
+
--muted: var(--color-zinc-100);
|
|
327
|
+
--muted-foreground: var(--color-zinc-600);
|
|
328
|
+
--accent: oklch(0.97 0.005 250);
|
|
329
|
+
--accent-foreground: var(--color-zinc-950);
|
|
330
|
+
--border: var(--color-zinc-200);
|
|
331
|
+
--border-subtle: var(--color-zinc-200);
|
|
332
|
+
--border-strong: var(--color-zinc-300);
|
|
333
|
+
--ring: oklch(0.55 0.15 250);
|
|
334
|
+
--selection: oklch(0.92 0.03 250);
|
|
335
|
+
--selection-foreground: oklch(0.35 0.12 250);
|
|
336
|
+
--input: var(--color-zinc-300);
|
|
337
|
+
--destructive: oklch(0.55 0.22 25);
|
|
338
|
+
--block-hover: oklch(0.97 0.02 250);
|
|
339
|
+
--block-selected: oklch(0.40 0.15 250);
|
|
340
|
+
--block-selected-bg: oklch(0.96 0.02 250);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Tiptap Editor Styles */
|
|
344
|
+
.ProseMirror {
|
|
345
|
+
outline: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.ProseMirror p {
|
|
349
|
+
margin: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.ProseMirror a {
|
|
353
|
+
color: inherit;
|
|
354
|
+
text-decoration: underline;
|
|
355
|
+
cursor: text;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* Liquid syntax highlighting */
|
|
359
|
+
.liquid-highlight {
|
|
360
|
+
background-color: oklch(0.93 0.04 250);
|
|
361
|
+
border-radius: 3px;
|
|
362
|
+
padding: 1px 2px;
|
|
363
|
+
margin: 0 -2px;
|
|
364
|
+
pointer-events: none;
|
|
365
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MjmlNode, EditorState, ContentBlockType } from '../types/mjml';
|
|
3
|
+
import { MjmlAttributesConfig, MjmlFontConfig } from '../lib/mjml/attributes';
|
|
4
|
+
interface EditorContextValue {
|
|
5
|
+
state: EditorState;
|
|
6
|
+
selectBlock: (id: string | null) => void;
|
|
7
|
+
updateAttributes: (id: string, attributes: Record<string, string>) => void;
|
|
8
|
+
updateContent: (id: string, content: string) => void;
|
|
9
|
+
addBlock: (parentId: string, index: number, blockType: ContentBlockType) => void;
|
|
10
|
+
addSection: () => void;
|
|
11
|
+
addColumn: (sectionId: string) => void;
|
|
12
|
+
deleteBlock: (id: string) => void;
|
|
13
|
+
moveBlock: (id: string, newParentId: string, newIndex: number) => void;
|
|
14
|
+
setDocument: (document: MjmlNode) => void;
|
|
15
|
+
undo: () => void;
|
|
16
|
+
redo: () => void;
|
|
17
|
+
canUndo: boolean;
|
|
18
|
+
canRedo: boolean;
|
|
19
|
+
selectedBlock: MjmlNode | null;
|
|
20
|
+
mjmlAttributes: MjmlAttributesConfig;
|
|
21
|
+
definedClasses: string[];
|
|
22
|
+
getResolvedAttributes: (node: MjmlNode) => Record<string, string>;
|
|
23
|
+
getInheritedValue: (node: MjmlNode, attributeKey: string) => string | undefined;
|
|
24
|
+
updateMjmlAttribute: (attributeType: 'all' | 'element' | 'class', target: string | null, attributes: Record<string, string>) => void;
|
|
25
|
+
addClass: (name: string) => void;
|
|
26
|
+
removeClass: (name: string) => void;
|
|
27
|
+
renameClass: (oldName: string, newName: string) => void;
|
|
28
|
+
fonts: MjmlFontConfig[];
|
|
29
|
+
addFont: (name: string, href: string) => void;
|
|
30
|
+
removeFont: (name: string) => void;
|
|
31
|
+
updateFont: (name: string, href: string) => void;
|
|
32
|
+
}
|
|
33
|
+
interface EditorProviderProps {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
initialDocument: MjmlNode;
|
|
36
|
+
}
|
|
37
|
+
export declare function EditorProvider({ children, initialDocument, }: EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function useEditor(): EditorContextValue;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=EditorContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["../../src/context/EditorContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EAEX,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAWtB,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AA2lB/B,UAAU,kBAAkB;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAC3E,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,QAAQ,EAAE,CACR,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,gBAAgB,KACxB,IAAI,CAAC;IACV,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC1C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE/B,cAAc,EAAE,oBAAoB,CAAC;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,qBAAqB,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClE,iBAAiB,EAAE,CACjB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,MAAM,KACjB,MAAM,GAAG,SAAS,CAAC;IACxB,mBAAmB,EAAE,CACnB,aAAa,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC/B,IAAI,CAAC;IACV,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAExD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAID,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,QAAQ,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,eAAe,GAChB,EAAE,mBAAmB,2CAmPrB;AAED,wBAAgB,SAAS,uBAMxB"}
|