@mekari/pixel3-rich-text-editor 0.1.2 → 0.1.3-dev.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.
Files changed (68) hide show
  1. package/dist/{chunk-7BEXEMOE.mjs → chunk-6O4HSL2C.mjs} +4 -0
  2. package/dist/chunk-76GEEOAG.mjs +189 -0
  3. package/dist/{chunk-MKTM47RO.mjs → chunk-AIWY3FHJ.mjs} +1 -1
  4. package/dist/chunk-BWRU2WZN.mjs +202 -0
  5. package/dist/{chunk-ZO6THAT6.mjs → chunk-COZ45QUD.mjs} +1 -1
  6. package/dist/chunk-ENKUUZPM.mjs +124 -0
  7. package/dist/{chunk-25RKPG44.mjs → chunk-FCLBNBXD.mjs} +25 -16
  8. package/dist/{chunk-Q7QLZISF.mjs → chunk-IFRJVX2K.mjs} +29 -1
  9. package/dist/{chunk-YE6FEVD4.mjs → chunk-RX7ZEE2M.mjs} +104 -58
  10. package/dist/{chunk-XNM3YX37.mjs → chunk-T7RFFPSJ.mjs} +13 -3
  11. package/dist/{chunk-YIEQVTEO.mjs → chunk-X2CB42A3.mjs} +1 -1
  12. package/dist/{chunk-5S2LSGJV.mjs → chunk-Y6UPQ6EU.mjs} +1 -1
  13. package/dist/{chunk-UBJOZ2IA.mjs → chunk-YWVVMJGP.mjs} +1 -1
  14. package/dist/editor-toolbar.d.mts +2 -1
  15. package/dist/editor-toolbar.d.ts +2 -1
  16. package/dist/editor-toolbar.js +469 -75
  17. package/dist/editor-toolbar.mjs +10 -8
  18. package/dist/extensions/align-extension.js +27 -0
  19. package/dist/extensions/align-extension.mjs +2 -2
  20. package/dist/extensions/color-extension.js +27 -0
  21. package/dist/extensions/color-extension.mjs +2 -2
  22. package/dist/extensions/heading-extension.js +27 -0
  23. package/dist/extensions/heading-extension.mjs +2 -2
  24. package/dist/extensions/icons.d.mts +2 -1
  25. package/dist/extensions/icons.d.ts +2 -1
  26. package/dist/extensions/icons.js +31 -2
  27. package/dist/extensions/icons.mjs +5 -3
  28. package/dist/extensions/index.d.mts +6 -0
  29. package/dist/extensions/index.d.ts +6 -0
  30. package/dist/extensions/index.js +368 -16
  31. package/dist/extensions/index.mjs +18 -10
  32. package/dist/extensions/link-extension.js +27 -0
  33. package/dist/extensions/link-extension.mjs +2 -2
  34. package/dist/extensions/single-extension.d.mts +12 -2
  35. package/dist/extensions/single-extension.d.ts +12 -2
  36. package/dist/extensions/single-extension.js +49 -14
  37. package/dist/extensions/single-extension.mjs +2 -2
  38. package/dist/extensions/variable-extension.d.mts +19 -0
  39. package/dist/extensions/variable-extension.d.ts +19 -0
  40. package/dist/extensions/variable-extension.js +158 -0
  41. package/dist/extensions/variable-extension.mjs +7 -0
  42. package/dist/extensions/variable-list-extension.d.mts +33 -0
  43. package/dist/extensions/variable-list-extension.d.ts +33 -0
  44. package/dist/extensions/variable-list-extension.js +210 -0
  45. package/dist/extensions/variable-list-extension.mjs +7 -0
  46. package/dist/index.d.mts +1 -1
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +699 -116
  49. package/dist/index.mjs +14 -11
  50. package/dist/metafile-cjs.json +1 -1
  51. package/dist/metafile-esm.json +1 -1
  52. package/dist/modules/rich-text-editor.props.d.mts +5 -1
  53. package/dist/modules/rich-text-editor.props.d.ts +5 -1
  54. package/dist/modules/rich-text-editor.props.js +4 -0
  55. package/dist/modules/rich-text-editor.props.mjs +1 -1
  56. package/dist/modules/rich-text-editor.types.d.mts +11 -3
  57. package/dist/modules/rich-text-editor.types.d.ts +11 -3
  58. package/dist/rich-text-editor.d.mts +10 -1
  59. package/dist/rich-text-editor.d.ts +10 -1
  60. package/dist/rich-text-editor.js +699 -116
  61. package/dist/rich-text-editor.mjs +14 -11
  62. package/dist/rte-style-provider.mjs +2 -2
  63. package/dist/rte-variable-suggestion.d.mts +11 -0
  64. package/dist/rte-variable-suggestion.d.ts +11 -0
  65. package/dist/rte-variable-suggestion.js +405 -0
  66. package/dist/rte-variable-suggestion.mjs +10 -0
  67. package/package.json +12 -12
  68. /package/dist/{chunk-VYCDVS5I.mjs → chunk-HIHIKPNN.mjs} +0 -0
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
9
  var __export = (target, all) => {
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
 
21
31
  // src/extensions/index.ts
@@ -25,7 +35,9 @@ __export(extensions_exports, {
25
35
  ColorExtension: () => ColorExtension,
26
36
  HeadingExtention: () => HeadingExtention,
27
37
  LinkExtension: () => LinkExtension,
28
- SingleExtention: () => SingleExtention
38
+ SingleExtention: () => SingleExtention,
39
+ Variable: () => Variable,
40
+ VariableList: () => VariableList
29
41
  });
30
42
  module.exports = __toCommonJS(extensions_exports);
31
43
 
@@ -445,6 +457,33 @@ var LocationIcon = (0, import_vue2.defineComponent)({
445
457
  }, null)]);
