@etrepum/lexical-emoji-plan 0.0.30-nightly.20240715.0 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/EmojiPlan.d.ts.map +1 -1
- package/dist/index.js +38 -36
- package/package.json +3 -3
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;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;AAMD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,
|
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;AAMD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,wHAkFpB,CAAC"}
|
package/dist/index.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
import { getPeerDependencyFromEditorOrThrow as
|
5
|
-
import { addClassNamesToElement as c, mergeRegister as
|
6
|
-
import { TextNode as
|
7
|
-
class _ extends
|
1
|
+
var b = Object.defineProperty;
|
2
|
+
var w = (e, a, n) => a in e ? b(e, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[a] = n;
|
3
|
+
var h = (e, a, n) => w(e, typeof a != "symbol" ? a + "" : a, n);
|
4
|
+
import { getPeerDependencyFromEditorOrThrow as k, definePlan as y, safeCast as v } from "@etrepum/lexical-builder";
|
5
|
+
import { addClassNamesToElement as c, mergeRegister as j, removeClassNamesFromElement as x } from "@lexical/utils";
|
6
|
+
import { TextNode as u, $getEditor as z, $applyNodeReplacement as q } from "lexical";
|
7
|
+
class _ extends u {
|
8
8
|
constructor(n, o, r) {
|
9
9
|
super(n, r);
|
10
|
-
|
10
|
+
h(this, "__shortcode");
|
11
11
|
this.__shortcode = o;
|
12
12
|
}
|
13
13
|
static getType() {
|
@@ -17,7 +17,7 @@ class _ extends h {
|
|
17
17
|
return new _(n.__text, n.__shortcode, n.__key);
|
18
18
|
}
|
19
19
|
static importJSON(n) {
|
20
|
-
return
|
20
|
+
return C(n.text, n.shortcode);
|
21
21
|
}
|
22
22
|
updateDOM(n, o, r) {
|
23
23
|
const l = super.updateDOM(n, o, r);
|
@@ -27,8 +27,8 @@ class _ extends h {
|
|
27
27
|
const r = super.createDOM(n, o);
|
28
28
|
return c(
|
29
29
|
r,
|
30
|
-
|
31
|
-
o ||
|
30
|
+
k(
|
31
|
+
o || z(),
|
32
32
|
"@etrepum/lexical-emoji-plan/Emoji"
|
33
33
|
).config.emojiClass
|
34
34
|
), this.__shortcode && (r.dataset.emojiShortcode = this.__shortcode), r;
|
@@ -48,13 +48,13 @@ class _ extends h {
|
|
48
48
|
};
|
49
49
|
}
|
50
50
|
}
|
51
|
-
function
|
52
|
-
return
|
51
|
+
function C(e, a) {
|
52
|
+
return q(new _(e, a).setMode("token"));
|
53
53
|
}
|
54
|
-
function
|
54
|
+
function I(e) {
|
55
55
|
return e instanceof _;
|
56
56
|
}
|
57
|
-
function
|
57
|
+
function L(e) {
|
58
58
|
return String.fromCodePoint(
|
59
59
|
...e.split("-").map((a) => parseInt(a, 16))
|
60
60
|
);
|
@@ -65,12 +65,12 @@ function E(e) {
|
|
65
65
|
(a) => a.codePointAt(0).toString(16).padStart(4, "0")
|
66
66
|
).join("-");
|
67
67
|
}
|
68
|
-
const
|
68
|
+
const O = "0.0.30";
|
69
69
|
function S() {
|
70
70
|
}
|
71
|
-
const
|
72
|
-
config:
|
73
|
-
emojiBaseUrl: `https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@${
|
71
|
+
const A = y({
|
72
|
+
config: v({
|
73
|
+
emojiBaseUrl: `https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@${O}/dist/emoji`,
|
74
74
|
emojiClass: "emoji-node",
|
75
75
|
emojiLoadingClass: "emoji-node-loading",
|
76
76
|
emojiLoadedClass: "emoji-node-loaded"
|
@@ -80,7 +80,7 @@ const I = k({
|
|
80
80
|
register(e, a, n) {
|
81
81
|
const o = /* @__PURE__ */ new Map();
|
82
82
|
let r = S;
|
83
|
-
const l =
|
83
|
+
const l = j(
|
84
84
|
// no need for init since we are synchronously registering at editor creation
|
85
85
|
e.registerMutationListener(_, (t) => {
|
86
86
|
for (const [s, p] of t)
|
@@ -97,14 +97,16 @@ const I = k({
|
|
97
97
|
a.emojiLoadingClass
|
98
98
|
), i.style.backgroundImage = `url(${m})`;
|
99
99
|
const g = new Image(), f = () => {
|
100
|
-
|
100
|
+
Object.assign(g, { onload: null, onerror: null });
|
101
|
+
}, d = () => {
|
102
|
+
f(), o.delete(s), x(i, a.emojiLoadingClass);
|
101
103
|
};
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}), g.src = m;
|
104
|
+
Object.assign(g, {
|
105
|
+
onerror: d,
|
106
|
+
onload: () => {
|
107
|
+
d(), c(i, a.emojiLoadedClass);
|
108
|
+
}
|
109
|
+
}), o.set(s, f), g.src = m;
|
108
110
|
}
|
109
111
|
}
|
110
112
|
}),
|
@@ -119,7 +121,7 @@ const I = k({
|
|
119
121
|
);
|
120
122
|
return import("./_textNodeTransform-JUH2dtPZ.js").then(({ $textNodeTransform: t }) => {
|
121
123
|
n.signal.aborted || (r = e.registerNodeTransform(
|
122
|
-
|
124
|
+
u,
|
123
125
|
t
|
124
126
|
));
|
125
127
|
}), l;
|
@@ -1974,7 +1976,7 @@ const I = k({
|
|
1974
1976
|
〰️ wavy_dash
|
1975
1977
|
〽️ part_alternation_mark
|
1976
1978
|
㊗️ congratulations
|
1977
|
-
㊙️ secret`,
|
1979
|
+
㊙️ secret`, N = D.split(`
|
1978
1980
|
`).reduce((e, a) => {
|
1979
1981
|
const [n, o, ...r] = a.split(" ");
|
1980
1982
|
e.set(`:${o}:`, n);
|
@@ -1982,10 +1984,10 @@ const I = k({
|
|
1982
1984
|
e.set(l, n);
|
1983
1985
|
return e;
|
1984
1986
|
}, /* @__PURE__ */ new Map());
|
1985
|
-
function
|
1987
|
+
function F(e) {
|
1986
1988
|
const a = e.split(/[ \xa0]/g);
|
1987
1989
|
for (let n = 0, o = 0; n < a.length; n++) {
|
1988
|
-
const r = a[n], l =
|
1990
|
+
const r = a[n], l = N.get(r);
|
1989
1991
|
if (l && // only consider matches for the unique :shortname: unless it's not at the
|
1990
1992
|
// end of the text. This avoids having smileys taking precedence over
|
1991
1993
|
// emoji with longer names (e.g. :b vs. :bear: or :p vs. :pig:)
|
@@ -2000,11 +2002,11 @@ function A(e) {
|
|
2000
2002
|
return null;
|
2001
2003
|
}
|
2002
2004
|
export {
|
2003
|
-
|
2004
|
-
|
2005
|
+
C as $createEmojiNode,
|
2006
|
+
I as $isEmojiNode,
|
2005
2007
|
_ as EmojiNode,
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2008
|
+
A as EmojiPlan,
|
2009
|
+
F as findEmoji,
|
2010
|
+
L as textFromUnifiedID,
|
2009
2011
|
E as unifiedIDFromText
|
2010
2012
|
};
|
package/package.json
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
"test": "vitest run",
|
17
17
|
"test:watch": "vitest"
|
18
18
|
},
|
19
|
-
"version": "0.0.30
|
19
|
+
"version": "0.0.30",
|
20
20
|
"license": "MIT",
|
21
21
|
"repository": {
|
22
22
|
"type": "git",
|
@@ -32,8 +32,8 @@
|
|
32
32
|
"emoji-datasource-facebook": "15.1.2"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
|
-
"@lexical/utils": ">=0.16.
|
36
|
-
"lexical": ">=0.16.
|
35
|
+
"@lexical/utils": ">=0.16.2-nightly.20240716",
|
36
|
+
"lexical": ">=0.16.2-nightly.20240716"
|
37
37
|
},
|
38
38
|
"sideEffects": false,
|
39
39
|
"devDependencies": {
|