@maily-to/core 0.3.0 → 0.3.2
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 +34 -22
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +9 -0
- package/dist/extensions/index.d.ts +9 -0
- package/dist/extensions/index.mjs +40 -28
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +34 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +48 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +11 -4
|
@@ -329,6 +329,7 @@ type Variable = {
|
|
|
329
329
|
name: string;
|
|
330
330
|
required?: boolean;
|
|
331
331
|
valid?: boolean;
|
|
332
|
+
hideDefaultValue?: boolean;
|
|
332
333
|
};
|
|
333
334
|
type VariableFunctionOptions = {
|
|
334
335
|
query: string;
|
|
@@ -369,6 +370,12 @@ type VariableOptions = {
|
|
|
369
370
|
* @default VariableSuggestionPopover
|
|
370
371
|
*/
|
|
371
372
|
variableSuggestionsPopover: VariableSuggestionsPopoverType;
|
|
373
|
+
/**
|
|
374
|
+
* Disable input is the boolean that will be used to disable the input of the variable
|
|
375
|
+
* when the variable is selected.
|
|
376
|
+
* @default false
|
|
377
|
+
*/
|
|
378
|
+
disableInput: boolean;
|
|
372
379
|
};
|
|
373
380
|
type VariableStorage = {
|
|
374
381
|
popover: boolean;
|
|
@@ -380,6 +387,7 @@ type VariableListProps = {
|
|
|
380
387
|
command: (params: {
|
|
381
388
|
id: string;
|
|
382
389
|
required: boolean;
|
|
390
|
+
hideDefaultValue: boolean;
|
|
383
391
|
}) => void;
|
|
384
392
|
items: Variable[];
|
|
385
393
|
} & SuggestionOptions;
|
|
@@ -387,6 +395,7 @@ declare const VariableList: react.ForwardRefExoticComponent<{
|
|
|
387
395
|
command: (params: {
|
|
388
396
|
id: string;
|
|
389
397
|
required: boolean;
|
|
398
|
+
hideDefaultValue: boolean;
|
|
390
399
|
}) => void;
|
|
391
400
|
items: Variable[];
|
|
392
401
|
} & SuggestionOptions<any, any> & react.RefAttributes<unknown>>;
|
|
@@ -329,6 +329,7 @@ type Variable = {
|
|
|
329
329
|
name: string;
|
|
330
330
|
required?: boolean;
|
|
331
331
|
valid?: boolean;
|
|
332
|
+
hideDefaultValue?: boolean;
|
|
332
333
|
};
|
|
333
334
|
type VariableFunctionOptions = {
|
|
334
335
|
query: string;
|
|
@@ -369,6 +370,12 @@ type VariableOptions = {
|
|
|
369
370
|
* @default VariableSuggestionPopover
|
|
370
371
|
*/
|
|
371
372
|
variableSuggestionsPopover: VariableSuggestionsPopoverType;
|
|
373
|
+
/**
|
|
374
|
+
* Disable input is the boolean that will be used to disable the input of the variable
|
|
375
|
+
* when the variable is selected.
|
|
376
|
+
* @default false
|
|
377
|
+
*/
|
|
378
|
+
disableInput: boolean;
|
|
372
379
|
};
|
|
373
380
|
type VariableStorage = {
|
|
374
381
|
popover: boolean;
|
|
@@ -380,6 +387,7 @@ type VariableListProps = {
|
|
|
380
387
|
command: (params: {
|
|
381
388
|
id: string;
|
|
382
389
|
required: boolean;
|
|
390
|
+
hideDefaultValue: boolean;
|
|
383
391
|
}) => void;
|
|
384
392
|
items: Variable[];
|
|
385
393
|
} & SuggestionOptions;
|
|
@@ -387,6 +395,7 @@ declare const VariableList: react.ForwardRefExoticComponent<{
|
|
|
387
395
|
command: (params: {
|
|
388
396
|
id: string;
|
|
389
397
|
required: boolean;
|
|
398
|
+
hideDefaultValue: boolean;
|
|
390
399
|
}) => void;
|
|
391
400
|
items: Variable[];
|
|
392
401
|
} & SuggestionOptions<any, any> & react.RefAttributes<unknown>>;
|
|
@@ -6120,7 +6120,7 @@ function VariableIcon(props) {
|
|
|
6120
6120
|
"div",
|
|
6121
6121
|
{
|
|
6122
6122
|
className: cn(
|
|
6123
|
-
"mly-flex mly-size-5 mly-items-center mly-justify-center mly-rounded-md mly-border",
|
|
6123
|
+
"mly-flex mly-size-5 mly-items-center mly-justify-center mly-rounded-md mly-border mly-border-gray-200",
|
|
6124
6124
|
className
|
|
6125
6125
|
),
|
|
6126
6126
|
children
|
|
@@ -6132,15 +6132,19 @@ function VariableIcon(props) {
|
|
|
6132
6132
|
import { NodeViewWrapper as NodeViewWrapper4 } from "@tiptap/react";
|
|
6133
6133
|
import { AlertTriangle, Braces as Braces2, Pencil } from "lucide-react";
|
|
6134
6134
|
import { useMemo as useMemo4 } from "react";
|
|
6135
|
-
import { jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6135
|
+
import { Fragment as Fragment3, jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6136
6136
|
function VariableView(props) {
|
|
6137
6137
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
6138
|
-
const { id, fallback, required } = node.attrs;
|
|
6138
|
+
const { id, fallback, required, hideDefaultValue = false } = node.attrs;
|
|
6139
6139
|
const renderVariable = useMemo4(() => {
|
|
6140
6140
|
var _a, _b;
|
|
6141
6141
|
const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
|
|
6142
6142
|
return variableRender;
|
|
6143
6143
|
}, [editor]);
|
|
6144
|
+
const disableInput = useMemo4(() => {
|
|
6145
|
+
var _a, _b;
|
|
6146
|
+
return (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.disableInput) != null ? _b : false;
|
|
6147
|
+
}, [editor]);
|
|
6144
6148
|
return /* @__PURE__ */ jsx29(
|
|
6145
6149
|
NodeViewWrapper4,
|
|
6146
6150
|
{
|
|
@@ -6174,6 +6178,7 @@ function VariableView(props) {
|
|
|
6174
6178
|
/* @__PURE__ */ jsx29(
|
|
6175
6179
|
"input",
|
|
6176
6180
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
6181
|
+
disabled: disableInput,
|
|
6177
6182
|
value: id != null ? id : "",
|
|
6178
6183
|
onChange: (e) => {
|
|
6179
6184
|
updateAttributes2({
|
|
@@ -6181,27 +6186,29 @@ function VariableView(props) {
|
|
|
6181
6186
|
});
|
|
6182
6187
|
},
|
|
6183
6188
|
placeholder: "ie. name...",
|
|
6184
|
-
className: "mly-h-7 mly-w-36 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
|
|
6189
|
+
className: "mly-h-7 mly-w-36 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none disabled:mly-cursor-not-allowed"
|
|
6185
6190
|
})
|
|
6186
6191
|
)
|
|
6187
6192
|
] }),
|
|
6188
|
-
/* @__PURE__ */
|
|
6189
|
-
|
|
6190
|
-
/* @__PURE__ */
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6193
|
+
!hideDefaultValue && /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
6194
|
+
/* @__PURE__ */ jsx29(Divider, { className: "mly-mx-1.5" }),
|
|
6195
|
+
/* @__PURE__ */ jsxs13("label", { className: "mly-relative", children: [
|
|
6196
|
+
/* @__PURE__ */ jsx29("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
|
|
6197
|
+
/* @__PURE__ */ jsx29(
|
|
6198
|
+
"input",
|
|
6199
|
+
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
6200
|
+
value: fallback != null ? fallback : "",
|
|
6201
|
+
onChange: (e) => {
|
|
6202
|
+
updateAttributes2({
|
|
6203
|
+
fallback: e.target.value
|
|
6204
|
+
});
|
|
6205
|
+
},
|
|
6206
|
+
placeholder: "ie. John Doe...",
|
|
6207
|
+
className: "mly-h-7 mly-w-32 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
|
|
6208
|
+
})
|
|
6209
|
+
),
|
|
6210
|
+
/* @__PURE__ */ jsx29("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ jsx29(Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
6211
|
+
] })
|
|
6205
6212
|
] })
|
|
6206
6213
|
] }) })
|
|
6207
6214
|
}
|
|
@@ -6272,6 +6279,7 @@ var VariableExtension = Node8.create({
|
|
|
6272
6279
|
variables: DEFAULT_VARIABLES,
|
|
6273
6280
|
variableSuggestionsPopover: DEFAULT_VARIABLE_SUGGESTION_POPOVER,
|
|
6274
6281
|
renderVariable: DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
6282
|
+
disableInput: false,
|
|
6275
6283
|
renderLabel(props) {
|
|
6276
6284
|
var _a;
|
|
6277
6285
|
const { node } = props;
|
|
@@ -6355,6 +6363,9 @@ var VariableExtension = Node8.create({
|
|
|
6355
6363
|
"data-required": (_a = attributes == null ? void 0 : attributes.required) != null ? _a : true
|
|
6356
6364
|
};
|
|
6357
6365
|
}
|
|
6366
|
+
},
|
|
6367
|
+
hideDefaultValue: {
|
|
6368
|
+
default: false
|
|
6358
6369
|
}
|
|
6359
6370
|
};
|
|
6360
6371
|
},
|
|
@@ -7657,7 +7668,7 @@ var SlashCommandExtension = Extension3.create({
|
|
|
7657
7668
|
import { ReactRenderer } from "@tiptap/react";
|
|
7658
7669
|
import {
|
|
7659
7670
|
forwardRef as forwardRef8,
|
|
7660
|
-
Fragment as
|
|
7671
|
+
Fragment as Fragment5,
|
|
7661
7672
|
useCallback as useCallback6,
|
|
7662
7673
|
useEffect as useEffect6,
|
|
7663
7674
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -7670,7 +7681,7 @@ import tippy from "tippy.js";
|
|
|
7670
7681
|
// src/editor/extensions/slash-command/slash-command-item.tsx
|
|
7671
7682
|
import { ChevronRightIcon } from "lucide-react";
|
|
7672
7683
|
import { useCallback as useCallback5, useState as useState7, useRef as useRef8, useEffect as useEffect5 } from "react";
|
|
7673
|
-
import { Fragment as
|
|
7684
|
+
import { Fragment as Fragment4, jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7674
7685
|
function SlashCommandItem(props) {
|
|
7675
7686
|
var _a;
|
|
7676
7687
|
const {
|
|
@@ -7693,7 +7704,7 @@ function SlashCommandItem(props) {
|
|
|
7693
7704
|
const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && (isHovered || isActive && !hoveredItemKey);
|
|
7694
7705
|
const hasRenderFunction = typeof item.render === "function";
|
|
7695
7706
|
const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
|
|
7696
|
-
let value = /* @__PURE__ */ jsxs19(
|
|
7707
|
+
let value = /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
7697
7708
|
/* @__PURE__ */ jsx35("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
|
|
7698
7709
|
/* @__PURE__ */ jsxs19("div", { className: "mly-grow", children: [
|
|
7699
7710
|
/* @__PURE__ */ jsx35("p", { className: "mly-font-medium", children: item.title }),
|
|
@@ -7752,7 +7763,7 @@ function SlashCommandItem(props) {
|
|
|
7752
7763
|
side: "right",
|
|
7753
7764
|
sideOffset: 10,
|
|
7754
7765
|
className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
|
|
7755
|
-
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ jsxs19(
|
|
7766
|
+
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
7756
7767
|
/* @__PURE__ */ jsx35("figure", { className: "mly-relative mly-aspect-[2.5] mly-w-full mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200", children: /* @__PURE__ */ jsx35(
|
|
7757
7768
|
"img",
|
|
7758
7769
|
{
|
|
@@ -7995,7 +8006,7 @@ var CommandList = forwardRef8((props, ref) => {
|
|
|
7995
8006
|
id: "slash-command",
|
|
7996
8007
|
ref: commandListContainer,
|
|
7997
8008
|
className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto",
|
|
7998
|
-
children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs20(
|
|
8009
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
7999
8010
|
/* @__PURE__ */ jsx36(
|
|
8000
8011
|
"span",
|
|
8001
8012
|
{
|
|
@@ -8151,10 +8162,11 @@ var VariableList = forwardRef9((props, ref) => {
|
|
|
8151
8162
|
{
|
|
8152
8163
|
items,
|
|
8153
8164
|
onSelectItem: (value) => {
|
|
8154
|
-
var _a2;
|
|
8165
|
+
var _a2, _b;
|
|
8155
8166
|
props.command({
|
|
8156
8167
|
id: value.name,
|
|
8157
|
-
required: (_a2 = value.required) != null ? _a2 : true
|
|
8168
|
+
required: (_a2 = value.required) != null ? _a2 : true,
|
|
8169
|
+
hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false
|
|
8158
8170
|
});
|
|
8159
8171
|
},
|
|
8160
8172
|
ref: popoverRef
|