@liveblocks/react-ui 3.18.0-rc2 → 3.18.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.
@@ -7,6 +7,22 @@ var getMatchRange = require('../../../slate/utils/get-match-range.cjs');
7
7
  var isEmptyString = require('../../../slate/utils/is-empty-string.cjs');
8
8
  var isWhitespaceCharacter = require('../../../slate/utils/is-whitespace-character.cjs');
9
9
 
10
+ const EMOJI_REGEX = /\p{Extended_Pictographic}|\p{Emoji_Modifier}|\uFE0F|\u200D/u;
11
+ const SUPPORTED_PRECEDING_PUNCTUATION = /* @__PURE__ */ new Set([
12
+ '"',
13
+ "'",
14
+ ".",
15
+ "!",
16
+ "?",
17
+ ",",
18
+ ";",
19
+ "(",
20
+ ")",
21
+ "[",
22
+ "]",
23
+ "<",
24
+ ">"
25
+ ]);
10
26
  function getMentionDraftAtSelection(editor) {
11
27
  const { selection } = editor;
12
28
  if (!selection || !slate.Range.isCollapsed(selection)) {
@@ -17,10 +33,16 @@ function getMentionDraftAtSelection(editor) {
17
33
  allowConsecutiveWhitespace: false,
18
34
  ignoreTerminator: (_, point) => {
19
35
  const characterBefore = getCharacter.getCharacterBefore(editor, point);
20
- if (characterBefore && !isWhitespaceCharacter.isWhitespaceCharacter(characterBefore.text)) {
21
- return true;
36
+ if (!characterBefore) {
37
+ return false;
22
38
  }
23
- return false;
39
+ if (SUPPORTED_PRECEDING_PUNCTUATION.has(characterBefore.text)) {
40
+ return false;
41
+ }
42
+ if (EMOJI_REGEX.test(characterBefore.text)) {
43
+ return false;
44
+ }
45
+ return !isWhitespaceCharacter.isWhitespaceCharacter(characterBefore.text);
24
46
  }
25
47
  });
26
48
  if (!match) {
@@ -1 +1 @@
1
- {"version":3,"file":"mentions.cjs","sources":["../../../../../src/primitives/Composer/slate/plugins/mentions.ts"],"sourcesContent":["import { MENTION_CHARACTER, type MentionData } from \"@liveblocks/core\";\nimport type { Node as SlateNode } from \"slate\";\nimport {\n Editor as SlateEditor,\n Element as SlateElement,\n Range as SlateRange,\n Transforms as SlateTransforms,\n} from \"slate\";\n\nimport type { ComposerBodyMention } from \"../../../../types\";\nimport {\n getCharacterAfter,\n getCharacterBefore,\n} from \"../../../slate/utils/get-character\";\nimport { getMatchRange } from \"../../../slate/utils/get-match-range\";\nimport { isEmptyString } from \"../../../slate/utils/is-empty-string\";\nimport { isWhitespaceCharacter } from \"../../../slate/utils/is-whitespace-character\";\n\nexport type MentionDraft = {\n range: SlateRange;\n text: string;\n};\n\nexport function getMentionDraftAtSelection(\n editor: SlateEditor\n): MentionDraft | undefined {\n const { selection } = editor;\n\n if (!selection || !SlateRange.isCollapsed(selection)) {\n return;\n }\n\n // Walk backwards from the selection until \"@\" is found, unless the character\n // before isn't whitespace (or \"@\" is the block's first character)\n const match = getMatchRange(editor, selection, [\"@\"], {\n include: true,\n allowConsecutiveWhitespace: false,\n ignoreTerminator: (_, point) => {\n const characterBefore = getCharacterBefore(editor, point);\n\n // Ignore \"@\" if it's preceded by a non-whitespace character\n if (characterBefore && !isWhitespaceCharacter(characterBefore.text)) {\n return true;\n }\n\n return false;\n },\n });\n\n if (!match) {\n return;\n }\n\n const matchText = SlateEditor.string(editor, match);\n\n // Check if the match starts with the mention character (not followed by a whitespace character)\n if (\n !matchText.startsWith(MENTION_CHARACTER) ||\n (matchText.length > 1 && isWhitespaceCharacter(matchText[1]))\n ) {\n return;\n }\n\n return {\n range: match,\n // Exclude the mention character from the text\n text: matchText.substring(1),\n };\n}\n\nexport function isComposerBodyMention(\n node: SlateNode\n): node is ComposerBodyMention {\n return SlateElement.isElement(node) && node.type === \"mention\";\n}\n\nexport function insertMention(editor: SlateEditor, mention: MentionData) {\n const mentionNode: ComposerBodyMention = {\n type: \"mention\",\n ...mention,\n children: [{ text: \"\" }],\n };\n\n // Insert the mention\n SlateTransforms.insertNodes(editor, mentionNode);\n SlateTransforms.move(editor);\n\n const afterCharacter = editor.selection\n ? getCharacterAfter(editor, editor.selection)\n : undefined;\n\n if (!afterCharacter || afterCharacter.void) {\n // Insert a following space if needed\n SlateTransforms.insertText(editor, \" \");\n } else if (isEmptyString(afterCharacter.text)) {\n // Move the selection if it's already followed by a space\n SlateTransforms.move(editor);\n }\n}\n\nexport function insertMentionCharacter(editor: SlateEditor) {\n if (!editor.selection) {\n return;\n }\n\n // Check if the selection is preceded or followed by a non-whitespace character\n const beforeCharacter = getCharacterBefore(editor, editor.selection, {\n filterVoids: true,\n });\n const afterCharacter = getCharacterAfter(editor, editor.selection, {\n filterVoids: true,\n });\n const shouldInsertSpaceBefore =\n beforeCharacter && !isEmptyString(beforeCharacter.text);\n const shouldInsertSpaceAfter =\n afterCharacter && !isEmptyString(afterCharacter.text);\n\n if (!SlateRange.isCollapsed(editor.selection)) {\n const text =\n (shouldInsertSpaceBefore ? \" \" : \"\") +\n MENTION_CHARACTER +\n (shouldInsertSpaceAfter ? \" \" : \"\");\n\n // If the selection is collapsed, insert the mention character at the current selection\n editor.insertText(text);\n\n // If a following space was inserted, move the selection back by one\n if (shouldInsertSpaceAfter) {\n SlateTransforms.move(editor, {\n distance: 1,\n unit: \"character\",\n reverse: true,\n });\n }\n } else {\n const beforeText = (shouldInsertSpaceBefore ? \" \" : \"\") + MENTION_CHARACTER;\n\n // If the selection is not collapsed, insert the mention character before the selection\n editor.insertText(beforeText, { at: SlateRange.start(editor.selection) });\n\n if (shouldInsertSpaceAfter) {\n editor.insertText(\" \", { at: SlateRange.end(editor.selection) });\n }\n\n // Collapse the selection at its end\n SlateTransforms.collapse(editor, { edge: \"end\" });\n }\n}\n\nexport function withMentions<T extends SlateEditor>(editor: T): T {\n const { isInline, isVoid, markableVoid, deleteBackward } = editor;\n\n editor.isInline = (element) => {\n return isComposerBodyMention(element) || isInline(element);\n };\n\n editor.isVoid = (element) => {\n return isComposerBodyMention(element) || isVoid(element);\n };\n\n editor.markableVoid = (element) => {\n return isComposerBodyMention(element) || markableVoid(element);\n };\n\n editor.deleteBackward = (unit) => {\n const { selection } = editor;\n\n if (selection && SlateRange.isCollapsed(selection)) {\n const [mention] = SlateEditor.nodes(editor, {\n at:\n unit === \"character\"\n ? SlateEditor.before(editor, selection, { unit: \"character\" })\n : selection,\n match: isComposerBodyMention,\n });\n\n deleteBackward(unit);\n\n if (mention) {\n SlateTransforms.insertText(editor, MENTION_CHARACTER);\n }\n } else {\n deleteBackward(unit);\n }\n };\n\n return editor;\n}\n"],"names":["SlateRange","getMatchRange","getCharacterBefore","isWhitespaceCharacter","SlateEditor","MENTION_CHARACTER","SlateElement","SlateTransforms","getCharacterAfter","isEmptyString"],"mappings":";;;;;;;;;AAuBO,SAAS,2BACd,MAC0B,EAAA;AAC1B,EAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AAEtB,EAAA,IAAI,CAAC,SAAa,IAAA,CAACA,WAAW,CAAA,WAAA,CAAY,SAAS,CAAG,EAAA;AACpD,IAAA,OAAA;AAAA,GACF;AAIA,EAAA,MAAM,QAAQC,2BAAc,CAAA,MAAA,EAAQ,SAAW,EAAA,CAAC,GAAG,CAAG,EAAA;AAAA,IACpD,OAAS,EAAA,IAAA;AAAA,IACT,0BAA4B,EAAA,KAAA;AAAA,IAC5B,gBAAA,EAAkB,CAAC,CAAA,EAAG,KAAU,KAAA;AAC9B,MAAM,MAAA,eAAA,GAAkBC,+BAAmB,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAGxD,MAAA,IAAI,eAAmB,IAAA,CAACC,2CAAsB,CAAA,eAAA,CAAgB,IAAI,CAAG,EAAA;AACnE,QAAO,OAAA,IAAA,CAAA;AAAA,OACT;AAEA,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AAED,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAA,OAAA;AAAA,GACF;AAEA,EAAA,MAAM,SAAY,GAAAC,YAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAGlD,EAAA,IACE,CAAC,SAAA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CAAA,CAAA;AAED,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAEnB,MAAA,IAAI,OAAS,EAAA;AACX,QAAgBG,gBAAA,CAAA,UAAA,CAAW,QAAQF,sBAAiB,CAAA,CAAA;AAAA,OACtD;AAAA,KACK,MAAA;AACL,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAAA,KACrB;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;;;"}
1
+ {"version":3,"file":"mentions.cjs","sources":["../../../../../src/primitives/Composer/slate/plugins/mentions.ts"],"sourcesContent":["import { MENTION_CHARACTER, type MentionData } from \"@liveblocks/core\";\nimport type { Node as SlateNode } from \"slate\";\nimport {\n Editor as SlateEditor,\n Element as SlateElement,\n Range as SlateRange,\n Transforms as SlateTransforms,\n} from \"slate\";\n\nimport type { ComposerBodyMention } from \"../../../../types\";\nimport {\n getCharacterAfter,\n getCharacterBefore,\n} from \"../../../slate/utils/get-character\";\nimport { getMatchRange } from \"../../../slate/utils/get-match-range\";\nimport { isEmptyString } from \"../../../slate/utils/is-empty-string\";\nimport { isWhitespaceCharacter } from \"../../../slate/utils/is-whitespace-character\";\n\nconst EMOJI_REGEX =\n /\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\uFE0F|\\u200D/u;\n\n// A few punctuation characters that aren't common (or even forbidden) as the\n// last character in email addresses' local part so we allow them before \"@\" mentions.\nconst SUPPORTED_PRECEDING_PUNCTUATION = new Set<string>([\n '\"',\n \"'\",\n \".\",\n \"!\",\n \"?\",\n \",\",\n \";\",\n \"(\",\n \")\",\n \"[\",\n \"]\",\n \"<\",\n \">\",\n]);\n\nexport type MentionDraft = {\n range: SlateRange;\n text: string;\n};\n\nexport function getMentionDraftAtSelection(\n editor: SlateEditor\n): MentionDraft | undefined {\n const { selection } = editor;\n\n if (!selection || !SlateRange.isCollapsed(selection)) {\n return;\n }\n\n // Walk backwards from the selection until \"@\" is found (with a few rules):\n // - `@` → `\"\"` mention draft\n // - `Hello @stacy` → `\"stacy\"` mention draft (because \"@\" is preceded by a whitespace character)\n // - `Hello pierre@example.com` → no mention draft (because \"@\" is preceded by a non-whitespace character)\n // - `Hello @alicia@example.com` → `\"alicia@example.com\"` mention draft (because the first \"@\" is preceded by a whitespace character)\n // - `Hello!@chris` → `\"chris\"` mention draft (because \"!\" is a supported preceding punctuation)\n // - `Hello.@vincent` → `\"vincent\"` mention draft (because \".\" is a supported preceding punctuation)\n // - `Hello (@olivier` → `\"olivier\"` mention draft (because \"(\" is a supported preceding punctuation)\n // - `Hello 👋@nimesh` → `\"nimesh\"` mention draft (because the first \"@\" is preceded by an emoji)\n const match = getMatchRange(editor, selection, [\"@\"], {\n include: true,\n allowConsecutiveWhitespace: false,\n ignoreTerminator: (_, point) => {\n const characterBefore = getCharacterBefore(editor, point);\n\n // If \"@\" is the first character of the block, this \"@\" is immediately accepted ✅\n if (!characterBefore) {\n return false;\n }\n\n // If the character before \"@\" is a supported preceding punctuation, this \"@\" is accepted ✅\n if (SUPPORTED_PRECEDING_PUNCTUATION.has(characterBefore.text)) {\n return false;\n }\n\n // If the character before \"@\" is an emoji, this \"@\" is accepted ✅\n if (EMOJI_REGEX.test(characterBefore.text)) {\n return false;\n }\n\n // If the character before \"@\" is still a non-whitespace character, this \"@\" is ignored ❌\n return !isWhitespaceCharacter(characterBefore.text);\n },\n });\n\n if (!match) {\n return;\n }\n\n const matchText = SlateEditor.string(editor, match);\n\n // Check if the match starts with the mention character (not followed by a whitespace character)\n if (\n !matchText.startsWith(MENTION_CHARACTER) ||\n (matchText.length > 1 && isWhitespaceCharacter(matchText[1]))\n ) {\n return;\n }\n\n return {\n range: match,\n // Exclude the mention character from the text\n text: matchText.substring(1),\n };\n}\n\nexport function isComposerBodyMention(\n node: SlateNode\n): node is ComposerBodyMention {\n return SlateElement.isElement(node) && node.type === \"mention\";\n}\n\nexport function insertMention(editor: SlateEditor, mention: MentionData) {\n const mentionNode: ComposerBodyMention = {\n type: \"mention\",\n ...mention,\n children: [{ text: \"\" }],\n };\n\n // Insert the mention\n SlateTransforms.insertNodes(editor, mentionNode);\n SlateTransforms.move(editor);\n\n const afterCharacter = editor.selection\n ? getCharacterAfter(editor, editor.selection)\n : undefined;\n\n if (!afterCharacter || afterCharacter.void) {\n // Insert a following space if needed\n SlateTransforms.insertText(editor, \" \");\n } else if (isEmptyString(afterCharacter.text)) {\n // Move the selection if it's already followed by a space\n SlateTransforms.move(editor);\n }\n}\n\nexport function insertMentionCharacter(editor: SlateEditor) {\n if (!editor.selection) {\n return;\n }\n\n // Check if the selection is preceded or followed by a non-whitespace character\n const beforeCharacter = getCharacterBefore(editor, editor.selection, {\n filterVoids: true,\n });\n const afterCharacter = getCharacterAfter(editor, editor.selection, {\n filterVoids: true,\n });\n const shouldInsertSpaceBefore =\n beforeCharacter && !isEmptyString(beforeCharacter.text);\n const shouldInsertSpaceAfter =\n afterCharacter && !isEmptyString(afterCharacter.text);\n\n if (!SlateRange.isCollapsed(editor.selection)) {\n const text =\n (shouldInsertSpaceBefore ? \" \" : \"\") +\n MENTION_CHARACTER +\n (shouldInsertSpaceAfter ? \" \" : \"\");\n\n // If the selection is collapsed, insert the mention character at the current selection\n editor.insertText(text);\n\n // If a following space was inserted, move the selection back by one\n if (shouldInsertSpaceAfter) {\n SlateTransforms.move(editor, {\n distance: 1,\n unit: \"character\",\n reverse: true,\n });\n }\n } else {\n const beforeText = (shouldInsertSpaceBefore ? \" \" : \"\") + MENTION_CHARACTER;\n\n // If the selection is not collapsed, insert the mention character before the selection\n editor.insertText(beforeText, { at: SlateRange.start(editor.selection) });\n\n if (shouldInsertSpaceAfter) {\n editor.insertText(\" \", { at: SlateRange.end(editor.selection) });\n }\n\n // Collapse the selection at its end\n SlateTransforms.collapse(editor, { edge: \"end\" });\n }\n}\n\nexport function withMentions<T extends SlateEditor>(editor: T): T {\n const { isInline, isVoid, markableVoid, deleteBackward } = editor;\n\n editor.isInline = (element) => {\n return isComposerBodyMention(element) || isInline(element);\n };\n\n editor.isVoid = (element) => {\n return isComposerBodyMention(element) || isVoid(element);\n };\n\n editor.markableVoid = (element) => {\n return isComposerBodyMention(element) || markableVoid(element);\n };\n\n editor.deleteBackward = (unit) => {\n const { selection } = editor;\n\n if (selection && SlateRange.isCollapsed(selection)) {\n const [mention] = SlateEditor.nodes(editor, {\n at:\n unit === \"character\"\n ? SlateEditor.before(editor, selection, { unit: \"character\" })\n : selection,\n match: isComposerBodyMention,\n });\n\n deleteBackward(unit);\n\n if (mention) {\n SlateTransforms.insertText(editor, MENTION_CHARACTER);\n }\n } else {\n deleteBackward(unit);\n }\n };\n\n return editor;\n}\n"],"names":["SlateRange","getMatchRange","getCharacterBefore","isWhitespaceCharacter","SlateEditor","MENTION_CHARACTER","SlateElement","SlateTransforms","getCharacterAfter","isEmptyString"],"mappings":";;;;;;;;;AAkBA,MAAM,WACJ,GAAA,6DAAA,CAAA;AAIF,MAAM,+BAAA,uBAAsC,GAAY,CAAA;AAAA,EACtD,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AACF,CAAC,CAAA,CAAA;AAOM,SAAS,2BACd,MAC0B,EAAA;AAC1B,EAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AAEtB,EAAA,IAAI,CAAC,SAAa,IAAA,CAACA,WAAW,CAAA,WAAA,CAAY,SAAS,CAAG,EAAA;AACpD,IAAA,OAAA;AAAA,GACF;AAWA,EAAA,MAAM,QAAQC,2BAAc,CAAA,MAAA,EAAQ,SAAW,EAAA,CAAC,GAAG,CAAG,EAAA;AAAA,IACpD,OAAS,EAAA,IAAA;AAAA,IACT,0BAA4B,EAAA,KAAA;AAAA,IAC5B,gBAAA,EAAkB,CAAC,CAAA,E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C3B,IAAA,OAAO,qBAAsB,CAAA,OAAO,CAAK,IAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,GACzD,CAAA;AAEA,EAAO,MAAA,CAAA,YAAA,GAAe,CAAC,OAAY,KAAA;AACjC,IAAA,OAAO,qBAAsB,CAAA,OAAO,CAAK,IAAA,YAAA,CAAa,OAAO,CAAA,CAAA;AAAA,GAC/D,CAAA;AAEA,EAAO,MAAA,CAAA,cAAA,GAAiB,CAAC,IAAS,KAAA;AAChC,IAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AAEtB,IAAA,IAAI,SAAa,IAAAP,WAAA,CAAW,WAAY,CAAA,SAAS,CAAG,EAAA;AAClD,MAAA,MAAM,CAAC,OAAO,CAAI,GAAAI,YAAA,CAAY,MAAM,MAAQ,EAAA;AAAA,QAC1C,EAAA,EACE,IAAS,KAAA,WAAA,GACLA,YAAY,CAAA,MAAA,CAAO,MAAQ,EAAA,SAAA,EAAW,EAAE,IAAA,EAAM,WAAY,EAAC,CAC3D,GAAA,SAAA;AAAA,QACN,KAAO,EAAA,qBAAA;AAAA,OACR,CAAA,CAAA;AAED,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAEnB,MAAA,IAAI,OAAS,EAAA;AACX,QAAgBG,gBAAA,CAAA,UAAA,CAAW,QAAQF,sBAAiB,CAAA,CAAA;AAAA,OACtD;AAAA,KACK,MAAA;AACL,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAAA,KACrB;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;;;"}
@@ -5,6 +5,22 @@ import { getMatchRange } from '../../../slate/utils/get-match-range.js';
5
5
  import { isEmptyString } from '../../../slate/utils/is-empty-string.js';
6
6
  import { isWhitespaceCharacter } from '../../../slate/utils/is-whitespace-character.js';
7
7
 
8
+ const EMOJI_REGEX = /\p{Extended_Pictographic}|\p{Emoji_Modifier}|\uFE0F|\u200D/u;
9
+ const SUPPORTED_PRECEDING_PUNCTUATION = /* @__PURE__ */ new Set([
10
+ '"',
11
+ "'",
12
+ ".",
13
+ "!",
14
+ "?",
15
+ ",",
16
+ ";",
17
+ "(",
18
+ ")",
19
+ "[",
20
+ "]",
21
+ "<",
22
+ ">"
23
+ ]);
8
24
  function getMentionDraftAtSelection(editor) {
9
25
  const { selection } = editor;
10
26
  if (!selection || !Range.isCollapsed(selection)) {
@@ -15,10 +31,16 @@ function getMentionDraftAtSelection(editor) {
15
31
  allowConsecutiveWhitespace: false,
16
32
  ignoreTerminator: (_, point) => {
17
33
  const characterBefore = getCharacterBefore(editor, point);
18
- if (characterBefore && !isWhitespaceCharacter(characterBefore.text)) {
19
- return true;
34
+ if (!characterBefore) {
35
+ return false;
20
36
  }
21
- return false;
37
+ if (SUPPORTED_PRECEDING_PUNCTUATION.has(characterBefore.text)) {
38
+ return false;
39
+ }
40
+ if (EMOJI_REGEX.test(characterBefore.text)) {
41
+ return false;
42
+ }
43
+ return !isWhitespaceCharacter(characterBefore.text);
22
44
  }
23
45
  });
24
46
  if (!match) {
@@ -1 +1 @@
1
- {"version":3,"file":"mentions.js","sources":["../../../../../src/primitives/Composer/slate/plugins/mentions.ts"],"sourcesContent":["import { MENTION_CHARACTER, type MentionData } from \"@liveblocks/core\";\nimport type { Node as SlateNode } from \"slate\";\nimport {\n Editor as SlateEditor,\n Element as SlateElement,\n Range as SlateRange,\n Transforms as SlateTransforms,\n} from \"slate\";\n\nimport type { ComposerBodyMention } from \"../../../../types\";\nimport {\n getCharacterAfter,\n getCharacterBefore,\n} from \"../../../slate/utils/get-character\";\nimport { getMatchRange } from \"../../../slate/utils/get-match-range\";\nimport { isEmptyString } from \"../../../slate/utils/is-empty-string\";\nimport { isWhitespaceCharacter } from \"../../../slate/utils/is-whitespace-character\";\n\nexport type MentionDraft = {\n range: SlateRange;\n text: string;\n};\n\nexport function getMentionDraftAtSelection(\n editor: SlateEditor\n): MentionDraft | undefined {\n const { selection } = editor;\n\n if (!selection || !SlateRange.isCollapsed(selection)) {\n return;\n }\n\n // Walk backwards from the selection until \"@\" is found, unless the character\n // before isn't whitespace (or \"@\" is the block's first character)\n const match = getMatchRange(editor, selection, [\"@\"], {\n include: true,\n allowConsecutiveWhitespace: false,\n ignoreTerminator: (_, point) => {\n const characterBefore = getCharacterBefore(editor, point);\n\n // Ignore \"@\" if it's preceded by a non-whitespace character\n if (characterBefore && !isWhitespaceCharacter(characterBefore.text)) {\n return true;\n }\n\n return false;\n },\n });\n\n if (!match) {\n return;\n }\n\n const matchText = SlateEditor.string(editor, match);\n\n // Check if the match starts with the mention character (not followed by a whitespace character)\n if (\n !matchText.startsWith(MENTION_CHARACTER) ||\n (matchText.length > 1 && isWhitespaceCharacter(matchText[1]))\n ) {\n return;\n }\n\n return {\n range: match,\n // Exclude the mention character from the text\n text: matchText.substring(1),\n };\n}\n\nexport function isComposerBodyMention(\n node: SlateNode\n): node is ComposerBodyMention {\n return SlateElement.isElement(node) && node.type === \"mention\";\n}\n\nexport function insertMention(editor: SlateEditor, mention: MentionData) {\n const mentionNode: ComposerBodyMention = {\n type: \"mention\",\n ...mention,\n children: [{ text: \"\" }],\n };\n\n // Insert the mention\n SlateTransforms.insertNodes(editor, mentionNode);\n SlateTransforms.move(editor);\n\n const afterCharacter = editor.selection\n ? getCharacterAfter(editor, editor.selection)\n : undefined;\n\n if (!afterCharacter || afterCharacter.void) {\n // Insert a following space if needed\n SlateTransforms.insertText(editor, \" \");\n } else if (isEmptyString(afterCharacter.text)) {\n // Move the selection if it's already followed by a space\n SlateTransforms.move(editor);\n }\n}\n\nexport function insertMentionCharacter(editor: SlateEditor) {\n if (!editor.selection) {\n return;\n }\n\n // Check if the selection is preceded or followed by a non-whitespace character\n const beforeCharacter = getCharacterBefore(editor, editor.selection, {\n filterVoids: true,\n });\n const afterCharacter = getCharacterAfter(editor, editor.selection, {\n filterVoids: true,\n });\n const shouldInsertSpaceBefore =\n beforeCharacter && !isEmptyString(beforeCharacter.text);\n const shouldInsertSpaceAfter =\n afterCharacter && !isEmptyString(afterCharacter.text);\n\n if (!SlateRange.isCollapsed(editor.selection)) {\n const text =\n (shouldInsertSpaceBefore ? \" \" : \"\") +\n MENTION_CHARACTER +\n (shouldInsertSpaceAfter ? \" \" : \"\");\n\n // If the selection is collapsed, insert the mention character at the current selection\n editor.insertText(text);\n\n // If a following space was inserted, move the selection back by one\n if (shouldInsertSpaceAfter) {\n SlateTransforms.move(editor, {\n distance: 1,\n unit: \"character\",\n reverse: true,\n });\n }\n } else {\n const beforeText = (shouldInsertSpaceBefore ? \" \" : \"\") + MENTION_CHARACTER;\n\n // If the selection is not collapsed, insert the mention character before the selection\n editor.insertText(beforeText, { at: SlateRange.start(editor.selection) });\n\n if (shouldInsertSpaceAfter) {\n editor.insertText(\" \", { at: SlateRange.end(editor.selection) });\n }\n\n // Collapse the selection at its end\n SlateTransforms.collapse(editor, { edge: \"end\" });\n }\n}\n\nexport function withMentions<T extends SlateEditor>(editor: T): T {\n const { isInline, isVoid, markableVoid, deleteBackward } = editor;\n\n editor.isInline = (element) => {\n return isComposerBodyMention(element) || isInline(element);\n };\n\n editor.isVoid = (element) => {\n return isComposerBodyMention(element) || isVoid(element);\n };\n\n editor.markableVoid = (element) => {\n return isComposerBodyMention(element) || markableVoid(element);\n };\n\n editor.deleteBackward = (unit) => {\n const { selection } = editor;\n\n if (selection && SlateRange.isCollapsed(selection)) {\n const [mention] = SlateEditor.nodes(editor, {\n at:\n unit === \"character\"\n ? SlateEditor.before(editor, selection, { unit: \"character\" })\n : selection,\n match: isComposerBodyMention,\n });\n\n deleteBackward(unit);\n\n if (mention) {\n SlateTransforms.insertText(editor, MENTION_CHARACTER);\n }\n } else {\n deleteBackward(unit);\n }\n };\n\n return editor;\n}\n"],"names":["SlateRange","SlateEditor","SlateElement","SlateTransforms"],"mappings":";;;;;;;AAuBO,SAAS,2BACd,MAC0B,EAAA;AAC1B,EAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AAEtB,EAAA,I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CAAA,MAAA,GAAS,CAAC,OAAY,KAAA;AAC3B,IAAA,OAAO,qBAAsB,CAAA,OAAO,CAAK,IAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,GACzD,CAAA;AAEA,EAAO,MAAA,CAAA,YAAA,GAAe,CAAC,OAAY,KAAA;AACjC,IAAA,OAAO,qBAAsB,CAAA,OAAO,CAAK,IAAA,YAAA,CAAa,OAAO,CAAA,CAAA;AAAA,GAC/D,CAAA;AAEA,EAAO,MAAA,CAAA,cAAA,GAAiB,CAAC,IAAS,KAAA;AAChC,IAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AAEtB,IAAA,IAAI,SAAa,IAAAH,KAAA,CAAW,WAAY,CAAA,SAAS,CAAG,EAAA;AAClD,MAAA,MAAM,CAAC,OAAO,CAAI,GAAAC,MAAA,CAAY,MAAM,MAAQ,EAAA;AAAA,QAC1C,EAAA,EACE,IAAS,KAAA,WAAA,GACLA,MAAY,CAAA,MAAA,CAAO,MAAQ,EAAA,SAAA,EAAW,EAAE,IAAA,EAAM,WAAY,EAAC,CAC3D,GAAA,SAAA;AAAA,QACN,KAAO,EAAA,qBAAA;AAAA,OACR,CAAA,CAAA;AAED,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAEnB,MAAA,IAAI,OAAS,EAAA;AACX,QAAgBE,UAAA,CAAA,UAAA,CAAW,QAAQ,iBAAiB,CAAA,CAAA;AAAA,OACtD;AAAA,KACK,MAAA;AACL,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAAA,KACrB;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"mentions.js","sources":["../../../../../src/primitives/Composer/slate/plugins/mentions.ts"],"sourcesContent":["import { MENTION_CHARACTER, type MentionData } from \"@liveblocks/core\";\nimport type { Node as SlateNode } from \"slate\";\nimport {\n Editor as SlateEditor,\n Element as SlateElement,\n Range as SlateRange,\n Transforms as SlateTransforms,\n} from \"slate\";\n\nimport type { ComposerBodyMention } from \"../../../../types\";\nimport {\n getCharacterAfter,\n getCharacterBefore,\n} from \"../../../slate/utils/get-character\";\nimport { getMatchRange } from \"../../../slate/utils/get-match-range\";\nimport { isEmptyString } from \"../../../slate/utils/is-empty-string\";\nimport { isWhitespaceCharacter } from \"../../../slate/utils/is-whitespace-character\";\n\nconst EMOJI_REGEX =\n /\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\uFE0F|\\u200D/u;\n\n// A few punctuation characters that aren't common (or even forbidden) as the\n// last character in email addresses' local part so we allow them before \"@\" mentions.\nconst SUPPORTED_PRECEDING_PUNCTUATION = new Set<string>([\n '\"',\n \"'\",\n \".\",\n \"!\",\n \"?\",\n \",\",\n \";\",\n \"(\",\n \")\",\n \"[\",\n \"]\",\n \"<\",\n \">\",\n]);\n\nexport type MentionDraft = {\n range: SlateRange;\n text: string;\n};\n\nexport function getMentionDraftAtSelection(\n editor: SlateEditor\n): MentionDraft | undefined {\n const { selection } = editor;\n\n if (!selection || !SlateRange.isCollapsed(selection)) {\n return;\n }\n\n // Walk backwards from the selection until \"@\" is found (with a few rules):\n // - `@` → `\"\"` mention draft\n // - `Hello @stacy` → `\"stacy\"` mention draft (because \"@\" is preceded by a whitespace character)\n // - `Hello pierre@example.com` → no mention draft (because \"@\" is preceded by a non-whitespace character)\n // - `Hello @alicia@example.com` → `\"alicia@example.com\"` mention draft (because the first \"@\" is preceded by a whitespace character)\n // - `Hello!@chris` → `\"chris\"` mention draft (because \"!\" is a supported preceding punctuation)\n // - `Hello.@vincent` → `\"vincent\"` mention draft (because \".\" is a supported preceding punctuation)\n // - `Hello (@olivier` → `\"olivier\"` mention draft (because \"(\" is a supported preceding punctuation)\n // - `Hello 👋@nimesh` → `\"nimesh\"` mention draft (because the first \"@\" is preceded by an emoji)\n const match = getMatchRange(editor, selection, [\"@\"], {\n include: true,\n allowConsecutiveWhitespace: false,\n ignoreTerminator: (_, point) => {\n const characterBefore = getCharacterBefore(editor, point);\n\n // If \"@\" is the first character of the block, this \"@\" is immediately accepted ✅\n if (!characterBefore) {\n return false;\n }\n\n // If the character before \"@\" is a supported preceding punctuation, this \"@\" is accepted ✅\n if (SUPPORTED_PRECEDING_PUNCTUATION.has(characterBefore.text)) {\n return false;\n }\n\n // If the character before \"@\" is an emoji, this \"@\" is accepted ✅\n if (EMOJI_REGEX.test(characterBefore.text)) {\n return false;\n }\n\n // If the character before \"@\" is still a non-whitespace character, this \"@\" is ignored ❌\n return !isWhitespaceCharacter(characterBefore.text);\n },\n });\n\n if (!match) {\n return;\n }\n\n const matchText = SlateEditor.string(editor, match);\n\n // Check if the match starts with the mention character (not followed by a whitespace character)\n if (\n !matchText.startsWith(MENTION_CHARACTER) ||\n (matchText.length > 1 && isWhitespaceCharacter(matchText[1]))\n ) {\n return;\n }\n\n return {\n range: match,\n // Exclude the mention character from the text\n text: matchText.substring(1),\n };\n}\n\nexport function isComposerBodyMention(\n node: SlateNode\n): node is ComposerBodyMention {\n return SlateElement.isElement(node) && node.type === \"mention\";\n}\n\nexport function insertMention(editor: SlateEditor, mention: MentionData) {\n const mentionNode: ComposerBodyMention = {\n type: \"mention\",\n ...mention,\n children: [{ text: \"\" }],\n };\n\n // Insert the mention\n SlateTransforms.insertNodes(editor, mentionNode);\n SlateTransforms.move(editor);\n\n const afterCharacter = editor.selection\n ? getCharacterAfter(editor, editor.selection)\n : undefined;\n\n if (!afterCharacter || afterCharacter.void) {\n // Insert a following space if needed\n SlateTransforms.insertText(editor, \" \");\n } else if (isEmptyString(afterCharacter.text)) {\n // Move the selection if it's already followed by a space\n SlateTransforms.move(editor);\n }\n}\n\nexport function insertMentionCharacter(editor: SlateEditor) {\n if (!editor.selection) {\n return;\n }\n\n // Check if the selection is preceded or followed by a non-whitespace character\n const beforeCharacter = getCharacterBefore(editor, editor.selection, {\n filterVoids: true,\n });\n const afterCharacter = getCharacterAfter(editor, editor.selection, {\n filterVoids: true,\n });\n const shouldInsertSpaceBefore =\n beforeCharacter && !isEmptyString(beforeCharacter.text);\n const shouldInsertSpaceAfter =\n afterCharacter && !isEmptyString(afterCharacter.text);\n\n if (!SlateRange.isCollapsed(editor.selection)) {\n const text =\n (shouldInsertSpaceBefore ? \" \" : \"\") +\n MENTION_CHARACTER +\n (shouldInsertSpaceAfter ? \" \" : \"\");\n\n // If the selection is collapsed, insert the mention character at the current selection\n editor.insertText(text);\n\n // If a following space was inserted, move the selection back by one\n if (shouldInsertSpaceAfter) {\n SlateTransforms.move(editor, {\n distance: 1,\n unit: \"character\",\n reverse: true,\n });\n }\n } else {\n const beforeText = (shouldInsertSpaceBefore ? \" \" : \"\") + MENTION_CHARACTER;\n\n // If the selection is not collapsed, insert the mention character before the selection\n editor.insertText(beforeText, { at: SlateRange.start(editor.selection) });\n\n if (shouldInsertSpaceAfter) {\n editor.insertText(\" \", { at: SlateRange.end(editor.selection) });\n }\n\n // Collapse the selection at its end\n SlateTransforms.collapse(editor, { edge: \"end\" });\n }\n}\n\nexport function withMentions<T extends SlateEditor>(editor: T): T {\n const { isInline, isVoid, markableVoid, deleteBackward } = editor;\n\n editor.isInline = (element) => {\n return isComposerBodyMention(element) || isInline(element);\n };\n\n editor.isVoid = (element) => {\n return isComposerBodyMention(element) || isVoid(element);\n };\n\n editor.markableVoid = (element) => {\n return isComposerBodyMention(element) || markableVoid(element);\n };\n\n editor.deleteBackward = (unit) => {\n const { selection } = editor;\n\n if (selection && SlateRange.isCollapsed(selection)) {\n const [mention] = SlateEditor.nodes(editor, {\n at:\n unit === \"character\"\n ? SlateEditor.before(editor, selection, { unit: \"character\" })\n : selection,\n match: isComposerBodyMention,\n });\n\n deleteBackward(unit);\n\n if (mention) {\n SlateTransforms.insertText(editor, MENTION_CHARACTER);\n }\n } else {\n deleteBackward(unit);\n }\n };\n\n return editor;\n}\n"],"names":["SlateRange","SlateEditor","SlateElement","SlateTransforms"],"mappings":";;;;;;;AAkBA,MAAM,WACJ,GAAA,6DAAA,CAAA;AAIF,MAAM,+BA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AAE,IAAA,EAAM,WAAY,EAAC,CAC3D,GAAA,SAAA;AAAA,QACN,KAAO,EAAA,qBAAA;AAAA,OACR,CAAA,CAAA;AAED,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAEnB,MAAA,IAAI,OAAS,EAAA;AACX,QAAgBE,UAAA,CAAA,UAAA,CAAW,QAAQ,iBAAiB,CAAA,CAAA;AAAA,OACtD;AAAA,KACK,MAAA;AACL,MAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAAA,KACrB;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
package/dist/version.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const PKG_NAME = "@liveblocks/react-ui";
4
- const PKG_VERSION = typeof "3.18.0-rc2" === "string" && "3.18.0-rc2";
4
+ const PKG_VERSION = typeof "3.18.1" === "string" && "3.18.1";
5
5
  const PKG_FORMAT = typeof "cjs" === "string" && "cjs";
6
6
 
7
7
  exports.PKG_FORMAT = PKG_FORMAT;
@@ -1 +1 @@
1
- {"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,YAAA,KAAgB,QAAY,IAAA,aAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;;;"}
1
+ {"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,QAAA,KAAgB,QAAY,IAAA,SAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;;;"}
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const PKG_NAME = "@liveblocks/react-ui";
2
- const PKG_VERSION = typeof "3.18.0-rc2" === "string" && "3.18.0-rc2";
2
+ const PKG_VERSION = typeof "3.18.1" === "string" && "3.18.1";
3
3
  const PKG_FORMAT = typeof "esm" === "string" && "esm";
4
4
 
5
5
  export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,YAAA,KAAgB,QAAY,IAAA,aAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;"}
1
+ {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,QAAA,KAAgB,QAAY,IAAA,SAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react-ui",
3
- "version": "3.18.0-rc2",
3
+ "version": "3.18.1",
4
4
  "description": "A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Liveblocks Inc.",
@@ -78,9 +78,9 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@floating-ui/react-dom": "^2.1.0",
81
- "@liveblocks/client": "3.18.0-rc2",
82
- "@liveblocks/core": "3.18.0-rc2",
83
- "@liveblocks/react": "3.18.0-rc2",
81
+ "@liveblocks/client": "3.18.1",
82
+ "@liveblocks/core": "3.18.1",
83
+ "@liveblocks/react": "3.18.1",
84
84
  "frimousse": "^0.2.0",
85
85
  "marked": "^15.0.11",
86
86
  "radix-ui": "^1.4.0",