@jvs-milkdown/plugin-emoji 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/lib/__internal__/parse.d.ts +36 -0
- package/lib/__internal__/parse.d.ts.map +1 -0
- package/lib/__internal__/remark-twemoji.d.ts +4 -0
- package/lib/__internal__/remark-twemoji.d.ts.map +1 -0
- package/lib/__internal__/with-meta.d.ts +3 -0
- package/lib/__internal__/with-meta.d.ts.map +1 -0
- package/lib/emoji-render.spec.d.ts +2 -0
- package/lib/emoji-render.spec.d.ts.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +178 -0
- package/lib/index.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +47 -0
- package/src/__internal__/parse.ts +49 -0
- package/src/__internal__/remark-twemoji.ts +77 -0
- package/src/__internal__/with-meta.ts +15 -0
- package/src/emoji-render.spec.ts +38 -0
- package/src/index.ts +145 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-present Mirone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @jvs-milkdown/plugin-emoji
|
|
2
|
+
|
|
3
|
+
The emoji plugin of [milkdown](https://milkdown.dev/).
|
|
4
|
+
|
|
5
|
+
# Official Documentation
|
|
6
|
+
|
|
7
|
+
Documentation can be found on the [Milkdown website](https://milkdown.dev/).
|
|
8
|
+
|
|
9
|
+
# License
|
|
10
|
+
|
|
11
|
+
Milkdown is open sourced software licensed under [MIT license](https://github.com/Milkdown/milkdown/blob/main/LICENSE).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface TwemojiOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Default: Cloudflare
|
|
4
|
+
*/
|
|
5
|
+
base?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Default: .png
|
|
8
|
+
*/
|
|
9
|
+
ext?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Default: emoji
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Default: 72x72
|
|
16
|
+
*/
|
|
17
|
+
size?: string | number;
|
|
18
|
+
/**
|
|
19
|
+
* To render with SVG use `folder: svg, ext: .svg`
|
|
20
|
+
*/
|
|
21
|
+
folder?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The function to invoke in order to generate image src(s).
|
|
24
|
+
*/
|
|
25
|
+
callback?: (icon: string, options: object, variant: string) => string | false;
|
|
26
|
+
/**
|
|
27
|
+
* The function to invoke in order to generate additional, custom attributes for the image tag.
|
|
28
|
+
* Default () => ({})
|
|
29
|
+
* @param icon the lower case HEX code point i.e. "1f4a9"
|
|
30
|
+
* @param variant variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
attributes?: (icon: string, variant: string) => object;
|
|
34
|
+
}
|
|
35
|
+
export declare function parse(emoji: string, twemojiOptions?: TwemojiOptions): string;
|
|
36
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/__internal__/parse.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,KAAK,CAAA;IAC7E;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;CACvD;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAM5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-twemoji.d.ts","sourceRoot":"","sources":["../../src/__internal__/remark-twemoji.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAItE,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,SAAS,CAAA;AAqCpD,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,cAAc,CAmCzD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-meta.d.ts","sourceRoot":"","sources":["../../src/__internal__/with-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAE7D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,cAAc,EAC/C,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAC9C,CAAC,CASH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji-render.spec.d.ts","sourceRoot":"","sources":["../src/emoji-render.spec.ts"],"names":[],"mappings":"AAEA,OAAO,kCAAkC,CAAA"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MilkdownPlugin } from '@jvs-milkdown/ctx';
|
|
2
|
+
import type { RemarkEmojiOptions } from 'remark-emoji';
|
|
3
|
+
export declare const emojiAttr: import("@jvs-milkdown/utils").$NodeAttr;
|
|
4
|
+
export declare const emojiSchema: import("@jvs-milkdown/utils").$NodeSchema<"emoji">;
|
|
5
|
+
export declare const remarkEmojiPlugin: import("@jvs-milkdown/utils").$Remark<"remarkEmoji", RemarkEmojiOptions>;
|
|
6
|
+
export declare const remarkTwemojiPlugin: import("@jvs-milkdown/utils").$Remark<"remarkTwemoji", import("./__internal__/parse").TwemojiOptions>;
|
|
7
|
+
export declare const insertEmojiInputRule: import("@jvs-milkdown/utils").$InputRule;
|
|
8
|
+
export declare const emoji: MilkdownPlugin[];
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AActD,eAAO,MAAM,SAAS,yCAGnB,CAAA;AAMH,eAAO,MAAM,WAAW,oDAuDrB,CAAA;AAUH,eAAO,MAAM,iBAAiB,0EAG7B,CAAA;AAWD,eAAO,MAAM,mBAAmB,uGAAgD,CAAA;AAYhF,eAAO,MAAM,oBAAoB,0CAehC,CAAA;AAOD,eAAO,MAAM,KAAK,EAAE,cAAc,EAM1B,CAAA"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { expectDomTypeError } from "@jvs-milkdown/exception";
|
|
2
|
+
import { InputRule } from "@jvs-milkdown/prose/inputrules";
|
|
3
|
+
import { $inputRule, $nodeAttr, $nodeSchema, $remark } from "@jvs-milkdown/utils";
|
|
4
|
+
import DOMPurify from "dompurify";
|
|
5
|
+
import { get } from "node-emoji";
|
|
6
|
+
import remarkEmoji from "remark-emoji";
|
|
7
|
+
import twemoji from "twemoji";
|
|
8
|
+
import emojiRegex from "emoji-regex";
|
|
9
|
+
//#region src/__internal__/parse.ts
|
|
10
|
+
var setAttr = (text) => ({ title: text });
|
|
11
|
+
function parse(emoji, twemojiOptions) {
|
|
12
|
+
return twemoji.parse(emoji, {
|
|
13
|
+
attributes: setAttr,
|
|
14
|
+
base: "https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/",
|
|
15
|
+
...twemojiOptions
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/__internal__/remark-twemoji.ts
|
|
20
|
+
var regex = emojiRegex();
|
|
21
|
+
var isParent = (node) => !!node.children;
|
|
22
|
+
var isLiteral = (node) => !!node.value;
|
|
23
|
+
function flatMap(ast, fn) {
|
|
24
|
+
return transform(ast, 0, null)[0];
|
|
25
|
+
function transform(node, index, parent) {
|
|
26
|
+
if (isParent(node)) {
|
|
27
|
+
const out = [];
|
|
28
|
+
for (let i = 0, n = node.children.length; i < n; i++) {
|
|
29
|
+
const nthChild = node.children[i];
|
|
30
|
+
if (nthChild) {
|
|
31
|
+
const xs = transform(nthChild, i, node);
|
|
32
|
+
if (xs) for (let j = 0, m = xs.length; j < m; j++) {
|
|
33
|
+
const item = xs[j];
|
|
34
|
+
if (item) out.push(item);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
node.children = out;
|
|
39
|
+
}
|
|
40
|
+
return fn(node, index, parent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var twemojiPlugin = (twemojiOptions) => {
|
|
44
|
+
function transformer(tree) {
|
|
45
|
+
flatMap(tree, (node) => {
|
|
46
|
+
if (!isLiteral(node)) return [node];
|
|
47
|
+
if (node.type === "code") return [node];
|
|
48
|
+
const value = node.value;
|
|
49
|
+
const output = [];
|
|
50
|
+
let match;
|
|
51
|
+
let str = value;
|
|
52
|
+
while (match = regex.exec(str)) {
|
|
53
|
+
const { index } = match;
|
|
54
|
+
const emoji = match[0];
|
|
55
|
+
if (emoji) {
|
|
56
|
+
if (index > 0) output.push({
|
|
57
|
+
...node,
|
|
58
|
+
value: str.slice(0, index)
|
|
59
|
+
});
|
|
60
|
+
output.push({
|
|
61
|
+
...node,
|
|
62
|
+
value: parse(emoji, twemojiOptions),
|
|
63
|
+
type: "emoji"
|
|
64
|
+
});
|
|
65
|
+
str = str.slice(index + emoji.length);
|
|
66
|
+
}
|
|
67
|
+
regex.lastIndex = 0;
|
|
68
|
+
}
|
|
69
|
+
if (str.length) output.push({
|
|
70
|
+
...node,
|
|
71
|
+
value: str
|
|
72
|
+
});
|
|
73
|
+
return output;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return transformer;
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/__internal__/with-meta.ts
|
|
80
|
+
function withMeta(plugin, meta) {
|
|
81
|
+
Object.assign(plugin, { meta: {
|
|
82
|
+
package: "@jvs-milkdown/plugin-emoji",
|
|
83
|
+
...meta
|
|
84
|
+
} });
|
|
85
|
+
return plugin;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/index.ts
|
|
89
|
+
var emojiAttr = $nodeAttr("emoji", () => ({
|
|
90
|
+
span: {},
|
|
91
|
+
img: {}
|
|
92
|
+
}));
|
|
93
|
+
withMeta(emojiAttr, { displayName: "Attr<emoji>" });
|
|
94
|
+
var emojiSchema = $nodeSchema("emoji", (ctx) => ({
|
|
95
|
+
group: "inline",
|
|
96
|
+
inline: true,
|
|
97
|
+
attrs: { html: { default: "" } },
|
|
98
|
+
parseDOM: [{
|
|
99
|
+
tag: "span[data-type=\"emoji\"]",
|
|
100
|
+
getAttrs: (dom) => {
|
|
101
|
+
if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);
|
|
102
|
+
return { html: dom.innerHTML };
|
|
103
|
+
}
|
|
104
|
+
}],
|
|
105
|
+
toDOM: (node) => {
|
|
106
|
+
const attrs = ctx.get(emojiAttr.key)(node);
|
|
107
|
+
const tmp = document.createElement("span");
|
|
108
|
+
tmp.innerHTML = DOMPurify.sanitize(node.attrs.html);
|
|
109
|
+
const firstChild = tmp.firstChild;
|
|
110
|
+
if (!firstChild) {
|
|
111
|
+
console.warn("Milkdown emoji plugin: emoji is not valid");
|
|
112
|
+
return [
|
|
113
|
+
"span",
|
|
114
|
+
{
|
|
115
|
+
...attrs.container,
|
|
116
|
+
"data-type": "emoji"
|
|
117
|
+
},
|
|
118
|
+
tmp
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
const dom = firstChild.cloneNode();
|
|
122
|
+
tmp.remove();
|
|
123
|
+
if (dom && dom instanceof HTMLElement) Object.entries(attrs.img).forEach(([key, value]) => dom.setAttribute(key, value));
|
|
124
|
+
return [
|
|
125
|
+
"span",
|
|
126
|
+
{
|
|
127
|
+
...attrs.container,
|
|
128
|
+
"data-type": "emoji"
|
|
129
|
+
},
|
|
130
|
+
dom
|
|
131
|
+
];
|
|
132
|
+
},
|
|
133
|
+
parseMarkdown: {
|
|
134
|
+
match: ({ type }) => type === "emoji",
|
|
135
|
+
runner: (state, node, type) => {
|
|
136
|
+
state.addNode(type, { html: node.value });
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
toMarkdown: {
|
|
140
|
+
match: (node) => node.type.name === "emoji",
|
|
141
|
+
runner: (state, node) => {
|
|
142
|
+
const span = document.createElement("span");
|
|
143
|
+
span.innerHTML = node.attrs.html;
|
|
144
|
+
const img = span.querySelector("img");
|
|
145
|
+
const title = img?.title || img?.alt;
|
|
146
|
+
span.remove();
|
|
147
|
+
state.addNode("text", void 0, title);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
withMeta(emojiSchema.node, { displayName: "NodeSchema<emoji>" });
|
|
152
|
+
withMeta(emojiSchema.ctx, { displayName: "NodeSchemaCtx<emoji>" });
|
|
153
|
+
var remarkEmojiPlugin = $remark("remarkEmoji", () => remarkEmoji);
|
|
154
|
+
withMeta(remarkEmojiPlugin.plugin, { displayName: "Remark<remarkEmojiPlugin>" });
|
|
155
|
+
withMeta(remarkEmojiPlugin.options, { displayName: "RemarkConfig<remarkEmojiPlugin>" });
|
|
156
|
+
var remarkTwemojiPlugin = $remark("remarkTwemoji", () => twemojiPlugin);
|
|
157
|
+
withMeta(remarkTwemojiPlugin.plugin, { displayName: "Remark<remarkTwemojiPlugin>" });
|
|
158
|
+
withMeta(remarkTwemojiPlugin.options, { displayName: "RemarkConfig<remarkTwemojiPlugin>" });
|
|
159
|
+
var insertEmojiInputRule = $inputRule((ctx) => new InputRule(/(:([^:\s]+):)$/, (state, match, start, end) => {
|
|
160
|
+
const content = match[0];
|
|
161
|
+
if (!content) return null;
|
|
162
|
+
const got = get(content);
|
|
163
|
+
if (!got || content.includes(got)) return null;
|
|
164
|
+
const html = parse(got, ctx.get(remarkTwemojiPlugin.options.key));
|
|
165
|
+
return state.tr.setMeta("emoji", true).replaceRangeWith(start, end, emojiSchema.type(ctx).create({ html })).scrollIntoView();
|
|
166
|
+
}));
|
|
167
|
+
withMeta(insertEmojiInputRule, { displayName: "InputRule<insertEmojiInputRule>" });
|
|
168
|
+
var emoji = [
|
|
169
|
+
emojiAttr,
|
|
170
|
+
remarkEmojiPlugin,
|
|
171
|
+
remarkTwemojiPlugin,
|
|
172
|
+
emojiSchema,
|
|
173
|
+
insertEmojiInputRule
|
|
174
|
+
].flat();
|
|
175
|
+
//#endregion
|
|
176
|
+
export { emoji, emojiAttr, emojiSchema, insertEmojiInputRule, remarkEmojiPlugin, remarkTwemojiPlugin };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/__internal__/parse.ts","../src/__internal__/remark-twemoji.ts","../src/__internal__/with-meta.ts","../src/index.ts"],"sourcesContent":["import twemoji from 'twemoji'\n\nconst setAttr = (text: string) => ({ title: text })\n\n/// @internal\n/// This is copied from https://github.com/twitter/twemoji/blob/master/index.d.ts#L14\n/// The file is not released for some reason, so I have to copy it here.\nexport interface TwemojiOptions {\n /**\n * Default: Cloudflare\n */\n base?: string\n /**\n * Default: .png\n */\n ext?: string\n /**\n * Default: emoji\n */\n className?: string\n /**\n * Default: 72x72\n */\n size?: string | number\n /**\n * To render with SVG use `folder: svg, ext: .svg`\n */\n folder?: string\n /**\n * The function to invoke in order to generate image src(s).\n */\n callback?: (icon: string, options: object, variant: string) => string | false\n /**\n * The function to invoke in order to generate additional, custom attributes for the image tag.\n * Default () => ({})\n * @param icon the lower case HEX code point i.e. \"1f4a9\"\n * @param variant variant the optional \\uFE0F (\"as image\") variant, in case this info is anyhow meaningful. By default this is ignored.\n *\n */\n attributes?: (icon: string, variant: string) => object\n}\n\nexport function parse(emoji: string, twemojiOptions?: TwemojiOptions): string {\n return twemoji.parse(emoji, {\n attributes: setAttr,\n base: 'https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/',\n ...twemojiOptions,\n }) as unknown as string\n}\n","import type { Node, RemarkPluginRaw } from '@jvs-milkdown/transformer'\n\nimport emojiRegex from 'emoji-regex'\n\nimport { type TwemojiOptions, parse } from './parse'\n\nconst regex = emojiRegex()\n\nconst isParent = (node: Node): node is Node & { children: Node[] } =>\n !!(node as Node & { children: Node[] }).children\nconst isLiteral = (node: Node): node is Node & { value: string } =>\n !!(node as Node & { value: string }).value\n\nfunction flatMap(\n ast: Node,\n fn: (node: Node, index: number, parent: Node | null) => Node[]\n) {\n return transform(ast, 0, null)[0]\n\n function transform(node: Node, index: number, parent: Node | null) {\n if (isParent(node)) {\n const out = []\n for (let i = 0, n = node.children.length; i < n; i++) {\n const nthChild = node.children[i]\n if (nthChild) {\n const xs = transform(nthChild, i, node)\n if (xs) {\n for (let j = 0, m = xs.length; j < m; j++) {\n const item = xs[j]\n if (item) out.push(item)\n }\n }\n }\n }\n node.children = out\n }\n\n return fn(node, index, parent)\n }\n}\n\nexport const twemojiPlugin: RemarkPluginRaw<TwemojiOptions> = (\n twemojiOptions\n) => {\n function transformer(tree: Node) {\n flatMap(tree, (node) => {\n if (!isLiteral(node)) return [node]\n\n // Should not convert code block\n if (node.type === 'code') return [node]\n\n const value = node.value\n const output: Array<Node & { value: string }> = []\n let match\n let str = value\n while ((match = regex.exec(str))) {\n const { index } = match\n const emoji = match[0]\n if (emoji) {\n if (index > 0) output.push({ ...node, value: str.slice(0, index) })\n\n output.push({\n ...node,\n value: parse(emoji, twemojiOptions),\n type: 'emoji',\n })\n str = str.slice(index + emoji.length)\n }\n regex.lastIndex = 0\n }\n if (str.length) output.push({ ...node, value: str })\n\n return output\n })\n }\n return transformer\n}\n","import type { Meta, MilkdownPlugin } from '@jvs-milkdown/ctx'\n\nexport function withMeta<T extends MilkdownPlugin>(\n plugin: T,\n meta: Partial<Meta> & Pick<Meta, 'displayName'>\n): T {\n Object.assign(plugin, {\n meta: {\n package: '@jvs-milkdown/plugin-emoji',\n ...meta,\n },\n })\n\n return plugin\n}\n","import type { MilkdownPlugin } from '@jvs-milkdown/ctx'\nimport type { RemarkPluginRaw } from '@jvs-milkdown/transformer'\nimport type { RemarkEmojiOptions } from 'remark-emoji'\n\nimport { expectDomTypeError } from '@jvs-milkdown/exception'\nimport { InputRule } from '@jvs-milkdown/prose/inputrules'\nimport { $inputRule, $nodeAttr, $nodeSchema, $remark } from '@jvs-milkdown/utils'\nimport DOMPurify from 'dompurify'\nimport { get } from 'node-emoji'\nimport remarkEmoji from 'remark-emoji'\n\nimport { parse } from './__internal__/parse'\nimport { twemojiPlugin } from './__internal__/remark-twemoji'\nimport { withMeta } from './__internal__/with-meta'\n\n/// HTML attributes for emoji node.\nexport const emojiAttr = $nodeAttr('emoji', () => ({\n span: {},\n img: {},\n}))\nwithMeta(emojiAttr, {\n displayName: 'Attr<emoji>',\n})\n\n/// Schema for emoji node.\nexport const emojiSchema = $nodeSchema('emoji', (ctx) => ({\n group: 'inline',\n inline: true,\n attrs: {\n html: {\n default: '',\n },\n },\n parseDOM: [\n {\n tag: 'span[data-type=\"emoji\"]',\n getAttrs: (dom) => {\n if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom)\n\n return { html: dom.innerHTML }\n },\n },\n ],\n toDOM: (node) => {\n const attrs = ctx.get(emojiAttr.key)(node)\n const tmp = document.createElement('span')\n tmp.innerHTML = DOMPurify.sanitize(node.attrs.html)\n\n const firstChild = tmp.firstChild\n if (!firstChild) {\n console.warn('Milkdown emoji plugin: emoji is not valid')\n return ['span', { ...attrs.container, 'data-type': 'emoji' }, tmp]\n }\n\n const dom = firstChild.cloneNode()\n tmp.remove()\n if (dom && dom instanceof HTMLElement)\n Object.entries<string>(attrs.img).forEach(([key, value]) =>\n dom.setAttribute(key, value)\n )\n\n return ['span', { ...attrs.container, 'data-type': 'emoji' }, dom]\n },\n parseMarkdown: {\n match: ({ type }) => type === 'emoji',\n runner: (state, node, type) => {\n state.addNode(type, { html: node.value as string })\n },\n },\n toMarkdown: {\n match: (node) => node.type.name === 'emoji',\n runner: (state, node) => {\n const span = document.createElement('span')\n span.innerHTML = node.attrs.html\n const img = span.querySelector('img')\n const title = img?.title || img?.alt\n span.remove()\n state.addNode('text', undefined, title)\n },\n },\n}))\n\nwithMeta(emojiSchema.node, {\n displayName: 'NodeSchema<emoji>',\n})\nwithMeta(emojiSchema.ctx, {\n displayName: 'NodeSchemaCtx<emoji>',\n})\n\n/// This plugin wraps [remark-emoji](https://github.com/rhysd/remark-emoji).\nexport const remarkEmojiPlugin = $remark(\n 'remarkEmoji',\n () => remarkEmoji as RemarkPluginRaw<RemarkEmojiOptions>\n)\n\nwithMeta(remarkEmojiPlugin.plugin, {\n displayName: 'Remark<remarkEmojiPlugin>',\n})\n\nwithMeta(remarkEmojiPlugin.options, {\n displayName: 'RemarkConfig<remarkEmojiPlugin>',\n})\n\n/// This plugin is used for transforming emoji to twemoji.\nexport const remarkTwemojiPlugin = $remark('remarkTwemoji', () => twemojiPlugin)\n\nwithMeta(remarkTwemojiPlugin.plugin, {\n displayName: 'Remark<remarkTwemojiPlugin>',\n})\n\nwithMeta(remarkTwemojiPlugin.options, {\n displayName: 'RemarkConfig<remarkTwemojiPlugin>',\n})\n\n/// Input rule for inserting emoji.\n/// For example, `:smile:` will be replaced with `😄`.\nexport const insertEmojiInputRule = $inputRule(\n (ctx) =>\n new InputRule(/(:([^:\\s]+):)$/, (state, match, start, end) => {\n const content = match[0]\n if (!content) return null\n const got = get(content)\n if (!got || content.includes(got)) return null\n\n const html = parse(got, ctx.get(remarkTwemojiPlugin.options.key))\n\n return state.tr\n .setMeta('emoji', true)\n .replaceRangeWith(start, end, emojiSchema.type(ctx).create({ html }))\n .scrollIntoView()\n })\n)\n\nwithMeta(insertEmojiInputRule, {\n displayName: 'InputRule<insertEmojiInputRule>',\n})\n\n/// All plugins exported by this package.\nexport const emoji: MilkdownPlugin[] = [\n emojiAttr,\n remarkEmojiPlugin,\n remarkTwemojiPlugin,\n emojiSchema,\n insertEmojiInputRule,\n].flat()\n"],"mappings":";;;;;;;;;AAEA,IAAM,WAAW,UAAkB,EAAE,OAAO,MAAM;AAwClD,SAAgB,MAAM,OAAe,gBAAyC;AAC5E,QAAO,QAAQ,MAAM,OAAO;EAC1B,YAAY;EACZ,MAAM;EACN,GAAG;EACJ,CAAC;;;;ACzCJ,IAAM,QAAQ,YAAY;AAE1B,IAAM,YAAY,SAChB,CAAC,CAAE,KAAqC;AAC1C,IAAM,aAAa,SACjB,CAAC,CAAE,KAAkC;AAEvC,SAAS,QACP,KACA,IACA;AACA,QAAO,UAAU,KAAK,GAAG,KAAK,CAAC;CAE/B,SAAS,UAAU,MAAY,OAAe,QAAqB;AACjE,MAAI,SAAS,KAAK,EAAE;GAClB,MAAM,MAAM,EAAE;AACd,QAAK,IAAI,IAAI,GAAG,IAAI,KAAK,SAAS,QAAQ,IAAI,GAAG,KAAK;IACpD,MAAM,WAAW,KAAK,SAAS;AAC/B,QAAI,UAAU;KACZ,MAAM,KAAK,UAAU,UAAU,GAAG,KAAK;AACvC,SAAI,GACF,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,QAAQ,IAAI,GAAG,KAAK;MACzC,MAAM,OAAO,GAAG;AAChB,UAAI,KAAM,KAAI,KAAK,KAAK;;;;AAKhC,QAAK,WAAW;;AAGlB,SAAO,GAAG,MAAM,OAAO,OAAO;;;AAIlC,IAAa,iBACX,mBACG;CACH,SAAS,YAAY,MAAY;AAC/B,UAAQ,OAAO,SAAS;AACtB,OAAI,CAAC,UAAU,KAAK,CAAE,QAAO,CAAC,KAAK;AAGnC,OAAI,KAAK,SAAS,OAAQ,QAAO,CAAC,KAAK;GAEvC,MAAM,QAAQ,KAAK;GACnB,MAAM,SAA0C,EAAE;GAClD,IAAI;GACJ,IAAI,MAAM;AACV,UAAQ,QAAQ,MAAM,KAAK,IAAI,EAAG;IAChC,MAAM,EAAE,UAAU;IAClB,MAAM,QAAQ,MAAM;AACpB,QAAI,OAAO;AACT,SAAI,QAAQ,EAAG,QAAO,KAAK;MAAE,GAAG;MAAM,OAAO,IAAI,MAAM,GAAG,MAAM;MAAE,CAAC;AAEnE,YAAO,KAAK;MACV,GAAG;MACH,OAAO,MAAM,OAAO,eAAe;MACnC,MAAM;MACP,CAAC;AACF,WAAM,IAAI,MAAM,QAAQ,MAAM,OAAO;;AAEvC,UAAM,YAAY;;AAEpB,OAAI,IAAI,OAAQ,QAAO,KAAK;IAAE,GAAG;IAAM,OAAO;IAAK,CAAC;AAEpD,UAAO;IACP;;AAEJ,QAAO;;;;ACzET,SAAgB,SACd,QACA,MACG;AACH,QAAO,OAAO,QAAQ,EACpB,MAAM;EACJ,SAAS;EACT,GAAG;EACJ,EACF,CAAC;AAEF,QAAO;;;;ACGT,IAAa,YAAY,UAAU,gBAAgB;CACjD,MAAM,EAAE;CACR,KAAK,EAAE;CACR,EAAE;AACH,SAAS,WAAW,EAClB,aAAa,eACd,CAAC;AAGF,IAAa,cAAc,YAAY,UAAU,SAAS;CACxD,OAAO;CACP,QAAQ;CACR,OAAO,EACL,MAAM,EACJ,SAAS,IACV,EACF;CACD,UAAU,CACR;EACE,KAAK;EACL,WAAW,QAAQ;AACjB,OAAI,EAAE,eAAe,aAAc,OAAM,mBAAmB,IAAI;AAEhE,UAAO,EAAE,MAAM,IAAI,WAAW;;EAEjC,CACF;CACD,QAAQ,SAAS;EACf,MAAM,QAAQ,IAAI,IAAI,UAAU,IAAI,CAAC,KAAK;EAC1C,MAAM,MAAM,SAAS,cAAc,OAAO;AAC1C,MAAI,YAAY,UAAU,SAAS,KAAK,MAAM,KAAK;EAEnD,MAAM,aAAa,IAAI;AACvB,MAAI,CAAC,YAAY;AACf,WAAQ,KAAK,4CAA4C;AACzD,UAAO;IAAC;IAAQ;KAAE,GAAG,MAAM;KAAW,aAAa;KAAS;IAAE;IAAI;;EAGpE,MAAM,MAAM,WAAW,WAAW;AAClC,MAAI,QAAQ;AACZ,MAAI,OAAO,eAAe,YACxB,QAAO,QAAgB,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,WAC/C,IAAI,aAAa,KAAK,MAAM,CAC7B;AAEH,SAAO;GAAC;GAAQ;IAAE,GAAG,MAAM;IAAW,aAAa;IAAS;GAAE;GAAI;;CAEpE,eAAe;EACb,QAAQ,EAAE,WAAW,SAAS;EAC9B,SAAS,OAAO,MAAM,SAAS;AAC7B,SAAM,QAAQ,MAAM,EAAE,MAAM,KAAK,OAAiB,CAAC;;EAEtD;CACD,YAAY;EACV,QAAQ,SAAS,KAAK,KAAK,SAAS;EACpC,SAAS,OAAO,SAAS;GACvB,MAAM,OAAO,SAAS,cAAc,OAAO;AAC3C,QAAK,YAAY,KAAK,MAAM;GAC5B,MAAM,MAAM,KAAK,cAAc,MAAM;GACrC,MAAM,QAAQ,KAAK,SAAS,KAAK;AACjC,QAAK,QAAQ;AACb,SAAM,QAAQ,QAAQ,KAAA,GAAW,MAAM;;EAE1C;CACF,EAAE;AAEH,SAAS,YAAY,MAAM,EACzB,aAAa,qBACd,CAAC;AACF,SAAS,YAAY,KAAK,EACxB,aAAa,wBACd,CAAC;AAGF,IAAa,oBAAoB,QAC/B,qBACM,YACP;AAED,SAAS,kBAAkB,QAAQ,EACjC,aAAa,6BACd,CAAC;AAEF,SAAS,kBAAkB,SAAS,EAClC,aAAa,mCACd,CAAC;AAGF,IAAa,sBAAsB,QAAQ,uBAAuB,cAAc;AAEhF,SAAS,oBAAoB,QAAQ,EACnC,aAAa,+BACd,CAAC;AAEF,SAAS,oBAAoB,SAAS,EACpC,aAAa,qCACd,CAAC;AAIF,IAAa,uBAAuB,YACjC,QACC,IAAI,UAAU,mBAAmB,OAAO,OAAO,OAAO,QAAQ;CAC5D,MAAM,UAAU,MAAM;AACtB,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,MAAM,IAAI,QAAQ;AACxB,KAAI,CAAC,OAAO,QAAQ,SAAS,IAAI,CAAE,QAAO;CAE1C,MAAM,OAAO,MAAM,KAAK,IAAI,IAAI,oBAAoB,QAAQ,IAAI,CAAC;AAEjE,QAAO,MAAM,GACV,QAAQ,SAAS,KAAK,CACtB,iBAAiB,OAAO,KAAK,YAAY,KAAK,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CACpE,gBAAgB;EACnB,CACL;AAED,SAAS,sBAAsB,EAC7B,aAAa,mCACd,CAAC;AAGF,IAAa,QAA0B;CACrC;CACA;CACA;CACA;CACA;CACD,CAAC,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../ctx/lib/context/slice.d.ts","../../../ctx/lib/context/container.d.ts","../../../ctx/lib/context/index.d.ts","../../../ctx/lib/inspector/meta.d.ts","../../../ctx/lib/timer/timer.d.ts","../../../ctx/lib/timer/clock.d.ts","../../../ctx/lib/timer/index.d.ts","../../../ctx/lib/inspector/inspector.d.ts","../../../ctx/lib/inspector/index.d.ts","../../../ctx/lib/plugin/ctx.d.ts","../../../ctx/lib/plugin/types.d.ts","../../../ctx/lib/plugin/index.d.ts","../../../ctx/lib/index.d.ts","../../../../node_modules/.pnpm/orderedmap@2.1.1/node_modules/orderedmap/dist/index.d.ts","../../../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.d.ts","../../../../node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.d.ts","../../../../node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.d.ts","../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.d.ts","../../../../node_modules/.pnpm/prosemirror-inputrules@1.5.1/node_modules/prosemirror-inputrules/dist/index.d.ts","../../../prose/lib/inputrules.d.ts","../../../prose/lib/state.d.ts","../../../prose/lib/view.d.ts","../../../prose/lib/model.d.ts","../../../../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts","../../../../node_modules/.pnpm/@types+mdast@4.0.4/node_modules/@types/mdast/index.d.ts","../../../../node_modules/.pnpm/micromark-util-types@2.0.2/node_modules/micromark-util-types/index.d.ts","../../../../node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/lib/types.d.ts","../../../../node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/lib/index.d.ts","../../../../node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/index.d.ts","../../../../node_modules/.pnpm/vfile-message@4.0.3/node_modules/vfile-message/lib/index.d.ts","../../../../node_modules/.pnpm/vfile-message@4.0.3/node_modules/vfile-message/index.d.ts","../../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/index.d.ts","../../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/index.d.ts","../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/callable-instance.d.ts","../../../../node_modules/.pnpm/trough@2.2.0/node_modules/trough/lib/index.d.ts","../../../../node_modules/.pnpm/trough@2.2.0/node_modules/trough/index.d.ts","../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.d.ts","../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/index.d.ts","../../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.d.ts","../../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/index.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/types.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/index.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.d.ts","../../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/index.d.ts","../../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.d.ts","../../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/index.d.ts","../../../../node_modules/.pnpm/remark@15.0.1/node_modules/remark/index.d.ts","../../../transformer/lib/utility/stack.d.ts","../../../transformer/lib/utility/index.d.ts","../../../transformer/lib/serializer/stack-element.d.ts","../../../transformer/lib/serializer/state.d.ts","../../../transformer/lib/serializer/types.d.ts","../../../transformer/lib/utility/types.d.ts","../../../transformer/lib/parser/stack-element.d.ts","../../../transformer/lib/parser/state.d.ts","../../../transformer/lib/parser/types.d.ts","../../../transformer/lib/parser/index.d.ts","../../../transformer/lib/serializer/index.d.ts","../../../transformer/lib/index.d.ts","../../../core/lib/internal-plugin/atoms.d.ts","../../../core/lib/internal-plugin/commands.d.ts","../../../core/lib/internal-plugin/config.d.ts","../../../core/lib/internal-plugin/editor-state.d.ts","../../../core/lib/internal-plugin/editor-view.d.ts","../../../core/lib/internal-plugin/init.d.ts","../../../core/lib/internal-plugin/parser.d.ts","../../../core/lib/internal-plugin/schema.d.ts","../../../core/lib/internal-plugin/serializer.d.ts","../../../core/lib/internal-plugin/keymap.d.ts","../../../core/lib/internal-plugin/paste-rule.d.ts","../../../core/lib/internal-plugin/index.d.ts","../../../core/lib/editor/editor.d.ts","../../../core/lib/editor/index.d.ts","../../../core/lib/index.d.ts","../../../prose/lib/index.d.ts","../../../../node_modules/.pnpm/prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.d.ts","../../../prose/lib/commands.d.ts","../../../utils/lib/composable/utils.d.ts","../../../utils/lib/composable/$command.d.ts","../../../utils/lib/composable/$input-rule.d.ts","../../../utils/lib/composable/$paste-rule.d.ts","../../../utils/lib/composable/$mark.d.ts","../../../utils/lib/composable/$node.d.ts","../../../utils/lib/composable/$prose.d.ts","../../../utils/lib/composable/$shortcut.d.ts","../../../utils/lib/composable/$view.d.ts","../../../utils/lib/composable/$ctx.d.ts","../../../utils/lib/composable/composed/$node-schema.d.ts","../../../utils/lib/composable/composed/$mark-schema.d.ts","../../../utils/lib/composable/composed/$use-keymap.d.ts","../../../utils/lib/composable/composed/$attr.d.ts","../../../utils/lib/composable/composed/$remark.d.ts","../../../utils/lib/composable/composed/index.d.ts","../../../utils/lib/composable/index.d.ts","../../../utils/lib/macro/call-command.d.ts","../../../utils/lib/macro/force-update.d.ts","../../../utils/lib/macro/get-html.d.ts","../../../utils/lib/macro/get-markdown.d.ts","../../../utils/lib/macro/insert.d.ts","../../../utils/lib/macro/outline.d.ts","../../../utils/lib/macro/replace-all.d.ts","../../../utils/lib/macro/set-attr.d.ts","../../../utils/lib/macro/insert-pos.d.ts","../../../utils/lib/macro/replace-range.d.ts","../../../utils/lib/macro/markdown-to-slice.d.ts","../../../utils/lib/macro/index.d.ts","../../../utils/lib/pipe.d.ts","../../../utils/lib/index.d.ts","../../preset-commonmark/src/__internal__/serialize-text.ts","../../preset-commonmark/src/__internal__/with-meta.ts","../../preset-commonmark/src/__internal__/index.ts","../../preset-commonmark/src/mark/emphasis.ts","../../preset-commonmark/src/mark/strong.ts","../../preset-commonmark/src/mark/inline-code.ts","../../../exception/lib/code.d.ts","../../../exception/lib/error.d.ts","../../../exception/lib/index.d.ts","../../preset-commonmark/src/mark/link.ts","../../preset-commonmark/src/mark/index.ts","../../preset-commonmark/src/node/doc.ts","../../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.d.ts","../../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/index.d.ts","../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.d.ts","../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/index.d.ts","../../preset-commonmark/src/plugin/remark-preserve-empty-line.ts","../../preset-commonmark/src/node/paragraph.ts","../../preset-commonmark/src/node/heading.ts","../../preset-commonmark/src/node/blockquote.ts","../../preset-commonmark/src/node/code-block.ts","../../preset-commonmark/src/node/image.ts","../../preset-commonmark/src/node/hardbreak.ts","../../preset-commonmark/src/node/hr.ts","../../preset-commonmark/src/node/bullet-list.ts","../../preset-commonmark/src/node/ordered-list.ts","../../../../node_modules/.pnpm/prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.d.ts","../../../prose/lib/schema-list.d.ts","../../preset-commonmark/src/node/list-item.ts","../../preset-commonmark/src/node/text.ts","../../preset-commonmark/src/node/html.ts","../../preset-commonmark/src/node/index.ts","../../preset-commonmark/src/composed/schema.ts","../../preset-commonmark/src/composed/inputrules.ts","../../../prose/lib/transform.d.ts","../../preset-commonmark/src/commands/index.ts","../../preset-commonmark/src/composed/commands.ts","../../preset-commonmark/src/composed/keymap.ts","../../../../node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/lib/index.d.ts","../../../../node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/index.d.ts","../../preset-commonmark/src/plugin/remark-add-order-in-list-plugin.ts","../../preset-commonmark/src/plugin/remark-line-break.ts","../../../../node_modules/.pnpm/remark-inline-links@7.0.0/node_modules/remark-inline-links/lib/index.d.ts","../../../../node_modules/.pnpm/remark-inline-links@7.0.0/node_modules/remark-inline-links/index.d.ts","../../preset-commonmark/src/plugin/remark-inline-link-plugin.ts","../../preset-commonmark/src/plugin/remark-html-transformer.ts","../../preset-commonmark/src/plugin/remark-marker-plugin.ts","../../preset-commonmark/src/plugin/inline-nodes-cursor-plugin.ts","../../preset-commonmark/src/plugin/hardbreak-clear-mark-plugin.ts","../../preset-commonmark/src/plugin/hardbreak-filter-plugin.ts","../../preset-commonmark/src/plugin/sync-heading-id-plugin.ts","../../preset-commonmark/src/plugin/sync-list-order-plugin.ts","../../preset-commonmark/src/plugin/index.ts","../../preset-commonmark/src/composed/plugins.ts","../../preset-commonmark/src/composed/index.ts","../../preset-commonmark/src/index.ts","../../../../node_modules/.pnpm/@vitest+pretty-format@4.1.0/node_modules/@vitest/pretty-format/dist/index.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/display.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/types.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/helpers.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/timers.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/index.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/types.d-bcelap-c.d.ts","../../../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/diff.d.ts","../../../../node_modules/.pnpm/@vitest+runner@4.1.0/node_modules/@vitest/runner/dist/tasks.d-d2gkpdwq.d.ts","../../../../node_modules/.pnpm/@vitest+runner@4.1.0/node_modules/@vitest/runner/dist/index.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/traces.d.402v_yfi.d.ts","../../../../node_modules/.pnpm/vite@8.0.1_@types+node@24.1_876433a21c88fe1552cff9da3a930571/node_modules/vite/types/hmrpayload.d.ts","../../../../node_modules/.pnpm/vite@8.0.1_@types+node@24.1_876433a21c88fe1552cff9da3a930571/node_modules/vite/dist/node/chunks/modulerunnertransport.d.ts","../../../../node_modules/.pnpm/vite@8.0.1_@types+node@24.1_876433a21c88fe1552cff9da3a930571/node_modules/vite/types/customevent.d.ts","../../../../node_modules/.pnpm/vite@8.0.1_@types+node@24.1_876433a21c88fe1552cff9da3a930571/node_modules/vite/types/hot.d.ts","../../../../node_modules/.pnpm/vite@8.0.1_@types+node@24.1_876433a21c88fe1552cff9da3a930571/node_modules/vite/dist/node/module-runner.d.ts","../../../../node_modules/.pnpm/@vitest+snapshot@4.1.0/node_modules/@vitest/snapshot/dist/environment.d-dojxxzv9.d.ts","../../../../node_modules/.pnpm/@vitest+snapshot@4.1.0/node_modules/@vitest/snapshot/dist/rawsnapshot.d-u2kjuxdr.d.ts","../../../../node_modules/.pnpm/@vitest+snapshot@4.1.0/node_modules/@vitest/snapshot/dist/index.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/config.d.ejlve3es.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/environment.d.crsxczp1.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/rpc.d.bfmwpdph.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/worker.d.b84svry0.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/browser.d.x3sxoocv.d.ts","../../../../node_modules/.pnpm/@vitest+spy@4.1.0/node_modules/@vitest/spy/dist/index.d.ts","../../../../node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.d.ts","../../../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts","../../../../node_modules/.pnpm/@types+deep-eql@4.0.2/node_modules/@types/deep-eql/index.d.ts","../../../../node_modules/.pnpm/assertion-error@2.0.1/node_modules/assertion-error/index.d.ts","../../../../node_modules/.pnpm/@types+chai@5.2.3/node_modules/@types/chai/index.d.ts","../../../../node_modules/.pnpm/@vitest+expect@4.1.0/node_modules/@vitest/expect/dist/index.d.ts","../../../../node_modules/.pnpm/@vitest+runner@4.1.0/node_modules/@vitest/runner/dist/utils.d.ts","../../../../node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/benchmark.d.daahlpsq.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/global.d.x-ilcfae.d.ts","../../../../node_modules/.pnpm/@vitest+mocker@4.1.0_vite@8_4e6228533c587271678a054b13744890/node_modules/@vitest/mocker/dist/types.d-bji5eawu.d.ts","../../../../node_modules/.pnpm/@vitest+mocker@4.1.0_vite@8_4e6228533c587271678a054b13744890/node_modules/@vitest/mocker/dist/index.d-b41z0auw.d.ts","../../../../node_modules/.pnpm/@vitest+mocker@4.1.0_vite@8_4e6228533c587271678a054b13744890/node_modules/@vitest/mocker/dist/index.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/suite.d.udjtyagw.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/chunks/evaluatedmodules.d.bxj5omdx.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/runners.d.ts","../../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.d.ts","../../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.d.ts","../../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.d.ts","../../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.d.ts","../../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.d.ts","../../../../node_modules/.pnpm/vitest@4.1.0_@types+node@24_44b8d052b1a18cdf1651bd8d8e21974e/node_modules/vitest/dist/index.d.ts","../../../../node_modules/.pnpm/@types+aria-query@5.0.4/node_modules/@types/aria-query/index.d.ts","../../../../node_modules/.pnpm/@testing-library+jest-dom@6.9.1/node_modules/@testing-library/jest-dom/types/matchers.d.ts","../../../../node_modules/.pnpm/@testing-library+jest-dom@6.9.1/node_modules/@testing-library/jest-dom/types/vitest.d.ts","../../../../node_modules/.pnpm/remark-emoji@5.0.2/node_modules/remark-emoji/index.d.ts","../../../../node_modules/.pnpm/@types+trusted-types@2.0.7/node_modules/@types/trusted-types/lib/index.d.ts","../../../../node_modules/.pnpm/dompurify@3.3.3/node_modules/dompurify/dist/purify.es.d.mts","../../../../node_modules/.pnpm/node-emoji@2.2.0/node_modules/node-emoji/lib/index.d.ts","../../../../node_modules/.pnpm/twemoji@14.0.2/node_modules/twemoji/index.d.ts","../src/__internal__/parse.ts","../../../../node_modules/.pnpm/emoji-regex@10.6.0/node_modules/emoji-regex/index.d.ts","../src/__internal__/remark-twemoji.ts","../src/__internal__/with-meta.ts","../src/index.ts","../src/emoji-render.spec.ts"],"fileIdsList":[[289],[288,290,291],[269,270],[82],[243,249,251,266,267,268,271,276],[277],[277,278],[247,249,250],[247,249],[247],[242,247,258,259],[242,258],[242,248],[242],[244],[242,243,244,245,246],[293],[283,284],[283,284,285,286],[283,285],[283],[84,85,86,87],[83,84,85,87],[83,84,87],[99,100,120],[83,121],[83],[101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119],[82,83],[73,76],[72],[72,73,76],[73,74,75],[73],[73,74,76],[83,96,98,123],[228],[83,84,87,96,97,98,123],[83,87,91,96,98,123],[83,96,98,121,122,123],[83,91,96,98,121,123],[93],[91,95],[82,91,92,94,96,98,123],[198],[199,200],[82,199],[199,201,224],[82,199,201],[88],[89,90],[82,89,91],[253],[253,254,255,256],[255],[251,273,274,276],[251,252,264,276],[242,249,251,260,276],[257],[242,251,260,263,272,275,276],[251,252,257,260,276],[251,273,274,275,276],[251,257,261,262,263,276],[242,247,249,251,252,257,260,261,262,263,264,265,266,272,273,274,275,276,279,280,281,282,287],[242,249,251,252,260,261,273,274,275,276,280],[71,148],[149],[148,150],[71,78,79,80,123,136,150],[71,79],[71],[71,79,81,136],[71,80],[137,138,139,140,141,142,143,144,145,146,147],[71,150],[71,136],[71,80,81],[71,81,136],[59],[59,60],[60],[61,65,67,70],[62,66],[61,62,65],[61,65,67,71],[68,69],[67,68],[63],[63,64],[64],[192],[193],[296],[136,297,298],[151,241,288,291,301],[71,78,136,185,194,292,294,295,297,299,300],[186,187],[81,136],[79,81,152,185,220],[71,196,217,221],[218,219,222,223,239],[71,196,217],[71,238],[71,196,217,221,238,240],[151,152,154,185,188],[189,190,191,195],[81,151,152,185,188],[79,81,154,185,188,194],[78,151,154,185,188],[78,151,154,185,188,194],[185,188],[79,151,185,188],[78,81,151,154,185,188,194,203],[78,79,185,188,203],[78,152,185,188,194],[197,203,204,205,206,207,208,209,210,211,214,215,216],[71,79,151,154,185,188,194,213],[71,151,154,185,188,202],[79,185,188,217,220],[79,185,188],[202,226,227,230,231,232,233,234,235,236,237],[79,80,185,188],[185,188,225],[136,185,188],[185,188,229],[136,185,188,225],[136,185,188,201],[79,80,185,188,204],[79,81,185,188,211,214,217],[153],[73,75,76,77],[77],[212],[76],[74],[75],[126,134,135],[132,133],[81,126],[81,126,131,133],[81,130,132],[128,129],[126,136],[81,126,127,129],[81,128],[125,130],[81,96,98,123,124,129,133],[71,151,155],[71,78,155],[71,81,136,155],[71,79,155],[71,79,151,155],[71,80,155,171],[81,164],[71,136,159,164],[71,136,160,164],[71,136,164],[71,79,162,164],[165,166,167,168,169],[155,156,157,158,159,160,161,162,163,164,170],[171,183,184],[71,151],[172,173,174,175,176,177,178,179,180,181,182],[71,81]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},"73cc073d7a102374d6b9bcdbde8072f3aa3c8f86767f562086b6a7a7df5f22c0","e66deb230968faf1a8f37ea6f217f319dd0dad7a39ead1bf5d4f54e2eb5ce4bd","13ee17bbdd42459d6450899cea1999aab64c723328e773c0be5e8a13b51b6259","f79062b892847b4e33d0b730bf9dcf66ac24fc3fe9df7bba4d0997c6bdf6cbde","20f3a5481b2c009533e9e6b864cbd4ae3c09ccfca0577918b3587cda295e7071","2797c77cc0da0836a37c8c1fe64942a999c73f811f5481d827ac7d8cb9ddedd3","5a40849c3a5d5a8c2aa754fc964830ea344c94bfeddd4b442bdeae899e2f5339","848836f528d4ac80a5b3212c719225a3ba09406d44fea755cb642299a68d7056","fae981646738728f2b882c14625b99c23c430400a21c081dc6888d9703bd6c68","45c8a077eb724bae4e1fc0d15f76618650e32e55c4582dc1f27153ecdeb66ca6","302c082712d8fe41be387cd34af45b163b5314c04ddeefe53b1cb57fe46d3221","0c1a84d7b974db1961c6e9ab71d5257dfa38d99fb6300f22de55750526c9daef","69bc40bb169ea922cab72dc2142f37e75b44095cf1e79ca1b2809164c284de57",{"version":"264f935450101e4b000eb351cf75c9d799ca20a278b260a9e5770303b5f2b6a3","impliedFormat":99},{"version":"f6f171b23ae6db93454343f1b788960f799c8f37043904874a752c0990c6fca6","impliedFormat":99},{"version":"089f9928e7ab1ca2c225e167a80ff1cb5ed0a71c98be7e81f040a51e2cc6bf5e","impliedFormat":99},{"version":"b11acc27c280988d7256bbd8ffe9f1cb5a0e5ed17cddf5335289ee0e81500369","affectsGlobalScope":true,"impliedFormat":99},{"version":"02ab5dbcaa58da1d58c46c7cdfa7f94792c5ccf0fc7c0622ef33755fe415366c","impliedFormat":99},{"version":"2a04530c2579ddcf996e1cf017caaba573e0ebf8a5b9e45d3bc25ba4489fb5a3","impliedFormat":99},"f41d91b2db1112fcc673a6862fe68cadcbdd0a66ed16b47ac74a0a6da8932bb4","e689cc8cd8a102d31c9d3a7b0db0028594202093c4aca25982b425e8ae744556","1b4ed9deaba72d4bc8495bf46db690dbf91040da0cb2401db10bad162732c0e2","478e59ac0830a0f6360236632d0d589fb0211183aa1ab82292fbca529c0cce35",{"version":"89121c1bf2990f5219bfd802a3e7fc557de447c62058d6af68d6b6348d64499a","impliedFormat":1},{"version":"d4a22007b481fe2a2e6bfd3a42c00cd62d41edb36d30fc4697df2692e9891fc8","impliedFormat":1},{"version":"a5dbd4c9941b614526619bad31047ddd5f504ec4cdad88d6117b549faef34dd3","impliedFormat":99},{"version":"d36518bd617ff673c7d9f372706f241932a43f27673187f2a8472e93c40041c6","impliedFormat":99},{"version":"f8eb2909590ec619643841ead2fc4b4b183fbd859848ef051295d35fef9d8469","impliedFormat":99},{"version":"fe784567dd721417e2c4c7c1d7306f4b8611a4f232f5b7ce734382cf34b417d2","impliedFormat":99},{"version":"2b37ba54ec067598bf912d56fcb81f6d8ad86a045c757e79440bdef97b52fe1b","impliedFormat":99},{"version":"1bc9dd465634109668661f998485a32da369755d9f32b5a55ed64a525566c94b","impliedFormat":99},{"version":"5702b3c2f5d248290ed99419d77ca1cc3e6c29db5847172377659c50e6303768","impliedFormat":99},{"version":"9764b2eb5b4fc0b8951468fb3dbd6cd922d7752343ef5fbf1a7cd3dfcd54a75e","impliedFormat":99},{"version":"1fc2d3fe8f31c52c802c4dee6c0157c5a1d1f6be44ece83c49174e316cf931ad","impliedFormat":99},{"version":"dc4aae103a0c812121d9db1f7a5ea98231801ed405bf577d1c9c46a893177e36","impliedFormat":99},{"version":"106d3f40907ba68d2ad8ce143a68358bad476e1cc4a5c710c11c7dbaac878308","impliedFormat":99},{"version":"42ad582d92b058b88570d5be95393cf0a6c09a29ba9aa44609465b41d39d2534","impliedFormat":99},{"version":"36e051a1e0d2f2a808dbb164d846be09b5d98e8b782b37922a3b75f57ee66698","impliedFormat":99},{"version":"4f7e6730a707b0d4971d96de3b562819ce304af770723707a58a578dd55a5e52","impliedFormat":99},{"version":"d1c1213e9176398b4d1d9aa543691181fd5ae23ae5415e80ede41f1ec1ccf72a","impliedFormat":99},{"version":"45d1e8fb4fd3e265b15f5a77866a8e21870eae4c69c473c33289a4b971e93704","impliedFormat":99},{"version":"cd40919f70c875ca07ecc5431cc740e366c008bcbe08ba14b8c78353fb4680df","impliedFormat":99},{"version":"ddfd9196f1f83997873bbe958ce99123f11b062f8309fc09d9c9667b2c284391","impliedFormat":99},{"version":"2999ba314a310f6a333199848166d008d088c6e36d090cbdcc69db67d8ae3154","impliedFormat":99},{"version":"62c1e573cd595d3204dfc02b96eba623020b181d2aa3ce6a33e030bc83bebb41","impliedFormat":99},{"version":"ca1616999d6ded0160fea978088a57df492b6c3f8c457a5879837a7e68d69033","impliedFormat":99},{"version":"835e3d95251bbc48918bb874768c13b8986b87ea60471ad8eceb6e38ddd8845e","impliedFormat":99},{"version":"de54e18f04dbcc892a4b4241b9e4c233cfce9be02ac5f43a631bbc25f479cd84","impliedFormat":99},{"version":"453fb9934e71eb8b52347e581b36c01d7751121a75a5cd1a96e3237e3fd9fc7e","impliedFormat":99},{"version":"bc1a1d0eba489e3eb5c2a4aa8cd986c700692b07a76a60b73a3c31e52c7ef983","impliedFormat":99},{"version":"4098e612efd242b5e203c5c0b9afbf7473209905ab2830598be5c7b3942643d0","impliedFormat":99},{"version":"28410cfb9a798bd7d0327fbf0afd4c4038799b1d6a3f86116dc972e31156b6d2","impliedFormat":99},{"version":"514ae9be6724e2164eb38f2a903ef56cf1d0e6ddb62d0d40f155f32d1317c116","impliedFormat":99},{"version":"970e5e94a9071fd5b5c41e2710c0ef7d73e7f7732911681592669e3f7bd06308","impliedFormat":99},{"version":"491fb8b0e0aef777cec1339cb8f5a1a599ed4973ee22a2f02812dd0f48bd78c1","impliedFormat":99},{"version":"6acf0b3018881977d2cfe4382ac3e3db7e103904c4b634be908f1ade06eb302d","impliedFormat":99},{"version":"2dbb2e03b4b7f6524ad5683e7b5aa2e6aef9c83cab1678afd8467fde6d5a3a92","impliedFormat":99},{"version":"135b12824cd5e495ea0a8f7e29aba52e1adb4581bb1e279fb179304ba60c0a44","impliedFormat":99},{"version":"e4c784392051f4bbb80304d3a909da18c98bc58b093456a09b3e3a1b7b10937f","impliedFormat":99},{"version":"2e87c3480512f057f2e7f44f6498b7e3677196e84e0884618fc9e8b6d6228bed","impliedFormat":99},{"version":"66984309d771b6b085e3369227077da237b40e798570f0a2ddbfea383db39812","impliedFormat":99},{"version":"e41be8943835ad083a4f8a558bd2a89b7fe39619ed99f1880187c75e231d033e","impliedFormat":99},{"version":"260558fff7344e4985cfc78472ae58cbc2487e406d23c1ddaf4d484618ce4cfd","impliedFormat":99},{"version":"e6274d956641c1cbd5a01a221a85a6671fd85104ed6b530f8d34ad3086804133","impliedFormat":99},{"version":"77516308358982bb05209e8c0ed6f321860e03393587d89f61055941e5bbcdd2","impliedFormat":99},{"version":"dc8652855a95ef9b9c12be8d2f5e6fc37b96aa2144f6c6f195cd1d2e07f721ee","impliedFormat":99},"e2cb25ca55e10ba874410188a53331a6b0b2bc13c0ee4d538bde50460a4e1b77","041afde4e1ac27e6fabdc2ca87882a3a766443fcfe1a1cfc3ed78bcc1c25b28a","c2049793874bbeafd60402bab915f3d285f4057e718dfdefe8a54ccc80c991dd","8a2b6f999a708119f4fa55fc58c5803ca9563340d0a54b9fe2a4fa14838f148c","2db5b1bbf946e20cef3c889cb7be46e3da384bdd1b4b53964253d97635718774","79e620484ae1a7011482631159563e4729f7f4d4c316b914125cb95f678ffbb9","6434c2976daf446cfd95935af4e0a0b6b369ce81af183579dab3ac6567dbbfd0","f50c1778b48a9275078ad81abaa5b4cb13a295b3889986f8e72fe61dd9cd8b86","6e935a5aec1b1f86cfa97fb93ec13c8759479712014d7dc4c13f140f7d409357","8cd4c86b90f9a96ba804585a4b6a998f484a860af3dfd12641ecb9eca109274b","8cd4c86b90f9a96ba804585a4b6a998f484a860af3dfd12641ecb9eca109274b","1b92de1f5b74cf4bda283aa7688c80781e9c7273f44a4ef2db084747a94be933","8c24aeb14985e8089f29e1fea075e95a7c8825077277079d5dc4130ceb6339de","ff041f34cc1936cb45f94de1924d396abd69b3d6e0cc887dfaa0b6ec176e27e1","6abd2f68e6651205f5d7763dcf7a5b5e5dc28b6194b097b467913d2cf19c1dd2","c04c352fc277c57e16519814a13e1b84e6c54c461b89ee63c8bff94ddf615555","e406a8398f12e8bb0d7661b9974a9ce78043a916cd2c652f7b82b7889e57f9e8","441c8ea68ff583cefd0f77d2a1699f6328d714ebfb9435ffedad5470392de2e7","cc60d13b9e2058908f082cca058357d2ebd83143b3dc4e3a01731e8a4b7ae2fe","5ca4d7a999b9fa8c7e2ef9746968eaeabb8e69a904cc62a3c18ac23b9664c8a8","bff722032fb479d76cdd167e0aa05e2e3ca9b728cff777e893aa694bad01e3a9","de54e6c6d074b3a521a47b0fbe17732a951a852ef704402daceabcd450134283","ad43cfeea2ffc4f26107e49ae92bed3fe01b0c2aa3e328e293d7b0dceb01300f","50e52950b1b92455f40c3fba61ee9a43e74bf9bdf6a25e01ad2e3a2226bbb2ec","cd2e2d6ffad8a1de80249fd4aa35f6c6f9160c18f69fbaf6507072eba208abda","3b8dd8f967501f6193f2d31f8a124e05186264f37f1b73d073cf39c6e123fe50","bc699cb86e1528d370a29ae99fe8f89e3a838bb620ad4071a4c9999a390c8361","5399c605927513bf84fadca98140f7d1fb2b5bd13e1b95c63245c5cf0889a97b",{"version":"c60e1b30f06db4bb8955ee847c28592af992e45f2b8db300c1b0edfc3329b9cb","impliedFormat":99},"61a03f64adcb31f88db8ab9dceb0ce4fa239e8e725edd308d6f2ca94e1de82cc","487ae9dd80a97c7c7fa8cb272b81033c4252b064047f8b10b2d421e3a909dacf","0e0f762a06bd12f01872c86e03fd88a6830c3991ea17734ea2859a43a96b6ac5","88738bfae85b658c5728b5d84e7e9b78788281edc397bc6a75da4d1b554d2041","af1e3e5216a3a605be2384495ea43d50684dc0b674b0fc795cdaaaa51f979db6","d531e9345fbc0cb9e1fa9428752f675b40f2c32c8bda0c1547fc64522e3295d5","33be8125f7170aedbf456f05059014f0fbbfbf4842eb76d3c43a86bb82045df6","2246cd9c0a20fdf3df7fa37ee25c4e8d3989d38eb6274203fb0e9d43020a5cfc","f6d2f543d91edabb84f53c26e611514f0ecec59b72f6e5321145c00c70d0f1e7","6e12e26efaaeb591c891d49658152d874a1fc869c1231176172a4e90a78320c4","8e0872445888b4eac9c8915022cc2b58291db248fc33b0994c7e3296d7af306a","7064efe511093c8ab839f6c8bbe2ffc2911bc299ec8880f2129b541e2e32cc4c","41259a2d0eac0369e1581e08e5aef6ffef48f9ffc3d06d874524c9da6f1e4f29","9722d152fcdb95a635c8132764b7ded085073b4734daf2b19798be965fb10160","db3f677fdf3de11b7a334e5c8e677df05686b3d6e172d46ad3a1674790e5d03c","3a5ebec0a04030822776a5dcc7f9b053a38d79aa4b15e7c4df009ee5ac813dbf","77b54b2bf7d6e4a05b79d286903ad9f71141f91409729c5deb8bfa417d7f0960","573f356148118ea54c7b9a2eff374329022b1e38d5a1070cae53c97d7b0ef355","ef5ae01c8b2b11403554c319af51db9c3dc26051cb077b75c8885b5d02821557","1da18878fb9f757426713faa0c4b289ff717f1bb26bcefc358c2b03aae5f11be","5d7c0080e6e16f13e23ec822364b951a8135242ec61db38d230725c4cc8bba00","9fe63d563259a1a7e32332cd5cc24bccd9f0a34d0d9f2e80df7370d4205e91cb","947c6ccd6a0b2805b4e3479b51112d8affc4b64ecb209ee15a480a10c44a48a1","c4f0b3fb0d90e865c3ab69b9fff9c8eb13ff8fd49bcfce1f10f696bf5db9cdc9","e39e74456caf2be7616c1327e6447e6559e64d5ffb161d43bb44f50b3461ee59","8c3dde564136c2b88384fa63c823c9b4282b5b813ad8287a1c8f3734efb801a0","defdff60f915e05c089175d08b85199747f561dc318ac8dceacc844753060e6d","1a3dbaf2ef5ba30576b22fe1a26c868d9c76646670afb0c90ce7b6e1233211b2","d6faa230dcddc146229e72291ed444476e5c3fcf75b102fb0c78a46510e82424","bfa14541c2b697d5a73041bfa7a318b47db2301e2045856c7ab9db7bb3f4d21b","caee8e88a02710517f1d1849b48fa8793878f4ab0c51cde5c025ba6f21b946df","bbf57449e9341dc4b6f56e7ce74d0edee6cd7c4ca55b52664469de0c7d384445","5129dcd15ed813815b6b16fc9521feb8bc6d42b77df3189d16a57e4789013365","c14afc8375f9cf52b8debfa8a388c388ddf27bedd8ebedef646cb0db8f18babf","70dd4e2290d6d2d74cb175b91127282cb9b6120a32b4a49acefe15e874b76e09","f56ca2f020ca78de281ed8d339556019666821a18fd49af2264d97bbab91fdd2","4f68673aadf7b7bc27d4b0f57b49029d00b67a420b737d110b3432e8b95ebf81","5e7463e83e75d42d15b42ceb18ae239e7e661d165a617deb86d229d49d3cedab","16976e5481a0abbe56fa82010ecd47c152e76d9c7ecb5977d68a1b2c4a785c91","749f3bd08d4fc5cc1c95e3c3b07dede327898a51cf6fa7f156456c0d46aae680","7797184093e9b9f6203d001829de6f91d142497913c67a8d0c2a5b25de005a68","e65ed65652a892561e57b727aed87ab39d2bfe26fd4d89db5497ac4820ee1968","2a67cd40a12c76b06f6a5ffce4ae3ea6a7f4b7cf454d8cac4a2a56313b318aad","633d20629a9551646390ce13e2d5af5a018b6764d65c014a81648c9d60f96623",{"version":"987caed4114d7078f8485d01d392c02ef22b343ea381de043ec992972331eb83","impliedFormat":99},{"version":"3d8984c6feacd84cb26e64436b9162edba0d8e410ea4eb046298935466e8a747","impliedFormat":99},{"version":"3ee62280d6d3a02e9c1000aa211f53dc5d0fec26423825a978f7e501a8981bcf","impliedFormat":99},{"version":"6b243d0f6cf1786f6e3b10a99db080a977cc27e6f49bcff2b6264cf0339063d5","impliedFormat":99},"12f71c8c2991d858526113811beeac989a1cbc51773c33cf75e590029c468690","65080cf087c6bf4fc279a02b63512e029ecec5022cfc700772d6dc3a6412b150","266dde1ba26e69185a1161d0b49e1bdd69d7457bad83171b20c8a9c58773aee7","345183a049584b40a458aae4531d6bc38f15305780bd855618217b8f3205a7ab","a0df71219f44bbd87ce7f004ff1144b3e3c6c027986b7b1cde5c1c01fb8c7548","d00d5828248ea737249bcf2a7e00e8b9c32453606068fbf05b45324343c5bf94","de0e79c7ae81c6ced4abfc97fdd386a12c3a1d79327a9e9a37cfc6908f5cb6bf","2266b1a21fde8e05992b67e49903434962782226de04992636d5d5ca92b91130","39bf3047f7aeefef940324edb8a385b7a1475ae7e84917a71173d0d02cd42cce","5251aa31485afd22da179286acf0e41422b0f6f0eef3bae37f0834db5b5d7e22",{"version":"3bbc718988d8e71dfd6e66190184211e0026b363c6bc75463a8693c1b593b0ed","impliedFormat":99},"1e174cdac977fd33e44469939c0a0dc32e49bae37f68e7fd6c11fdef8c3b02b0","a8c03a9d1e1cc281d7e63e5e2c828b0040c5efea73cdcc2d189f9872845d3dcd","75c7a570d6a68d265a4fd08ecb96cb57cd32078fb13a306e9f0dddc60759e64b","630f20892b4325505fc0c2076eefd4af1ceb9a0cdf1ccedb35b25e9b5adfcda2","5f60e6f09faf085075493a31c06cc5569be6a8561ec0f6b636452b4704152f0f","6e196bba6fca959560a76e3de1a241f73d98b35032dc9251623a89e0f64242cf","6fb442caa4d8bcd1921dc760ebc22e2e6e2ff144af3a717df0b98146f51b0745","3e94295f73335c9122308a858445d2348949842579ac2bacd30728ab46fe75a7","5e73c9993652e92bbfc75fe99b8a9afc6eec464a86ed6d09921816641d973b14","cc3ac98053f83458758378fc3bf925423a54a687f82475dea36d3840842bbd03","f633b7d434e5f3b923ce962ca2ff68d8bfc0283190832d0f9c80202aed351c5e",{"version":"f0808f9a77fe5ea30e80bacb50ec9f6e0d993ebc9ab37d76c5fa0cd59ad480bb","impliedFormat":99},{"version":"083609ca47c047c6802bd40e974346a9509ef28367bb07769dbcead77cc7359f","impliedFormat":99},"21c589c0bc2ad3f7c91ebe94b20a6d6134eb8baef4a6e36c879eda712c73194a","682de3185690e29b72708b509b84af56af57d1b2dbdb9793c760dd44310c7bdb",{"version":"5ff9cea574bfbd7ea1df7028853fd0f6b415b629d40e881f99acc6169ba1381c","impliedFormat":99},{"version":"c35294da7a7f5e0cfd7f8efd5c0b9cdd4af7355f54f0244347d634b048e54a8d","impliedFormat":99},"da2d56e696d30aed831375d49e1b68cf8a367d8df1818938a72197c0f45250a8","b20c695105e7842dac2f7ad00db0b73cb22f5f5f0f399f9512607d5d3d0030b9","c47d479a6ebe896870635808d5e55b01d2ebbfc6b6c2805173c6ca8d3c4fc7cc","6e75ac1494f08481557cfe2e3eb74d08d1cffa46a46bfbc2fae74c4d7406857e","f2c45dd12c3d83fc7d5cd76979fb162d0270ea44653682c1e9f869e3ef4f97ed","f09d7ea0a92619d65365ae0d932ded56abd98b4535a2672612ce209e707a11ea","f6a2e747d88a5886b623e676d2f8086850e87ad03c6548b1eabc116d56733107","dfaf7bb8783f0f0994dde37e980a3135ebd6d984f35af992efb4e3ec3e832091","d7d0efdd54baab27cefc1fdfdedfe7a88a882ecefe16ec6c69fd2e78537b710b","c9c67cf33e8edb9d1b39ca688a8943da09776f7a103b16d67635e013f9977d4f","7b03ae0235d09107ea4bb3706e664250090dbd312cd373fda641265e3272e9d1","e78875ac4d512efbccc22db6cc17a58e4a2925b3a753e6fa65f7ae9c74ac0f72",{"version":"cadeb2c96f1c964d7e49c0f17d6805e1b4dee62f0862c49bb178dae6ab277e8e","impliedFormat":99},{"version":"0528f6d21f7a02d4092895090d2dd86104bd5a3e79eced96d5a1a7dd90943d17","impliedFormat":99},{"version":"b5ce343886d23392be9c8280e9f24a87f1d7d3667f6672c2fe4aa61fa4ece7d4","impliedFormat":99},{"version":"eb64a68249f1ee45e496a23cd0be8fe8c84aecb4c038b86d4abcc765c5ba115e","impliedFormat":99},{"version":"b0857bb28fd5236ace84280f79a25093f919fd0eff13e47cc26ea03de60a7294","impliedFormat":99},{"version":"5e43e0824f10cd8c48e7a8c5c673638488925a12c31f0f9e0957965c290eb14c","impliedFormat":99},{"version":"ef13c73d6157a32933c612d476c1524dd674cf5b9a88571d7d6a0d147544d529","impliedFormat":99},{"version":"3b0a56d056d81a011e484b9c05d5e430711aaecd561a788bad1d0498aad782c7","impliedFormat":99},{"version":"3354286ef917d22c72e0c830324062f950134d8882e9ea57ad6ade3d8ad943cf","impliedFormat":99},{"version":"3dedc468e9b0ed804c0226482e344bd769417f834988af838d814504af81cba6","impliedFormat":99},{"version":"ac3d263474022e9a14c43f588f485d549641d839b159ecc971978b90f34bdf6b","impliedFormat":99},{"version":"3b89216a7e38a454985ad17bb2ff85792837dc812f2a89fa5f60ad0a2e216fa7","impliedFormat":99},{"version":"10073cdcf56982064c5337787cc59b79586131e1b28c106ede5bff362f912b70","impliedFormat":99},{"version":"82179358c2d9d7347f1602dc9300039a2250e483137b38ebf31d4d2e5519c181","impliedFormat":99},{"version":"4e003c868b0d8f8ad200b96cbc653e18e513fa23e1c19c4fe3cc25d4394efc47","impliedFormat":99},{"version":"091546ac9077cddcd7b9479cc2e0c677238bf13e39eab4b13e75046c3328df93","impliedFormat":99},{"version":"42a12f2faa483c9b48195ed794d22698162274e755f6e07219c2351c4f08d732","impliedFormat":99},{"version":"727858fb893b87791876dee5e3cd4c187a721d2de516fd19d3d00dc6e8a894b3","impliedFormat":99},{"version":"5bfaa2ee33e63a1b17b08dbefd7a3c42d1e0f914e52aca5bef679b420bd7a07c","impliedFormat":99},{"version":"7d5c6cc5d537c47c7723a1fe76411b99373eb55c487045dfd076c1956e87389a","impliedFormat":99},{"version":"bcbd3becd08b4515225880abea0dbfbbf0d1181ce3af8f18f72f61edbe4febfb","impliedFormat":99},{"version":"a86701e56b10a6d1ef9b2ecaeedbab94ed7b957a646cd71fd09d02b323c6d3d7","impliedFormat":99},{"version":"b3f0791a73b6521da68107c5ba1bfed4bc21ff7099b892700fd65670e88ef6ee","impliedFormat":99},{"version":"d0411dddbef50f9ad568ee9d24b108153bcb8f0db1094de6dfbadf02feb3aa70","impliedFormat":99},{"version":"25249ca5fe64ca60d7bfb7fbbf0cb084324853b03a265dbbbc45fb4949de7567","impliedFormat":99},{"version":"06db2f8ba1d1dfacf04529cb731081ab23f133f29c7608ebdfbcab356996827c","impliedFormat":99},{"version":"bdd14f07b4eca0b4b5203b85b8dbc4d084c749fa590bee5ea613e1641dcd3b29","impliedFormat":99},{"version":"427fe2004642504828c1476d0af4270e6ad4db6de78c0b5da3e4c5ca95052a99","impliedFormat":1},{"version":"2eeffcee5c1661ddca53353929558037b8cf305ffb86a803512982f99bcab50d","impliedFormat":99},{"version":"9afb4cb864d297e4092a79ee2871b5d3143ea14153f62ef0bb04ede25f432030","affectsGlobalScope":true,"impliedFormat":99},{"version":"31d5fb0aeb0368909fbe8cd9b893c16350aa94d48a2f909fdd393982ceb4814d","affectsGlobalScope":true,"impliedFormat":99},{"version":"90fe5875e2c7519711442683a9489416819c6cec8d395e48ff568e94254533e7","impliedFormat":99},{"version":"69bf2422313487956e4dacf049f30cb91b34968912058d244cb19e4baa24da97","impliedFormat":99},{"version":"6987dfb4b0c4e02112cc4e548e7a77b3d9ddfeffa8c8a2db13ceac361a4567d9","impliedFormat":99},{"version":"72a863bc6c0fc7a6263d8e07279167d86467a3869b5f002b1df6eaf5000ccc7b","impliedFormat":99},{"version":"5e2ba3d18d78aebbde1f34bde356e41e9c76eeaeaeee56a37036596a9eff4211","impliedFormat":99},{"version":"8280ae8ccc0493b32d1742d585357ab9f0a508ea050af25a5a20d64010d0a5cf","impliedFormat":99},{"version":"7adfd9f9056ecd4ae6c65fde2a98654960c662714c73f048478959d04c09e144","impliedFormat":99},{"version":"32b35cf0dc3a1b1a7118b61c34ce2ad1a29695851679f9ec34e0776f2ece2a69","impliedFormat":99},{"version":"b413fbc6658fe2774f8bf9a15cf4c53e586fc38a2d5256b3b9647da242c14389","impliedFormat":99},{"version":"42f0f7e74d73ae5873ed666373e09a367d62232ca378677094d0dc06020d6e00","impliedFormat":99},{"version":"c30a41267fc04c6518b17e55dcb2b810f267af4314b0b6d7df1c33a76ce1b330","impliedFormat":1},{"version":"72422d0bac4076912385d0c10911b82e4694fc106e2d70added091f88f0824ba","impliedFormat":1},{"version":"da251b82c25bee1d93f9fd80c5a61d945da4f708ca21285541d7aff83ecb8200","impliedFormat":1},{"version":"64db14db2bf37ac089766fdb3c7e1160fabc10e9929bc2deeede7237e4419fc8","impliedFormat":1},{"version":"98b94085c9f78eba36d3d2314affe973e8994f99864b8708122750788825c771","impliedFormat":1},{"version":"ebb9b9fa684d70aef64614a59b7582f46f4982139b8b632b911ef98e10c4d117","impliedFormat":99},{"version":"ae77d81a5541a8abb938a0efedf9ac4bea36fb3a24cc28cfa11c598863aba571","impliedFormat":1},{"version":"f329dfad7970297cbf07ddc8fce2ad4a24e2a3855917c661922ef86eb24dd1f1","impliedFormat":1},{"version":"480f05e466e86ee6c80af99695d90079f9e2956a4986e930ebd3d578688ff05c","impliedFormat":1},{"version":"60b89b01aac9a46598a4385ada4a3b38e981f4555e6d8a6c9171cfc5c85b019b","impliedFormat":99},{"version":"15fe687c59d62741b4494d5e623d497d55eb38966ecf5bea7f36e48fc3fbe15e","impliedFormat":1},{"version":"70bf585bdacf3b20d843740b27b0359c9256c817a818bf7d18e74762be6bea91","impliedFormat":99},{"version":"0eb7c40cf46f33d2bc948a017fe5b0a1967bc9a36a403ce1674dda88c6cfe042","impliedFormat":99},{"version":"a75edf98163d6fb0ff87cd6d7d59e3f635e02b0d1abad21e5a0cfa37b23b008b","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e5d3940413d44f3f20f35deccf31545601c32d4cf80cb7d951d48586ae1ff42","signature":"7b1ad566858a695fdd67da3153afc1cbe33ac2afb17e91e9287a7debd228cb95"},{"version":"d73a4c0a98afa331568302e1ea8db954b11e9a13fb9d1b74e2a3b131076bee30","impliedFormat":1},{"version":"7a7628f5eca1de5af2039aac3ca4065aa0fd26c315116387c99d81f7dd49a39d","signature":"450b92fe6002850857d8d8f5df6977c6ce88e56f95b7c9615342f4ffe2cedfd1"},{"version":"56a13bafb5b4ca6ab1836260b55c2dd09ddc0da5fb3d404c17a2eab157baa194","signature":"6d17ed9b7135b0b3db99ead1c9a36ed2c4891df097fff6c3e2a9ef3df9a5740f"},{"version":"070c0df9eb6fa0e55429aa456b7bac70eed79aeafc346b007f772da3d5eff4ff","signature":"f45c6a57a080c3f9bed0c0eb21d28ff79148e5ba6bec5ca1dd32e04d49f81bce"},{"version":"d683c201ef34cb8f96e2560af1efa99c456a884f1bae043571e2ce0a1874029b","signature":"91a3c8962a0edcb956206a501d943fe99e1c78c6d4d8b5c9a948a3362c75978c"}],"root":[297,[299,302]],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noPropertyAccessFromIndexSignature":false,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":5,"tsBuildInfoFile":"./tsconfig.tsbuildinfo","useUnknownInCatchVariables":true,"verbatimModuleSyntax":true},"referencedMap":[[290,1],[291,2],[271,3],[83,4],[272,5],[278,6],[279,7],[251,8],[250,9],[273,8],[258,10],[260,11],[259,12],[249,13],[243,14],[245,15],[247,16],[248,14],[294,17],[285,18],[287,19],[286,20],[284,21],[87,22],[86,23],[85,24],[121,25],[101,26],[102,26],[103,26],[104,26],[105,26],[106,26],[107,27],[109,26],[108,26],[120,28],[110,26],[112,26],[111,26],[114,26],[113,26],[115,26],[116,26],[117,26],[118,26],[119,26],[100,26],[99,29],[153,30],[77,30],[73,31],[212,32],[76,33],[74,34],[75,35],[292,36],[229,37],[228,27],[98,38],[97,39],[123,40],[122,41],[124,36],[94,42],[96,43],[95,44],[199,45],[198,4],[201,46],[200,47],[225,48],[224,49],[89,50],[88,4],[91,51],[90,52],[254,53],[257,54],[255,53],[256,55],[275,56],[265,57],[261,58],[262,10],[281,59],[276,60],[263,61],[280,62],[264,63],[288,64],[282,65],[149,66],[150,67],[151,68],[137,69],[138,70],[139,71],[140,72],[141,73],[148,74],[142,75],[146,70],[143,76],[147,77],[144,78],[145,76],[60,79],[61,80],[59,81],[71,82],[67,83],[66,84],[68,85],[70,86],[69,87],[64,88],[65,89],[63,90],[193,91],[194,92],[297,93],[299,94],[300,71],[302,95],[301,96],[188,97],[186,98],[187,71],[221,99],[222,100],[240,101],[219,102],[223,102],[239,103],[218,102],[241,104],[189,105],[196,106],[191,107],[195,108],[190,105],[205,109],[210,110],[206,110],[197,111],[208,112],[204,113],[209,114],[216,111],[207,115],[217,116],[214,117],[211,110],[203,118],[215,111],[234,119],[235,120],[238,121],[233,122],[226,123],[231,124],[230,125],[227,126],[232,126],[202,127],[236,128],[237,129],[154,130],[152,131],[78,132],[81,34],[213,133],[79,134],[220,135],[80,136],[136,137],[134,138],[131,139],[132,140],[133,141],[135,142],[127,143],[128,144],[129,145],[126,146],[130,147],[156,148],[164,71],[157,149],[159,150],[160,150],[158,148],[161,151],[162,152],[163,153],[168,154],[166,155],[165,156],[169,157],[167,158],[170,159],[171,160],[155,71],[185,161],[172,162],[173,71],[174,71],[175,71],[183,163],[180,71],[176,71],[182,71],[177,71],[178,71],[181,71],[179,164]],"latestChangedDtsFile":"./emoji-render.spec.d.ts","version":"6.0.2"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jvs-milkdown/plugin-emoji",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"milkdown",
|
|
6
|
+
"milkdown plugin"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Milkdown/milkdown.git",
|
|
12
|
+
"directory": "packages/plugins/plugin-emoji"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"src"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"main": "./lib/index.js",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./lib/index.js",
|
|
24
|
+
"types": "./lib/index.d.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"dompurify": "^3.2.5",
|
|
29
|
+
"emoji-regex": "^10.0.0",
|
|
30
|
+
"node-emoji": "^2.1.3",
|
|
31
|
+
"remark-emoji": "^5.0.0",
|
|
32
|
+
"twemoji": "^14.0.2",
|
|
33
|
+
"@jvs-milkdown/utils": "1.0.0",
|
|
34
|
+
"@jvs-milkdown/transformer": "1.0.0",
|
|
35
|
+
"@jvs-milkdown/core": "1.0.0",
|
|
36
|
+
"@jvs-milkdown/exception": "1.0.0",
|
|
37
|
+
"@jvs-milkdown/ctx": "1.0.0",
|
|
38
|
+
"@jvs-milkdown/prose": "1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@jvs-milkdown/preset-commonmark": "1.0.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "vite build"
|
|
45
|
+
},
|
|
46
|
+
"types": "./lib/index.d.ts"
|
|
47
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import twemoji from 'twemoji'
|
|
2
|
+
|
|
3
|
+
const setAttr = (text: string) => ({ title: text })
|
|
4
|
+
|
|
5
|
+
/// @internal
|
|
6
|
+
/// This is copied from https://github.com/twitter/twemoji/blob/master/index.d.ts#L14
|
|
7
|
+
/// The file is not released for some reason, so I have to copy it here.
|
|
8
|
+
export interface TwemojiOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Default: Cloudflare
|
|
11
|
+
*/
|
|
12
|
+
base?: string
|
|
13
|
+
/**
|
|
14
|
+
* Default: .png
|
|
15
|
+
*/
|
|
16
|
+
ext?: string
|
|
17
|
+
/**
|
|
18
|
+
* Default: emoji
|
|
19
|
+
*/
|
|
20
|
+
className?: string
|
|
21
|
+
/**
|
|
22
|
+
* Default: 72x72
|
|
23
|
+
*/
|
|
24
|
+
size?: string | number
|
|
25
|
+
/**
|
|
26
|
+
* To render with SVG use `folder: svg, ext: .svg`
|
|
27
|
+
*/
|
|
28
|
+
folder?: string
|
|
29
|
+
/**
|
|
30
|
+
* The function to invoke in order to generate image src(s).
|
|
31
|
+
*/
|
|
32
|
+
callback?: (icon: string, options: object, variant: string) => string | false
|
|
33
|
+
/**
|
|
34
|
+
* The function to invoke in order to generate additional, custom attributes for the image tag.
|
|
35
|
+
* Default () => ({})
|
|
36
|
+
* @param icon the lower case HEX code point i.e. "1f4a9"
|
|
37
|
+
* @param variant variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
attributes?: (icon: string, variant: string) => object
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function parse(emoji: string, twemojiOptions?: TwemojiOptions): string {
|
|
44
|
+
return twemoji.parse(emoji, {
|
|
45
|
+
attributes: setAttr,
|
|
46
|
+
base: 'https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/',
|
|
47
|
+
...twemojiOptions,
|
|
48
|
+
}) as unknown as string
|
|
49
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Node, RemarkPluginRaw } from '@jvs-milkdown/transformer'
|
|
2
|
+
|
|
3
|
+
import emojiRegex from 'emoji-regex'
|
|
4
|
+
|
|
5
|
+
import { type TwemojiOptions, parse } from './parse'
|
|
6
|
+
|
|
7
|
+
const regex = emojiRegex()
|
|
8
|
+
|
|
9
|
+
const isParent = (node: Node): node is Node & { children: Node[] } =>
|
|
10
|
+
!!(node as Node & { children: Node[] }).children
|
|
11
|
+
const isLiteral = (node: Node): node is Node & { value: string } =>
|
|
12
|
+
!!(node as Node & { value: string }).value
|
|
13
|
+
|
|
14
|
+
function flatMap(
|
|
15
|
+
ast: Node,
|
|
16
|
+
fn: (node: Node, index: number, parent: Node | null) => Node[]
|
|
17
|
+
) {
|
|
18
|
+
return transform(ast, 0, null)[0]
|
|
19
|
+
|
|
20
|
+
function transform(node: Node, index: number, parent: Node | null) {
|
|
21
|
+
if (isParent(node)) {
|
|
22
|
+
const out = []
|
|
23
|
+
for (let i = 0, n = node.children.length; i < n; i++) {
|
|
24
|
+
const nthChild = node.children[i]
|
|
25
|
+
if (nthChild) {
|
|
26
|
+
const xs = transform(nthChild, i, node)
|
|
27
|
+
if (xs) {
|
|
28
|
+
for (let j = 0, m = xs.length; j < m; j++) {
|
|
29
|
+
const item = xs[j]
|
|
30
|
+
if (item) out.push(item)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
node.children = out
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return fn(node, index, parent)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const twemojiPlugin: RemarkPluginRaw<TwemojiOptions> = (
|
|
43
|
+
twemojiOptions
|
|
44
|
+
) => {
|
|
45
|
+
function transformer(tree: Node) {
|
|
46
|
+
flatMap(tree, (node) => {
|
|
47
|
+
if (!isLiteral(node)) return [node]
|
|
48
|
+
|
|
49
|
+
// Should not convert code block
|
|
50
|
+
if (node.type === 'code') return [node]
|
|
51
|
+
|
|
52
|
+
const value = node.value
|
|
53
|
+
const output: Array<Node & { value: string }> = []
|
|
54
|
+
let match
|
|
55
|
+
let str = value
|
|
56
|
+
while ((match = regex.exec(str))) {
|
|
57
|
+
const { index } = match
|
|
58
|
+
const emoji = match[0]
|
|
59
|
+
if (emoji) {
|
|
60
|
+
if (index > 0) output.push({ ...node, value: str.slice(0, index) })
|
|
61
|
+
|
|
62
|
+
output.push({
|
|
63
|
+
...node,
|
|
64
|
+
value: parse(emoji, twemojiOptions),
|
|
65
|
+
type: 'emoji',
|
|
66
|
+
})
|
|
67
|
+
str = str.slice(index + emoji.length)
|
|
68
|
+
}
|
|
69
|
+
regex.lastIndex = 0
|
|
70
|
+
}
|
|
71
|
+
if (str.length) output.push({ ...node, value: str })
|
|
72
|
+
|
|
73
|
+
return output
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
return transformer
|
|
77
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, MilkdownPlugin } from '@jvs-milkdown/ctx'
|
|
2
|
+
|
|
3
|
+
export function withMeta<T extends MilkdownPlugin>(
|
|
4
|
+
plugin: T,
|
|
5
|
+
meta: Partial<Meta> & Pick<Meta, 'displayName'>
|
|
6
|
+
): T {
|
|
7
|
+
Object.assign(plugin, {
|
|
8
|
+
meta: {
|
|
9
|
+
package: '@jvs-milkdown/plugin-emoji',
|
|
10
|
+
...meta,
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return plugin
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defaultValueCtx, Editor, editorViewCtx } from '@jvs-milkdown/core'
|
|
2
|
+
import { commonmark } from '@jvs-milkdown/preset-commonmark'
|
|
3
|
+
import '@testing-library/jest-dom/vitest'
|
|
4
|
+
import { test, expect } from 'vitest'
|
|
5
|
+
|
|
6
|
+
import { emoji } from '.'
|
|
7
|
+
|
|
8
|
+
test('show normal emoji', async () => {
|
|
9
|
+
const editor = Editor.make()
|
|
10
|
+
.config((ctx) => {
|
|
11
|
+
ctx.set(defaultValueCtx, 'Emoji :+1:')
|
|
12
|
+
})
|
|
13
|
+
.use(commonmark)
|
|
14
|
+
.use(emoji)
|
|
15
|
+
|
|
16
|
+
await editor.create()
|
|
17
|
+
|
|
18
|
+
const view = editor.ctx.get(editorViewCtx)
|
|
19
|
+
expect(view.dom.querySelector('[data-type="emoji"]')).toBeInTheDocument()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('show emoji not in twemoji', async () => {
|
|
23
|
+
const editor = Editor.make()
|
|
24
|
+
.config((ctx) => {
|
|
25
|
+
ctx.set(
|
|
26
|
+
defaultValueCtx,
|
|
27
|
+
"HTML entities should render as symbols (™, ©, etc.) regardless of the emoji plugin's presence."
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
.use(commonmark)
|
|
31
|
+
.use(emoji)
|
|
32
|
+
|
|
33
|
+
await editor.create()
|
|
34
|
+
|
|
35
|
+
const view = editor.ctx.get(editorViewCtx)
|
|
36
|
+
// ™ and ©
|
|
37
|
+
expect(view.dom.querySelectorAll('[data-type="emoji"]')).toHaveLength(2)
|
|
38
|
+
})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { MilkdownPlugin } from '@jvs-milkdown/ctx'
|
|
2
|
+
import type { RemarkPluginRaw } from '@jvs-milkdown/transformer'
|
|
3
|
+
import type { RemarkEmojiOptions } from 'remark-emoji'
|
|
4
|
+
|
|
5
|
+
import { expectDomTypeError } from '@jvs-milkdown/exception'
|
|
6
|
+
import { InputRule } from '@jvs-milkdown/prose/inputrules'
|
|
7
|
+
import { $inputRule, $nodeAttr, $nodeSchema, $remark } from '@jvs-milkdown/utils'
|
|
8
|
+
import DOMPurify from 'dompurify'
|
|
9
|
+
import { get } from 'node-emoji'
|
|
10
|
+
import remarkEmoji from 'remark-emoji'
|
|
11
|
+
|
|
12
|
+
import { parse } from './__internal__/parse'
|
|
13
|
+
import { twemojiPlugin } from './__internal__/remark-twemoji'
|
|
14
|
+
import { withMeta } from './__internal__/with-meta'
|
|
15
|
+
|
|
16
|
+
/// HTML attributes for emoji node.
|
|
17
|
+
export const emojiAttr = $nodeAttr('emoji', () => ({
|
|
18
|
+
span: {},
|
|
19
|
+
img: {},
|
|
20
|
+
}))
|
|
21
|
+
withMeta(emojiAttr, {
|
|
22
|
+
displayName: 'Attr<emoji>',
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/// Schema for emoji node.
|
|
26
|
+
export const emojiSchema = $nodeSchema('emoji', (ctx) => ({
|
|
27
|
+
group: 'inline',
|
|
28
|
+
inline: true,
|
|
29
|
+
attrs: {
|
|
30
|
+
html: {
|
|
31
|
+
default: '',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
parseDOM: [
|
|
35
|
+
{
|
|
36
|
+
tag: 'span[data-type="emoji"]',
|
|
37
|
+
getAttrs: (dom) => {
|
|
38
|
+
if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom)
|
|
39
|
+
|
|
40
|
+
return { html: dom.innerHTML }
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
toDOM: (node) => {
|
|
45
|
+
const attrs = ctx.get(emojiAttr.key)(node)
|
|
46
|
+
const tmp = document.createElement('span')
|
|
47
|
+
tmp.innerHTML = DOMPurify.sanitize(node.attrs.html)
|
|
48
|
+
|
|
49
|
+
const firstChild = tmp.firstChild
|
|
50
|
+
if (!firstChild) {
|
|
51
|
+
console.warn('Milkdown emoji plugin: emoji is not valid')
|
|
52
|
+
return ['span', { ...attrs.container, 'data-type': 'emoji' }, tmp]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const dom = firstChild.cloneNode()
|
|
56
|
+
tmp.remove()
|
|
57
|
+
if (dom && dom instanceof HTMLElement)
|
|
58
|
+
Object.entries<string>(attrs.img).forEach(([key, value]) =>
|
|
59
|
+
dom.setAttribute(key, value)
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
return ['span', { ...attrs.container, 'data-type': 'emoji' }, dom]
|
|
63
|
+
},
|
|
64
|
+
parseMarkdown: {
|
|
65
|
+
match: ({ type }) => type === 'emoji',
|
|
66
|
+
runner: (state, node, type) => {
|
|
67
|
+
state.addNode(type, { html: node.value as string })
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
toMarkdown: {
|
|
71
|
+
match: (node) => node.type.name === 'emoji',
|
|
72
|
+
runner: (state, node) => {
|
|
73
|
+
const span = document.createElement('span')
|
|
74
|
+
span.innerHTML = node.attrs.html
|
|
75
|
+
const img = span.querySelector('img')
|
|
76
|
+
const title = img?.title || img?.alt
|
|
77
|
+
span.remove()
|
|
78
|
+
state.addNode('text', undefined, title)
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
}))
|
|
82
|
+
|
|
83
|
+
withMeta(emojiSchema.node, {
|
|
84
|
+
displayName: 'NodeSchema<emoji>',
|
|
85
|
+
})
|
|
86
|
+
withMeta(emojiSchema.ctx, {
|
|
87
|
+
displayName: 'NodeSchemaCtx<emoji>',
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
/// This plugin wraps [remark-emoji](https://github.com/rhysd/remark-emoji).
|
|
91
|
+
export const remarkEmojiPlugin = $remark(
|
|
92
|
+
'remarkEmoji',
|
|
93
|
+
() => remarkEmoji as RemarkPluginRaw<RemarkEmojiOptions>
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
withMeta(remarkEmojiPlugin.plugin, {
|
|
97
|
+
displayName: 'Remark<remarkEmojiPlugin>',
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
withMeta(remarkEmojiPlugin.options, {
|
|
101
|
+
displayName: 'RemarkConfig<remarkEmojiPlugin>',
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
/// This plugin is used for transforming emoji to twemoji.
|
|
105
|
+
export const remarkTwemojiPlugin = $remark('remarkTwemoji', () => twemojiPlugin)
|
|
106
|
+
|
|
107
|
+
withMeta(remarkTwemojiPlugin.plugin, {
|
|
108
|
+
displayName: 'Remark<remarkTwemojiPlugin>',
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
withMeta(remarkTwemojiPlugin.options, {
|
|
112
|
+
displayName: 'RemarkConfig<remarkTwemojiPlugin>',
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
/// Input rule for inserting emoji.
|
|
116
|
+
/// For example, `:smile:` will be replaced with `😄`.
|
|
117
|
+
export const insertEmojiInputRule = $inputRule(
|
|
118
|
+
(ctx) =>
|
|
119
|
+
new InputRule(/(:([^:\s]+):)$/, (state, match, start, end) => {
|
|
120
|
+
const content = match[0]
|
|
121
|
+
if (!content) return null
|
|
122
|
+
const got = get(content)
|
|
123
|
+
if (!got || content.includes(got)) return null
|
|
124
|
+
|
|
125
|
+
const html = parse(got, ctx.get(remarkTwemojiPlugin.options.key))
|
|
126
|
+
|
|
127
|
+
return state.tr
|
|
128
|
+
.setMeta('emoji', true)
|
|
129
|
+
.replaceRangeWith(start, end, emojiSchema.type(ctx).create({ html }))
|
|
130
|
+
.scrollIntoView()
|
|
131
|
+
})
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
withMeta(insertEmojiInputRule, {
|
|
135
|
+
displayName: 'InputRule<insertEmojiInputRule>',
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
/// All plugins exported by this package.
|
|
139
|
+
export const emoji: MilkdownPlugin[] = [
|
|
140
|
+
emojiAttr,
|
|
141
|
+
remarkEmojiPlugin,
|
|
142
|
+
remarkTwemojiPlugin,
|
|
143
|
+
emojiSchema,
|
|
144
|
+
insertEmojiInputRule,
|
|
145
|
+
].flat()
|