@mekari/pixel3-rich-text-editor 0.1.2 → 0.1.3-dev.0

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-25RKPG44.mjs → chunk-47IOAHWN.mjs} +4 -2
  2. package/dist/{chunk-7BEXEMOE.mjs → chunk-6O4HSL2C.mjs} +4 -0
  3. package/dist/chunk-76GEEOAG.mjs +189 -0
  4. package/dist/{chunk-MKTM47RO.mjs → chunk-AIWY3FHJ.mjs} +1 -1
  5. package/dist/chunk-BWRU2WZN.mjs +202 -0
  6. package/dist/{chunk-ZO6THAT6.mjs → chunk-COZ45QUD.mjs} +1 -1
  7. package/dist/chunk-ENKUUZPM.mjs +124 -0
  8. package/dist/{chunk-Q7QLZISF.mjs → chunk-IFRJVX2K.mjs} +29 -1
  9. package/dist/{chunk-YE6FEVD4.mjs → chunk-UD5PDCGC.mjs} +18 -9
  10. package/dist/{chunk-YIEQVTEO.mjs → chunk-X2CB42A3.mjs} +1 -1
  11. package/dist/{chunk-5S2LSGJV.mjs → chunk-Y6UPQ6EU.mjs} +1 -1
  12. package/dist/{chunk-UBJOZ2IA.mjs → chunk-YWVVMJGP.mjs} +1 -1
  13. package/dist/{chunk-XNM3YX37.mjs → chunk-ZYSEHV5N.mjs} +13 -3
  14. package/dist/editor-toolbar.d.mts +2 -1
  15. package/dist/editor-toolbar.d.ts +2 -1
  16. package/dist/editor-toolbar.js +366 -16
  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 +347 -2
  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 +1 -1
  35. package/dist/extensions/single-extension.d.ts +1 -1
  36. package/dist/extensions/single-extension.js +28 -0
  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 +596 -57
  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 +10 -3
  57. package/dist/modules/rich-text-editor.types.d.ts +10 -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 +596 -57
  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 +7 -7
  68. /package/dist/{chunk-VYCDVS5I.mjs → chunk-HIHIKPNN.mjs} +0 -0
@@ -438,6 +438,33 @@ var LocationIcon = (0, import_vue2.defineComponent)({
438
438
  }, null)]);
439
439
  }
440
440
  });
441
+ var VariableIcon = (0, import_vue2.defineComponent)({
442
+ name: "VariableIcon",
443
+ setup() {
444
+ return () => (0, import_vue.createVNode)("svg", {
445
+ "class": "mp-icon mp-icon--size_sm",
446
+ "data-pixel-component": "MpIcon",
447
+ "data-icon-name": "text-editor-inline-code",
448
+ "viewBox": "0 0 24 24",
449
+ "role": "presentation",
450
+ "fill": "none",
451
+ "focusable": "false",
452
+ "style": "--mp-icon-color: var(--mp-colors-icon-default);"
453
+ }, [(0, import_vue.createVNode)("path", {
454
+ "d": "M15 6L21 12L15 18",
455
+ "stroke": "currentcolor",
456
+ "stroke-width": "1.5",
457
+ "stroke-linecap": "round",
458
+ "stroke-linejoin": "round"
459
+ }, null), (0, import_vue.createVNode)("path", {
460
+ "d": "M9 6L3 12L9 18",
461
+ "stroke": "currentcolor",
462
+ "stroke-width": "1.5",
463
+ "stroke-linecap": "round",
464
+ "stroke-linejoin": "round"
465
+ }, null)]);
466
+ }
467
+ });
441
468
 
442
469
  // src/extensions/heading-extension.tsx
443
470
  var HeadingExtention = (0, import_vue4.defineComponent)({
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HeadingExtention
3
- } from "../chunk-YIEQVTEO.mjs";
4
- import "../chunk-Q7QLZISF.mjs";
3
+ } from "../chunk-X2CB42A3.mjs";
4
+ import "../chunk-IFRJVX2K.mjs";
5
5
  import "../chunk-QZ7VFGWC.mjs";