446
458
  }
447
459
  });
460
+ var VariableIcon = (0, import_vue2.defineComponent)({
461
+ name: "VariableIcon",
462
+ setup() {
463
+ return () => (0, import_vue.createVNode)("svg", {
464
+ "class": "mp-icon mp-icon--size_sm",
465
+ "data-pixel-component": "MpIcon",
466
+ "data-icon-name": "text-editor-inline-code",
467
+ "viewBox": "0 0 24 24",
468
+ "role": "presentation",
469
+ "fill": "none",
470
+ "focusable": "false",
471
+ "style": "--mp-icon-color: var(--mp-colors-icon-default);"
472
+ }, [(0, import_vue.createVNode)("path", {
473
+ "d": "M15 6L21 12L15 18",
474
+ "stroke": "currentcolor",
475
+ "stroke-width": "1.5",
476
+ "stroke-linecap": "round",
477
+ "stroke-linejoin": "round"
478
+ }, null), (0, import_vue.createVNode)("path", {
479
+ "d": "M9 6L3 12L9 18",
480
+ "stroke": "currentcolor",
481
+ "stroke-width": "1.5",
482
+ "stroke-linecap": "round",
483
+ "stroke-linejoin": "round"
484
+ }, null)]);
485
+ }
486
+ });
448
487
 
449
488
  // src/extensions/heading-extension.tsx
