@etrepum/lexical-emoji-plan 0.0.29-nightly.20240709.0 → 0.0.30-nightly.20240710.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
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,EAAE,QAAQ,EAAyB,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,QAAQ;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAErB,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,OAAO;IAKvE,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,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO;IAY1E,SAAS,CACP,MAAM,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,GACjC,WAAW;IAQd,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAMlD,UAAU,IAAI,mBAAmB;CAOlC;AA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AM,GAAG,SAAS;IAIlC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAMlD,UAAU,IAAI,mBAAmB;CAOlC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAC7B,SAAS,CAMX;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,SAAS,CAEnB"}
@@ -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;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,wHA4EpB,CAAC"}
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,wHA8EpB,CAAC"}
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- var p = Object.defineProperty;
2
- var b = (e, a, n) => a in e ? p(e, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[a] = n;
3
- var m = (e, a, n) => b(e, typeof a != "symbol" ? a + "" : a, n);
4
- import { definePlan as w, safeCast as k } from "@etrepum/lexical-builder";
5
- import { mergeRegister as f, addClassNamesToElement as d, removeClassNamesFromElement as y } from "@lexical/utils";
6
- import { TextNode as h, $applyNodeReplacement as v } from "lexical";
1
+ var u = Object.defineProperty;
2
+ var b = (e, a, n) => a in e ? u(e, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[a] = n;
3
+ var d = (e, a, n) => b(e, typeof a != "symbol" ? a + "" : a, n);
4
+ import { getPeerDependencyFromEditorOrThrow as w, definePlan as k, safeCast as y } from "@etrepum/lexical-builder";
5
+ import { addClassNamesToElement as c, mergeRegister as v, removeClassNamesFromElement as j } from "@lexical/utils";
6
+ import { TextNode as h, $getEditor as x, $applyNodeReplacement as z } from "lexical";
7
7
  class _ extends h {
8
8
  constructor(n, o, r) {
9
9
  super(n, r);
10
- m(this, "__shortcode");
10
+ d(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 j(n.text, n.shortcode);
20
+ return q(n.text, n.shortcode);
21
21
  }
22
22
  updateDOM(n, o, r) {
23
23
  const l = super.updateDOM(n, o, r);
@@ -25,7 +25,13 @@ class _ extends h {
25
25
  }
26
26
  createDOM(n, o) {
27
27
  const r = super.createDOM(n, o);
28
- return this.__shortcode && (r.dataset.emojiShortcode = this.__shortcode), r;
28
+ return c(
29
+ r,
30
+ w(
31
+ o || x(),
32
+ "@etrepum/lexical-emoji-plan/Emoji"
33
+ ).config.emojiClass
34
+ ), this.__shortcode && (r.dataset.emojiShortcode = this.__shortcode), r;
29
35
  }
30
36
  getShortcode() {
31
37
  return this.getLatest().__shortcode;
@@ -42,26 +48,29 @@ class _ extends h {
42
48
  };
43
49
  }
44
50
  }
45
- function j(e, a) {
46
- return v(new _(e, a).setMode("token"));
51
+ function q(e, a) {
52
+ return z(new _(e, a).setMode("token"));
47
53
  }
48
- function O(e) {
54
+ function $(e) {
49
55
  return e instanceof _;
50
56
  }
51
- function L(e) {
57
+ function T(e) {
52
58
  return String.fromCodePoint(
53
59
  ...e.split("-").map((a) => parseInt(a, 16))
54
60
  );
55
61
  }
56
- function x(e) {
62
+ function E(e) {
57
63
  return Array.from(
58
64
  e,
59
65
  (a) => a.codePointAt(0).toString(16).padStart(4, "0")
60
66
  ).join("-");
61
67
  }
62
- const z = "0.0.29-nightly.20240709.0", M = w({
63
- config: k({
64
- emojiBaseUrl: `https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@${z}/dist/emoji`,
68
+ const C = "0.0.30-nightly.20240710.0";
69
+ function S() {
70
+ }
71
+ const I = k({
72
+ config: y({
73
+ emojiBaseUrl: `https://cdn.jsdelivr.net/npm/@etrepum/lexical-emoji-plan@${C}/dist/emoji`,
65
74
  emojiClass: "emoji-node",
66
75
  emojiLoadingClass: "emoji-node-loading",
67
76
  emojiLoadedClass: "emoji-node-loaded"
@@ -70,50 +79,52 @@ const z = "0.0.29-nightly.20240709.0", M = w({
70
79
  nodes: [_],
71
80
  register(e, a, n) {
72
81
  const o = /* @__PURE__ */ new Map();
73
- let r = f(
82
+ let r = S;
83
+ const l = v(
74
84
  // no need for init since we are synchronously registering at editor creation
75
- e.registerMutationListener(_, (l) => {
76
- for (const [t, u] of l)
77
- if (u === "destroyed") {
78
- const i = o.get(t);
79
- i && (o.delete(t), i());
85
+ e.registerMutationListener(_, (t) => {
86
+ for (const [s, p] of t)
87
+ if (p === "destroyed") {
88
+ const i = o.get(s);
89
+ i && (o.delete(s), i());
80
90
  } else {
81
- const i = e.getElementByKey(t);
91
+ const i = e.getElementByKey(s);
82
92
  if (i) {
83
- const g = `${a.emojiBaseUrl}/${x(i.innerText)}.png`;
84
- d(
93
+ const m = `${a.emojiBaseUrl}/${E(i.innerText)}.png`;
94
+ c(
85
95
  i,
86
96
  a.emojiClass,
87
97
  a.emojiLoadingClass
88
- ), i.style.backgroundImage = `url(${g})`;
89
- const s = new Image(), c = () => {
90
- y(i, a.emojiLoadingClass), d(i, a.emojiLoadedClass), o.delete(t);
98
+ ), i.style.backgroundImage = `url(${m})`;
99
+ const g = new Image(), f = () => {
100
+ j(i, a.emojiLoadingClass), c(i, a.emojiLoadedClass), o.delete(s);
91
101
  };
92
- o.set(t, () => {
93
- s.removeEventListener("load", c);
94
- }), s.addEventListener("load", c, {
102
+ o.set(s, () => {
103
+ g.removeEventListener("load", f);
104
+ }), g.addEventListener("load", f, {
95
105
  signal: n.signal,
96
106
  once: !0
97
- }), s.src = g;
107
+ }), g.src = m;
98
108
  }
99
109
  }
100
110
  }),
101
111
  () => {
102
- for (const l of o.values())
103
- l();
112
+ for (const t of o.values())
113
+ t();
104
114
  o.clear();
115
+ },
116
+ () => {
117
+ r();
105
118
  }
106
119
  );
107
- return import("./_textNodeTransform-JUH2dtPZ.js").then(({ $textNodeTransform: l }) => {
108
- n.signal.aborted || (r = f(
109
- r,
110
- e.registerNodeTransform(h, l)
120
+ return import("./_textNodeTransform-JUH2dtPZ.js").then(({ $textNodeTransform: t }) => {
121
+ n.signal.aborted || (r = e.registerNodeTransform(
122
+ h,
123
+ t
111
124
  ));
112
- }), () => {
113
- r();
114
- };
125
+ }), l;
115
126
  }
116
- }), q = `🀄 mahjong
127
+ }), D = `🀄 mahjong
117
128
  🃏 black_joker
118
129
  🅰️ a
119
130
  🅱️ b
@@ -1963,7 +1974,7 @@ const z = "0.0.29-nightly.20240709.0", M = w({
1963
1974
  〰️ wavy_dash
1964
1975
  〽️ part_alternation_mark
1965
1976
  ㊗️ congratulations
1966
- ㊙️ secret`, C = q.split(`
1977
+ ㊙️ secret`, O = D.split(`
1967
1978
  `).reduce((e, a) => {
1968
1979
  const [n, o, ...r] = a.split(" ");
1969
1980
  e.set(`:${o}:`, n);
@@ -1971,10 +1982,10 @@ const z = "0.0.29-nightly.20240709.0", M = w({
1971
1982
  e.set(l, n);
1972
1983
  return e;
1973
1984
  }, /* @__PURE__ */ new Map());
1974
- function P(e) {
1985
+ function A(e) {
1975
1986
  const a = e.split(/[ \xa0]/g);
1976
1987
  for (let n = 0, o = 0; n < a.length; n++) {
1977
- const r = a[n], l = C.get(r);
1988
+ const r = a[n], l = O.get(r);
1978
1989
  if (l && // only consider matches for the unique :shortname: unless it's not at the
1979
1990
  // end of the text. This avoids having smileys taking precedence over
1980
1991
  // emoji with longer names (e.g. :b vs. :bear: or :p vs. :pig:)
@@ -1989,11 +2000,11 @@ function P(e) {
1989
2000
  return null;
1990
2001
  }
1991
2002
  export {
1992
- j as $createEmojiNode,
1993
- O as $isEmojiNode,
2003
+ q as $createEmojiNode,
2004
+ $ as $isEmojiNode,
1994
2005
  _ as EmojiNode,
1995
- M as EmojiPlan,
1996
- P as findEmoji,
1997
- L as textFromUnifiedID,
1998
- x as unifiedIDFromText
2006
+ I as EmojiPlan,
2007
+ A as findEmoji,
2008
+ T as textFromUnifiedID,
2009
+ E as unifiedIDFromText
1999
2010
  };
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "test": "vitest run",
17
17
  "test:watch": "vitest"
18
18
  },
19
- "version": "0.0.29-nightly.20240709.0",
19
+ "version": "0.0.30-nightly.20240710.0",
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",