@maily-to/core 2.0.0-beta.6 → 2.0.0-beta.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
@@ -3,7 +3,7 @@ import { B as ArrowIcon, C as ColumnsExtension, D as updateColumnWidth, E as rem
3
3
  import { c } from "react/compiler-runtime";
4
4
  import { BORDER_STYLES, BUTTON_KINDS, DATA_NODE_TYPE_KEY, DEFAULT_BORDER_COLOR, DEFAULT_EDITOR_THEME, DEFAULT_EDITOR_THEME as DEFAULT_EDITOR_THEME$1, DEFAULT_FONT_FALLBACK, DEFAULT_FONT_FAMILIES, DEFAULT_FONT_FAMILY, DEFAULT_HTML_CODE_BLOCK_TAB, DEFAULT_TEXT_ALIGN, DEFAULT_TEXT_DIRECTION, DEFAULT_VARIABLE_START_TRIGGER, FIELD_MODE, FONT_SIZE_PRESETS, FONT_STYLES, FONT_WEIGHTS, HTML_CODE_BLOCK_TABS, LINE_HEIGHT_PRESETS, MAILY_ERROR_PREFIX, MAILY_MARK_TYPES, MAILY_NODE_TYPES, MAX_IMAGE_WIDTH_PERCENTAGE, MIN_IMAGE_WIDTH_PERCENTAGE, OPERATORS_WITHOUT_VALUE, TEXT_ALIGNMENTS, TEXT_DIRECTIONS, VISIBILITY_ACTIONS, VISIBILITY_ACTION_OPTIONS, VISIBILITY_OPERATORS, VISIBILITY_OPERATOR_OPTIONS, allowedFallbackFonts, allowedTextAligns, buildDocFromVariableText, clamp, deepMerge, getMailyCssVariables, getNodeFontStyleDefaults, invariant, isAllowedTextAlignment, isAllowedTextDirection, loadFont, noop, parseWidthToPercentage, roundTo, serializeVariableToText } from "@maily-to/shared";
5
5
  import * as React$1 from "react";
6
- import React, { Fragment, createContext, forwardRef, memo, use, useCallback, useEffect, useRef, useState } from "react";
6
+ import React, { Fragment, createContext, forwardRef, memo, use, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
7
7
  import { EditorContent, EditorContext, isNodeSelection, useEditor, useEditorState } from "@tiptap/react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { ALargeSmallIcon, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, AlignVerticalDistributeCenterIcon, AlignVerticalDistributeEndIcon, AlignVerticalDistributeStartIcon, ArrowDownIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, BaselineIcon, BoldIcon, BoxIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, ClipboardCopyIcon, CodeIcon, CodeXmlIcon, Columns2Icon, Columns3Icon, CopyIcon, CornerDownLeftIcon, EyeIcon, FootprintsIcon, GripVerticalIcon, Heading1Icon, Heading2Icon, Heading3Icon, HighlighterIcon, ImageIcon, InfoIcon, ItalicIcon, LetterTextIcon, LinkIcon, ListIcon, ListOrderedIcon, Loader2Icon, Maximize2Icon, MaximizeIcon, Minimize2Icon, MinusIcon, MoveIcon, PencilRulerIcon, PilcrowIcon, PilcrowLeftIcon, PilcrowRightIcon, PlusIcon, RectangleHorizontalIcon, Redo2Icon, RotateCcwIcon, RulerDimensionLineIcon, ScanIcon, SlidersHorizontalIcon, SlidersVerticalIcon, SpaceIcon, SparklesIcon, SquareRoundCornerIcon, StrikethroughIcon, Trash2Icon, TrashIcon, TypeIcon, UnderlineIcon, Undo2Icon, WandSparklesIcon } from "lucide-react";
@@ -59,9 +59,9 @@ function useEditorRootContext() {
59
59
  //#region src/components/editor/editor-body.tsx
60
60
  function EditorBody(props) {
61
61
  const $ = c(10);
62
- if ($[0] !== "08264d493db23d0844b7d874763c27e96ff54995c142b8eca8b59311e5865190") {
62
+ if ($[0] !== "e0db2c4ee2319be90290f51b6cb62ac65cda55fb0a791d170ccfb3db88fb15bf") {
63
63
  for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
64
- $[0] = "08264d493db23d0844b7d874763c27e96ff54995c142b8eca8b59311e5865190";
64
+ $[0] = "e0db2c4ee2319be90290f51b6cb62ac65cda55fb0a791d170ccfb3db88fb15bf";
65
65
  }
66
66
  const { children, className } = props;
67
67
  const editor = useEditorInstance();
@@ -100,9 +100,9 @@ function EditorBody(props) {
100
100
  //#region src/components/editor/editor-container.tsx
101
101
  function EditorContainer(props) {
102
102
  const $ = c(6);
103
- if ($[0] !== "5ef00baa2b8343ac498779ad6863dfa70c2281535afe6975f73537f4c66da32b") {
103
+ if ($[0] !== "fd9819035fb8d7796d59a1a90fcbfc9e5b7753eeaf928e84b714d59fa03b5311") {
104
104
  for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
105
- $[0] = "5ef00baa2b8343ac498779ad6863dfa70c2281535afe6975f73537f4c66da32b";
105
+ $[0] = "fd9819035fb8d7796d59a1a90fcbfc9e5b7753eeaf928e84b714d59fa03b5311";
106
106
  }
107
107
  const { children, className } = props;
108
108
  let t0;
@@ -12092,9 +12092,9 @@ function EditorContent$1() {
12092
12092
  //#region src/components/editor/editor-frame.tsx
12093
12093
  function EditorFrame(props) {
12094
12094
  const $ = c(6);
12095
- if ($[0] !== "a3270474fa083168e1bd56f8baf4610d656cdae67efe07a809cfb92383319710") {
12095
+ if ($[0] !== "c70cfba59a8743ecb194a79fa89db1db6b0ca8f7dead4dddc636154d99413bbe") {
12096
12096
  for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12097
- $[0] = "a3270474fa083168e1bd56f8baf4610d656cdae67efe07a809cfb92383319710";
12097
+ $[0] = "c70cfba59a8743ecb194a79fa89db1db6b0ca8f7dead4dddc636154d99413bbe";
12098
12098
  }
12099
12099
  const { children, className } = props;
12100
12100
  let t0;
@@ -12310,12 +12310,12 @@ const useMailyEditor = (options, dependencies) => {
12310
12310
  //#endregion
12311
12311
  //#region src/components/editor/editor-root.tsx
12312
12312
  function EditorRoot(props) {
12313
- const $ = c(42);
12314
- if ($[0] !== "83cc79a8eef36a8644d9a9370c55893ad945dd5968fcd1a59854bb5709218134") {
12315
- for (let $i = 0; $i < 42; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12316
- $[0] = "83cc79a8eef36a8644d9a9370c55893ad945dd5968fcd1a59854bb5709218134";
12313
+ const $ = c(45);
12314
+ if ($[0] !== "d4f6388642f4f2a74c10cf5f30ef3af0c666c6414466df4a2596bac0abc8e597") {
12315
+ for (let $i = 0; $i < 45; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12316
+ $[0] = "d4f6388642f4f2a74c10cf5f30ef3af0c666c6414466df4a2596bac0abc8e597";
12317
12317
  }
12318
- const { content, onUpdate, onCreate, extensions, theme: t0, defaultTextDirection, textDirection: textDirectionProp, onTextDirectionChange, children, editable: t1, immediatelyRender: t2, autofocus: t3, editorProps } = props;
12318
+ const { ref, content, onUpdate, onCreate, extensions, theme: t0, defaultTextDirection, textDirection: textDirectionProp, onTextDirectionChange, children, editable: t1, immediatelyRender: t2, autofocus: t3, editorProps } = props;
12319
12319
  let t4;
12320
12320
  if ($[1] !== t0) {
12321
12321
  t4 = t0 === void 0 ? {} : t0;
@@ -12438,34 +12438,64 @@ function EditorRoot(props) {
12438
12438
  $[33] = t14;
12439
12439
  } else t14 = $[33];
12440
12440
  const contextValue = t14;
12441
- if (!editor) return null;
12442
12441
  let t15;
12442
+ let t16;
12443
12443
  if ($[34] !== editor) {
12444
- t15 = { editor };
12444
+ t15 = () => ({
12445
+ getEditor: () => {
12446
+ invariant(editor, "Editor.Root ref accessed before the editor was ready");
12447
+ return editor;
12448
+ },
12449
+ getJSON: () => {
12450
+ invariant(editor, "Editor.Root ref accessed before the editor was ready");
12451
+ return editor.getJSON();
12452
+ },
12453
+ getEditorHTML: () => {
12454
+ invariant(editor, "Editor.Root ref accessed before the editor was ready");
12455
+ return editor.getHTML();
12456
+ },
12457
+ getText: () => {
12458
+ invariant(editor, "Editor.Root ref accessed before the editor was ready");
12459
+ return editor.getText();
12460
+ }
12461
+ });
12462
+ t16 = [editor];
12445
12463
  $[34] = editor;
12446
12464
  $[35] = t15;
12447
- } else t15 = $[35];
12448
- let t16;
12449
- if ($[36] !== children || $[37] !== contextValue) {
12450
- t16 = /* @__PURE__ */ jsx(EditorRootContext.Provider, {
12465
+ $[36] = t16;
12466
+ } else {
12467
+ t15 = $[35];
12468
+ t16 = $[36];
12469
+ }
12470
+ useImperativeHandle(ref, t15, t16);
12471
+ if (!editor) return null;
12472
+ let t17;
12473
+ if ($[37] !== editor) {
12474
+ t17 = { editor };
12475
+ $[37] = editor;
12476
+ $[38] = t17;
12477
+ } else t17 = $[38];
12478
+ let t18;
12479
+ if ($[39] !== children || $[40] !== contextValue) {
12480
+ t18 = /* @__PURE__ */ jsx(EditorRootContext.Provider, {
12451
12481
  value: contextValue,
12452
12482
  children
12453
12483
  });
12454
- $[36] = children;
12455
- $[37] = contextValue;
12456
- $[38] = t16;
12457
- } else t16 = $[38];
12458
- let t17;
12459
- if ($[39] !== t15 || $[40] !== t16) {
12460
- t17 = /* @__PURE__ */ jsx(EditorContext.Provider, {
12461
- value: t15,
12462
- children: t16
12484
+ $[39] = children;
12485
+ $[40] = contextValue;
12486
+ $[41] = t18;
12487
+ } else t18 = $[41];
12488
+ let t19;
12489
+ if ($[42] !== t17 || $[43] !== t18) {
12490
+ t19 = /* @__PURE__ */ jsx(EditorContext.Provider, {
12491
+ value: t17,
12492
+ children: t18
12463
12493
  });
12464
- $[39] = t15;
12465
- $[40] = t16;
12466
- $[41] = t17;
12467
- } else t17 = $[41];
12468
- return t17;
12494
+ $[42] = t17;
12495
+ $[43] = t18;
12496
+ $[44] = t19;
12497
+ } else t19 = $[44];
12498
+ return t19;
12469
12499
  }
12470
12500
  //#endregion
12471
12501
  //#region src/components/editor/editor.ts
@@ -12489,9 +12519,9 @@ function useToolbarContext() {
12489
12519
  //#region src/components/toolbar/toolbar-root.tsx
12490
12520
  function ToolbarRoot(props) {
12491
12521
  const $ = c(7);
12492
- if ($[0] !== "8d4ab18fa777ab9294ea6377aea6b117a56a716f720835777aac9c9c60718dd9") {
12522
+ if ($[0] !== "31afef1fa674a9ea40f7096df8cbce7e24a2db8515cb28f922330dc487cc78f6") {
12493
12523
  for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12494
- $[0] = "8d4ab18fa777ab9294ea6377aea6b117a56a716f720835777aac9c9c60718dd9";
12524
+ $[0] = "31afef1fa674a9ea40f7096df8cbce7e24a2db8515cb28f922330dc487cc78f6";
12495
12525
  }
12496
12526
  const { children, className } = props;
12497
12527
  const container = useRef(null);
@@ -12526,9 +12556,9 @@ function ToolbarRoot(props) {
12526
12556
  //#region src/components/toolbar/toolbar-group.tsx
12527
12557
  function ToolbarGroup(props) {
12528
12558
  const $ = c(6);
12529
- if ($[0] !== "ac5670fddaae730fb00e50f42f652e231ab5bc0edc8319b872d0caf991a0d545") {
12559
+ if ($[0] !== "332110c055cffec57025020bcc4a2c42d19ca5cce2b3ec715aafb1d742b472dc") {
12530
12560
  for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12531
- $[0] = "ac5670fddaae730fb00e50f42f652e231ab5bc0edc8319b872d0caf991a0d545";
12561
+ $[0] = "332110c055cffec57025020bcc4a2c42d19ca5cce2b3ec715aafb1d742b472dc";
12532
12562
  }
12533
12563
  const { children, className } = props;
12534
12564
  let t0;
@@ -12553,9 +12583,9 @@ function ToolbarGroup(props) {
12553
12583
  //#region src/components/toolbar/toolbar-align.tsx
12554
12584
  function ToolbarAlign(props) {
12555
12585
  const $ = c(9);
12556
- if ($[0] !== "10f74e4e80c188006469dca96d9800d8e5f117eb5b797e91f59ce59dd7eaae5c") {
12586
+ if ($[0] !== "46dcd72ed91be102db31a05035529f787923102270099d2cb9cbfa4d86764b6f") {
12557
12587
  for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12558
- $[0] = "10f74e4e80c188006469dca96d9800d8e5f117eb5b797e91f59ce59dd7eaae5c";
12588
+ $[0] = "46dcd72ed91be102db31a05035529f787923102270099d2cb9cbfa4d86764b6f";
12559
12589
  }
12560
12590
  const editor = useEditorInstance();
12561
12591
  const { container } = useToolbarContext();
@@ -12750,9 +12780,9 @@ function ToggleDirectionPopover(props) {
12750
12780
  //#region src/components/toolbar/toolbar-direction.tsx
12751
12781
  function ToolbarDirection(props) {
12752
12782
  const $ = c(5);
12753
- if ($[0] !== "fcbc5c40fd64980e192775cec9a6c2d4963a30d64999c9ade177fcc6847e304a") {
12783
+ if ($[0] !== "bbf2b96913e758c97a88de3c13a825b915427f59a1bbd0b50ea0fe3a9711ca1c") {
12754
12784
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12755
- $[0] = "fcbc5c40fd64980e192775cec9a6c2d4963a30d64999c9ade177fcc6847e304a";
12785
+ $[0] = "bbf2b96913e758c97a88de3c13a825b915427f59a1bbd0b50ea0fe3a9711ca1c";
12756
12786
  }
12757
12787
  const { container } = useToolbarContext();
12758
12788
  const { textDirection, setTextDirection } = useEditorRootContext();
@@ -12774,9 +12804,9 @@ function ToolbarDirection(props) {
12774
12804
  //#region src/components/toolbar/toolbar-actions.tsx
12775
12805
  function ToolbarUndo(props) {
12776
12806
  const $ = c(12);
12777
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
12807
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
12778
12808
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12779
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
12809
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
12780
12810
  }
12781
12811
  const { className } = props;
12782
12812
  const editor = useEditorInstance();
@@ -12827,9 +12857,9 @@ function _temp(ctx) {
12827
12857
  }
12828
12858
  function ToolbarRedo(props) {
12829
12859
  const $ = c(12);
12830
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
12860
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
12831
12861
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12832
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
12862
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
12833
12863
  }
12834
12864
  const { className } = props;
12835
12865
  const editor = useEditorInstance();
@@ -12880,9 +12910,9 @@ function _temp2(ctx) {
12880
12910
  }
12881
12911
  function ToolbarBold(props) {
12882
12912
  const $ = c(12);
12883
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
12913
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
12884
12914
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12885
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
12915
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
12886
12916
  }
12887
12917
  const { className } = props;
12888
12918
  const editor = useEditorInstance();
@@ -12933,9 +12963,9 @@ function _temp3(ctx) {
12933
12963
  }
12934
12964
  function ToolbarItalic(props) {
12935
12965
  const $ = c(12);
12936
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
12966
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
12937
12967
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12938
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
12968
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
12939
12969
  }
12940
12970
  const { className } = props;
12941
12971
  const editor = useEditorInstance();
@@ -12986,9 +13016,9 @@ function _temp4(ctx) {
12986
13016
  }
12987
13017
  function ToolbarUnderline(props) {
12988
13018
  const $ = c(12);
12989
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
13019
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
12990
13020
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12991
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
13021
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
12992
13022
  }
12993
13023
  const { className } = props;
12994
13024
  const editor = useEditorInstance();
@@ -13039,9 +13069,9 @@ function _temp5(ctx) {
13039
13069
  }
13040
13070
  function ToolbarStrikethrough(props) {
13041
13071
  const $ = c(12);
13042
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
13072
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
13043
13073
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
13044
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
13074
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
13045
13075
  }
13046
13076
  const { className } = props;
13047
13077
  const editor = useEditorInstance();
@@ -13092,9 +13122,9 @@ function _temp6(ctx) {
13092
13122
  }
13093
13123
  function ToolbarCode(props) {
13094
13124
  const $ = c(12);
13095
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
13125
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
13096
13126
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
13097
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
13127
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
13098
13128
  }
13099
13129
  const { className } = props;
13100
13130
  const editor = useEditorInstance();
@@ -13145,9 +13175,9 @@ function _temp7(ctx) {
13145
13175
  }
13146
13176
  function ToolbarCommonActions() {
13147
13177
  const $ = c(4);
13148
- if ($[0] !== "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a") {
13178
+ if ($[0] !== "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71") {
13149
13179
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
13150
- $[0] = "65b945a5f294f9fce14bbebc3b69cea8532974c3261aaea9744bf15dba675e8a";
13180
+ $[0] = "f25ad897b75847b9d1ba61954e8b3b6d1b120850f2baf12520029ca22e821f71";
13151
13181
  }
13152
13182
  let t0;
13153
13183
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {