@tensor_1/react 2.39.0 → 2.40.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.
@@ -2,8 +2,19 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { E as EmojiPickerLabels, a as EmojiLocale } from './emoji-image-DjCKpdwE.cjs';
4
4
  export { l as emojiImageFileName } from './emoji-image-DjCKpdwE.cjs';
5
+ export { M as MENTION_SCHEME, f as findMentions, e as formatMention, i as isMentionId, r as readMention } from './markdown-model-Cuwi6pIk.cjs';
5
6
  import './overlay-position-2Afke51l.cjs';
6
7
 
8
+ /** A person the consumer offers in the `@` listbox. */
9
+ interface MentionCandidate {
10
+ /** Stored in the text; letters, digits and `_ . -` only (see `isMentionId`). */
11
+ id: string;
12
+ /** The name inserted and shown. */
13
+ label: string;
14
+ /** A second line in the listbox (e.g. team or e-mail), never stored. */
15
+ description?: string;
16
+ }
17
+
7
18
  type RichTextFeatures = 'full' | 'comment' | 'template';
8
19
  type RichTextHeadingLevel = 1 | 2 | 3;
9
20
  /** Every visible and accessible string of the editor. Placeholders are filled by the editor. */
@@ -43,6 +54,14 @@ interface RichTextLabels {
43
54
  emoji: string;
44
55
  /** Accessible name of the `:shortcode` suggestion list. */
45
56
  emojiSuggestions: string;
57
+ /** Accessible name of the `@` people list. */
58
+ mentionSuggestions: string;
59
+ /** Shown while `onMentionSearch` has not answered. */
60
+ mentionSearching: string;
61
+ /** Shown when `onMentionSearch` found nobody. */
62
+ mentionEmpty: string;
63
+ /** Shown when `onMentionSearch` failed. */
64
+ mentionFailed: string;
46
65
  undo: string;
47
66
  redo: string;
48
67
  /** Toggle to markdown source. */
@@ -85,6 +104,13 @@ interface RichTextEditorProps {
85
104
  onSubmitShortcut?: () => void;
86
105
  /** Emoji button and `:shortcode` suggestions. Default `true`. */
87
106
  emoji?: boolean;
107
+ /**
108
+ * People for the `@` list: called with the text typed after `@` (possibly empty) and
109
+ * answering the candidates to offer. The product owns the query and who may be
110
+ * mentioned; UIx never fetches. A picked person is inserted as one token, stored as
111
+ * `@[Name](mention:<id>)`. Without it, typing `@` does nothing special.
112
+ */
113
+ onMentionSearch?: (query: string) => Promise<ReadonlyArray<MentionCandidate>> | ReadonlyArray<MentionCandidate>;
88
114
  /**
89
115
  * Same-origin folder of fallback emoji PNGs for devices without a colour emoji font
90
116
  * (e.g. `/static/emoji`). Emoji the device cannot draw show as
@@ -153,4 +179,4 @@ interface RoundTripOptions {
153
179
  */
154
180
  declare function roundTripMarkdown(markdown: string, options?: RoundTripOptions): Promise<string>;
155
181
 
156
- export { DEFAULT_RICH_TEXT_LABELS, EmojiLocale, EmojiPickerLabels, RichTextEditor, RichTextEditorFallback, type RichTextEditorProps, type RichTextFeatures, type RichTextHeadingLevel, type RichTextLabels, type RoundTripOptions, roundTripMarkdown };
182
+ export { DEFAULT_RICH_TEXT_LABELS, EmojiLocale, EmojiPickerLabels, type MentionCandidate, RichTextEditor, RichTextEditorFallback, type RichTextEditorProps, type RichTextFeatures, type RichTextHeadingLevel, type RichTextLabels, type RoundTripOptions, roundTripMarkdown };
@@ -3,6 +3,9 @@ export { RoundTripOptions, roundTripMarkdown } from './rich-text/round-trip.js';
3
3
  export { EmojiLocale } from './emoji-model.js';
4
4
  export { EmojiPickerLabels } from './components/EmojiPicker.js';
5
5
  export { emojiImageFileName } from './emoji-image.js';
6
+ export { MentionCandidate } from './rich-text/mention.js';
7
+ export { MENTION_SCHEME, findMentions, formatMention, isMentionId, readMention } from './markdown-model.js';
6
8
  import 'react';
7
9
  import '@tiptap/extension-emoji';
8
10
  import './overlay-position.js';
11
+ import '@tiptap/core';
package/dist/rich-text.js CHANGED
@@ -1,10 +1,16 @@
1
1
  import { RichTextEditor, RichTextEditorFallback, DEFAULT_RICH_TEXT_LABELS } from "./components/RichTextEditor.js";
2
2
  import { roundTripMarkdown } from "./rich-text/round-trip.js";
3
3
  import { emojiImageFileName } from "./emoji-image.js";
4
+ import { findMentions, formatMention, readMention, isMentionId, MENTION_SCHEME } from "./markdown-model.js";
4
5
  export {
5
6
  DEFAULT_RICH_TEXT_LABELS,
7
+ MENTION_SCHEME,
6
8
  RichTextEditor,
7
9
  RichTextEditorFallback,
8
10
  emojiImageFileName,
11
+ findMentions,
12
+ formatMention,
13
+ isMentionId,
14
+ readMention,
9
15
  roundTripMarkdown
10
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensor_1/react",
3
- "version": "2.39.0",
3
+ "version": "2.40.1",
4
4
  "description": "Thin React wrappers over the UIx v2 CSS component library.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",