450
489
  var HeadingExtention = (0, import_vue4.defineComponent)({
@@ -686,14 +725,13 @@ var SingleExtention = (0, import_vue8.defineComponent)({
686
725
  },
687
726
  editor: {
688
727
  type: Object
728
+ },
729
+ isDisabled: {
730
+ type: Boolean,
731
+ default: false
689
732
  }
690
733
  },
691
- setup({
692
- name,
693
- tooltipLabel,
694
- onClick,
695
- editor
696
- }) {
734
+ setup(props) {
697
735
  const iconMap = {
698
736
  bold: (0, import_vue7.createVNode)(BoldIcon, null, null),
699
737
  italic: (0, import_vue7.createVNode)(ItalicIcon, null, null),
@@ -709,16 +747,25 @@ var SingleExtention = (0, import_vue8.defineComponent)({
709
747
  file: (0, import_vue7.createVNode)(FileIcon, null, null),
710
748
  audio: (0, import_vue7.createVNode)(AudioIcon, null, null),
711
749
  mention: (0, import_vue7.createVNode)(MentionIcon, null, null),
750
+ variable: (0, import_vue7.createVNode)(VariableIcon, null, null),
712
751
  location: (0, import_vue7.createVNode)(LocationIcon, null, null)
713
752
  };
714
- return () => (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
715
- "class": {
716
- "is-active": name && (editor == null ? void 0 : editor.isActive(name))
717
- },
718
- "onClick": onClick
719
- }, [name && iconMap[name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
720
- label: tooltipLabel
721
- }]]);
753
+ return () => {
754
+ var _a;
755
+ return (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
756
+ "class": {
757
+ "is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
758
+ },
759
+ "style": props.isDisabled ? {
760
+ opacity: "0.4",
761
+ cursor: "not-allowed"
762
+ } : void 0,
763
+ "disabled": props.isDisabled,
764
+ "onClick": props.isDisabled ? void 0 : props.onClick
765
+ }, [props.name && iconMap[props.name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
766
+ label: props.tooltipLabel
767
+ }]]);
768
+ };
722
769
  }
723
770
  });
724
771
 
@@ -1034,11 +1081,316 @@ var LinkExtension = (0, import_vue12.defineComponent)({
1034
1081
  })]);
1035
1082
  }
1036
1083
  });
