@etrepum/lexical-emoji-plan 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -2
- package/dist/EmojiPlan.d.ts +11 -2
- package/dist/EmojiPlan.d.ts.map +1 -1
- package/dist/__tests__/findEmoji.test.d.ts +9 -0
- package/dist/__tests__/findEmoji.test.d.ts.map +1 -0
- package/dist/__tests__/unifiedID.test.d.ts +9 -0
- package/dist/__tests__/unifiedID.test.d.ts.map +1 -0
- package/dist/{_textNodeTransform-Bq8MmgIE.js → _textNodeTransform-BK8SL6Gn.js} +1 -1
- package/dist/index-DgoyRltj.js +66 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/supportedEmojis.data.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/index-C6HoUNop.js +0 -21944
package/README.md
CHANGED
package/dist/EmojiPlan.d.ts
CHANGED
@@ -5,8 +5,17 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
7
|
*/
|
8
|
-
|
8
|
+
declare const NAME = "@etrepum/lexical-builder/emoji-plan";
|
9
|
+
export interface EmojiPlanConfig {
|
9
10
|
emojiBaseUrl: string;
|
10
11
|
emojiClass: string;
|
11
|
-
|
12
|
+
emojiLoadedClass: string;
|
13
|
+
}
|
14
|
+
declare module '@etrepum/lexical-builder' {
|
15
|
+
interface LexicalPlanRegistry {
|
16
|
+
[NAME]: EmojiPlanConfig;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
export declare const EmojiPlan: import('@etrepum/lexical-builder').LexicalPlan<EmojiPlanConfig, "@etrepum/lexical-builder/emoji-plan">;
|
20
|
+
export {};
|
12
21
|
//# 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,SAAS
|
1
|
+
{"version":3,"file":"EmojiPlan.d.ts","sourceRoot":"","sources":["../src/EmojiPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,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,eAAe,CAAC;KACzB;CACF;AAED,eAAO,MAAM,SAAS,wGA8CpB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"findEmoji.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/findEmoji.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unifiedID.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/unifiedID.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { definePlan as p, safeCast as u } from "@etrepum/lexical-builder";
|
2
|
+
import { mergeRegister as j } 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 g(e.text);
|
13
|
+
}
|
14
|
+
exportJSON() {
|
15
|
+
return {
|
16
|
+
...super.exportJSON(),
|
17
|
+
type: "emoji"
|
18
|
+
};
|
19
|
+
}
|
20
|
+
}
|
21
|
+
function g(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.5/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-BK8SL6Gn.js").then(({ $textNodeTransform: i }) => {
|
56
|
+
s.signal.aborted || (n = j(
|
57
|
+
n,
|
58
|
+
t.registerNodeTransform(d, i)
|
59
|
+
));
|
60
|
+
}), () => n();
|
61
|
+
}
|
62
|
+
});
|
63
|
+
export {
|
64
|
+
g as $,
|
65
|
+
L as E
|
66
|
+
};
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,2 @@
|
|
1
|
-
|
2
|
-
import { EmojiPlan } from './EmojiPlan';
|
3
|
-
|
4
|
-
export type EmojiConfig = LexicalPlanConfig<typeof EmojiPlan>;
|
5
|
-
export { EmojiPlan };
|
1
|
+
export { EmojiPlan, type EmojiPlanConfig } from './EmojiPlan';
|
6
2
|
//# 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,
|
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"}
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"supportedEmojis.data.d.ts","sourceRoot":"","sources":["../src/supportedEmojis.data.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,eAAe,
|
1
|
+
{"version":3,"file":"supportedEmojis.data.d.ts","sourceRoot":"","sources":["../src/supportedEmojis.data.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,eAAe,QAYf,CAAC"}
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"test": "vitest run",
|
16
16
|
"test:watch": "vitest"
|
17
17
|
},
|
18
|
-
"version": "0.0.
|
18
|
+
"version": "0.0.5",
|
19
19
|
"license": "MIT",
|
20
20
|
"repository": {
|
21
21
|
"type": "git",
|
@@ -42,6 +42,7 @@
|
|
42
42
|
"vite": "^5.2.11",
|
43
43
|
"vite-plugin-data": "^0.2.5",
|
44
44
|
"vite-plugin-dts": "^3.9.1",
|
45
|
+
"vite-plugin-package-version": "^1.1.0",
|
45
46
|
"vite-plugin-static-copy": "^1.0.5",
|
46
47
|
"vitest": "^1.6.0"
|
47
48
|
},
|