@etrepum/lexical-emoji-plan 0.0.13-nightly.20240606.0 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/EmojiNode.d.ts +2 -1
- package/dist/EmojiNode.d.ts.map +1 -1
- package/dist/EmojiPlan.d.ts +26 -0
- package/dist/EmojiPlan.d.ts.map +1 -1
- package/dist/_textNodeTransform-CSOyqRcv.js +20 -0
- package/dist/findEmoji.d.ts +36 -2
- package/dist/findEmoji.d.ts.map +1 -1
- package/dist/{_textNodeTransform-BfftQYga.js → index-DE5LwTx8.js} +99 -31
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/supportedEmojis.data.d.ts +5 -2
- package/dist/supportedEmojis.data.d.ts.map +1 -1
- package/dist/unifiedID.d.ts +19 -0
- package/dist/unifiedID.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/index-BBnhKeug.js +0 -66
package/dist/EmojiNode.d.ts
CHANGED
@@ -12,7 +12,8 @@ export type SerializedEmojiNode = Spread<{
|
|
12
12
|
* transforms.
|
13
13
|
*
|
14
14
|
* The display behavior is all implemented in the mutation listener set up
|
15
|
-
* by EmojiPlan
|
15
|
+
* by EmojiPlan, which makes it a little easier to ensure that clean-up is
|
16
|
+
* done properly.
|
16
17
|
*/
|
17
18
|
export declare class EmojiNode extends TextNode {
|
18
19
|
static getType(): "emoji";
|
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,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5C,EACD,kBAAkB,CACnB,CAAC;AAEF
|
1
|
+
{"version":3,"file":"EmojiNode.d.ts","sourceRoot":"","sources":["../src/EmojiNode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5C,EACD,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,QAAQ;IACrC,MAAM,CAAC,OAAO,IAAI,OAAO;IAIzB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS;IAIxC,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS;IAIjE,UAAU,IAAI,mBAAmB;CAMlC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAMxD;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,SAAS,CAEnB"}
|
package/dist/EmojiPlan.d.ts
CHANGED
@@ -8,8 +8,20 @@
|
|
8
8
|
export declare const PACKAGE_VERSION: string;
|
9
9
|
declare const NAME = "@etrepum/lexical-builder/emoji-plan";
|
10
10
|
export interface EmojiPlanConfig {
|
11
|
+
/**
|
12
|
+
* The base URL to find the emoji PNG files, originally from the 64x64 set in emoji-datasource-facebook.
|
13
|
+
* Default: https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@${import.meta.env.PACKAGE_VERSION}/dist/emoji
|
14
|
+
*
|
15
|
+
* Do not add a trailing slash to the path.
|
16
|
+
*/
|
11
17
|
emojiBaseUrl: string;
|
18
|
+
/**
|
19
|
+
* The class to use for emoji nodes
|
20
|
+
*/
|
12
21
|
emojiClass: string;
|
22
|
+
/**
|
23
|
+
* The class to use for emoji nodes after the image is loaded and set as a background-image
|
24
|
+
*/
|
13
25
|
emojiLoadedClass: string;
|
14
26
|
}
|
15
27
|
declare module "@etrepum/lexical-builder" {
|
@@ -17,6 +29,20 @@ declare module "@etrepum/lexical-builder" {
|
|
17
29
|
[NAME]: typeof EmojiPlan;
|
18
30
|
}
|
19
31
|
}
|
32
|
+
/**
|
33
|
+
* A plan to use the emoji-datasource-facebook emoji database to convert
|
34
|
+
* short names such as :man-facepalming: or :) to their corresponding
|
35
|
+
* emoji, and uses an img from the same package rather than the current
|
36
|
+
* font to display it so that the display is consistent regardless of the
|
37
|
+
* platform.
|
38
|
+
*
|
39
|
+
* Loading the emoji database is done using an async import so will typicallly
|
40
|
+
* be a lazy loaded module in a separate chunk.
|
41
|
+
*
|
42
|
+
* Images are also maximally lazily loaded, before they load the font's
|
43
|
+
* representation of that emoji is used and then the emojiLoadedClass is
|
44
|
+
* added.
|
45
|
+
*/
|
20
46
|
export declare const EmojiPlan: import('@etrepum/lexical-builder').LexicalPlan<EmojiPlanConfig, "@etrepum/lexical-builder/emoji-plan">;
|
21
47
|
export {};
|
22
48
|
//# 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;AAQH,eAAO,MAAM,eAAe,EAAE,MAAwC,CAAC;AAEvE,QAAA,MAAM,IAAI,wCAAwC,CAAC;AACnD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,OAAO,QAAQ,0BAA0B,CAAC;IACxC,UAAU,mBAAmB;QAC3B,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,CAAC;KAC1B;CACF;AAED,eAAO,MAAM,SAAS,
|
1
|
+
{"version":3,"file":"EmojiPlan.d.ts","sourceRoot":"","sources":["../src/EmojiPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,eAAO,MAAM,eAAe,EAAE,MAAwC,CAAC;AAEvE,QAAA,MAAM,IAAI,wCAAwC,CAAC;AACnD,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,OAAO,QAAQ,0BAA0B,CAAC;IACxC,UAAU,mBAAmB;QAC3B,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,CAAC;KAC1B;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,wGAmEpB,CAAC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { f as r, $ as n } from "./index-DE5LwTx8.js";
|
2
|
+
function l(e) {
|
3
|
+
if (!e.isSimpleText() || e.hasFormat("code"))
|
4
|
+
return;
|
5
|
+
const i = e.getTextContent(), t = r(i);
|
6
|
+
if (t === null)
|
7
|
+
return;
|
8
|
+
let o;
|
9
|
+
t.position === 0 ? [o] = e.splitText(
|
10
|
+
t.position + t.shortcode.length
|
11
|
+
) : [, o] = e.splitText(
|
12
|
+
t.position,
|
13
|
+
t.position + t.shortcode.length
|
14
|
+
);
|
15
|
+
const s = n(t.emoji);
|
16
|
+
o.replace(s);
|
17
|
+
}
|
18
|
+
export {
|
19
|
+
l as $textNodeTransform
|
20
|
+
};
|
package/dist/findEmoji.d.ts
CHANGED
@@ -5,13 +5,47 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
7
|
*/
|
8
|
+
/**
|
9
|
+
* The location of the emoji match in the given text
|
10
|
+
*/
|
8
11
|
export type EmojiMatch = Readonly<{
|
12
|
+
/** The start position of the text */
|
9
13
|
position: number;
|
14
|
+
/** The matching shortcode from the text, such as ":man-facepalming:" or ":)" */
|
10
15
|
shortcode: string;
|
16
|
+
/** The text of the emoji from the database, such as "🤦♂️" or "🙂" */
|
11
17
|
emoji: string;
|
12
18
|
}>;
|
13
19
|
/**
|
14
|
-
* Finds emoji shortcodes in text
|
20
|
+
* Finds emoji shortcodes in text, tokenized by spaces. The canonical short
|
21
|
+
* names such as ":smiley:" are matched even if they are at the end of the
|
22
|
+
* text, but a text such as ":)" is only matched if it is followed by a
|
23
|
+
* space.
|
24
|
+
*
|
25
|
+
* @example Matching canonical short names
|
26
|
+
* ```js
|
27
|
+
* const result =
|
28
|
+
* assert(findEmoji(":man-facepalming").emoji === "🤦♂️");
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* @example Matching non-canonical text for an emoji
|
32
|
+
* ```js
|
33
|
+
* const input = "handles :) mid-string";
|
34
|
+
* const result = findEmoji(input);
|
35
|
+
* assert(result.position === "handles ".length);
|
36
|
+
* assert(result.shortcode === ":)")
|
37
|
+
* assert(result.emoji === "🙂");
|
38
|
+
* assert([
|
39
|
+
* input.slice(0, result.position),
|
40
|
+
* result.emoji,
|
41
|
+
* input.slice(result.position + result.shortcode.length)
|
42
|
+
* ].join("") === "handles 🙂 mid-string");
|
43
|
+
* ```
|
44
|
+
*
|
45
|
+
* @example Non-canonical text does not match at the end
|
46
|
+
* ```js
|
47
|
+
* assert(findEmoji(":)") === null)
|
48
|
+
* ```
|
15
49
|
*/
|
16
|
-
export
|
50
|
+
export declare function findEmoji(text: string): EmojiMatch | null;
|
17
51
|
//# sourceMappingURL=findEmoji.d.ts.map
|
package/dist/findEmoji.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"findEmoji.d.ts","sourceRoot":"","sources":["../src/findEmoji.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAiBH
|
1
|
+
{"version":3,"file":"findEmoji.d.ts","sourceRoot":"","sources":["../src/findEmoji.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAiBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAqBzD"}
|
@@ -1,5 +1,85 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import { definePlan as h, safeCast as p } from "@etrepum/lexical-builder";
|
2
|
+
import { mergeRegister as m } from "@lexical/utils";
|
3
|
+
import { TextNode as f } from "lexical";
|
4
|
+
class t extends f {
|
5
|
+
static getType() {
|
6
|
+
return "emoji";
|
7
|
+
}
|
8
|
+
static clone(n) {
|
9
|
+
return new t(n.__text, n.__key);
|
10
|
+
}
|
11
|
+
static importJSON(n) {
|
12
|
+
return u(n.text);
|
13
|
+
}
|
14
|
+
exportJSON() {
|
15
|
+
return {
|
16
|
+
...super.exportJSON(),
|
17
|
+
type: "emoji"
|
18
|
+
};
|
19
|
+
}
|
20
|
+
}
|
21
|
+
function u(a) {
|
22
|
+
return new t(a).setMode("token");
|
23
|
+
}
|
24
|
+
function z(a) {
|
25
|
+
return String.fromCodePoint(
|
26
|
+
...a.split("-").map((n) => parseInt(n, 16))
|
27
|
+
);
|
28
|
+
}
|
29
|
+
function b(a) {
|
30
|
+
return Array.from(
|
31
|
+
a,
|
32
|
+
(n) => n.codePointAt(0).toString(16).padStart(4, "0")
|
33
|
+
).join("-");
|
34
|
+
}
|
35
|
+
const w = "@etrepum/lexical-builder/emoji-plan", q = h({
|
36
|
+
config: p({
|
37
|
+
emojiBaseUrl: "https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@0.0.13/dist/emoji",
|
38
|
+
emojiClass: "emoji-node",
|
39
|
+
emojiLoadedClass: "emoji-node-loaded"
|
40
|
+
}),
|
41
|
+
name: w,
|
42
|
+
nodes: [t],
|
43
|
+
register(a, n, r) {
|
44
|
+
const e = /* @__PURE__ */ new Map();
|
45
|
+
let o = m(
|
46
|
+
a.registerMutationListener(t, (l) => {
|
47
|
+
for (const [_, d] of l)
|
48
|
+
if (d === "destroyed") {
|
49
|
+
const i = e.get(_);
|
50
|
+
i && (e.delete(_), i());
|
51
|
+
} else {
|
52
|
+
const i = a.getElementByKey(_);
|
53
|
+
if (i) {
|
54
|
+
const g = `${n.emojiBaseUrl}/${b(i.innerText)}.png`;
|
55
|
+
i.classList.add(n.emojiClass), i.style.backgroundImage = `url(${g})`;
|
56
|
+
const s = new Image(), c = () => {
|
57
|
+
i.classList.add(n.emojiLoadedClass), e.delete(_);
|
58
|
+
};
|
59
|
+
e.set(
|
60
|
+
_,
|
61
|
+
() => s.removeEventListener("load", c)
|
62
|
+
), s.addEventListener("load", c, {
|
63
|
+
signal: r.signal,
|
64
|
+
once: !0
|
65
|
+
}), s.src = g;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}),
|
69
|
+
() => {
|
70
|
+
for (const l of e.values())
|
71
|
+
l();
|
72
|
+
e.clear();
|
73
|
+
}
|
74
|
+
);
|
75
|
+
return import("./_textNodeTransform-CSOyqRcv.js").then(({ $textNodeTransform: l }) => {
|
76
|
+
r.signal.aborted || (o = m(
|
77
|
+
o,
|
78
|
+
a.registerNodeTransform(f, l)
|
79
|
+
));
|
80
|
+
}), () => o();
|
81
|
+
}
|
82
|
+
}), k = `🀄 mahjong
|
3
83
|
🃏 black_joker
|
4
84
|
🅰️ a
|
5
85
|
🅱️ b
|
@@ -1849,47 +1929,35 @@ const _ = `🀄 mahjong
|
|
1849
1929
|
〰️ wavy_dash
|
1850
1930
|
〽️ part_alternation_mark
|
1851
1931
|
㊗️ congratulations
|
1852
|
-
㊙️ secret`,
|
1853
|
-
`).reduce((a,
|
1854
|
-
const [
|
1855
|
-
a.set(`:${e}:`,
|
1856
|
-
for (const
|
1857
|
-
a.set(
|
1932
|
+
㊙️ secret`, y = k.split(`
|
1933
|
+
`).reduce((a, n) => {
|
1934
|
+
const [r, e, ...o] = n.split(" ");
|
1935
|
+
a.set(`:${e}:`, r);
|
1936
|
+
for (const l of o)
|
1937
|
+
a.set(l, r);
|
1858
1938
|
return a;
|
1859
1939
|
}, /* @__PURE__ */ new Map());
|
1860
|
-
function
|
1861
|
-
const
|
1862
|
-
for (let
|
1863
|
-
const o =
|
1864
|
-
if (
|
1940
|
+
function E(a) {
|
1941
|
+
const n = a.split(" ");
|
1942
|
+
for (let r = 0, e = 0; r < n.length; r++) {
|
1943
|
+
const o = n[r], l = y.get(o);
|
1944
|
+
if (l && // only consider matches for the unique :shortname: unless it's not at the
|
1865
1945
|
// end of the text. This avoids having smileys taking precedence over
|
1866
1946
|
// emoji with longer names (e.g. :b vs. :bear: or :p vs. :pig:)
|
1867
1947
|
(a.length > e + o.length || o.endsWith(":")))
|
1868
1948
|
return {
|
1869
1949
|
position: e,
|
1870
1950
|
shortcode: o,
|
1871
|
-
emoji:
|
1951
|
+
emoji: l
|
1872
1952
|
};
|
1873
1953
|
e += o.length + 1;
|
1874
1954
|
}
|
1875
1955
|
return null;
|
1876
1956
|
}
|
1877
|
-
function c(a) {
|
1878
|
-
if (!a.isSimpleText() || a.hasFormat("code"))
|
1879
|
-
return;
|
1880
|
-
const l = a.getTextContent(), n = s(l);
|
1881
|
-
if (n === null)
|
1882
|
-
return;
|
1883
|
-
let e;
|
1884
|
-
n.position === 0 ? [e] = a.splitText(
|
1885
|
-
n.position + n.shortcode.length
|
1886
|
-
) : [, e] = a.splitText(
|
1887
|
-
n.position,
|
1888
|
-
n.position + n.shortcode.length
|
1889
|
-
);
|
1890
|
-
const o = i(n.emoji);
|
1891
|
-
e.replace(o);
|
1892
|
-
}
|
1893
1957
|
export {
|
1894
|
-
|
1958
|
+
u as $,
|
1959
|
+
q as E,
|
1960
|
+
E as f,
|
1961
|
+
z as t,
|
1962
|
+
b as u
|
1895
1963
|
};
|
package/dist/index.d.ts
CHANGED
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"}
|
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"}
|
package/dist/index.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* We rewrite the emoji dataset into plain text
|
3
|
-
* is quicker to parse
|
2
|
+
* We rewrite the emoji dataset into plain text delimited by
|
3
|
+
* spaces and newlines, which serializes smaller and is quicker to parse.
|
4
|
+
*
|
5
|
+
* This is done at build time by vite-plugin-data, which does compile-time
|
6
|
+
* evaluation of modules with .data in their name.
|
4
7
|
*/
|
5
8
|
export declare const supportedEmojis: string;
|
6
9
|
//# sourceMappingURL=supportedEmojis.data.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"supportedEmojis.data.d.ts","sourceRoot":"","sources":["../src/supportedEmojis.data.ts"],"names":[],"mappings":"AAGA
|
1
|
+
{"version":3,"file":"supportedEmojis.data.d.ts","sourceRoot":"","sources":["../src/supportedEmojis.data.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,QAYf,CAAC"}
|
package/dist/unifiedID.d.ts
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Convert a unified emoji ID its emoji representation.
|
3
|
+
*
|
4
|
+
* @example
|
5
|
+
* ```js
|
6
|
+
* assert(textFromUnifiedId("1F926-200D-2642-FE0F") === "🤦♂️");
|
7
|
+
* ```
|
8
|
+
*
|
9
|
+
* @param unifiedID The hyphen delimited hex representation of the UTF-16 code points in the emoji
|
10
|
+
* @returns The emoji as a string
|
11
|
+
*/
|
1
12
|
export declare function textFromUnifiedID(unifiedID: string): string;
|
13
|
+
/**
|
14
|
+
* Convert an emoji to its unified id (in uppercase).
|
15
|
+
*
|
16
|
+
* @example
|
17
|
+
* ```js
|
18
|
+
* assert(unifiedIDFromText("🤦♂️") === "1F926-200D-2642-FE0F");
|
19
|
+
* ```
|
20
|
+
*/
|
2
21
|
export declare function unifiedIDFromText(text: string): string;
|
3
22
|
//# sourceMappingURL=unifiedID.d.ts.map
|
package/dist/unifiedID.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"unifiedID.d.ts","sourceRoot":"","sources":["../src/unifiedID.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
1
|
+
{"version":3,"file":"unifiedID.d.ts","sourceRoot":"","sources":["../src/unifiedID.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"test": "vitest run",
|
16
16
|
"test:watch": "vitest"
|
17
17
|
},
|
18
|
-
"version": "0.0.13
|
18
|
+
"version": "0.0.13",
|
19
19
|
"license": "MIT",
|
20
20
|
"repository": {
|
21
21
|
"type": "git",
|
@@ -28,7 +28,6 @@
|
|
28
28
|
"homepage": "https://github.com/etrepum/lexical-builder",
|
29
29
|
"dependencies": {
|
30
30
|
"@etrepum/lexical-builder": "*",
|
31
|
-
"@repo/typescript-config": "*",
|
32
31
|
"emoji-datasource-facebook": "15.1.2"
|
33
32
|
},
|
34
33
|
"peerDependencies": {
|
package/dist/index-BBnhKeug.js
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
import { definePlan as p, safeCast as u } from "@etrepum/lexical-builder";
|
2
|
-
import { mergeRegister as g } from "@lexical/utils";
|
3
|
-
import { TextNode as d } from "lexical";
|
4
|
-
class r extends d {
|
5
|
-
static getType() {
|
6
|
-
return "emoji";
|
7
|
-
}
|
8
|
-
static clone(e) {
|
9
|
-
return new r(e.__text, e.__key);
|
10
|
-
}
|
11
|
-
static importJSON(e) {
|
12
|
-
return j(e.text);
|
13
|
-
}
|
14
|
-
exportJSON() {
|
15
|
-
return {
|
16
|
-
...super.exportJSON(),
|
17
|
-
type: "emoji"
|
18
|
-
};
|
19
|
-
}
|
20
|
-
}
|
21
|
-
function j(t) {
|
22
|
-
return new r(t).setMode("token");
|
23
|
-
}
|
24
|
-
function f(t) {
|
25
|
-
return Array.from(
|
26
|
-
t,
|
27
|
-
(e) => e.codePointAt(0).toString(16).padStart(4, "0")
|
28
|
-
).join("-");
|
29
|
-
}
|
30
|
-
const x = "@etrepum/lexical-builder/emoji-plan", L = p({
|
31
|
-
config: u({
|
32
|
-
emojiBaseUrl: "https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@0.0.13-nightly.20240606.0/dist/emoji",
|
33
|
-
emojiClass: "emoji-node",
|
34
|
-
emojiLoadedClass: "emoji-node-loaded"
|
35
|
-
}),
|
36
|
-
name: x,
|
37
|
-
nodes: [r],
|
38
|
-
register(t, e, s) {
|
39
|
-
let n = t.registerMutationListener(r, (i) => {
|
40
|
-
for (const [l, c] of i)
|
41
|
-
if (c !== "destroyed") {
|
42
|
-
const o = t.getElementByKey(l);
|
43
|
-
if (o) {
|
44
|
-
const a = `${e.emojiBaseUrl}/${f(o.innerText)}.png`;
|
45
|
-
o.classList.add(e.emojiClass), o.style.backgroundImage = `url(${a})`;
|
46
|
-
const m = new Image();
|
47
|
-
m.addEventListener(
|
48
|
-
"load",
|
49
|
-
() => o.classList.add(e.emojiLoadedClass),
|
50
|
-
{ signal: s.signal, once: !0 }
|
51
|
-
), m.src = a;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
});
|
55
|
-
return import("./_textNodeTransform-BfftQYga.js").then(({ $textNodeTransform: i }) => {
|
56
|
-
s.signal.aborted || (n = g(
|
57
|
-
n,
|
58
|
-
t.registerNodeTransform(d, i)
|
59
|
-
));
|
60
|
-
}), () => n();
|
61
|
-
}
|
62
|
-
});
|
63
|
-
export {
|
64
|
-
j as $,
|
65
|
-
L as E
|
66
|
-
};
|