@etrepum/lexical-emoji-plan 0.0.28-nightly.20240705.0 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/$textNodeTransform.d.ts.map +1 -1
- package/dist/EmojiNode.d.ts +10 -3
- package/dist/EmojiNode.d.ts.map +1 -1
- package/dist/EmojiPlan.d.ts +6 -2
- package/dist/EmojiPlan.d.ts.map +1 -1
- package/dist/_textNodeTransform-JUH2dtPZ.js +21 -0
- package/dist/findEmoji.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1997 -5
- package/dist/supportedEmojis.data.d.ts.map +1 -1
- package/dist/unifiedID.d.ts +1 -1
- package/package.json +1 -1
- package/dist/_textNodeTransform-CugvQRN7.js +0 -20
- package/dist/index-EQ2IHeqn.js +0 -1963
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"$textNodeTransform.d.ts","sourceRoot":"","sources":["../src/$textNodeTransform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"$textNodeTransform.d.ts","sourceRoot":"","sources":["../src/$textNodeTransform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CA+BvD"}
|
package/dist/EmojiNode.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
import { LexicalNode, SerializedTextNode, Spread, TextNode } from 'lexical';
|
1
|
+
import { EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedTextNode, Spread, TextNode } from 'lexical';
|
2
2
|
|
3
3
|
export type SerializedEmojiNode = Spread<{
|
4
4
|
type: ReturnType<typeof EmojiNode.getType>;
|
5
|
+
shortcode?: string;
|
5
6
|
}, SerializedTextNode>;
|
6
7
|
/**
|
7
8
|
* EmojiNode doesn't really need to override any of TextNode's functionality,
|
@@ -16,15 +17,21 @@ export type SerializedEmojiNode = Spread<{
|
|
16
17
|
* done properly.
|
17
18
|
*/
|
18
19
|
export declare class EmojiNode extends TextNode {
|
20
|
+
__shortcode?: string | undefined;
|
21
|
+
constructor(text: string, shortcode?: string | undefined, key?: NodeKey);
|
19
22
|
static getType(): "emoji";
|
20
23
|
static clone(node: EmojiNode): EmojiNode;
|
21
24
|
static importJSON(serializedNode: SerializedEmojiNode): EmojiNode;
|
25
|
+
updateDOM(prevNode: this, dom: HTMLElement, config: EditorConfig): boolean;
|
26
|
+
createDOM(config: EditorConfig, editor?: LexicalEditor | undefined): HTMLElement;
|
27
|
+
getShortcode(): string | undefined;
|
28
|
+
setShortcode(shortcode?: string | undefined): this;
|
22
29
|
exportJSON(): SerializedEmojiNode;
|
23
30
|
}
|
24
31
|
/**
|
25
|
-
* @param text The emoji string (a decoded unified id)
|
32
|
+
* @param text - The emoji string (a decoded unified id)
|
26
33
|
* @returns the EmojiNode
|
27
34
|
*/
|
28
|
-
export declare function $createEmojiNode(text: string): EmojiNode;
|
35
|
+
export declare function $createEmojiNode(text: string, shortcode?: string | undefined): EmojiNode;
|
29
36
|
export declare function $isEmojiNode(node: LexicalNode | null | undefined): node is EmojiNode;
|
30
37
|
//# sourceMappingURL=EmojiNode.d.ts.map
|
package/dist/EmojiNode.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EmojiNode.d.ts","sourceRoot":"","sources":["../src/EmojiNode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"EmojiNode.d.ts","sourceRoot":"","sources":["../src/EmojiNode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EA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{
|
10
10
|
/**
|
11
11
|
* The base URL to find the emoji PNG files, originally from the 64x64 set in emoji-datasource-facebook.
|
12
|
-
* Default: https://cdn.jsdelivr.net/npm
|
12
|
+
* Default: "https://cdn.jsdelivr.net/npm/\@etrepum/lexical-emoji-plan\@$\{PACKAGE_VERSION\}/dist/emoji"
|
13
13
|
*
|
14
14
|
* Do not add a trailing slash to the path.
|
15
15
|
*/
|
@@ -18,6 +18,10 @@ export interface EmojiPlanConfig {
|
|
18
18
|
* The class to use for emoji nodes
|
19
19
|
*/
|
20
20
|
emojiClass: string;
|
21
|
+
/**
|
22
|
+
* The class to use for emoji nodes before the image is loaded
|
23
|
+
*/
|
24
|
+
emojiLoadingClass: string;
|
21
25
|
/**
|
22
26
|
* The class to use for emoji nodes after the image is loaded and set as a background-image
|
23
27
|
*/
|
@@ -37,5 +41,5 @@ export interface EmojiPlanConfig {
|
|
37
41
|
* representation of that emoji is used and then the emojiLoadedClass is
|
38
42
|
* added.
|
39
43
|
*/
|
40
|
-
export declare const EmojiPlan: import('@etrepum/lexical-builder').LexicalPlan<EmojiPlanConfig, "@etrepum/lexical-
|
44
|
+
export declare const EmojiPlan: import('@etrepum/lexical-builder').LexicalPlan<EmojiPlanConfig, "@etrepum/lexical-emoji-plan/Emoji", unknown, unknown>;
|
41
45
|
//# sourceMappingURL=EmojiPlan.d.ts.map
|
package/dist/EmojiPlan.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EmojiPlan.d.ts","sourceRoot":"","sources":["../src/EmojiPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
1
|
+
{"version":3,"file":"EmojiPlan.d.ts","sourceRoot":"","sources":["../src/EmojiPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,eAAO,MAAM,eAAe,EAAE,MAAwC,CAAC;AAEvE,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,wHA4EpB,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { findEmoji as s, $createEmojiNode as n } from "./index.js";
|
2
|
+
function l(o) {
|
3
|
+
if (!o.isSimpleText() || o.hasFormat("code"))
|
4
|
+
return;
|
5
|
+
const i = o.getTextContent(), t = s(i);
|
6
|
+
if (t === null)
|
7
|
+
return;
|
8
|
+
let e;
|
9
|
+
if (t.position === 0 ? [e] = o.splitText(
|
10
|
+
t.position + t.shortcode.length
|
11
|
+
) : [, e] = o.splitText(
|
12
|
+
t.position,
|
13
|
+
t.position + t.shortcode.length
|
14
|
+
), e !== void 0) {
|
15
|
+
const r = n(t.emoji, t.shortcode);
|
16
|
+
e.replace(r);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
export {
|
20
|
+
l as $textNodeTransform
|
21
|
+
};
|
package/dist/findEmoji.d.ts
CHANGED
@@ -24,7 +24,7 @@ export type EmojiMatch = Readonly<{
|
|
24
24
|
*
|
25
25
|
* @example Matching canonical short names
|
26
26
|
* ```js
|
27
|
-
* assert(findEmoji(":man-facepalming").emoji === "🤦♂️");
|
27
|
+
* assert(findEmoji(":man-facepalming:").emoji === "🤦♂️");
|
28
28
|
* ```
|
29
29
|
*
|
30
30
|
* @example Matching non-canonical text for an emoji
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export { EmojiPlan, type EmojiPlanConfig } from './EmojiPlan';
|
2
2
|
export { unifiedIDFromText, textFromUnifiedID } from './unifiedID';
|
3
3
|
export { findEmoji, type EmojiMatch } from './findEmoji';
|
4
|
+
export { EmojiNode, $isEmojiNode, $createEmojiNode } from './EmojiNode';
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|