@dialpad/dialtone 9.126.1 → 9.126.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/css/dialtone-default-theme.css +1 -1
  2. package/dist/css/dialtone-default-theme.min.css +1 -1
  3. package/dist/css/dialtone.css +1 -1
  4. package/dist/css/dialtone.min.css +1 -1
  5. package/dist/tokens/doc.json +26155 -26155
  6. package/dist/vue2/component-documentation.json +1 -1
  7. package/dist/vue2/lib/message-input/message-input.cjs +1 -1
  8. package/dist/vue2/lib/message-input/message-input.cjs.map +1 -1
  9. package/dist/vue2/lib/message-input/message-input.js +29 -7
  10. package/dist/vue2/lib/message-input/message-input.js.map +1 -1
  11. package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  12. package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  13. package/dist/vue2/lib/rich-text-editor/rich-text-editor.js +73 -44
  14. package/dist/vue2/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  15. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts.map +1 -1
  16. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +1 -1
  17. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  18. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  19. package/dist/vue3/component-documentation.json +1 -1
  20. package/dist/vue3/lib/message-input/message-input.cjs +1 -1
  21. package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
  22. package/dist/vue3/lib/message-input/message-input.js +88 -67
  23. package/dist/vue3/lib/message-input/message-input.js.map +1 -1
  24. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  25. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  26. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +48 -19
  27. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  28. package/dist/vue3/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts.map +1 -1
  29. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +2 -1
  30. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  31. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  32. package/package.json +3 -3
@@ -26,17 +26,17 @@ import _e from "@tiptap/suggestion";
26
26
  import { emojiPattern as B } from "regex-combined-emojis";
27
27
  import { n as c } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
28
28
  import P from "../emoji/emoji.js";
29
- import { stringToUnicode as ye, codeToEmojiData as R, emojiRegex as we, emojiShortCodeRegex as ve } from "../../common/emoji/index.js";
29
+ import { stringToUnicode as ye, codeToEmojiData as L, emojiRegex as we, emojiShortCodeRegex as ve } from "../../common/emoji/index.js";
30
30
  import { emojisIndexed as xe } from "@dialpad/dialtone-emojis";
31
31
  import be from "../list-item/list-item.js";
32
32
  import x from "../stack/stack.js";
33
33
  import b from "tippy.js";
34
- import { linkRegex as ke, getPhoneNumberRegex as Te, warnIfUnmounted as Ce } from "../../common/utils/index.js";
34
+ import { linkRegex as Ce, getPhoneNumberRegex as ke, warnIfUnmounted as Te } from "../../common/utils/index.js";
35
35
  import Ee from "@tiptap/extension-image";
36
- import S from "@tiptap/extension-mention";
36
+ import R from "@tiptap/extension-mention";
37
37
  import M from "../link/link.js";
38
- import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as Le, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Re, RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as $ } from "./rich-text-editor-constants.js";
39
- import Se from "../avatar/avatar.js";
38
+ import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as Se, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Le, RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as $ } from "./rich-text-editor-constants.js";
39
+ import Re from "../avatar/avatar.js";
40
40
  import $e from "@dialpad/dialtone-icons/vue2/hash";
41
41
  import Ie from "@dialpad/dialtone-icons/vue2/lock";
42
42
  import Ae from "deep-equal";
@@ -148,7 +148,7 @@ var Ne = function() {
148
148
  Ne,
149
149
  qe
150
150
  );