6
6
  export {
7
7
  HeadingExtention
@@ -24,5 +24,6 @@ declare const FileIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Elemen
24
24
  declare const AudioIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
25
25
  declare const MentionIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
26
26
  declare const LocationIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
27
+ declare const VariableIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
27
28
 
28
- export { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AudioIcon, BlockquoteIcon, BoldIcon, BulletListIcon, CaretIcon, ClearIcon, ColorTextIcon, FileIcon, FillTextIcon, ImageIcon, ItalicIcon, LinkIcon, LocationIcon, MentionIcon, OrderedListIcon, RedoIcon, StrikeIcon, UnderlineIcon, UndoIcon };
29
+ export { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AudioIcon, BlockquoteIcon, BoldIcon, BulletListIcon, CaretIcon, ClearIcon, ColorTextIcon, FileIcon, FillTextIcon, ImageIcon, ItalicIcon, LinkIcon, LocationIcon, MentionIcon, OrderedListIcon, RedoIcon, StrikeIcon, UnderlineIcon, UndoIcon, VariableIcon };
@@ -24,5 +24,6 @@ declare const FileIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Elemen
24
24
  declare const AudioIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
25
25
  declare const MentionIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
26
26
  declare const LocationIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
27
+ declare const VariableIcon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
27
28
 
28
- export { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AudioIcon, BlockquoteIcon, BoldIcon, BulletListIcon, CaretIcon, ClearIcon, ColorTextIcon, FileIcon, FillTextIcon, ImageIcon, ItalicIcon, LinkIcon, LocationIcon, MentionIcon, OrderedListIcon, RedoIcon, StrikeIcon, UnderlineIcon, UndoIcon };
29
+ export { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AudioIcon, BlockquoteIcon, BoldIcon, BulletListIcon, CaretIcon, ClearIcon, ColorTextIcon, FileIcon, FillTextIcon, ImageIcon, ItalicIcon, LinkIcon, LocationIcon, MentionIcon, OrderedListIcon, RedoIcon, StrikeIcon, UnderlineIcon, UndoIcon, VariableIcon };
@@ -42,7 +42,8 @@ __export(icons_exports, {
42
42
  RedoIcon: () => RedoIcon,
43
43
  StrikeIcon: () => StrikeIcon,
44
44
  UnderlineIcon: () => UnderlineIcon,
45
- UndoIcon: () => UndoIcon
45
+ UndoIcon: () => UndoIcon,
46
+ VariableIcon: () => VariableIcon
46
47
  });
47
48
  module.exports = __toCommonJS(icons_exports);
48
49
  var import_vue = require("vue");
@@ -453,6 +454,33 @@ var LocationIcon = (0, import_vue2.defineComponent)({
453
454
  }, null)]);
454
455
  }
455
456
  });
457
+ var VariableIcon = (0, import_vue2.defineComponent)({
458
+ name: "VariableIcon",
459
+ setup() {
460
+ return () => (0, import_vue.createVNode)("svg", {
461
+ "class": "mp-icon mp-icon--size_sm",
462
+ "data-pixel-component": "MpIcon",
463
+ "data-icon-name": "text-editor-inline-code",
464
+ "viewBox": "0 0 24 24",
465
+ "role": "presentation",
466
+ "fill": "none",
467
+ "focusable": "false",
468
+ "style": "--mp-icon-color: var(--mp-colors-icon-default);"
469
+ }, [(0, import_vue.createVNode)("path", {
470
+ "d": "M15 6L21 12L15 18",
471
+ "stroke": "currentcolor",
472
+ "stroke-width": "1.5",
473
+ "stroke-linecap": "round",
474
+ "stroke-linejoin": "round"
475
+ }, null), (0, import_vue.createVNode)("path", {
476
+ "d": "M9 6L3 12L9 18",
477
+ "stroke": "currentcolor",
478
+ "stroke-width": "1.5",
479
+ "stroke-linecap": "round",
480
+ "stroke-linejoin": "round"
481
+ }, null)]);
482
+ }
483
+ });
456
484
  // Annotate the CommonJS export names for ESM import in node:
