@daisychainapp/maily-to-core 0.1.2 → 0.2.8
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/blocks/index.cjs +305 -0
- package/dist/blocks/index.cjs.map +1 -0
- package/dist/blocks/index.d.cts +59 -0
- package/dist/blocks/index.d.ts +3 -1
- package/dist/blocks/index.mjs +40 -26
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.cjs +6079 -0
- package/dist/extensions/index.cjs.map +1 -0
- package/dist/extensions/index.d.cts +425 -0
- package/dist/extensions/index.d.ts +237 -144
- package/dist/extensions/index.js +304 -155
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +3938 -2982
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +9057 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2358 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +61 -0
- package/dist/index.d.ts +1 -22
- package/dist/index.js +63 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5631 -4880
- package/dist/index.mjs.map +1 -1
- package/package.json +128 -50
- package/readme.md +91 -33
package/dist/extensions/index.js
CHANGED
|
@@ -1197,7 +1197,7 @@ var ColumnsExtension = import_core9.Node.create({
|
|
|
1197
1197
|
|
|
1198
1198
|
// src/editor/nodes/button/button.tsx
|
|
1199
1199
|
var import_core10 = require("@tiptap/core");
|
|
1200
|
-
var
|
|
1200
|
+
var import_react18 = require("@tiptap/react");
|
|
1201
1201
|
|
|
1202
1202
|
// src/editor/components/alignment-switch.tsx
|
|
1203
1203
|
var import_lucide_react = require("lucide-react");
|
|
@@ -3011,24 +3011,160 @@ function Select(props) {
|
|
|
3011
3011
|
}
|
|
3012
3012
|
|
|
3013
3013
|
// src/editor/nodes/button/button-view.tsx
|
|
3014
|
-
var
|
|
3014
|
+
var import_react16 = require("@tiptap/react");
|
|
3015
3015
|
|
|
3016
|
-
// src/editor/
|
|
3016
|
+
// src/editor/components/show-popover.tsx
|
|
3017
|
+
var import_lucide_react15 = require("lucide-react");
|
|
3017
3018
|
var import_react12 = require("react");
|
|
3019
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3020
|
+
function _ShowPopover(props) {
|
|
3021
|
+
const { showIfKey = "", onShowIfKeyValueChange, editor } = props;
|
|
3022
|
+
const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
3023
|
+
const [isUpdatingKey, setIsUpdatingKey] = (0, import_react12.useState)(false);
|
|
3024
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
3025
|
+
const autoCompleteOptions = (0, import_react12.useMemo)(() => {
|
|
3026
|
+
return processVariables(variables, {
|
|
3027
|
+
query: showIfKey || "",
|
|
3028
|
+
from: "bubble-variable",
|
|
3029
|
+
editor
|
|
3030
|
+
}).map((variable) => variable.name);
|
|
3031
|
+
}, [variables, showIfKey, editor]);
|
|
3032
|
+
const isValidWhenKey = showIfKey || autoCompleteOptions.includes(showIfKey);
|
|
3033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3034
|
+
Popover,
|
|
3035
|
+
{
|
|
3036
|
+
onOpenChange: (open) => {
|
|
3037
|
+
if (open) {
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
setIsUpdatingKey(false);
|
|
3041
|
+
},
|
|
3042
|
+
children: [
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3045
|
+
PopoverTrigger,
|
|
3046
|
+
{
|
|
3047
|
+
className: cn(
|
|
3048
|
+
"mly-flex mly-size-7 mly-items-center mly-justify-center mly-gap-1 mly-rounded-md mly-px-1.5 mly-text-sm data-[state=open]:mly-bg-soft-gray hover:mly-bg-soft-gray focus-visible:mly-relative focus-visible:mly-z-10 focus-visible:mly-outline-none focus-visible:mly-ring-2 focus-visible:mly-ring-gray-400 focus-visible:mly-ring-offset-2",
|
|
3049
|
+
showIfKey && "mly-bg-rose-100 mly-text-rose-800 data-[state=open]:mly-bg-rose-100 hover:mly-bg-rose-100"
|
|
3050
|
+
),
|
|
3051
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Eye, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5]" })
|
|
3052
|
+
}
|
|
3053
|
+
) }),
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { sideOffset: 8, children: "Show block conditionally" })
|
|
3055
|
+
] }),
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3057
|
+
PopoverContent,
|
|
3058
|
+
{
|
|
3059
|
+
className: "mly-flex mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
3060
|
+
side: "top",
|
|
3061
|
+
sideOffset: 8,
|
|
3062
|
+
align: "end",
|
|
3063
|
+
onOpenAutoFocus: (e) => {
|
|
3064
|
+
e.preventDefault();
|
|
3065
|
+
},
|
|
3066
|
+
onCloseAutoFocus: (e) => {
|
|
3067
|
+
e.preventDefault();
|
|
3068
|
+
},
|
|
3069
|
+
children: [
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1.5 mly-px-1.5 mly-text-sm mly-leading-none", children: [
|
|
3071
|
+
"Show if",
|
|
3072
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3074
|
+
import_lucide_react15.InfoIcon,
|
|
3075
|
+
{
|
|
3076
|
+
className: cn("mly-size-3 mly-stroke-[2.5] mly-text-gray-500")
|
|
3077
|
+
}
|
|
3078
|
+
) }),
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3080
|
+
TooltipContent,
|
|
3081
|
+
{
|
|
3082
|
+
sideOffset: 14,
|
|
3083
|
+
className: "mly-max-w-[285px]",
|
|
3084
|
+
align: "start",
|
|
3085
|
+
children: "Show the block if the selected variable is true."
|
|
3086
|
+
}
|
|
3087
|
+
)
|
|
3088
|
+
] })
|
|
3089
|
+
] }),
|
|
3090
|
+
!isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3091
|
+
"button",
|
|
3092
|
+
{
|
|
3093
|
+
onClick: () => {
|
|
3094
|
+
setIsUpdatingKey(true);
|
|
3095
|
+
setTimeout(() => {
|
|
3096
|
+
var _a;
|
|
3097
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
3098
|
+
}, 0);
|
|
3099
|
+
},
|
|
3100
|
+
children: renderVariable({
|
|
3101
|
+
variable: {
|
|
3102
|
+
name: showIfKey,
|
|
3103
|
+
valid: !!isValidWhenKey
|
|
3104
|
+
},
|
|
3105
|
+
fallback: "",
|
|
3106
|
+
from: "bubble-variable",
|
|
3107
|
+
editor
|
|
3108
|
+
})
|
|
3109
|
+
}
|
|
3110
|
+
),
|
|
3111
|
+
isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3112
|
+
"form",
|
|
3113
|
+
{
|
|
3114
|
+
onSubmit: (e) => {
|
|
3115
|
+
e.preventDefault();
|
|
3116
|
+
setIsUpdatingKey(false);
|
|
3117
|
+
},
|
|
3118
|
+
onKeyDown: (e) => {
|
|
3119
|
+
if (e.key === "Escape") {
|
|
3120
|
+
setIsUpdatingKey(false);
|
|
3121
|
+
}
|
|
3122
|
+
},
|
|
3123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3124
|
+
InputAutocomplete,
|
|
3125
|
+
{
|
|
3126
|
+
value: showIfKey || "",
|
|
3127
|
+
onValueChange: (value) => {
|
|
3128
|
+
onShowIfKeyValueChange == null ? void 0 : onShowIfKeyValueChange(value);
|
|
3129
|
+
},
|
|
3130
|
+
onOutsideClick: () => {
|
|
3131
|
+
setIsUpdatingKey(false);
|
|
3132
|
+
},
|
|
3133
|
+
onSelectOption: (value) => {
|
|
3134
|
+
onShowIfKeyValueChange == null ? void 0 : onShowIfKeyValueChange(value);
|
|
3135
|
+
setIsUpdatingKey(false);
|
|
3136
|
+
},
|
|
3137
|
+
autoCompleteOptions,
|
|
3138
|
+
ref: inputRef
|
|
3139
|
+
}
|
|
3140
|
+
)
|
|
3141
|
+
}
|
|
3142
|
+
)
|
|
3143
|
+
]
|
|
3144
|
+
}
|
|
3145
|
+
)
|
|
3146
|
+
]
|
|
3147
|
+
}
|
|
3148
|
+
);
|
|
3149
|
+
}
|
|
3150
|
+
var ShowPopover = (0, import_react12.memo)(_ShowPopover);
|
|
3151
|
+
|
|
3152
|
+
// src/editor/nodes/button/button-label-input.tsx
|
|
3018
3153
|
var import_react13 = require("react");
|
|
3019
3154
|
var import_react14 = require("react");
|
|
3020
|
-
var
|
|
3155
|
+
var import_react15 = require("react");
|
|
3156
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3021
3157
|
function ButtonLabelInput(props) {
|
|
3022
3158
|
const { value, onValueChange, isVariable, editor } = props;
|
|
3023
|
-
const linkInputRef = (0,
|
|
3024
|
-
const [isEditing, setIsEditing] = (0,
|
|
3159
|
+
const linkInputRef = (0, import_react15.useRef)(null);
|
|
3160
|
+
const [isEditing, setIsEditing] = (0, import_react14.useState)(!isVariable);
|
|
3025
3161
|
const {
|
|
3026
3162
|
variables = [],
|
|
3027
3163
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
3028
3164
|
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
3029
3165
|
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
3030
3166
|
} = useMailyContext();
|
|
3031
|
-
const autoCompleteOptions = (0,
|
|
3167
|
+
const autoCompleteOptions = (0, import_react13.useMemo)(() => {
|
|
3032
3168
|
const withoutTrigger = value.replace(
|
|
3033
3169
|
new RegExp(variableTriggerCharacter, "g"),
|
|
3034
3170
|
""
|
|
@@ -3039,8 +3175,8 @@ function ButtonLabelInput(props) {
|
|
|
3039
3175
|
editor
|
|
3040
3176
|
}).map((variable) => variable.name);
|
|
3041
3177
|
}, [variables, value, editor]);
|
|
3042
|
-
return /* @__PURE__ */ (0,
|
|
3043
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
3178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
3179
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3044
3180
|
"button",
|
|
3045
3181
|
{
|
|
3046
3182
|
onClick: () => {
|
|
@@ -3061,7 +3197,7 @@ function ButtonLabelInput(props) {
|
|
|
3061
3197
|
})
|
|
3062
3198
|
}
|
|
3063
3199
|
),
|
|
3064
|
-
isEditing && /* @__PURE__ */ (0,
|
|
3200
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3065
3201
|
InputAutocomplete,
|
|
3066
3202
|
{
|
|
3067
3203
|
value,
|
|
@@ -3087,8 +3223,8 @@ function ButtonLabelInput(props) {
|
|
|
3087
3223
|
}
|
|
3088
3224
|
|
|
3089
3225
|
// src/editor/nodes/button/button-view.tsx
|
|
3090
|
-
var
|
|
3091
|
-
var
|
|
3226
|
+
var import_react17 = require("react");
|
|
3227
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3092
3228
|
function ButtonView(props) {
|
|
3093
3229
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
3094
3230
|
const {
|
|
@@ -3108,7 +3244,7 @@ function ButtonView(props) {
|
|
|
3108
3244
|
paddingLeft
|
|
3109
3245
|
} = node.attrs;
|
|
3110
3246
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
3111
|
-
const sizes = (0,
|
|
3247
|
+
const sizes = (0, import_react17.useMemo)(
|
|
3112
3248
|
() => ({
|
|
3113
3249
|
small: {
|
|
3114
3250
|
paddingX: 24,
|
|
@@ -3125,14 +3261,14 @@ function ButtonView(props) {
|
|
|
3125
3261
|
}),
|
|
3126
3262
|
[]
|
|
3127
3263
|
);
|
|
3128
|
-
const size = (0,
|
|
3264
|
+
const size = (0, import_react17.useMemo)(() => {
|
|
3129
3265
|
var _a;
|
|
3130
3266
|
return (_a = Object.entries(sizes).find(
|
|
3131
3267
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
3132
3268
|
)) == null ? void 0 : _a[0];
|
|
3133
3269
|
}, [paddingRight, paddingTop, sizes]);
|
|
3134
|
-
return /* @__PURE__ */ (0,
|
|
3135
|
-
|
|
3270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3271
|
+
import_react16.NodeViewWrapper,
|
|
3136
3272
|
{
|
|
3137
3273
|
draggable: editor.isEditable,
|
|
3138
3274
|
"data-drag-handle": editor.isEditable,
|
|
@@ -3140,8 +3276,8 @@ function ButtonView(props) {
|
|
|
3140
3276
|
style: {
|
|
3141
3277
|
textAlign: alignment
|
|
3142
3278
|
},
|
|
3143
|
-
children: /* @__PURE__ */ (0,
|
|
3144
|
-
/* @__PURE__ */ (0,
|
|
3279
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
3280
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3145
3281
|
"button",
|
|
3146
3282
|
{
|
|
3147
3283
|
className: cn(
|
|
@@ -3184,7 +3320,7 @@ function ButtonView(props) {
|
|
|
3184
3320
|
}) : text2
|
|
3185
3321
|
}
|
|
3186
3322
|
) }) }),
|
|
3187
|
-
/* @__PURE__ */ (0,
|
|
3323
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3188
3324
|
PopoverContent,
|
|
3189
3325
|
{
|
|
3190
3326
|
align: "end",
|
|
@@ -3193,8 +3329,8 @@ function ButtonView(props) {
|
|
|
3193
3329
|
sideOffset: 8,
|
|
3194
3330
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3195
3331
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
3196
|
-
children: /* @__PURE__ */ (0,
|
|
3197
|
-
/* @__PURE__ */ (0,
|
|
3332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3198
3334
|
ButtonLabelInput,
|
|
3199
3335
|
{
|
|
3200
3336
|
value: text2,
|
|
@@ -3208,9 +3344,9 @@ function ButtonView(props) {
|
|
|
3208
3344
|
editor
|
|
3209
3345
|
}
|
|
3210
3346
|
),
|
|
3211
|
-
/* @__PURE__ */ (0,
|
|
3212
|
-
/* @__PURE__ */ (0,
|
|
3213
|
-
/* @__PURE__ */ (0,
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3214
3350
|
Select,
|
|
3215
3351
|
{
|
|
3216
3352
|
label: "Border Radius",
|
|
@@ -3228,7 +3364,7 @@ function ButtonView(props) {
|
|
|
3228
3364
|
className: "mly-capitalize"
|
|
3229
3365
|
}
|
|
3230
3366
|
),
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3232
3368
|
Select,
|
|
3233
3369
|
{
|
|
3234
3370
|
label: "Style",
|
|
@@ -3246,7 +3382,7 @@ function ButtonView(props) {
|
|
|
3246
3382
|
className: "mly-capitalize"
|
|
3247
3383
|
}
|
|
3248
3384
|
),
|
|
3249
|
-
/* @__PURE__ */ (0,
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3250
3386
|
Select,
|
|
3251
3387
|
{
|
|
3252
3388
|
label: "Size",
|
|
@@ -3269,9 +3405,9 @@ function ButtonView(props) {
|
|
|
3269
3405
|
}
|
|
3270
3406
|
)
|
|
3271
3407
|
] }),
|
|
3272
|
-
/* @__PURE__ */ (0,
|
|
3273
|
-
/* @__PURE__ */ (0,
|
|
3274
|
-
/* @__PURE__ */ (0,
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3410
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3275
3411
|
AlignmentSwitch,
|
|
3276
3412
|
{
|
|
3277
3413
|
alignment,
|
|
@@ -3282,7 +3418,7 @@ function ButtonView(props) {
|
|
|
3282
3418
|
}
|
|
3283
3419
|
}
|
|
3284
3420
|
),
|
|
3285
|
-
/* @__PURE__ */ (0,
|
|
3421
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3286
3422
|
LinkInputPopover,
|
|
3287
3423
|
{
|
|
3288
3424
|
defaultValue: externalLink || "",
|
|
@@ -3298,9 +3434,9 @@ function ButtonView(props) {
|
|
|
3298
3434
|
}
|
|
3299
3435
|
)
|
|
3300
3436
|
] }),
|
|
3301
|
-
/* @__PURE__ */ (0,
|
|
3302
|
-
/* @__PURE__ */ (0,
|
|
3303
|
-
/* @__PURE__ */ (0,
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3304
3440
|
BackgroundColorPickerPopup,
|
|
3305
3441
|
{
|
|
3306
3442
|
variant,
|
|
@@ -3312,7 +3448,7 @@ function ButtonView(props) {
|
|
|
3312
3448
|
}
|
|
3313
3449
|
}
|
|
3314
3450
|
),
|
|
3315
|
-
/* @__PURE__ */ (0,
|
|
3451
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3316
3452
|
TextColorPickerPopup,
|
|
3317
3453
|
{
|
|
3318
3454
|
color: textColor,
|
|
@@ -3323,7 +3459,20 @@ function ButtonView(props) {
|
|
|
3323
3459
|
}
|
|
3324
3460
|
}
|
|
3325
3461
|
)
|
|
3326
|
-
] })
|
|
3462
|
+
] }),
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3465
|
+
ShowPopover,
|
|
3466
|
+
{
|
|
3467
|
+
showIfKey,
|
|
3468
|
+
onShowIfKeyValueChange: (value) => {
|
|
3469
|
+
updateAttributes2({
|
|
3470
|
+
showIfKey: value
|
|
3471
|
+
});
|
|
3472
|
+
},
|
|
3473
|
+
editor
|
|
3474
|
+
}
|
|
3475
|
+
)
|
|
3327
3476
|
] }) })
|
|
3328
3477
|
}
|
|
3329
3478
|
)
|
|
@@ -3333,20 +3482,20 @@ function ButtonView(props) {
|
|
|
3333
3482
|
}
|
|
3334
3483
|
function BackgroundColorPickerPopup(props) {
|
|
3335
3484
|
const { color, onChange, variant } = props;
|
|
3336
|
-
return /* @__PURE__ */ (0,
|
|
3485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3337
3486
|
ColorPicker,
|
|
3338
3487
|
{
|
|
3339
3488
|
color,
|
|
3340
3489
|
onColorChange: onChange,
|
|
3341
3490
|
tooltip: "Background Color",
|
|
3342
|
-
children: /* @__PURE__ */ (0,
|
|
3491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3343
3492
|
BaseButton,
|
|
3344
3493
|
{
|
|
3345
3494
|
variant: "ghost",
|
|
3346
3495
|
size: "sm",
|
|
3347
3496
|
type: "button",
|
|
3348
3497
|
className: "mly-size-7",
|
|
3349
|
-
children: /* @__PURE__ */ (0,
|
|
3498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3350
3499
|
"div",
|
|
3351
3500
|
{
|
|
3352
3501
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded-full mly-shadow",
|
|
@@ -3365,16 +3514,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
3365
3514
|
}
|
|
3366
3515
|
function TextColorPickerPopup(props) {
|
|
3367
3516
|
const { color, onChange } = props;
|
|
3368
|
-
return /* @__PURE__ */ (0,
|
|
3517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3369
3518
|
BaseButton,
|
|
3370
3519
|
{
|
|
3371
3520
|
variant: "ghost",
|
|
3372
3521
|
size: "sm",
|
|
3373
3522
|
type: "button",
|
|
3374
3523
|
className: "mly-size-7",
|
|
3375
|
-
children: /* @__PURE__ */ (0,
|
|
3376
|
-
/* @__PURE__ */ (0,
|
|
3377
|
-
/* @__PURE__ */ (0,
|
|
3524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-midnight-gray", children: "A" }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3378
3527
|
"div",
|
|
3379
3528
|
{
|
|
3380
3529
|
className: "mly-h-[2px] mly-w-3 mly-shrink-0 mly-rounded-md mly-shadow",
|
|
@@ -3613,7 +3762,7 @@ var ButtonExtension = import_core10.Node.create({
|
|
|
3613
3762
|
};
|
|
3614
3763
|
},
|
|
3615
3764
|
addNodeView() {
|
|
3616
|
-
return (0,
|
|
3765
|
+
return (0, import_react18.ReactNodeViewRenderer)(ButtonView, {
|
|
3617
3766
|
contentDOMElementTag: "div",
|
|
3618
3767
|
className: "mly-relative"
|
|
3619
3768
|
});
|
|
@@ -3622,21 +3771,21 @@ var ButtonExtension = import_core10.Node.create({
|
|
|
3622
3771
|
|
|
3623
3772
|
// src/editor/nodes/logo/logo.ts
|
|
3624
3773
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
3625
|
-
var
|
|
3774
|
+
var import_react25 = require("@tiptap/react");
|
|
3626
3775
|
|
|
3627
3776
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3628
|
-
var
|
|
3629
|
-
var import_react22 = require("react");
|
|
3777
|
+
var import_react22 = require("@tiptap/react");
|
|
3630
3778
|
var import_react23 = require("react");
|
|
3779
|
+
var import_react24 = require("react");
|
|
3631
3780
|
|
|
3632
3781
|
// src/editor/utils/use-event.ts
|
|
3633
|
-
var
|
|
3782
|
+
var import_react19 = require("react");
|
|
3634
3783
|
var useEvent = (handler) => {
|
|
3635
|
-
const handlerRef = (0,
|
|
3636
|
-
(0,
|
|
3784
|
+
const handlerRef = (0, import_react19.useRef)(null);
|
|
3785
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
3637
3786
|
handlerRef.current = handler;
|
|
3638
3787
|
}, [handler]);
|
|
3639
|
-
return (0,
|
|
3788
|
+
return (0, import_react19.useCallback)((...args) => {
|
|
3640
3789
|
if (handlerRef.current === null) {
|
|
3641
3790
|
throw new Error("Handler is not assigned");
|
|
3642
3791
|
}
|
|
@@ -3645,18 +3794,18 @@ var useEvent = (handler) => {
|
|
|
3645
3794
|
};
|
|
3646
3795
|
|
|
3647
3796
|
// src/editor/nodes/image/image-view.tsx
|
|
3648
|
-
var
|
|
3649
|
-
var
|
|
3650
|
-
var
|
|
3651
|
-
var
|
|
3797
|
+
var import_react20 = require("@tiptap/react");
|
|
3798
|
+
var import_lucide_react16 = require("lucide-react");
|
|
3799
|
+
var import_react21 = require("react");
|
|
3800
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3652
3801
|
var MIN_WIDTH = 20;
|
|
3653
3802
|
var MAX_WIDTH = 600;
|
|
3654
3803
|
function ImageView(props) {
|
|
3655
3804
|
const { node, updateAttributes: updateAttributes2, selected, editor } = props;
|
|
3656
|
-
const [status, setStatus] = (0,
|
|
3657
|
-
const wrapperRef = (0,
|
|
3658
|
-
const imgRef = (0,
|
|
3659
|
-
const [resizingStyle, setResizingStyle] = (0,
|
|
3805
|
+
const [status, setStatus] = (0, import_react21.useState)("idle");
|
|
3806
|
+
const wrapperRef = (0, import_react21.useRef)(null);
|
|
3807
|
+
const imgRef = (0, import_react21.useRef)(null);
|
|
3808
|
+
const [resizingStyle, setResizingStyle] = (0, import_react21.useState)();
|
|
3660
3809
|
const handleMouseDown = useEvent(
|
|
3661
3810
|
(event) => {
|
|
3662
3811
|
const imageParent = document.querySelector(
|
|
@@ -3699,7 +3848,7 @@ function ImageView(props) {
|
|
|
3699
3848
|
}
|
|
3700
3849
|
);
|
|
3701
3850
|
function dragCornerButton(direction) {
|
|
3702
|
-
return /* @__PURE__ */ (0,
|
|
3851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3703
3852
|
"div",
|
|
3704
3853
|
{
|
|
3705
3854
|
role: "button",
|
|
@@ -3730,7 +3879,7 @@ function ImageView(props) {
|
|
|
3730
3879
|
"showIfKey"
|
|
3731
3880
|
]);
|
|
3732
3881
|
const hasImageSrc = !!attrs.src;
|
|
3733
|
-
(0,
|
|
3882
|
+
(0, import_react21.useEffect)(() => {
|
|
3734
3883
|
if (!src) {
|
|
3735
3884
|
return;
|
|
3736
3885
|
}
|
|
@@ -3764,8 +3913,8 @@ function ImageView(props) {
|
|
|
3764
3913
|
img.onerror = null;
|
|
3765
3914
|
};
|
|
3766
3915
|
}, [src]);
|
|
3767
|
-
return /* @__PURE__ */ (0,
|
|
3768
|
-
|
|
3916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3917
|
+
import_react20.NodeViewWrapper,
|
|
3769
3918
|
{
|
|
3770
3919
|
as: "div",
|
|
3771
3920
|
draggable: editor.isEditable,
|
|
@@ -3786,12 +3935,12 @@ function ImageView(props) {
|
|
|
3786
3935
|
}[alignment] || {}),
|
|
3787
3936
|
ref: wrapperRef,
|
|
3788
3937
|
children: [
|
|
3789
|
-
!hasImageSrc && /* @__PURE__ */ (0,
|
|
3790
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
3791
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3792
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3793
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3794
|
-
/* @__PURE__ */ (0,
|
|
3938
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "idle", minHeight: height }),
|
|
3939
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "variable", minHeight: height }),
|
|
3940
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "loading", minHeight: height }),
|
|
3941
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "error", minHeight: height }),
|
|
3942
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3795
3944
|
"img",
|
|
3796
3945
|
__spreadProps(__spreadValues({}, attrs), {
|
|
3797
3946
|
ref: imgRef,
|
|
@@ -3802,13 +3951,13 @@ function ImageView(props) {
|
|
|
3802
3951
|
draggable: editor.isEditable
|
|
3803
3952
|
})
|
|
3804
3953
|
),
|
|
3805
|
-
selected && editor.isEditable && /* @__PURE__ */ (0,
|
|
3954
|
+
selected && editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3806
3955
|
[
|
|
3807
3956
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
3808
3957
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
3809
3958
|
{ top: 0, left: 0, width: "100%", height: "1px" },
|
|
3810
3959
|
{ bottom: 0, left: 0, width: "100%", height: "1px" }
|
|
3811
|
-
].map((style, i) => /* @__PURE__ */ (0,
|
|
3960
|
+
].map((style, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3812
3961
|
"div",
|
|
3813
3962
|
{
|
|
3814
3963
|
className: "mly-bg-rose-500",
|
|
@@ -3830,7 +3979,7 @@ function ImageView(props) {
|
|
|
3830
3979
|
}
|
|
3831
3980
|
function ImageStatusLabel(props) {
|
|
3832
3981
|
const { status, minHeight } = props;
|
|
3833
|
-
return /* @__PURE__ */ (0,
|
|
3982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3834
3983
|
"div",
|
|
3835
3984
|
{
|
|
3836
3985
|
className: cn(
|
|
@@ -3844,21 +3993,21 @@ function ImageStatusLabel(props) {
|
|
|
3844
3993
|
minHeight
|
|
3845
3994
|
} : {}),
|
|
3846
3995
|
children: [
|
|
3847
|
-
status === "idle" && /* @__PURE__ */ (0,
|
|
3848
|
-
/* @__PURE__ */ (0,
|
|
3849
|
-
/* @__PURE__ */ (0,
|
|
3996
|
+
status === "idle" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.ImageOffIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "No image selected" })
|
|
3850
3999
|
] }),
|
|
3851
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
3852
|
-
/* @__PURE__ */ (0,
|
|
3853
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Loader2, { className: "mly-size-4 mly-animate-spin mly-stroke-[2.5]" }),
|
|
4002
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Loading image..." })
|
|
3854
4003
|
] }),
|
|
3855
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
3856
|
-
/* @__PURE__ */ (0,
|
|
3857
|
-
/* @__PURE__ */ (0,
|
|
4004
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Ban, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
4006
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Error loading image" })
|
|
3858
4007
|
] }),
|
|
3859
|
-
status === "variable" && /* @__PURE__ */ (0,
|
|
3860
|
-
/* @__PURE__ */ (0,
|
|
3861
|
-
/* @__PURE__ */ (0,
|
|
4008
|
+
status === "variable" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.BracesIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
4010
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Variable Image URL" })
|
|
3862
4011
|
] })
|
|
3863
4012
|
]
|
|
3864
4013
|
}
|
|
@@ -3866,10 +4015,10 @@ function ImageStatusLabel(props) {
|
|
|
3866
4015
|
}
|
|
3867
4016
|
|
|
3868
4017
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3869
|
-
var
|
|
4018
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3870
4019
|
function LogoView(props) {
|
|
3871
4020
|
const { node, editor } = props;
|
|
3872
|
-
const [status, setStatus] = (0,
|
|
4021
|
+
const [status, setStatus] = (0, import_react24.useState)("idle");
|
|
3873
4022
|
let {
|
|
3874
4023
|
alignment = "center",
|
|
3875
4024
|
src: logoSrc,
|
|
@@ -3877,7 +4026,7 @@ function LogoView(props) {
|
|
|
3877
4026
|
size = "sm"
|
|
3878
4027
|
} = node.attrs || {};
|
|
3879
4028
|
const hasImageSrc = !!logoSrc;
|
|
3880
|
-
(0,
|
|
4029
|
+
(0, import_react23.useEffect)(() => {
|
|
3881
4030
|
if (!logoSrc) {
|
|
3882
4031
|
return;
|
|
3883
4032
|
}
|
|
@@ -3897,8 +4046,8 @@ function LogoView(props) {
|
|
|
3897
4046
|
};
|
|
3898
4047
|
}, [logoSrc]);
|
|
3899
4048
|
const logoSize = logoSizes[size];
|
|
3900
|
-
return /* @__PURE__ */ (0,
|
|
3901
|
-
|
|
4049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4050
|
+
import_react22.NodeViewWrapper,
|
|
3902
4051
|
{
|
|
3903
4052
|
as: "div",
|
|
3904
4053
|
draggable: editor.isEditable,
|
|
@@ -3911,11 +4060,11 @@ function LogoView(props) {
|
|
|
3911
4060
|
display: "block"
|
|
3912
4061
|
},
|
|
3913
4062
|
children: [
|
|
3914
|
-
!hasImageSrc && /* @__PURE__ */ (0,
|
|
3915
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
3916
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3917
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3918
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
4063
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "idle", minHeight: logoSize }),
|
|
4064
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "variable", minHeight: logoSize }),
|
|
4065
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "loading", minHeight: logoSize }),
|
|
4066
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "error", minHeight: logoSize }),
|
|
4067
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3919
4068
|
"img",
|
|
3920
4069
|
{
|
|
3921
4070
|
src: logoSrc,
|
|
@@ -4035,7 +4184,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
4035
4184
|
];
|
|
4036
4185
|
},
|
|
4037
4186
|
addNodeView() {
|
|
4038
|
-
return (0,
|
|
4187
|
+
return (0, import_react25.ReactNodeViewRenderer)(LogoView, {
|
|
4039
4188
|
className: "mly-relative"
|
|
4040
4189
|
});
|
|
4041
4190
|
}
|
|
@@ -4043,7 +4192,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
4043
4192
|
|
|
4044
4193
|
// src/editor/nodes/image/image.ts
|
|
4045
4194
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
4046
|
-
var
|
|
4195
|
+
var import_react26 = require("@tiptap/react");
|
|
4047
4196
|
var ImageExtension = import_extension_image2.default.extend({
|
|
4048
4197
|
addAttributes() {
|
|
4049
4198
|
var _a;
|
|
@@ -4135,7 +4284,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
4135
4284
|
});
|
|
4136
4285
|
},
|
|
4137
4286
|
addNodeView() {
|
|
4138
|
-
return (0,
|
|
4287
|
+
return (0, import_react26.ReactNodeViewRenderer)(ImageView, {
|
|
4139
4288
|
className: "mly-relative"
|
|
4140
4289
|
});
|
|
4141
4290
|
}
|
|
@@ -4212,24 +4361,24 @@ var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
|
4212
4361
|
|
|
4213
4362
|
// src/editor/nodes/repeat/repeat.ts
|
|
4214
4363
|
var import_core11 = require("@tiptap/core");
|
|
4215
|
-
var
|
|
4364
|
+
var import_react28 = require("@tiptap/react");
|
|
4216
4365
|
|
|
4217
4366
|
// src/editor/nodes/repeat/repeat-view.tsx
|
|
4218
|
-
var
|
|
4219
|
-
var
|
|
4220
|
-
var
|
|
4367
|
+
var import_react27 = require("@tiptap/react");
|
|
4368
|
+
var import_lucide_react17 = require("lucide-react");
|
|
4369
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4221
4370
|
function RepeatView(props) {
|
|
4222
4371
|
const { editor, getPos } = props;
|
|
4223
|
-
return /* @__PURE__ */ (0,
|
|
4224
|
-
|
|
4372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4373
|
+
import_react27.NodeViewWrapper,
|
|
4225
4374
|
{
|
|
4226
4375
|
"data-type": "repeat",
|
|
4227
4376
|
draggable: editor.isEditable,
|
|
4228
4377
|
"data-drag-handle": editor.isEditable,
|
|
4229
4378
|
className: "mly-relative",
|
|
4230
4379
|
children: [
|
|
4231
|
-
/* @__PURE__ */ (0,
|
|
4232
|
-
/* @__PURE__ */ (0,
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react27.NodeViewContent, { className: "is-editable" }),
|
|
4381
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4233
4382
|
"div",
|
|
4234
4383
|
{
|
|
4235
4384
|
role: "button",
|
|
@@ -4240,8 +4389,8 @@ function RepeatView(props) {
|
|
|
4240
4389
|
editor.commands.setNodeSelection(getPos());
|
|
4241
4390
|
},
|
|
4242
4391
|
children: [
|
|
4243
|
-
/* @__PURE__ */ (0,
|
|
4244
|
-
/* @__PURE__ */ (0,
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
4245
4394
|
]
|
|
4246
4395
|
}
|
|
4247
4396
|
)
|
|
@@ -4325,7 +4474,7 @@ var RepeatExtension = import_core11.Node.create({
|
|
|
4325
4474
|
};
|
|
4326
4475
|
},
|
|
4327
4476
|
addNodeView() {
|
|
4328
|
-
return (0,
|
|
4477
|
+
return (0, import_react28.ReactNodeViewRenderer)(RepeatView, {
|
|
4329
4478
|
contentDOMElementTag: "div",
|
|
4330
4479
|
className: "mly-relative"
|
|
4331
4480
|
});
|
|
@@ -4464,16 +4613,16 @@ var SlashCommandExtension = import_core13.Extension.create({
|
|
|
4464
4613
|
});
|
|
4465
4614
|
|
|
4466
4615
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
4467
|
-
var
|
|
4468
|
-
var
|
|
4616
|
+
var import_react29 = require("@tiptap/react");
|
|
4617
|
+
var import_react30 = require("react");
|
|
4469
4618
|
var import_tippy = __toESM(require("tippy.js"));
|
|
4470
|
-
var
|
|
4471
|
-
var
|
|
4472
|
-
var CommandList = (0,
|
|
4619
|
+
var import_lucide_react18 = require("lucide-react");
|
|
4620
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4621
|
+
var CommandList = (0, import_react30.forwardRef)(function CommandList2(props, ref) {
|
|
4473
4622
|
const { items: groups, command, editor } = props;
|
|
4474
|
-
const [selectedGroupIndex, setSelectedGroupIndex] = (0,
|
|
4475
|
-
const [selectedCommandIndex, setSelectedCommandIndex] = (0,
|
|
4476
|
-
const selectItem = (0,
|
|
4623
|
+
const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react30.useState)(0);
|
|
4624
|
+
const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react30.useState)(0);
|
|
4625
|
+
const selectItem = (0, import_react30.useCallback)(
|
|
4477
4626
|
(groupIndex, commandIndex) => {
|
|
4478
4627
|
const item = groups[groupIndex].commands[commandIndex];
|
|
4479
4628
|
if (!item) {
|
|
@@ -4483,7 +4632,7 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4483
4632
|
},
|
|
4484
4633
|
[command]
|
|
4485
4634
|
);
|
|
4486
|
-
(0,
|
|
4635
|
+
(0, import_react30.useImperativeHandle)(ref, () => ({
|
|
4487
4636
|
onKeyDown: ({ event }) => {
|
|
4488
4637
|
var _a, _b;
|
|
4489
4638
|
const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
|
|
@@ -4535,13 +4684,13 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4535
4684
|
}
|
|
4536
4685
|
}
|
|
4537
4686
|
}));
|
|
4538
|
-
(0,
|
|
4687
|
+
(0, import_react30.useEffect)(() => {
|
|
4539
4688
|
setSelectedGroupIndex(0);
|
|
4540
4689
|
setSelectedCommandIndex(0);
|
|
4541
4690
|
}, [groups]);
|
|
4542
|
-
const commandListContainer = (0,
|
|
4543
|
-
const activeCommandRef = (0,
|
|
4544
|
-
(0,
|
|
4691
|
+
const commandListContainer = (0, import_react30.useRef)(null);
|
|
4692
|
+
const activeCommandRef = (0, import_react30.useRef)(null);
|
|
4693
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
4545
4694
|
const container = commandListContainer == null ? void 0 : commandListContainer.current;
|
|
4546
4695
|
const activeCommandContainer = activeCommandRef == null ? void 0 : activeCommandRef.current;
|
|
4547
4696
|
if (!container || !activeCommandContainer) {
|
|
@@ -4555,15 +4704,15 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4555
4704
|
commandListContainer,
|
|
4556
4705
|
activeCommandRef
|
|
4557
4706
|
]);
|
|
4558
|
-
return groups.length > 0 ? /* @__PURE__ */ (0,
|
|
4559
|
-
/* @__PURE__ */ (0,
|
|
4707
|
+
return groups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-z-50 mly-w-72 mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200 mly-bg-white mly-shadow-md mly-transition-all", children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4560
4709
|
"div",
|
|
4561
4710
|
{
|
|
4562
4711
|
id: "slash-command",
|
|
4563
4712
|
ref: commandListContainer,
|
|
4564
4713
|
className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto mly-scroll-smooth",
|
|
4565
|
-
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0,
|
|
4566
|
-
/* @__PURE__ */ (0,
|
|
4714
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react30.Fragment, { children: [
|
|
4715
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4567
4716
|
"span",
|
|
4568
4717
|
{
|
|
4569
4718
|
className: cn(
|
|
@@ -4573,26 +4722,26 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4573
4722
|
children: group.title
|
|
4574
4723
|
}
|
|
4575
4724
|
),
|
|
4576
|
-
/* @__PURE__ */ (0,
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-space-y-0.5 mly-p-1", children: group.commands.map((item, commandIndex) => {
|
|
4577
4726
|
var _a;
|
|
4578
4727
|
const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
|
|
4579
4728
|
const isSubCommand = "commands" in item;
|
|
4580
4729
|
const hasRenderFunction = typeof item.render === "function";
|
|
4581
4730
|
const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
|
|
4582
|
-
let value = /* @__PURE__ */ (0,
|
|
4583
|
-
/* @__PURE__ */ (0,
|
|
4584
|
-
/* @__PURE__ */ (0,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
4731
|
+
let value = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
|
|
4733
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-grow", children: [
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-font-medium", children: item.title }),
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-text-xs mly-text-gray-400", children: item.description })
|
|
4587
4736
|
] }),
|
|
4588
|
-
isSubCommand && /* @__PURE__ */ (0,
|
|
4737
|
+
isSubCommand && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly-block mly-px-1 mly-text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react18.ChevronRightIcon, { className: "mly-size-3.5 mly-stroke-[2.5]" }) })
|
|
4589
4738
|
] });
|
|
4590
4739
|
if (renderFunctionValue !== null && renderFunctionValue !== true) {
|
|
4591
4740
|
value = renderFunctionValue;
|
|
4592
4741
|
}
|
|
4593
4742
|
const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && isActive;
|
|
4594
|
-
return /* @__PURE__ */ (0,
|
|
4595
|
-
/* @__PURE__ */ (0,
|
|
4743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { open: shouldOpenTooltip, children: [
|
|
4744
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4596
4745
|
"button",
|
|
4597
4746
|
{
|
|
4598
4747
|
className: cn(
|
|
@@ -4605,14 +4754,14 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4605
4754
|
children: value
|
|
4606
4755
|
}
|
|
4607
4756
|
) }),
|
|
4608
|
-
/* @__PURE__ */ (0,
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4609
4758
|
TooltipContent,
|
|
4610
4759
|
{
|
|
4611
4760
|
side: "right",
|
|
4612
4761
|
sideOffset: 10,
|
|
4613
4762
|
className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
|
|
4614
|
-
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0,
|
|
4615
|
-
/* @__PURE__ */ (0,
|
|
4763
|
+
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4764
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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__ */ (0, import_jsx_runtime35.jsx)(
|
|
4616
4765
|
"img",
|
|
4617
4766
|
{
|
|
4618
4767
|
src: item == null ? void 0 : item.preview,
|
|
@@ -4620,7 +4769,7 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4620
4769
|
className: "mly-absolute mly-inset-0 mly-h-full mly-w-full mly-object-cover"
|
|
4621
4770
|
}
|
|
4622
4771
|
) }),
|
|
4623
|
-
/* @__PURE__ */ (0,
|
|
4772
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-mt-2 mly-px-0.5 mly-text-gray-500", children: item.description })
|
|
4624
4773
|
] })
|
|
4625
4774
|
}
|
|
4626
4775
|
)
|
|
@@ -4629,16 +4778,16 @@ var CommandList = (0, import_react29.forwardRef)(function CommandList2(props, re
|
|
|
4629
4778
|
] }, groupIndex))
|
|
4630
4779
|
}
|
|
4631
4780
|
),
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
4633
|
-
/* @__PURE__ */ (0,
|
|
4634
|
-
/* @__PURE__ */ (0,
|
|
4635
|
-
/* @__PURE__ */ (0,
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-border-t mly-border-gray-200 mly-px-1 mly-py-3 mly-pl-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-flex mly-items-center", children: [
|
|
4782
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2191" }),
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-ml-1 mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2193" }),
|
|
4636
4785
|
" ",
|
|
4637
4786
|
"to navigate"
|
|
4638
4787
|
] }),
|
|
4639
|
-
/* @__PURE__ */ (0,
|
|
4640
|
-
/* @__PURE__ */ (0,
|
|
4641
|
-
/* @__PURE__ */ (0,
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", className: "mly-select-none mly-px-1", children: "\xB7" }),
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-1.5 mly-font-medium", children: "Enter" }),
|
|
4642
4791
|
" ",
|
|
4643
4792
|
"to select"
|
|
4644
4793
|
] })
|
|
@@ -4727,7 +4876,7 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
|
4727
4876
|
let popup = null;
|
|
4728
4877
|
return {
|
|
4729
4878
|
onStart: (props) => {
|
|
4730
|
-
component = new
|
|
4879
|
+
component = new import_react29.ReactRenderer(CommandList, {
|
|
4731
4880
|
props,
|
|
4732
4881
|
editor: props.editor
|
|
4733
4882
|
});
|
|
@@ -4769,7 +4918,7 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
|
4769
4918
|
// src/editor/nodes/variable/variable.ts
|
|
4770
4919
|
var import_core14 = require("@tiptap/core");
|
|
4771
4920
|
var import_state3 = require("@tiptap/pm/state");
|
|
4772
|
-
var
|
|
4921
|
+
var import_react31 = require("@tiptap/react");
|
|
4773
4922
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"));
|
|
4774
4923
|
var VariablePluginKey = new import_state3.PluginKey("variable");
|
|
4775
4924
|
var VariableExtension = import_core14.Node.create({
|
|
@@ -4927,7 +5076,7 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4927
5076
|
];
|
|
4928
5077
|
},
|
|
4929
5078
|
addNodeView() {
|
|
4930
|
-
return (0,
|
|
5079
|
+
return (0, import_react31.ReactNodeViewRenderer)(VariableView, {
|
|
4931
5080
|
className: "mly-relative mly-inline-block",
|
|
4932
5081
|
as: "div"
|
|
4933
5082
|
});
|
|
@@ -4935,14 +5084,14 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4935
5084
|
});
|
|
4936
5085
|
|
|
4937
5086
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
4938
|
-
var
|
|
4939
|
-
var
|
|
5087
|
+
var import_react32 = require("@tiptap/react");
|
|
5088
|
+
var import_react33 = require("react");
|
|
4940
5089
|
var import_tippy2 = __toESM(require("tippy.js"));
|
|
4941
|
-
var
|
|
4942
|
-
var VariableList = (0,
|
|
5090
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5091
|
+
var VariableList = (0, import_react33.forwardRef)((props, ref) => {
|
|
4943
5092
|
const { items = [] } = props;
|
|
4944
|
-
const popoverRef = (0,
|
|
4945
|
-
(0,
|
|
5093
|
+
const popoverRef = (0, import_react33.useRef)(null);
|
|
5094
|
+
(0, import_react33.useImperativeHandle)(ref, () => ({
|
|
4946
5095
|
onKeyDown: ({ event }) => {
|
|
4947
5096
|
if (!popoverRef.current) {
|
|
4948
5097
|
return false;
|
|
@@ -4965,7 +5114,7 @@ var VariableList = (0, import_react32.forwardRef)((props, ref) => {
|
|
|
4965
5114
|
return false;
|
|
4966
5115
|
}
|
|
4967
5116
|
}));
|
|
4968
|
-
return /* @__PURE__ */ (0,
|
|
5117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4969
5118
|
VariablePopover,
|
|
4970
5119
|
{
|
|
4971
5120
|
items,
|
|
@@ -4996,7 +5145,7 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4996
5145
|
let popup = null;
|
|
4997
5146
|
return {
|
|
4998
5147
|
onStart: (props) => {
|
|
4999
|
-
component = new
|
|
5148
|
+
component = new import_react32.ReactRenderer(variableListComponent, {
|
|
5000
5149
|
props,
|
|
5001
5150
|
editor: props.editor
|
|
5002
5151
|
});
|