1084
+
1085
+ // src/extensions/variable-extension.ts
1086
+ var import_core2 = require("@tiptap/core");
1087
+ var import_suggestion = __toESM(require("@tiptap/suggestion"));
1088
+ var Variable = import_core2.Node.create({
1089
+ name: "variable",
1090
+ addOptions() {
1091
+ return {
1092
+ HTMLAttributes: {},
1093
+ renderLabel({
1094
+ node
1095
+ }) {
1096
+ var _a;
1097
+ return `{${(_a = node.attrs.label) != null ? _a : node.attrs.id}}`;
1098
+ },
1099
+ suggestion: {}
1100
+ };
1101
+ },
1102
+ group: "inline",
1103
+ inline: true,
1104
+ selectable: false,
1105
+ atom: true,
1106
+ addAttributes() {
1107
+ return {
1108
+ id: {
1109
+ default: null,
1110
+ parseHTML: (element) => element.getAttribute("data-id"),
1111
+ renderHTML: (attributes) => {
1112
+ if (!attributes.id) {
1113
+ return {};
1114
+ }
1115
+ return {
1116
+ "data-id": attributes.id
1117
+ };
1118
+ }
1119
+ },
1120
+ label: {
1121
+ default: null,
1122
+ parseHTML: (element) => element.getAttribute("data-label"),
1123
+ renderHTML: (attributes) => {
1124
+ if (!attributes.label) {
1125
+ return {};
1126
+ }
1127
+ return {
1128
+ "data-label": attributes.label
1129
+ };
1130
+ }
1131
+ },
1132
+ category: {
1133
+ default: null,
1134
+ parseHTML: (element) => element.getAttribute("data-category"),
1135
+ renderHTML: (attributes) => {
1136
+ if (!attributes.category) {
1137
+ return {};
1138
+ }
1139
+ return {
1140
+ "data-category": attributes.category
1141
+ };
1142
+ }
1143
+ }
1144
+ };
1145
+ },
1146
+ parseHTML() {
1147
+ return [{
1148
+ tag: `span[data-type="${this.name}"]`
1149
+ }];
1150
+ },
1151
+ renderHTML({
1152
+ node,
1153
+ HTMLAttributes
1154
+ }) {
1155
+ return ["span", (0, import_core2.mergeAttributes)({
1156
+ "data-type": this.name
1157
+ }, this.options.HTMLAttributes, HTMLAttributes), this.options.renderLabel({
1158
+ options: this.options,
1159
+ node
1160
+ })];
1161
+ },
1162
+ renderText({
1163
+ node
1164
+ }) {
1165
+ return this.options.renderLabel({
1166
+ options: this.options,
1167
+ node
1168
+ });
1169
+ },
1170
+ addKeyboardShortcuts() {
1171
+ return {
1172
+ Backspace: () => this.editor.commands.command(({
1173
+ tr,
1174
+ state
1175
+ }) => {
1176
+ let isVariable = false;
1177
+ const {
1178
+ selection
1179
+ } = state;
1180
+ const {
1181
+ empty,
1182
+ anchor
1183
+ } = selection;
1184
+ if (!empty) {
1185
+ return false;
1186
+ }
1187
+ state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
1188
+ if (node.type.name === this.name) {
1189
+ isVariable = true;
1190
+ tr.insertText(this.options.suggestion.char || "", pos, pos + node.nodeSize);
1191
+ return false;
1192
+ }
1193
+ });
1194
+ return isVariable;
1195
+ })
1196
+ };
1197
+ },
1198
+ addProseMirrorPlugins() {
1199
+ return [(0, import_suggestion.default)({
1200
+ editor: this.editor,
1201
+ ...this.options.suggestion
1202
+ })];
1203
+ }
1204
+ });
1205
+
1206
+ // src/extensions/variable-list-extension.tsx
1207
+ var import_vue13 = require("vue");
1208
+ var import_vue14 = require("vue");
1209
+ var import_css5 = require("@mekari/pixel3-styled-system/css");
1210
+ var import_pixel3_popover3 = require("@mekari/pixel3-popover");
1211
+ var import_pixel3_text2 = require("@mekari/pixel3-text");
1212
+ var VariableList = (0, import_vue14.defineComponent)({
1213
+ name: "VariableList",
1214
+ props: {
1215
+ items: {
1216
+ type: Array,
1217
+ default: () => []
1218
+ },
1219
+ command: {
1220
+ type: Function,
1221
+ required: true
1222
+ }
1223
+ },
1224
+ setup(props, {
1225
+ expose
1226
+ }) {
1227
+ const selectedIndex = (0, import_vue14.ref)(0);
1228
+ const listRef = (0, import_vue14.ref)(null);
1229
+ const groupedItems = (0, import_vue14.computed)(() => {
1230
+ const groups = {};
1231
+ props.items.forEach((item) => {
1232
+ const category = item.category || "OTHER";
1233
+ if (!groups[category]) {
1234
+ groups[category] = [];
1235
+ }
1236
+ groups[category].push(item);
1237
+ });
1238
+ return Object.entries(groups).map(([category, items]) => ({
1239
+ category,
1240
+ items
1241
+ }));
1242
+ });
1243
+ const scrollToFocusedItem = /* @__PURE__ */ __name(() => {
1244
+ (0, import_vue14.nextTick)(() => {
1245
+ if (!listRef.value)
1246
+ return;
1247
+ const targetItem = listRef.value.querySelector('[data-active="true"], [data-highlight]');
1248
+ if (targetItem) {
1249
+ targetItem.scrollIntoView({
1250
+ block: "nearest"
1251
+ });
1252
+ }
1253
+ });
1254
+ }, "scrollToFocusedItem");
1255
+ (0, import_vue14.watch)(() => props.items, () => {
1256
+ selectedIndex.value = 0;
1257
+ });
1258
+ const onSelect = /* @__PURE__ */ __name((index) => {
1259
+ const item = props.items[index];
1260
+ if (item) {
1261
+ props.command({
1262
+ ...item,
1263
+ label: item.id
1264
+ });
1265
+ }
1266
+ }, "onSelect");
1267
+ const onKeyDown = /* @__PURE__ */ __name(({
1268
+ event
1269
+ }) => {
1270
+ if (!props.items.length) {
1271
+ return false;
1272
+ }
1273
+ if (event.key === "ArrowUp") {
1274
+ event.preventDefault();
1275
+ const total = props.items.length;
1276
+ selectedIndex.value = (selectedIndex.value + total - 1) % total;
1277
+ scrollToFocusedItem();
1278
+ return true;
1279
+ }
1280
+ if (event.key === "ArrowDown") {
1281
+ event.preventDefault();
1282
+ selectedIndex.value = (selectedIndex.value + 1) % props.items.length;
1283
+ scrollToFocusedItem();
1284
+ return true;
1285
+ }
1286
+ if (event.key === "Enter") {
1287
+ event.preventDefault();
1288
+ onSelect(selectedIndex.value);
1289
+ return true;
1290
+ }
1291
+ return false;
1292
+ }, "onKeyDown");
1293
+ expose({
1294
+ onKeyDown
1295
+ });
1296
+ return () => (0, import_vue13.createVNode)(import_pixel3_popover3.MpPopover, {
1297
+ "id": "popover-rte-variable-list",
1298
+ "is-manual": true,
1299
+ "is-default-open": true,
1300
+ "is-open": true
1301
+ }, {
1302
+ default: () => [(0, import_vue13.createVNode)(import_pixel3_popover3.MpPopoverContent, {
1303
+ "class": (0, import_css5.css)({
1304
+ width: "280px",
1305
+ maxHeight: "284px",
1306
+ overflowY: "auto"
1307
+ })
1308
+ }, {
1309
+ default: () => [(0, import_vue13.createVNode)(import_pixel3_popover3.MpPopoverList, {
1310
+ "ref": (element) => {
1311
+ var _a;
1312
+ if (!element) {
1313
+ listRef.value = null;
1314
+ return;
1315
+ }
1316
+ listRef.value = (_a = element.$el) != null ? _a : element;
1317
+ },
1318
+ "data-pixel-rte": true
1319
+ }, {
1320
+ default: () => [!props.items.length && (0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1321
+ "color": "text.secondary",
1322
+ "class": (0, import_css5.css)({
1323
+ px: "3",
1324
+ py: "2"
1325
+ })
1326
+ }, {
1327
+ default: () => [(0, import_vue13.createTextVNode)("No result")]
1328
+ }), groupedItems.value.map((group) => {
1329
+ return (0, import_vue13.createVNode)(import_vue13.Fragment, null, [(0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1330
+ "size": "label-small",
1331
+ "color": "text.secondary",
1332
+ "class": (0, import_css5.css)({
1333
+ px: "3",
1334
+ py: "2",
1335
+ textTransform: "uppercase",
1336
+ textAlign: "left",
1337
+ letterSpacing: "0.05em",
1338
+ display: "block",
1339
+ width: "full"
1340
+ })
1341
+ }, {
1342
+ default: () => [group.category]
1343
+ }), group.items.map((item) => {
1344
+ const itemIndex = props.items.indexOf(item);
1345
+ return (0, import_vue13.createVNode)(import_pixel3_popover3.MpPopoverListItem, {
1346
+ "key": `${item.id}-${itemIndex}`,
1347
+ "onMousedown": (event) => event.preventDefault(),
1348
+ "onMouseenter": () => {
1349
+ selectedIndex.value = itemIndex;
1350
+ },
1351
+ "onClick": () => {
1352
+ onSelect(itemIndex);
1353
+ }
1354
+ }, {
1355
+ default: () => [(0, import_vue13.createVNode)("div", {
1356
+ "class": (0, import_css5.css)({
1357
+ display: "flex",
1358
+ flexDirection: "column",
1359
+ alignItems: "flex-start",
1360
+ minWidth: "0",
1361
+ width: "full",
1362
+ gap: "0.5"
1363
+ })
1364
+ }, [(0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1365
+ "size": "label",
1366
+ "is-truncated": true
1367
+ }, {
1368
+ default: () => [item.name || "Unknown"]
1369
+ }), (0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1370
+ "size": "label-small",
1371
+ "color": "text.secondary",
1372
+ "is-truncated": true,
1373
+ "class": (0, import_css5.css)({
1374
+ fontFamily: "mono"
1375
+ })
1376
+ }, {
1377
+ default: () => [`{${item.id}}`]
1378
+ })])]
1379
+ });
1380
+ })]);
1381
+ })]
1382
+ })]
1383
+ })]
1384
+ });
1385
+ }
1386
+ });
1037
1387
  // Annotate the CommonJS export names for ESM import in node:
