@lumel/mention 5.2.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.
- package/CHANGELOG.md +286 -0
- package/LICENSE +7 -0
- package/README.md +9 -0
- package/lib/Mention.d.ts +22 -0
- package/lib/MentionSuggestions/Entry/Avatar/Avatar.d.ts +9 -0
- package/lib/MentionSuggestions/Entry/DefaultEntryComponent.d.ts +3 -0
- package/lib/MentionSuggestions/Entry/Entry.d.ts +38 -0
- package/lib/MentionSuggestions/MentionSuggestions.d.ts +80 -0
- package/lib/MentionSuggestions/Popover.d.ts +10 -0
- package/lib/MentionSuggestions/__test__/MentionSuggestions.test.d.ts +1 -0
- package/lib/MentionSuggestionsPortal.d.ts +11 -0
- package/lib/__test__/Mention.test.d.ts +1 -0
- package/lib/__test__/mentionSuggestionsStrategy.test.d.ts +1 -0
- package/lib/defaultRegExp.d.ts +2 -0
- package/lib/index.cjs.js +1215 -0
- package/lib/index.d.ts +66 -0
- package/lib/index.esm.js +1198 -0
- package/lib/mentionStrategy.d.ts +3 -0
- package/lib/mentionSuggestionsStrategy.d.ts +6 -0
- package/lib/modifiers/addMention.d.ts +3 -0
- package/lib/plugin.css +8 -0
- package/lib/theme.d.ts +12 -0
- package/lib/utils/__test__/getSearchTextAt.test.d.ts +1 -0
- package/lib/utils/__test__/getTriggerForMention.test.d.ts +1 -0
- package/lib/utils/__test__/getTypeByTrigger.test.d.ts +1 -0
- package/lib/utils/decodeOffsetKey.d.ts +7 -0
- package/lib/utils/defaultSuggestionsFilter.d.ts +3 -0
- package/lib/utils/getSearchText.d.ts +4 -0
- package/lib/utils/getSearchTextAt.d.ts +9 -0
- package/lib/utils/getTriggerForMention.d.ts +8 -0
- package/lib/utils/getTypeByTrigger.d.ts +1 -0
- package/lib/utils/positionSuggestions.d.ts +13 -0
- package/lib/utils/warning.d.ts +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContentBlock } from 'draft-js';
|
|
2
|
+
interface FindWithRegexCb {
|
|
3
|
+
(start: number, end: number): void;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: (triggers: string[], supportWhiteSpace: boolean, regExp: string) => (contentBlock: ContentBlock, callback: FindWithRegexCb) => void;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EditorState } from 'draft-js';
|
|
2
|
+
import { MentionData } from '..';
|
|
3
|
+
export default function addMention(editorState: EditorState, mention: MentionData, mentionPrefix: string, mentionTrigger: string, entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE'): EditorState;
|
package/lib/plugin.css
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
.m6zwb4v,.m6zwb4v:visited{color:#575f67;cursor:pointer;display:inline-block;background:#e6f3ff;padding-left:2px;padding-right:2px;border-radius:2px;-webkit-text-decoration:none;text-decoration:none;}.m6zwb4v:hover,.m6zwb4v:focus{color:#677584;background:#edf5fd;outline:0;}.m6zwb4v:active{color:#222;background:#455261;}
|
|
2
|
+
.mnw6qvm{border:1px solid #eee;position:absolute;min-width:220px;max-width:440px;background:#fff;border-radius:2px;box-shadow:0px 4px 30px 0px rgba(220,220,220,1);cursor:pointer;padding-top:8px;padding-bottom:8px;z-index:2;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;box-sizing:border-box;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);}
|
|
3
|
+
.m1ymsnxd{opacity:0;-webkit-transition:opacity 0.25s cubic-bezier(0.3,1.2,0.2,1);transition:opacity 0.25s cubic-bezier(0.3,1.2,0.2,1);}
|
|
4
|
+
.m126ak5t{opacity:1;}
|
|
5
|
+
.mtiwdxc{padding:7px 10px 3px 10px;-webkit-transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);}.mtiwdxc:active{background-color:#cce7ff;}
|
|
6
|
+
.myz2dw1{padding:7px 10px 3px 10px;-webkit-transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);background-color:#e6f3ff;}.myz2dw1:active{background-color:#cce7ff;}
|
|
7
|
+
.mpqdcgq{display:inline-block;margin-left:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:368px;font-size:0.9em;margin-bottom:0.2em;}
|
|
8
|
+
.m1mfvffo{display:inline-block;width:24px;height:24px;border-radius:12px;}
|
package/lib/theme.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface MentionPluginTheme {
|
|
2
|
+
mention?: string;
|
|
3
|
+
mentionSuggestions?: string;
|
|
4
|
+
mentionSuggestionsPopup?: string;
|
|
5
|
+
mentionSuggestionsPopupVisible?: string;
|
|
6
|
+
mentionSuggestionsEntry?: string;
|
|
7
|
+
mentionSuggestionsEntryFocused?: string;
|
|
8
|
+
mentionSuggestionsEntryText?: string;
|
|
9
|
+
mentionSuggestionsEntryAvatar?: string;
|
|
10
|
+
[x: string]: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultTheme: MentionPluginTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SearchTextAtResult {
|
|
2
|
+
begin: number;
|
|
3
|
+
end: number;
|
|
4
|
+
matchingString: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Return tail end of the string matching trigger upto the position.
|
|
8
|
+
*/
|
|
9
|
+
export default function getSearchTextAt(blockText: string, position: number, triggers: string[]): SearchTextAtResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorState } from 'draft-js';
|
|
2
|
+
import { Map } from 'immutable';
|
|
3
|
+
interface TriggerForMentionResult {
|
|
4
|
+
activeOffsetKey: string;
|
|
5
|
+
activeTrigger: string;
|
|
6
|
+
}
|
|
7
|
+
export default function getTriggerForMention(editorState: EditorState, searches: Map<string, string>, mentionTriggers: string[]): TriggerForMentionResult | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getTypeByTrigger(trigger: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { MentionData, MentionPluginStore } from '..';
|
|
3
|
+
export interface PositionSuggestionsParams {
|
|
4
|
+
decoratorRect: ClientRect;
|
|
5
|
+
popover: HTMLElement;
|
|
6
|
+
props: {
|
|
7
|
+
open: boolean;
|
|
8
|
+
suggestions: MentionData[];
|
|
9
|
+
store: MentionPluginStore;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export default function positionSuggestions({ decoratorRect, popover, props, }: PositionSuggestionsParams): CSSProperties;
|
|
13
|
+
export declare type PositionSuggestionsFn = typeof positionSuggestions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const warning: (text: string) => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lumel/mention",
|
|
3
|
+
"version": "5.2.1",
|
|
4
|
+
"sideEffects": [
|
|
5
|
+
"*.css"
|
|
6
|
+
],
|
|
7
|
+
"description": "Mention Plugin for DraftJS",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Nik Graf",
|
|
10
|
+
"email": "nik@nikgraf.com",
|
|
11
|
+
"url": "http://www.nikgraf.com"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
|
|
16
|
+
},
|
|
17
|
+
"main": "lib/index.cjs.js",
|
|
18
|
+
"module": "lib/index.esm.js",
|
|
19
|
+
"types": "./lib/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"lib"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"editor",
|
|
25
|
+
"wysiwyg",
|
|
26
|
+
"draft",
|
|
27
|
+
"react",
|
|
28
|
+
"ux",
|
|
29
|
+
"components",
|
|
30
|
+
"widget",
|
|
31
|
+
"react-component"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "yarn rimraf lib",
|
|
35
|
+
"build": "yarn build:js && yarn build:dts && yarn build:css",
|
|
36
|
+
"build:js": "yarn rollup --config ../../rollup.config.js",
|
|
37
|
+
"build:dts": "tsc -d",
|
|
38
|
+
"build:css": "node ../../scripts/build-css.js $(pwd)",
|
|
39
|
+
"test": "jest"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@popperjs/core": "^2.11.6",
|
|
44
|
+
"@types/lodash": "^4.14.185",
|
|
45
|
+
"clsx": "^1.2.1",
|
|
46
|
+
"immutable": "~3.7.4",
|
|
47
|
+
"lodash": "^4.17.21",
|
|
48
|
+
"prop-types": "^15.8.1",
|
|
49
|
+
"react-popper": "^2.3.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"draft-js": "^0.10.1 || ^0.11.0",
|
|
53
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
54
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
}
|
|
60
|
+
}
|