457
485
  0 && (module.exports = {
458
486
  AlignCenterIcon,
@@ -477,5 +505,6 @@ var LocationIcon = (0, import_vue2.defineComponent)({
477
505
  RedoIcon,
478
506
  StrikeIcon,
479
507
  UnderlineIcon,
480
- UndoIcon
508
+ UndoIcon,
509
+ VariableIcon
481
510
  });
@@ -21,8 +21,9 @@ import {
21
21
  RedoIcon,
22
22
  StrikeIcon,
23
23
  UnderlineIcon,
24
- UndoIcon
25
- } from "../chunk-Q7QLZISF.mjs";
24
+ UndoIcon,
25
+ VariableIcon
26
+ } from "../chunk-IFRJVX2K.mjs";
26
27
  import "../chunk-QZ7VFGWC.mjs";
27
28
  export {
28
29
  AlignCenterIcon,
@@ -47,5 +48,6 @@ export {
47
48
  RedoIcon,
48
49
  StrikeIcon,
49
50
  UnderlineIcon,
50
- UndoIcon
51
+ UndoIcon,
52
+ VariableIcon
51
53
  };
@@ -3,6 +3,12 @@ export { AlignExtention } from './align-extension.mjs';
3
3
  export { SingleExtention } from './single-extension.mjs';
4
4
  export { ColorExtension } from './color-extension.mjs';
5
5
  export { LinkExtension } from './link-extension.mjs';
6
+ export { Variable } from './variable-extension.mjs';
7
+ export { VariableList } from './variable-list-extension.mjs';
6
8
  import 'vue';
7
9
  import 'vue/jsx-runtime';
8
10
  import '@tiptap/vue-3';
11
+ import '@tiptap/core';
12
+ import '@tiptap/suggestion';
13
+ import '../modules/rich-text-editor.types.mjs';
14
+ import '@mekari/pixel3-utils';
@@ -3,6 +3,12 @@ export { AlignExtention } from './align-extension.js';
3
3
  export { SingleExtention } from './single-extension.js';
4
4
  export { ColorExtension } from './color-extension.js';
5
5
  export { LinkExtension } from './link-extension.js';
6
+ export { Variable } from './variable-extension.js';
7
+ export { VariableList } from './variable-list-extension.js';
6
8
  import 'vue';
7
9
  import 'vue/jsx-runtime';
8
10
  import '@tiptap/vue-3';
11
+ import '@tiptap/core';
12
+ import '@tiptap/suggestion';
13
+ import '../modules/rich-text-editor.types.js';
14
+ import '@mekari/pixel3-utils';
@@ -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)({
@@ -709,6 +748,7 @@ var SingleExtention = (0, import_vue8.defineComponent)({
709
748
  file: (0, import_vue7.createVNode)(FileIcon, null, null),
710
749
  audio: (0, import_vue7.createVNode)(AudioIcon, null, null),
711
750
  mention: (0, import_vue7.createVNode)(MentionIcon, null, null),
751
+ variable: (0, import_vue7.createVNode)(VariableIcon, null, null),
712
752
  location: (0, import_vue7.createVNode)(LocationIcon, null, null)
713
753
  };
714
754
  return () => (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
@@ -1034,11 +1074,316 @@ var LinkExtension = (0, import_vue12.defineComponent)({
1034
1074
  })]);
1035
1075
  }
1036
1076
  });