1038
1388
  0 && (module.exports = {
1039
1389
  AlignExtention,
1040
1390
  ColorExtension,
1041
1391
  HeadingExtention,
1042
1392
  LinkExtension,
1043
- SingleExtention
1393
+ SingleExtention,
1394
+ Variable,
1395
+ VariableList
1044
1396
  });
@@ -1,25 +1,33 @@
1
- import "../chunk-VYCDVS5I.mjs";
1
+ import "../chunk-HIHIKPNN.mjs";
2
+ import {
3
+ HeadingExtention
4
+ } from "../chunk-X2CB42A3.mjs";
2
5
  import {
3
6
  LinkExtension
4
- } from "../chunk-ZO6THAT6.mjs";
7
+ } from "../chunk-COZ45QUD.mjs";
5
8
  import {
6
9
  SingleExtention
7
- } from "../chunk-25RKPG44.mjs";
10
+ } from "../chunk-FCLBNBXD.mjs";
11
+ import {
12
+ Variable
13
+ } from "../chunk-ENKUUZPM.mjs";
14
+ import {
15
+ VariableList
16
+ } from "../chunk-76GEEOAG.mjs";
8
17
  import {
9
18
  AlignExtention
10
- } from "../chunk-UBJOZ2IA.mjs";
19
+ } from "../chunk-YWVVMJGP.mjs";
11
20
  import {
12
21
  ColorExtension
13
- } from "../chunk-5S2LSGJV.mjs";
14
- import {
15
- HeadingExtention
16
- } from "../chunk-YIEQVTEO.mjs";
17
- import "../chunk-Q7QLZISF.mjs";
22
+ } from "../chunk-Y6UPQ6EU.mjs";
23
+ import "../chunk-IFRJVX2K.mjs";
18
24
  import "../chunk-QZ7VFGWC.mjs";
