@daisychainapp/maily-to-core 0.3.6 → 0.4.1
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/extensions/index.cjs +36 -84
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.mjs +35 -83
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +702 -857
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1909 -1881
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +548 -703
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -4754,6 +4754,10 @@ function ImageView(props) {
|
|
|
4754
4754
|
}),
|
|
4755
4755
|
[handleImageUpload]
|
|
4756
4756
|
);
|
|
4757
|
+
const widthValue = width && width !== "auto" ? `${width}px` : void 0;
|
|
4758
|
+
const heightValue = height && height !== "auto" ? `${height}px` : void 0;
|
|
4759
|
+
const hasExplicitWidth = Boolean(widthValue || (resizingStyle == null ? void 0 : resizingStyle.width));
|
|
4760
|
+
const hasExplicitHeight = Boolean(heightValue || (resizingStyle == null ? void 0 : resizingStyle.height));
|
|
4757
4761
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
4758
4762
|
import_react6.NodeViewWrapper,
|
|
4759
4763
|
__spreadProps(__spreadValues({
|
|
@@ -4762,13 +4766,13 @@ function ImageView(props) {
|
|
|
4762
4766
|
"data-drag-handle": editor.isEditable,
|
|
4763
4767
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
4764
4768
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
4765
|
-
width:
|
|
4766
|
-
height:
|
|
4769
|
+
width: widthValue,
|
|
4770
|
+
height: heightValue
|
|
4767
4771
|
}, resizingStyle) : {}), {
|
|
4768
4772
|
overflow: "hidden",
|
|
4769
4773
|
position: "relative",
|
|
4770
4774
|
// Weird! Basically tiptap/prose wraps this in a span and the line height causes an annoying buffer.
|
|
4771
|
-
lineHeight: "
|
|
4775
|
+
lineHeight: "normal",
|
|
4772
4776
|
display: "block",
|
|
4773
4777
|
maxWidth: "100%"
|
|
4774
4778
|
}), {
|
|
@@ -4801,7 +4805,7 @@ function ImageView(props) {
|
|
|
4801
4805
|
type: "file",
|
|
4802
4806
|
accept: "image/*",
|
|
4803
4807
|
onChange: handleFileChange,
|
|
4804
|
-
className: "mly:absolute mly:inset-0 mly:opacity-0",
|
|
4808
|
+
className: "mly:absolute mly:inset-0 mly:z-10 mly:h-full mly:w-full mly:cursor-pointer mly:appearance-none mly:bg-transparent mly:opacity-0 mly:text-transparent",
|
|
4805
4809
|
multiple: false
|
|
4806
4810
|
}
|
|
4807
4811
|
),
|
|
@@ -4812,11 +4816,13 @@ function ImageView(props) {
|
|
|
4812
4816
|
ref: imgRef,
|
|
4813
4817
|
style: __spreadProps(__spreadValues({}, resizingStyle), {
|
|
4814
4818
|
cursor: "default",
|
|
4815
|
-
objectFit: "
|
|
4819
|
+
objectFit: "contain",
|
|
4816
4820
|
marginBottom: 0,
|
|
4817
4821
|
borderRadius,
|
|
4818
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` :
|
|
4819
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` :
|
|
4822
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : widthValue != null ? widthValue : "100%",
|
|
4823
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : heightValue != null ? heightValue : "auto",
|
|
4824
|
+
maxWidth: hasExplicitWidth ? void 0 : "100%",
|
|
4825
|
+
maxHeight: hasExplicitHeight ? void 0 : "none"
|
|
4820
4826
|
}),
|
|
4821
4827
|
draggable: editor.isEditable,
|
|
4822
4828
|
className: cn(
|
|
@@ -4852,6 +4858,8 @@ function ImageView(props) {
|
|
|
4852
4858
|
}
|
|
4853
4859
|
function ImageStatusLabel(props) {
|
|
4854
4860
|
const _a = props, { status, minHeight, className, style, isDropZone } = _a, rest = __objRest(_a, ["status", "minHeight", "className", "style", "isDropZone"]);
|
|
4861
|
+
const resolvedMinHeight = minHeight != null ? minHeight : isDropZone ? 36 : void 0;
|
|
4862
|
+
const resolvedPaddingY = isDropZone ? 8 : void 0;
|
|
4855
4863
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
4856
4864
|
"div",
|
|
4857
4865
|
__spreadProps(__spreadValues({}, rest), {
|
|
@@ -4863,8 +4871,11 @@ function ImageStatusLabel(props) {
|
|
|
4863
4871
|
},
|
|
4864
4872
|
className
|
|
4865
4873
|
),
|
|
4866
|
-
style: __spreadValues(__spreadValues({},
|
|
4867
|
-
minHeight
|
|
4874
|
+
style: __spreadValues(__spreadValues(__spreadValues({}, resolvedMinHeight ? {
|
|
4875
|
+
minHeight: resolvedMinHeight
|
|
4876
|
+
} : {}), resolvedPaddingY ? {
|
|
4877
|
+
paddingTop: resolvedPaddingY,
|
|
4878
|
+
paddingBottom: resolvedPaddingY
|
|
4868
4879
|
} : {}), style),
|
|
4869
4880
|
children: [
|
|
4870
4881
|
status === "idle" && !isDropZone && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
@@ -7015,16 +7026,16 @@ function Select(props) {
|
|
|
7015
7026
|
placeholder
|
|
7016
7027
|
} = props;
|
|
7017
7028
|
const selectId = `mly${(0, import_react22.useId)()}`;
|
|
7018
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mly:relative", children: [
|
|
7029
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mly:relative mly:inline-flex mly:h-7 mly:items-center mly:overflow-hidden", children: [
|
|
7019
7030
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { htmlFor: selectId, className: "mly:sr-only", children: label }),
|
|
7020
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mly:pointer-events-none mly:absolute mly:
|
|
7031
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mly:pointer-events-none mly:absolute mly:left-2 mly:top-1/2 mly:z-20 mly:flex mly:h-7 mly:-translate-y-1/2 mly:items-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { className: cn("mly:size-3.5", iconClassName) }) }),
|
|
7021
7032
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
7022
7033
|
"select",
|
|
7023
7034
|
{
|
|
7024
7035
|
id: selectId,
|
|
7025
7036
|
className: cn(
|
|
7026
|
-
"mly-select-padding mly:flex mly:
|
|
7027
|
-
!!Icon && "mly:pl-
|
|
7037
|
+
"mly-select-padding mly:flex mly:h-7 mly:max-w-max mly:appearance-none mly:items-center mly:rounded-md mly:bg-white mly:text-sm mly:leading-none mly:text-midnight-gray mly:ring-offset-white mly:transition-colors mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:active:bg-soft-gray",
|
|
7038
|
+
!!Icon && "mly:pl-[25px]",
|
|
7028
7039
|
className
|
|
7029
7040
|
),
|
|
7030
7041
|
value: value || "",
|
|
@@ -8647,89 +8658,30 @@ function getVariableSuggestions(char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
|
|
|
8647
8658
|
// src/editor/nodes/html/html.tsx
|
|
8648
8659
|
var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
|
|
8649
8660
|
var import_state5 = require("@tiptap/pm/state");
|
|
8650
|
-
var
|
|
8661
|
+
var import_react36 = require("@tiptap/react");
|
|
8651
8662
|
var import_xml = __toESM(require("highlight.js/lib/languages/xml"), 1);
|
|
8652
8663
|
var import_lowlight = require("lowlight");
|
|
8653
8664
|
|
|
8654
8665
|
// src/editor/nodes/html/html-view.tsx
|
|
8655
8666
|
var import_react35 = require("@tiptap/react");
|
|
8656
|
-
var import_react36 = require("react");
|
|
8657
8667
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8658
8668
|
function HTMLCodeBlockView(props) {
|
|
8659
|
-
const { node
|
|
8660
|
-
|
|
8661
|
-
activeTab || (activeTab = "code");
|
|
8669
|
+
const { node } = props;
|
|
8670
|
+
const { language } = node.attrs;
|
|
8662
8671
|
const languageClass = language ? `language-${language}` : "";
|
|
8663
|
-
|
|
8664
|
-
const text2 = node.content.content.reduce((acc, cur) => {
|
|
8665
|
-
if (cur.type.name === "text") {
|
|
8666
|
-
return acc + cur.text;
|
|
8667
|
-
} else if (cur.type.name === "variable") {
|
|
8668
|
-
const { id: variable, fallback } = (cur == null ? void 0 : cur.attrs) || {};
|
|
8669
|
-
const formattedVariable = fallback ? `{{${variable},fallback=${fallback}}}` : `{{${variable}}}`;
|
|
8670
|
-
return acc + formattedVariable;
|
|
8671
|
-
}
|
|
8672
|
-
return acc;
|
|
8673
|
-
}, "");
|
|
8674
|
-
const htmlParser = new DOMParser();
|
|
8675
|
-
const htmlDoc = htmlParser.parseFromString(text2, "text/html");
|
|
8676
|
-
const style = htmlDoc.querySelectorAll("style");
|
|
8677
|
-
const body = htmlDoc.body;
|
|
8678
|
-
const combinedStyle = Array.from(style).map((s) => s.innerHTML).join("\n");
|
|
8679
|
-
return `<style>${combinedStyle}</style>${body.innerHTML}`;
|
|
8680
|
-
}, [activeTab]);
|
|
8681
|
-
const isEmpty = html2 === "";
|
|
8682
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
8672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8683
8673
|
import_react35.NodeViewWrapper,
|
|
8684
8674
|
{
|
|
8685
8675
|
draggable: false,
|
|
8686
8676
|
"data-drag-handle": false,
|
|
8687
8677
|
"data-type": "htmlCodeBlock",
|
|
8688
|
-
children:
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
) }),
|
|
8696
|
-
activeTab === "preview" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8697
|
-
"div",
|
|
8698
|
-
{
|
|
8699
|
-
className: cn(
|
|
8700
|
-
"mly:not-prose mly:rounded-lg mly:border mly:border-gray-200 mly:p-2",
|
|
8701
|
-
isEmpty && "mly:min-h-[42px]"
|
|
8702
|
-
),
|
|
8703
|
-
ref: (node2) => {
|
|
8704
|
-
if (!node2 || (node2 == null ? void 0 : node2.shadowRoot)) {
|
|
8705
|
-
return;
|
|
8706
|
-
}
|
|
8707
|
-
const shadow = node2.attachShadow({ mode: "open" });
|
|
8708
|
-
const sheet = new CSSStyleSheet();
|
|
8709
|
-
sheet.replaceSync(`
|
|
8710
|
-
* { font-family: 'Inter', sans-serif; }
|
|
8711
|
-
blockquote, h1, h2, h3, img, li, ol, p, ul {
|
|
8712
|
-
margin-top: 0;
|
|
8713
|
-
margin-bottom: 0;
|
|
8714
|
-
}
|
|
8715
|
-
`);
|
|
8716
|
-
shadow.adoptedStyleSheets = [sheet];
|
|
8717
|
-
const container = document.createElement("div");
|
|
8718
|
-
container.innerHTML = html2;
|
|
8719
|
-
shadow.appendChild(container);
|
|
8720
|
-
},
|
|
8721
|
-
contentEditable: false,
|
|
8722
|
-
onClick: () => {
|
|
8723
|
-
if (!isEmpty) {
|
|
8724
|
-
return;
|
|
8725
|
-
}
|
|
8726
|
-
updateAttributes2({
|
|
8727
|
-
activeTab: "code"
|
|
8728
|
-
});
|
|
8729
|
-
}
|
|
8730
|
-
}
|
|
8731
|
-
)
|
|
8732
|
-
]
|
|
8678
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "mly-html-code-pre", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8679
|
+
import_react35.NodeViewContent,
|
|
8680
|
+
{
|
|
8681
|
+
as: "code",
|
|
8682
|
+
className: cn("is-editable", languageClass)
|
|
8683
|
+
}
|
|
8684
|
+
) })
|
|
8733
8685
|
}
|
|
8734
8686
|
);
|
|
8735
8687
|
}
|
|
@@ -8761,7 +8713,7 @@ var HTMLCodeBlockExtension = import_extension_code_block_lowlight.default.extend
|
|
|
8761
8713
|
});
|
|
8762
8714
|
},
|
|
8763
8715
|
addNodeView() {
|
|
8764
|
-
return (0,
|
|
8716
|
+
return (0, import_react36.ReactNodeViewRenderer)(HTMLCodeBlockView, {
|
|
8765
8717
|
className: "mly:relative",
|
|
8766
8718
|
attrs: ({ node }) => {
|
|
8767
8719
|
var _a;
|