151
- const k = Ue.exports, Ke = {
151
+ const C = Ue.exports, Ke = {
152
152
  name: "EmojiSuggestion",
153
153
  components: {
154
154
  DtEmoji: P,
@@ -169,7 +169,7 @@ var We = function() {
169
169
  We,
170
170
  Ve
171
171
  );
172
- const Xe = ze.exports, T = {
172
+ const Xe = ze.exports, k = {
173
173
  name: "hideOnEsc",
174
174
  defaultValue: !0,
175
175
  fn({ hide: e }) {
@@ -212,7 +212,7 @@ const Xe = ze.exports, T = {
212
212
  let e, t, n = !1;
213
213
  return {
214
214
  onStart: (r) => {
215
- e = new w(k, {
215
+ e = new w(C, {
216
216
  parent: void 0,
217
217
  propsData: {
218
218
  itemComponent: Xe,
@@ -235,7 +235,7 @@ const Xe = ze.exports, T = {
235
235
  trigger: "manual",
236
236
  placement: "top-start",
237
237
  zIndex: 650,
238
- plugins: [T]
238
+ plugins: [k]
239
239
  }), r.items.length > 0 && (t == null || t[0].show()));
240
240
  },
241
241
  onUpdate(r) {
@@ -254,9 +254,9 @@ const Xe = ze.exports, T = {
254
254
  };
255
255
  }
256
256
  }, Ge = /(:\w+:)$/, Qe = new RegExp(B + "$"), Ze = (e) => {
257
- if (e && R(e[0]))
257
+ if (e && L(e[0]))
258
258
  return { text: e[2] || e[0] };
259
- }, et = (e) => [...e.matchAll(ve)].filter((n) => R(n[0])).map((n) => ({
259
+ }, et = (e) => [...e.matchAll(ve)].filter((n) => L(n[0])).map((n) => ({
260
260
  index: n.index,
261
261
  text: n[0],
262
262
  match: n
@@ -289,7 +289,7 @@ const Xe = ze.exports, T = {
289
289
  ];
290
290
  },
291
291
  renderText({ node: e }) {
292
- return ye(R(e.attrs.code).unicode_output);
292
+ return ye(L(e.attrs.code).unicode_output);
293
293
  },
294
294
  renderHTML({ HTMLAttributes: e }) {
295
295
  return ["emoji-component", m(this.options.HTMLAttributes, e)];
@@ -392,37 +392,37 @@ function it(e, t) {
392
392
  to: r + t
393
393
  };
394
394
  }
395
- function L(e, t, n, r) {
395
+ function S(e, t, n, r) {
396
396
  const s = it(e, t);
397
397
  if (r.lastIndex = 0, !r.test(s.text))
398
398
  return s;
399
399
  const o = n === "left" ? s.from - 1 : s.to + 1;
400
- return o <= 0 || o >= e.length || o === t ? s : L(e, o, n, r);
400
+ return o <= 0 || o >= e.length || o === t ? s : S(e, o, n, r);
401
401
  }
402
402
  function ot(e, t, n, r) {
403
403
  const s = Math.max(e.from - 1, 0), o = Math.min(e.to + 1, t.content.size), i = U(s, o, t);
404
404
  for (const a of i)
405
405
  a.mark.type === r && n.removeMark(a.from, a.to, r);
406
406
  }
407
- const I = Te(1, 15);
407
+ const I = ke(1, 15);
408
408
  function A(e, t, n, r, s, o) {
409
409
  if (!e)
410
410
  return;
411
411
  let i = n - t - 1;
412
412
  i = i < 0 ? 0 : i;
413
- const a = r - t, l = L(
413
+ const a = r - t, l = S(
414
414
  e,
415
415
  i,
416
416
  "left",
417
417
  I
418
- ), d = L(
418
+ ), d = S(
419
419
  e,
420
420
  a,
421
421
  "right",
422
422
  I
423
423
  ), u = e.slice(l.from, d.to);
424
- nt(u, ke, rt).forEach((C) => {
425
- const h = st(C[0]), g = t + l.from + C.index + 1, D = g + h.length;
424
+ nt(u, Ce, rt).forEach((T) => {
425
+ const h = st(T[0]), g = t + l.from + T.index + 1, D = g + h.length;
426
426
  s.addMark(g, D, o.create());
427
427
  });
428
428
  }
@@ -534,7 +534,7 @@ var ht = function() {
534
534
  ht,
535
535
  ft
536
536
  );
537
- const gt = pt.exports, _t = S.extend({
537
+ const gt = pt.exports, _t = R.extend({
538
538
  addNodeView() {
539
539
  return v(gt);
540
540
  },
@@ -590,7 +590,7 @@ var wt = function() {
590
590
  wt,
591
591
  vt
592
592
  );
593
- const bt = xt.exports, kt = S.extend({
593
+ const bt = xt.exports, Ct = R.extend({
594
594
  name: "channel",
595
595
  addNodeView() {
596
596
  return v(bt);
@@ -626,12 +626,14 @@ const bt = xt.exports, kt = S.extend({
626
626
  char: "#",
627
627
  pluginKey: new f("channelSuggestion")
628
628
  }
629
- }), Tt = {
629
+ }), kt = {
630
630
  name: "SlashCommandsComponent",
631
631
  components: {
632
632
  NodeViewWrapper: _
633
633
  },
634
- props: y,
634
+ props: {
635
+ ...y
636
+ },
635
637
  emits: ["selected-command"],
636
638
  computed: {
637
639
  text() {
@@ -639,30 +641,46 @@ const bt = xt.exports, kt = S.extend({
639
641
  }
640
642
  },
641
643
  created() {
642
- this.$parent.$emit("selected-command", this.$props.node.attrs.command);
644
+ var n, r, s;
645
+ const e = this.$props.node.attrs.command;
646
+ this.$emit("selected-command", e);
647
+ const t = (s = (r = (n = this.editor) == null ? void 0 : n.storage) == null ? void 0 : r["slash-commands"]) == null ? void 0 : s.onSelectedCommand;
648
+ t && typeof t == "function" && t(e);
643
649
  }
644
650
  };
645
- var Ct = function() {
651
+ var Tt = function() {
646
652
  var t = this, n = t._self._c;
647
653
  return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [t._v(" " + t._s(t.text) + " ")]);
648
- }, Et = [], Lt = /* @__PURE__ */ c(
654
+ }, Et = [], St = /* @__PURE__ */ c(
655
+ kt,
649
656
  Tt,
650
- Ct,
651
657
  Et
652
658
  );
653
- const Rt = Lt.exports, St = (e, t) => [...e.matchAll(t)].map((r) => {
659
+ const Lt = St.exports, Rt = (e, t) => [...e.matchAll(t)].map((r) => {
654
660
  let s = r[2];
655
661
  return s.endsWith(" ") || (s += " "), {
656
662
  index: r.index,
657
663
  text: s,
658
664
  match: r
659
665
  };
660
- }), $t = S.extend({
666
+ }), $t = R.extend({
661
667
  name: "slash-commands",
662
668
  group: "inline",
663
669
  inline: !0,
670
+ addOptions() {
671
+ var e;
672
+ return {
673
+ ...(e = this.parent) == null ? void 0 : e.call(this),
674
+ onSelectedCommand: null
675
+ };
676
+ },
677
+ addStorage() {
678
+ return {
679
+ onSelectedCommand: this.options.onSelectedCommand
680
+ };
681
+ },
664
682
  addNodeView() {
665
- return v(Rt);
683
+ return v(Lt);
666
684
  },
667
685
  parseHTML() {
668
686
  return [
@@ -708,7 +726,7 @@ const Rt = Lt.exports, St = (e, t) => [...e.matchAll(t)].map((r) => {
708
726
  const e = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) ?$`, "g");
709
727
  return [
710
728
  E({
711
- find: (r) => St(r, t),
729
+ find: (r) => Rt(r, t),
712
730
  type: this.type,
713
731
  getAttributes(r) {
714
732
  return { command: r[0].trim() };
@@ -724,7 +742,7 @@ const Rt = Lt.exports, St = (e, t) => [...e.matchAll(t)].map((r) => {
724
742
  }), It = {
725
743
  name: "MentionSuggestion",
726
744
  components: {
727
- DtAvatar: Se,
745
+ DtAvatar: Re,
728
746
  DtStack: x
729
747
  },
730
748
  props: {
@@ -779,7 +797,7 @@ const Pt = Bt.exports, Mt = {
779
797
  let e, t, n = !1;
780
798
  return {
781
799
  onStart: (r) => {
782
- e = new w(k, {
800
+ e = new w(C, {
783
801
  parent: void 0,
784
802
  propsData: {
785
803
  itemComponent: Pt,
@@ -802,7 +820,7 @@ const Pt = Bt.exports, Mt = {
802
820
  trigger: "manual",
803
821
  placement: "top-start",
804
822
  zIndex: 650,
805
- plugins: [T]
823
+ plugins: [k]
806
824
  }), r.items.length > 0 && (t == null || t[0].show()));
807
825
  },
808
826
  onUpdate(r) {
@@ -856,7 +874,7 @@ const Nt = Ft.exports, qt = {
856
874
  let e, t, n = !1;
857
875
  return {
858
876
  onStart: (r) => {
859
- e = new w(k, {
877
+ e = new w(C, {
860
878
  parent: void 0,
861
879
  propsData: {
862
880
  itemComponent: Nt,
@@ -879,7 +897,7 @@ const Nt = Ft.exports, qt = {
879
897
  trigger: "manual",
880
898
  placement: "top-start",
881
899
  zIndex: 650,
882
- plugins: [T]
900
+ plugins: [k]
883
901
  }), r.items.length > 0 && (t == null || t[0].show()));
884
902
  },
885
903
  onUpdate(r) {
@@ -935,7 +953,7 @@ const zt = Vt.exports, Xt = {
935
953
  let e, t, n = !1;
936
954
  return {
937
955
  onStart: (r) => {
938
- e = new w(k, {
956
+ e = new w(C, {
939
957
  parent: void 0,
940
958
  propsData: {
941
959
  itemComponent: zt,
@@ -958,7 +976,7 @@ const zt = Vt.exports, Xt = {
958
976
  trigger: "manual",
959
977
  placement: "top-start",
960
978
  zIndex: 650,
961
- plugins: [T]
979
+ plugins: [k]
962
980
  }), r.items.length > 0 && (t == null || t[0].show()));
963
981
  },
964
982
  onUpdate(r) {
@@ -1055,7 +1073,7 @@ const zt = Vt.exports, Xt = {
1055
1073
  type: [Boolean, String, Number],
1056
1074
  default: !1,
1057
1075
  validator(e) {
1058
- return typeof e == "string" ? Le.includes(e) : !0;
1076
+ return typeof e == "string" ? Se.includes(e) : !0;
1059
1077
  }
1060
1078
  },
1061
1079
  /**
@@ -1068,7 +1086,7 @@ const zt = Vt.exports, Xt = {
1068
1086
  type: String,
1069
1087
  default: "html",
1070
1088
  validator(e) {
1071
- return Re.includes(e);
1089
+ return Le.includes(e);
1072
1090
  }
1073
1091
  },
1074
1092
  /**
@@ -1313,7 +1331,13 @@ const zt = Vt.exports, Xt = {
1313
1331
  * @event selected
1314
1332
  * @type {String}
1315
1333
  */
1316
- "selected"
1334
+ "selected",
1335
+ /**
1336
+ * Event fired when a slash command is selected
1337
+ * @event selected-command
1338
+ * @type {String}
1339
+ */
1340
+ "selected-command"
1317
1341
  ],
1318
1342
  data() {
1319
1343
  return {
@@ -1376,11 +1400,16 @@ const zt = Vt.exports, Xt = {
1376
1400
  }
1377
1401
  if (this.channelSuggestion) {
1378
1402
  const r = { ...this.channelSuggestion, ...qt };
1379
- e.push(kt.configure({ suggestion: r }));
1403
+ e.push(Ct.configure({ suggestion: r }));
1380
1404
  }
1381
1405
  if (this.slashCommandSuggestion) {
1382
1406
  const r = { ...this.slashCommandSuggestion, ...Xt };
1383
- e.push($t.configure({ suggestion: r }));
1407
+ e.push($t.configure({
1408
+ suggestion: r,
1409
+ onSelectedCommand: (s) => {
1410
+ this.$emit("selected-command", s);
1411
+ }
1412
+ }));
1384
1413
  }
1385
1414
  return e.push(tt), e.push(ue.configure({
1386
1415
  types: ["paragraph"]
@@ -1434,7 +1463,7 @@ ${r.textContent}
1434
1463
  this.destroyEditor();
1435
1464
  },
1436
1465
  mounted() {
1437
- Ce(this.$el, this.$options.name), this.processValue(this.value, !1);
1466
+ Te(this.$el, this.$options.name), this.processValue(this.value, !1);
1438
1467
  },
1439
1468
  methods: {
1440
1469
  createEditor() {