19
25
  export {
20
26
  AlignExtention,
21
27
  ColorExtension,
22
28
  HeadingExtention,
23
29
  LinkExtension,
24
- SingleExtention
30
+ SingleExtention,
31
+ Variable,
32
+ VariableList
25
33
  };
@@ -441,6 +441,33 @@ var LocationIcon = (0, import_vue2.defineComponent)({
441
441
  }, null)]);
442
442
  }
443
443
  });
444
+ var VariableIcon = (0, import_vue2.defineComponent)({
445
+ name: "VariableIcon",
446
+ setup() {
447
+ return () => (0, import_vue.createVNode)("svg", {
448
+ "class": "mp-icon mp-icon--size_sm",
449
+ "data-pixel-component": "MpIcon",
450
+ "data-icon-name": "text-editor-inline-code",
451
+ "viewBox": "0 0 24 24",
452
+ "role": "presentation",
453
+ "fill": "none",
454
+ "focusable": "false",
455
+ "style": "--mp-icon-color: var(--mp-colors-icon-default);"
456
+ }, [(0, import_vue.createVNode)("path", {
457
+ "d": "M15 6L21 12L15 18",
458
+ "stroke": "currentcolor",
459
+ "stroke-width": "1.5",
460
+ "stroke-linecap": "round",
461
+ "stroke-linejoin": "round"
462
+ }, null), (0, import_vue.createVNode)("path", {
463
+ "d": "M9 6L3 12L9 18",
464
+ "stroke": "currentcolor",
465
+ "stroke-width": "1.5",
466
+ "stroke-linecap": "round",
467
+ "stroke-linejoin": "round"
468
+ }, null)]);
469
+ }
470
+ });
444
471
 
