@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
|
@@ -4666,6 +4666,10 @@ function ImageView(props) {
|
|
|
4666
4666
|
}),
|
|
4667
4667
|
[handleImageUpload]
|
|
4668
4668
|
);
|
|
4669
|
+
const widthValue = width && width !== "auto" ? `${width}px` : void 0;
|
|
4670
|
+
const heightValue = height && height !== "auto" ? `${height}px` : void 0;
|
|
4671
|
+
const hasExplicitWidth = Boolean(widthValue || (resizingStyle == null ? void 0 : resizingStyle.width));
|
|
4672
|
+
const hasExplicitHeight = Boolean(heightValue || (resizingStyle == null ? void 0 : resizingStyle.height));
|
|
4669
4673
|
return /* @__PURE__ */ jsxs3(
|
|
4670
4674
|
NodeViewWrapper2,
|
|
4671
4675
|
__spreadProps(__spreadValues({
|
|
@@ -4674,13 +4678,13 @@ function ImageView(props) {
|
|
|
4674
4678
|
"data-drag-handle": editor.isEditable,
|
|
4675
4679
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
4676
4680
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
4677
|
-
width:
|
|
4678
|
-
height:
|
|
4681
|
+
width: widthValue,
|
|
4682
|
+
height: heightValue
|
|
4679
4683
|
}, resizingStyle) : {}), {
|
|
4680
4684
|
overflow: "hidden",
|
|
4681
4685
|
position: "relative",
|
|
4682
4686
|
// Weird! Basically tiptap/prose wraps this in a span and the line height causes an annoying buffer.
|
|
4683
|
-
lineHeight: "
|
|
4687
|
+
lineHeight: "normal",
|
|
4684
4688
|
display: "block",
|
|
4685
4689
|
maxWidth: "100%"
|
|
4686
4690
|
}), {
|
|
@@ -4713,7 +4717,7 @@ function ImageView(props) {
|
|
|
4713
4717
|
type: "file",
|
|
4714
4718
|
accept: "image/*",
|
|
4715
4719
|
onChange: handleFileChange,
|
|
4716
|
-
className: "mly:absolute mly:inset-0 mly:opacity-0",
|
|
4720
|
+
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",
|
|
4717
4721
|
multiple: false
|
|
4718
4722
|
}
|
|
4719
4723
|
),
|
|
@@ -4724,11 +4728,13 @@ function ImageView(props) {
|
|
|
4724
4728
|
ref: imgRef,
|
|
4725
4729
|
style: __spreadProps(__spreadValues({}, resizingStyle), {
|
|
4726
4730
|
cursor: "default",
|
|
4727
|
-
objectFit: "
|
|
4731
|
+
objectFit: "contain",
|
|
4728
4732
|
marginBottom: 0,
|
|
4729
4733
|
borderRadius,
|
|
4730
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` :
|
|
4731
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` :
|
|
4734
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : widthValue != null ? widthValue : "100%",
|
|
4735
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : heightValue != null ? heightValue : "auto",
|
|
4736
|
+
maxWidth: hasExplicitWidth ? void 0 : "100%",
|
|
4737
|
+
maxHeight: hasExplicitHeight ? void 0 : "none"
|
|
4732
4738
|
}),
|
|
4733
4739
|
draggable: editor.isEditable,
|
|
4734
4740
|
className: cn(
|
|
@@ -4764,6 +4770,8 @@ function ImageView(props) {
|
|
|
4764
4770
|
}
|
|
4765
4771
|
function ImageStatusLabel(props) {
|
|
4766
4772
|
const _a = props, { status, minHeight, className, style, isDropZone } = _a, rest = __objRest(_a, ["status", "minHeight", "className", "style", "isDropZone"]);
|
|
4773
|
+
const resolvedMinHeight = minHeight != null ? minHeight : isDropZone ? 36 : void 0;
|
|
4774
|
+
const resolvedPaddingY = isDropZone ? 8 : void 0;
|
|
4767
4775
|
return /* @__PURE__ */ jsxs3(
|
|
4768
4776
|
"div",
|
|
4769
4777
|
__spreadProps(__spreadValues({}, rest), {
|
|
@@ -4775,8 +4783,11 @@ function ImageStatusLabel(props) {
|
|
|
4775
4783
|
},
|
|
4776
4784
|
className
|
|
4777
4785
|
),
|
|
4778
|
-
style: __spreadValues(__spreadValues({},
|
|
4779
|
-
minHeight
|
|
4786
|
+
style: __spreadValues(__spreadValues(__spreadValues({}, resolvedMinHeight ? {
|
|
4787
|
+
minHeight: resolvedMinHeight
|
|
4788
|
+
} : {}), resolvedPaddingY ? {
|
|
4789
|
+
paddingTop: resolvedPaddingY,
|
|
4790
|
+
paddingBottom: resolvedPaddingY
|
|
4780
4791
|
} : {}), style),
|
|
4781
4792
|
children: [
|
|
4782
4793
|
status === "idle" && !isDropZone && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
@@ -6957,16 +6968,16 @@ function Select(props) {
|
|
|
6957
6968
|
placeholder
|
|
6958
6969
|
} = props;
|
|
6959
6970
|
const selectId = `mly${useId()}`;
|
|
6960
|
-
const content = /* @__PURE__ */ jsxs14("div", { className: "mly:relative", children: [
|
|
6971
|
+
const content = /* @__PURE__ */ jsxs14("div", { className: "mly:relative mly:inline-flex mly:h-7 mly:items-center mly:overflow-hidden", children: [
|
|
6961
6972
|
/* @__PURE__ */ jsx30("label", { htmlFor: selectId, className: "mly:sr-only", children: label }),
|
|
6962
|
-
Icon && /* @__PURE__ */ jsx30("div", { className: "mly:pointer-events-none mly:absolute mly:
|
|
6973
|
+
Icon && /* @__PURE__ */ jsx30("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__ */ jsx30(Icon, { className: cn("mly:size-3.5", iconClassName) }) }),
|
|
6963
6974
|
/* @__PURE__ */ jsxs14(
|
|
6964
6975
|
"select",
|
|
6965
6976
|
{
|
|
6966
6977
|
id: selectId,
|
|
6967
6978
|
className: cn(
|
|
6968
|
-
"mly-select-padding mly:flex mly:
|
|
6969
|
-
!!Icon && "mly:pl-
|
|
6979
|
+
"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",
|
|
6980
|
+
!!Icon && "mly:pl-[25px]",
|
|
6970
6981
|
className
|
|
6971
6982
|
),
|
|
6972
6983
|
value: value || "",
|
|
@@ -8606,83 +8617,24 @@ import { createLowlight, common } from "lowlight";
|
|
|
8606
8617
|
|
|
8607
8618
|
// src/editor/nodes/html/html-view.tsx
|
|
8608
8619
|
import { NodeViewContent as NodeViewContent2, NodeViewWrapper as NodeViewWrapper7 } from "@tiptap/react";
|
|
8609
|
-
import {
|
|
8610
|
-
import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
8620
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
8611
8621
|
function HTMLCodeBlockView(props) {
|
|
8612
|
-
const { node
|
|
8613
|
-
|
|
8614
|
-
activeTab || (activeTab = "code");
|
|
8622
|
+
const { node } = props;
|
|
8623
|
+
const { language } = node.attrs;
|
|
8615
8624
|
const languageClass = language ? `language-${language}` : "";
|
|
8616
|
-
|
|
8617
|
-
const text2 = node.content.content.reduce((acc, cur) => {
|
|
8618
|
-
if (cur.type.name === "text") {
|
|
8619
|
-
return acc + cur.text;
|
|
8620
|
-
} else if (cur.type.name === "variable") {
|
|
8621
|
-
const { id: variable, fallback } = (cur == null ? void 0 : cur.attrs) || {};
|
|
8622
|
-
const formattedVariable = fallback ? `{{${variable},fallback=${fallback}}}` : `{{${variable}}}`;
|
|
8623
|
-
return acc + formattedVariable;
|
|
8624
|
-
}
|
|
8625
|
-
return acc;
|
|
8626
|
-
}, "");
|
|
8627
|
-
const htmlParser = new DOMParser();
|
|
8628
|
-
const htmlDoc = htmlParser.parseFromString(text2, "text/html");
|
|
8629
|
-
const style = htmlDoc.querySelectorAll("style");
|
|
8630
|
-
const body = htmlDoc.body;
|
|
8631
|
-
const combinedStyle = Array.from(style).map((s) => s.innerHTML).join("\n");
|
|
8632
|
-
return `<style>${combinedStyle}</style>${body.innerHTML}`;
|
|
8633
|
-
}, [activeTab]);
|
|
8634
|
-
const isEmpty = html2 === "";
|
|
8635
|
-
return /* @__PURE__ */ jsxs20(
|
|
8625
|
+
return /* @__PURE__ */ jsx37(
|
|
8636
8626
|
NodeViewWrapper7,
|
|
8637
8627
|
{
|
|
8638
8628
|
draggable: false,
|
|
8639
8629
|
"data-drag-handle": false,
|
|
8640
8630
|
"data-type": "htmlCodeBlock",
|
|
8641
|
-
children:
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
) }),
|
|
8649
|
-
activeTab === "preview" && /* @__PURE__ */ jsx37(
|
|
8650
|
-
"div",
|
|
8651
|
-
{
|
|
8652
|
-
className: cn(
|
|
8653
|
-
"mly:not-prose mly:rounded-lg mly:border mly:border-gray-200 mly:p-2",
|
|
8654
|
-
isEmpty && "mly:min-h-[42px]"
|
|
8655
|
-
),
|
|
8656
|
-
ref: (node2) => {
|
|
8657
|
-
if (!node2 || (node2 == null ? void 0 : node2.shadowRoot)) {
|
|
8658
|
-
return;
|
|
8659
|
-
}
|
|
8660
|
-
const shadow = node2.attachShadow({ mode: "open" });
|
|
8661
|
-
const sheet = new CSSStyleSheet();
|
|
8662
|
-
sheet.replaceSync(`
|
|
8663
|
-
* { font-family: 'Inter', sans-serif; }
|
|
8664
|
-
blockquote, h1, h2, h3, img, li, ol, p, ul {
|
|
8665
|
-
margin-top: 0;
|
|
8666
|
-
margin-bottom: 0;
|
|
8667
|
-
}
|
|
8668
|
-
`);
|
|
8669
|
-
shadow.adoptedStyleSheets = [sheet];
|
|
8670
|
-
const container = document.createElement("div");
|
|
8671
|
-
container.innerHTML = html2;
|
|
8672
|
-
shadow.appendChild(container);
|
|
8673
|
-
},
|
|
8674
|
-
contentEditable: false,
|
|
8675
|
-
onClick: () => {
|
|
8676
|
-
if (!isEmpty) {
|
|
8677
|
-
return;
|
|
8678
|
-
}
|
|
8679
|
-
updateAttributes2({
|
|
8680
|
-
activeTab: "code"
|
|
8681
|
-
});
|
|
8682
|
-
}
|
|
8683
|
-
}
|
|
8684
|
-
)
|
|
8685
|
-
]
|
|
8631
|
+
children: /* @__PURE__ */ jsx37("pre", { className: "mly-html-code-pre", children: /* @__PURE__ */ jsx37(
|
|
8632
|
+
NodeViewContent2,
|
|
8633
|
+
{
|
|
8634
|
+
as: "code",
|
|
8635
|
+
className: cn("is-editable", languageClass)
|
|
8636
|
+
}
|
|
8637
|
+
) })
|
|
8686
8638
|
}
|
|
8687
8639
|
);
|
|
8688
8640
|
}
|