1077
+
1078
+ // src/extensions/variable-extension.ts
1079
+ var import_core2 = require("@tiptap/core");
1080
+ var import_suggestion = __toESM(require("@tiptap/suggestion"));
1081
+ var Variable = import_core2.Node.create({
1082
+ name: "variable",
1083
+ addOptions() {
1084
+ return {
1085
+ HTMLAttributes: {},
1086
+ renderLabel({
1087
+ node
1088
+ }) {
1089
+ var _a;
1090
+ return `{${(_a = node.attrs.label) != null ? _a : node.attrs.id}}`;
1091
+ },
1092
+ suggestion: {}
1093
+ };
1094
+ },
1095
+ group: "inline",
1096
+ inline: true,
1097
+ selectable: false,
1098
+ atom: true,
1099
+ addAttributes() {
1100
+ return {
1101
+ id: {
1102
+ default: null,
1103
+ parseHTML: (element) => element.getAttribute("data-id"),
1104
+ renderHTML: (attributes) => {
1105
+ if (!attributes.id) {
1106
+ return {};
1107
+ }
1108
+ return {
1109
+ "data-id": attributes.id
1110
+ };
1111
+ }
1112
+ },
1113
+ label: {
1114
+ default: null,
1115
+ parseHTML: (element) => element.getAttribute("data-label"),
1116
+ renderHTML: (attributes) => {
1117
+ if (!attributes.label) {
1118
+ return {};
1119
+ }
1120
+ return {
1121
+ "data-label": attributes.label
1122
+ };
1123
+ }
1124
+ },
1125
+ category: {
1126
+ default: null,
1127
+ parseHTML: (element) => element.getAttribute("data-category"),
1128
+ renderHTML: (attributes) => {
1129
+ if (!attributes.category) {
1130
+ return {};
1131
+ }
1132
+ return {
1133
+ "data-category": attributes.category
1134
+ };
1135
+ }
1136
+ }
1137
+ };
1138
+ },
1139
+ parseHTML() {
1140
+ return [{
1141
+ tag: `span[data-type="${this.name}"]`
1142
+ }];
1143
+ },
1144
+ renderHTML({
1145
+ node,
1146
+ HTMLAttributes
1147
+ }) {
1148
+ return ["span", (0, import_core2.mergeAttributes)({
1149
+ "data-type": this.name
1150
+ }, this.options.HTMLAttributes, HTMLAttributes), this.options.renderLabel({
1151
+ options: this.options,
1152
+ node
1153
+ })];
1154
+ },
1155
+ renderText({
1156
+ node
1157
+ }) {
1158
+ return this.options.renderLabel({
1159
+ options: this.options,
1160
+ node
1161
+ });
1162
+ },
1163
+ addKeyboardShortcuts() {
1164
+ return {
1165
+ Backspace: () => this.editor.commands.command(({
1166
+ tr,
1167
+ state
1168
+ }) => {
1169
+ let isVariable = false;
1170
+ const {
1171
+ selection
1172
+ } = state;
1173
+ const {
1174
+ empty,
1175
+ anchor
1176
+ } = selection;
1177
+ if (!empty) {
1178
+ return false;
1179
+ }
1180
+ state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
1181
+ if (node.type.name === this.name) {
1182
+ isVariable = true;
1183
+ tr.insertText(this.options.suggestion.char || "", pos, pos + node.nodeSize);
1184
+ return false;
1185
+ }
1186
+ });
1187
+ return isVariable;
1188
+ })
1189
+ };
1190
+ },
1191
+ addProseMirrorPlugins() {
1192
+ return [(0, import_suggestion.default)({
1193
+ editor: this.editor,
1194
+ ...this.options.suggestion
1195
+ })];
1196
+ }
1197
+ });
1198
+
1199
+ // src/extensions/variable-list-extension.tsx
1200
+ var import_vue13 = require("vue");
1201
+ var import_vue14 = require("vue");
1202
+ var import_css5 = require("@mekari/pixel3-styled-system/css");
1203
+ var import_pixel3_popover3 = require("@mekari/pixel3-popover");
1204
+ var import_pixel3_text2 = require("@mekari/pixel3-text");
1205
+ var VariableList = (0, import_vue14.defineComponent)({
1206
+ name: "VariableList",
1207
+ props: {
1208
+ items: {
1209
+ type: Array,
1210
+ default: () => []
1211
+ },
1212
+ command: {
1213
+ type: Function,
1214
+ required: true
1215
+ }
1216
+ },
1217
+ setup(props, {
1218
+ expose
1219
+ }) {
1220
+ const selectedIndex = (0, import_vue14.ref)(0);
1221
+ const listRef = (0, import_vue14.ref)(null);
1222
+ const groupedItems = (0, import_vue14.computed)(() => {
1223
+ const groups = {};
1224
+ props.items.forEach((item) => {
1225
+ const category = item.category || "OTHER";
1226
+ if (!groups[category]) {
1227
+ groups[category] = [];
1228
+ }
1229
+ groups[category].push(item);
1230
+ });
1231
+ return Object.entries(groups).map(([category, items]) => ({
1232
+ category,
1233
+ items
1234
+ }));
1235
+ });
1236
+ const scrollToFocusedItem = /* @__PURE__ */ __name(() => {
1237
+ (0, import_vue14.nextTick)(() => {
1238
+ if (!listRef.value)
1239
+ return;
1240
+ const targetItem = listRef.value.querySelector('[data-active="true"], [data-highlight]');
1241
+ if (targetItem) {
1242
+ targetItem.scrollIntoView({
1243
+ block: "nearest"
1244
+ });
1245
+ }
1246
+ });
1247
+ }, "scrollToFocusedItem");
1248
+ (0, import_vue14.watch)(() => props.items, () => {
1249
+ selectedIndex.value = 0;
1250
+ });
1251
+ const onSelect = /* @__PURE__ */ __name((index) => {
1252
+ const item = props.items[index];
1253
+ if (item) {
1254
+ props.command({
1255
+ ...item,
1256
+ label: item.id
1257
+ });
1258
+ }
1259
+ }, "onSelect");
1260
+ const onKeyDown = /* @__PURE__ */ __name(({
1261
+ event
1262
+ }) => {
1263
+ if (!props.items.length) {
1264
+ return false;
1265
+ }
1266
+ if (event.key === "ArrowUp") {
1267
+ event.preventDefault();
1268
+ const total = props.items.length;
1269
+ selectedIndex.value = (selectedIndex.value + total - 1) % total;
1270
+ scrollToFocusedItem();
1271
+ return true;
1272
+ }
1273
+ if (event.key === "ArrowDown") {
1274
+ event.preventDefault();
1275
+ selectedIndex.value = (selectedIndex.value + 1) % props.items.length;
1276
+ scrollToFocusedItem();
1277
+ return true;
1278
+ }
1279
+ if (event.key === "Enter") {
1280
+ event.preventDefault();
1281
+ onSelect(selectedIndex.value);
1282
+ return true;
1283
+ }
1284
+ return false;
1285
+ }, "onKeyDown");
1286
+ expose({
1287
+ onKeyDown
1288
+ });
1289
+ return () => (0, import_vue13.createVNode)(import_pixel3_popover3.MpPopover, {
1290
+ "id": "popover-rte-variable-list",
1291
+ "is-manual": true,
1292
+ "is-default-open": true,
1293
+ "is-open": true
1294
+ }, {
1295
+ default: () => [(0, import_vue13.createVNode)(import_pixel3_popover3.MpPopoverContent, {
1296
+ "class": (0, import_css5.css)({
1297
+ width: "280px",
1298
+ maxHeight: "284px",
1299
+ overflowY: "auto"
1300
+ })
1301
+ }, {
1302
+ default: () => [(0, import_vue13.createVNode)(import_pixel3_popover3.MpPopoverList, {
1303
+ "ref": (element) => {
1304
+ var _a;
1305
+ if (!element) {
1306
+ listRef.value = null;
1307
+ return;
1308
+ }
1309
+ listRef.value = (_a = element.$el) != null ? _a : element;
1310
+ },
1311
+ "data-pixel-rte": true
1312
+ }, {
1313
+ default: () => [!props.items.length && (0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1314
+ "color": "text.secondary",
1315
+ "class": (0, import_css5.css)({
1316
+ px: "3",
1317
+ py: "2"
1318
+ })
1319
+ }, {
1320
+ default: () => [(0, import_vue13.createTextVNode)("No result")]
1321
+ }), groupedItems.value.map((group) => {
1322
+ return (0, import_vue13.createVNode)(import_vue13.Fragment, null, [(0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1323
+ "size": "label-small",
1324
+ "color": "text.secondary",
1325
+ "class": (0, import_css5.css)({
1326
+ px: "3",
1327
+ py: "2",
1328
+ textTransform: "uppercase",
1329
+ textAlign: "left",
1330
+ letterSpacing: "0.05em",
1331
+ display: "block",
1332
+ width: "full"
1333
+ })
1334
+ }, {
1335
+ default: () => [group.category]
1336
+ }), group.items.map((item) => {
1337
+ const itemIndex = props.items.indexOf(item);
1338
+ return (0, import_vue13.createVNode)(import_pixel3_popover3.MpPopoverListItem, {
1339
+ "key": `${item.id}-${itemIndex}`,
1340
+ "onMousedown": (event) => event.preventDefault(),
1341
+ "onMouseenter": () => {
1342
+ selectedIndex.value = itemIndex;
1343
+ },
1344
+ "onClick": () => {
1345
+ onSelect(itemIndex);
1346
+ }
1347
+ }, {
1348
+ default: () => [(0, import_vue13.createVNode)("div", {
1349
+ "class": (0, import_css5.css)({
1350
+ display: "flex",
1351
+ flexDirection: "column",
1352
+ alignItems: "flex-start",
1353
+ minWidth: "0",
1354
+ width: "full",
1355
+ gap: "0.5"
1356
+ })
1357
+ }, [(0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1358
+ "size": "label",
1359
+ "is-truncated": true
1360
+ }, {
1361
+ default: () => [item.name || "Unknown"]
1362
+ }), (0, import_vue13.createVNode)(import_pixel3_text2.MpText, {
1363
+ "size": "label-small",
1364
+ "color": "text.secondary",
1365
+ "is-truncated": true,
1366
+ "class": (0, import_css5.css)({
1367
+ fontFamily: "mono"
1368
+ })
1369
+ }, {
1370
+ default: () => [`{${item.id}}`]
1371
+ })])]
1372
+ });
1373
+ })]);
1374
+ })]
1375
+ })]
1376
+ })]
1377
+ });
1378
+ }
1379
+ });
1037
1380
  // Annotate the CommonJS export names for ESM import in node:
1038
1381
  0 && (module.exports = {
1039
1382
  AlignExtention,
1040
1383
  ColorExtension,
1041
1384
  HeadingExtention,
1042
1385
  LinkExtension,
1043
- SingleExtention
1386
+ SingleExtention,
1387
+ Variable,
1388
+ VariableList
1044
1389
  });
@@ -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-47IOAHWN.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>;
@@ -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>;