445
472
  // src/extensions/link-extension.tsx
446
473
  var LinkExtension = (0, import_vue4.defineComponent)({
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LinkExtension
3
- } from "../chunk-ZO6THAT6.mjs";
4
- import "../chunk-Q7QLZISF.mjs";
3
+ } from "../chunk-COZ45QUD.mjs";
4
+ import "../chunk-IFRJVX2K.mjs";
5
5
  import "../chunk-QZ7VFGWC.mjs";
6
6
  export {
7
7
  LinkExtension
@@ -3,7 +3,7 @@ import { PropType } from 'vue';
3
3
  import { JSX } from 'vue/jsx-runtime';
4
4
  import { Editor } from '@tiptap/vue-3';
5
5
 
6
- type ExtensionName = 'bold' | 'italic' | 'underline' | 'strike' | 'blockquote' | 'bulletList' | 'orderedList' | 'undo' | 'redo' | 'clear' | 'image' | 'file' | 'audio' | 'mention' | 'location';
6
+ type ExtensionName = 'bold' | 'italic' | 'underline' | 'strike' | 'blockquote' | 'bulletList' | 'orderedList' | 'undo' | 'redo' | 'clear' | 'image' | 'file' | 'audio' | 'mention' | 'variable' | 'location';
7
7
  declare const SingleExtention: vue.DefineComponent<{
8
8
  name: {
9
9
  type: PropType<ExtensionName>;
@@ -17,6 +17,10 @@ declare const SingleExtention: vue.DefineComponent<{
17
17
  editor: {
18
18
  type: PropType<Editor>;
19
19
  };
20
+ isDisabled: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
20
24
  }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
21
25
  name: {
22
26
  type: PropType<ExtensionName>;
@@ -30,6 +34,12 @@ declare const SingleExtention: vue.DefineComponent<{
30
34
  editor: {
31
35
  type: PropType<Editor>;
32
36
  };
33
- }>>, {}, {}>;
37
+ isDisabled: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ }>>, {
42
+ isDisabled: boolean;
43
+ }, {}>;
34
44
 
35
45
  export { SingleExtention };
@@ -3,7 +3,7 @@ import { PropType } from 'vue';
3
3
  import { JSX } from 'vue/jsx-runtime';
4
4
  import { Editor } from '@tiptap/vue-3';
5
5
 
6
- type ExtensionName = 'bold' | 'italic' | 'underline' | 'strike' | 'blockquote' | 'bulletList' | 'orderedList' | 'undo' | 'redo' | 'clear' | 'image' | 'file' | 'audio' | 'mention' | 'location';
6
+ type ExtensionName = 'bold' | 'italic' | 'underline' | 'strike' | 'blockquote' | 'bulletList' | 'orderedList' | 'undo' | 'redo' | 'clear' | 'image' | 'file' | 'audio' | 'mention' | 'variable' | 'location';
7
7
  declare const SingleExtention: vue.DefineComponent<{
8
8
  name: {
9
9
  type: PropType<ExtensionName>;
@@ -17,6 +17,10 @@ declare const SingleExtention: vue.DefineComponent<{
17
17
  editor: {
18
18
  type: PropType<Editor>;
19
19
  };
20
+ isDisabled: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
20
24
  }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
21
25
  name: {
22
26
  type: PropType<ExtensionName>;
@@ -30,6 +34,12 @@ declare const SingleExtention: vue.DefineComponent<{
30
34
  editor: {
31
35
  type: PropType<Editor>;
32
36
  };
33
- }>>, {}, {}>;
37
+ isDisabled: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ }>>, {
42
+ isDisabled: boolean;
43
+ }, {}>;
34
44
 
35
45
  export { SingleExtention };
@@ -435,6 +435,33 @@ var LocationIcon = (0, import_vue2.defineComponent)({
435
435
  }, null)]);
436
436
  }
437
437
  });
438
+ var VariableIcon = (0, import_vue2.defineComponent)({
439
+ name: "VariableIcon",
440
+ setup() {
441
+ return () => (0, import_vue.createVNode)("svg", {
442
+ "class": "mp-icon mp-icon--size_sm",
443
+ "data-pixel-component": "MpIcon",
444
+ "data-icon-name": "text-editor-inline-code",
445
+ "viewBox": "0 0 24 24",
446
+ "role": "presentation",
447
+ "fill": "none",
448
+ "focusable": "false",
449
+ "style": "--mp-icon-color: var(--mp-colors-icon-default);"
450
+ }, [(0, import_vue.createVNode)("path", {
451
+ "d": "M15 6L21 12L15 18",
452
+ "stroke": "currentcolor",
453
+ "stroke-width": "1.5",
454
+ "stroke-linecap": "round",
455
+ "stroke-linejoin": "round"
456
+ }, null), (0, import_vue.createVNode)("path", {
457
+ "d": "M9 6L3 12L9 18",
458
+ "stroke": "currentcolor",
459
+ "stroke-width": "1.5",
460
+ "stroke-linecap": "round",
461
+ "stroke-linejoin": "round"
462
+ }, null)]);
463
+ }
464
+ });
438
465
 
439
466
  // src/extensions/single-extension.tsx
440
467
  var SingleExtention = (0, import_vue4.defineComponent)({
@@ -451,14 +478,13 @@ var SingleExtention = (0, import_vue4.defineComponent)({
451
478
  },
452
479
  editor: {
453
480
  type: Object
481
+ },
482
+ isDisabled: {
483
+ type: Boolean,
484
+ default: false
454
485
  }
455
486
  },
456
- setup({
457
- name,
458
- tooltipLabel,
459
- onClick,
460
- editor
461
- }) {
487
+ setup(props) {
462
488
  const iconMap = {
463
489
  bold: (0, import_vue3.createVNode)(BoldIcon, null, null),
464
490
  italic: (0, import_vue3.createVNode)(ItalicIcon, null, null),
@@ -474,16 +500,25 @@ var SingleExtention = (0, import_vue4.defineComponent)({
474
500
  file: (0, import_vue3.createVNode)(FileIcon, null, null),
475
501
  audio: (0, import_vue3.createVNode)(AudioIcon, null, null),
476
502
  mention: (0, import_vue3.createVNode)(MentionIcon, null, null),
503
+ variable: (0, import_vue3.createVNode)(VariableIcon, null, null),
477
504
  location: (0, import_vue3.createVNode)(LocationIcon, null, null)
478
505
  };
479
- return () => (0, import_vue3.withDirectives)((0, import_vue3.createVNode)("button", {
480
- "class": {
481
- "is-active": name && (editor == null ? void 0 : editor.isActive(name))
482
- },
483
- "onClick": onClick
484
- }, [name && iconMap[name]]), [[(0, import_vue3.resolveDirective)("tooltip"), {
485
- label: tooltipLabel
486
- }]]);
506
+ return () => {
507
+ var _a;
508
+ return (0, import_vue3.withDirectives)((0, import_vue3.createVNode)("button", {
509
+ "class": {
510
+ "is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
511
+ },
512
+ "style": props.isDisabled ? {
513
+ opacity: "0.4",
514
+ cursor: "not-allowed"
515
+ } : void 0,
516
+ "disabled": props.isDisabled,
517
+ "onClick": props.isDisabled ? void 0 : props.onClick
518
+ }, [props.name && iconMap[props.name]]), [[(0, import_vue3.resolveDirective)("tooltip"), {
519
+ label: props.tooltipLabel
520
+ }]]);
521
+ };
487
522
  }
488
523
  });
489
524
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SingleExtention
3
- } from "../chunk-25RKPG44.mjs";
4
- import "../chunk-Q7QLZISF.mjs";
3
+ } from "../chunk-FCLBNBXD.mjs";
4
+ import "../chunk-IFRJVX2K.mjs";
5
5
  import "../chunk-QZ7VFGWC.mjs";
6
6
  export {
7
7
  SingleExtention