@kerebron/extension-menu 0.4.3 → 0.4.4
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/README.md +80 -0
- package/assets/custom-menu.css +26 -6
- package/assets/menu.css +2 -2
- package/esm/_dnt.polyfills.d.ts +101 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +127 -0
- package/esm/editor/src/utilities/getShadowRoot.d.ts +2 -0
- package/esm/editor/src/utilities/getShadowRoot.d.ts.map +1 -0
- package/esm/editor/src/utilities/getShadowRoot.js +16 -0
- package/esm/editor/src/utilities/mod.d.ts +6 -0
- package/esm/editor/src/utilities/mod.d.ts.map +1 -0
- package/esm/editor/src/utilities/mod.js +5 -0
- package/esm/editor/src/utilities/toRawTextResult.d.ts +3 -0
- package/esm/editor/src/utilities/toRawTextResult.d.ts.map +1 -0
- package/esm/editor/src/utilities/toRawTextResult.js +21 -0
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +8 -0
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/AutocompletePlugin.js +232 -0
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +17 -0
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/DefaultRenderer.js +137 -0
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +26 -0
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +30 -0
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +11 -0
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/createDefaultMatcher.js +58 -0
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +4 -0
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/createRegexMatcher.js +50 -0
- package/esm/extension-autocomplete/src/mod.d.ts +3 -0
- package/esm/extension-autocomplete/src/mod.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/mod.js +2 -0
- package/esm/extension-autocomplete/src/types.d.ts +60 -0
- package/esm/extension-autocomplete/src/types.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/types.js +1 -0
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +15 -0
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +1 -0
- package/esm/extension-basic-editor/src/ExtensionHtml.js +108 -0
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +32 -0
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +1 -0
- package/esm/extension-lsp/src/DiagnosticPlugin.js +131 -0
- package/esm/extension-lsp/src/ExtensionLsp.d.ts +25 -0
- package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +1 -0
- package/esm/extension-lsp/src/ExtensionLsp.js +126 -0
- package/esm/extension-lsp/src/LSPClient.d.ts +56 -0
- package/esm/extension-lsp/src/LSPClient.d.ts.map +1 -0
- package/esm/extension-lsp/src/LSPClient.js +449 -0
- package/esm/extension-lsp/src/LspStatus.d.ts +34 -0
- package/esm/extension-lsp/src/LspStatus.d.ts.map +1 -0
- package/esm/extension-lsp/src/LspStatus.js +127 -0
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +8 -0
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +1 -0
- package/esm/extension-lsp/src/computeIncrementalChanges.js +82 -0
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts +23 -0
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +1 -0
- package/esm/extension-lsp/src/createLspAutocomplete.js +68 -0
- package/esm/extension-lsp/src/workspace.d.ts +62 -0
- package/esm/extension-lsp/src/workspace.d.ts.map +1 -0
- package/esm/extension-lsp/src/workspace.js +168 -0
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +36 -0
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +1 -0
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +240 -0
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +26 -0
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +1 -0
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +115 -0
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +22 -0
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +1 -0
- package/esm/extension-markdown/src/ExtensionMarkdown.js +48 -0
- package/esm/extension-markdown/src/MarkdownParser.d.ts +61 -0
- package/esm/extension-markdown/src/MarkdownParser.d.ts.map +1 -0
- package/esm/extension-markdown/src/MarkdownParser.js +249 -0
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts +42 -0
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +1 -0
- package/esm/extension-markdown/src/MarkdownSerializer.js +325 -0
- package/esm/extension-markdown/src/PositionMapper.d.ts +15 -0
- package/esm/extension-markdown/src/PositionMapper.d.ts.map +1 -0
- package/esm/extension-markdown/src/PositionMapper.js +100 -0
- package/esm/extension-markdown/src/TokenSource.d.ts +11 -0
- package/esm/extension-markdown/src/TokenSource.d.ts.map +1 -0
- package/esm/extension-markdown/src/TokenSource.js +39 -0
- package/esm/extension-markdown/src/mdToPmConverter.d.ts +5 -0
- package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +1 -0
- package/esm/extension-markdown/src/mdToPmConverter.js +111 -0
- package/esm/extension-markdown/src/pmToMdConverter.d.ts +16 -0
- package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +1 -0
- package/esm/extension-markdown/src/pmToMdConverter.js +433 -0
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +4 -0
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +151 -0
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +3 -0
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +34 -0
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +6 -0
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +380 -0
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +3 -0
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +323 -0
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +9 -0
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +308 -0
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +5 -0
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +1 -0
- package/esm/extension-markdown/src/treeSitterTokenizer.js +769 -0
- package/esm/extension-markdown/src/types.d.ts +28 -0
- package/esm/extension-markdown/src/types.d.ts.map +1 -0
- package/esm/extension-markdown/src/types.js +131 -0
- package/esm/extension-markdown/src/utils.d.ts +8 -0
- package/esm/extension-markdown/src/utils.d.ts.map +1 -0
- package/esm/extension-markdown/src/utils.js +86 -0
- package/esm/extension-menu/src/CustomMenuPlugin.d.ts +7 -3
- package/esm/extension-menu/src/CustomMenuPlugin.d.ts.map +1 -1
- package/esm/extension-menu/src/CustomMenuPlugin.js +60 -4
- package/esm/extension-menu/src/ExtensionCustomMenu.d.ts +6 -2
- package/esm/extension-menu/src/ExtensionCustomMenu.d.ts.map +1 -1
- package/esm/extension-menu/src/ExtensionCustomMenu.js +36 -1
- package/esm/extension-menu/src/mod.d.ts +1 -0
- package/esm/extension-menu/src/mod.d.ts.map +1 -1
- package/esm/extension-menu/src/mod.js +1 -0
- package/esm/extension-yjs/src/CollaborationStatus.d.ts +59 -0
- package/esm/extension-yjs/src/CollaborationStatus.d.ts.map +1 -0
- package/esm/extension-yjs/src/CollaborationStatus.js +286 -0
- package/esm/tree-sitter-shim/src/main.d.ts +15 -0
- package/esm/tree-sitter-shim/src/main.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/main.js +25 -0
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +6 -0
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/node.js +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +7 -0
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/parser.js +5 -0
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +6 -0
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/tree.js +1 -0
- package/esm/wasm/src/mod.d.ts +12 -0
- package/esm/wasm/src/mod.d.ts.map +1 -0
- package/esm/wasm/src/mod.js +48 -0
- package/esm/wasm/wasm.d.ts +138 -0
- package/esm/wasm/wasm.d.ts.map +1 -0
- package/esm/wasm/wasm.js +120 -0
- package/package.json +4 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type TupleArray = Array<[string, string]>;
|
|
2
|
+
export declare const NESTING_OPENING = 1;
|
|
3
|
+
export declare const NESTING_SELF_CLOSING = 0;
|
|
4
|
+
export declare const NESTING_CLOSING = -1;
|
|
5
|
+
type Nesting = -1 | 0 | 1;
|
|
6
|
+
export declare class Token {
|
|
7
|
+
type: string;
|
|
8
|
+
tag: string;
|
|
9
|
+
nesting: Nesting;
|
|
10
|
+
attrs: TupleArray | null;
|
|
11
|
+
map: [number] | [number, number] | [number, number, number, number] | null;
|
|
12
|
+
level: number;
|
|
13
|
+
children: Array<Token> | null;
|
|
14
|
+
content: string;
|
|
15
|
+
markup: string;
|
|
16
|
+
info: string;
|
|
17
|
+
meta: any;
|
|
18
|
+
block: boolean;
|
|
19
|
+
hidden: boolean;
|
|
20
|
+
constructor(type: string, tag: string, nesting: Nesting);
|
|
21
|
+
attrIndex(name: string): number;
|
|
22
|
+
attrPush(attrData: [string, string]): void;
|
|
23
|
+
attrSet(name: string, value: string): void;
|
|
24
|
+
attrGet(name: string): string | null;
|
|
25
|
+
attrJoin(name: string, value: string): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extension-markdown/src/types.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1C,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,KAAK,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE1B,qBAAa,KAAK;IAcP,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,OAAO;IAfzB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAQ;IAChC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CACnE;IACP,KAAK,EAAE,MAAM,CAAK;IAClB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;IACrC,OAAO,EAAE,MAAM,CAAM;IACrB,MAAM,EAAE,MAAM,CAAM;IACpB,IAAI,EAAE,MAAM,CAAM;IAClB,IAAI,EAAE,GAAG,CAAQ;IACjB,KAAK,UAAS;IACd,MAAM,UAAS;gBAGN,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO;IAIzB,SAAS,CAAC,IAAI,EAAE,MAAM;IAWtB,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IAQnC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAWnC,OAAO,CAAC,IAAI,EAAE,MAAM;IASpB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CASrC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// https://github.com/markdown-it/markdown-it/blob/master/lib/token.mjs
|
|
2
|
+
export const NESTING_OPENING = 1;
|
|
3
|
+
export const NESTING_SELF_CLOSING = 0;
|
|
4
|
+
export const NESTING_CLOSING = -1;
|
|
5
|
+
export class Token {
|
|
6
|
+
constructor(type, tag, nesting) {
|
|
7
|
+
Object.defineProperty(this, "type", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: type
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(this, "tag", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: tag
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "nesting", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: nesting
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "attrs", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: null
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "map", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: null
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "level", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: 0
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "children", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: null
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "content", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: ''
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "markup", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: ''
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(this, "info", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
value: ''
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(this, "meta", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: null
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(this, "block", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
value: false
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(this, "hidden", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: false
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
attrIndex(name) {
|
|
87
|
+
if (!this.attrs)
|
|
88
|
+
return -1;
|
|
89
|
+
const attrs = this.attrs;
|
|
90
|
+
for (let i = 0, len = attrs.length; i < len; i++) {
|
|
91
|
+
if (attrs[i][0] === name)
|
|
92
|
+
return i;
|
|
93
|
+
}
|
|
94
|
+
return -1;
|
|
95
|
+
}
|
|
96
|
+
attrPush(attrData) {
|
|
97
|
+
if (this.attrs) {
|
|
98
|
+
this.attrs.push(attrData);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.attrs = [attrData];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
attrSet(name, value) {
|
|
105
|
+
const idx = this.attrIndex(name);
|
|
106
|
+
const attrData = [name, value];
|
|
107
|
+
if (idx < 0 || !this.attrs) {
|
|
108
|
+
this.attrPush(attrData);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.attrs[idx] = attrData;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
attrGet(name) {
|
|
115
|
+
const idx = this.attrIndex(name);
|
|
116
|
+
let value = null;
|
|
117
|
+
if (idx >= 0 && this.attrs) {
|
|
118
|
+
value = this.attrs[idx][1];
|
|
119
|
+
}
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
attrJoin(name, value) {
|
|
123
|
+
const idx = this.attrIndex(name);
|
|
124
|
+
if (idx < 0 || !this.attrs) {
|
|
125
|
+
this.attrPush([name, value]);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function spaces(num: number): string;
|
|
2
|
+
export declare function inchesToSpaces(value: string): number;
|
|
3
|
+
export declare function inchesToMm(value: string): number;
|
|
4
|
+
export declare function inchesToPixels(value: string): number;
|
|
5
|
+
export declare function fixCharacters(text: string): string;
|
|
6
|
+
export declare function numberString(num: number, symbol?: string): string;
|
|
7
|
+
export declare function romanize(num: number): string;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/extension-markdown/src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,UAEjC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAchD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,UASzC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAM,UAkBrD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyB5C"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export function spaces(num) {
|
|
2
|
+
return ' '.repeat(num || 0);
|
|
3
|
+
}
|
|
4
|
+
export function inchesToSpaces(value) {
|
|
5
|
+
if (!value) {
|
|
6
|
+
return 0;
|
|
7
|
+
}
|
|
8
|
+
if (value.endsWith('in')) {
|
|
9
|
+
return Math.floor(parseFloat(value.substring(0, value.length - 2)) / 0.125);
|
|
10
|
+
}
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
export function inchesToMm(value) {
|
|
14
|
+
if (!value) {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
if (value.endsWith('pt')) {
|
|
18
|
+
return parseFloat(value.substring(0, value.length - 2)) * 0.3528;
|
|
19
|
+
}
|
|
20
|
+
if (value.endsWith('in')) {
|
|
21
|
+
return parseFloat(value.substring(0, value.length - 2)) * 25.4;
|
|
22
|
+
}
|
|
23
|
+
if (value.endsWith('em')) {
|
|
24
|
+
return parseFloat(value.substring(0, value.length - 2)) / 0.125 * 25.4;
|
|
25
|
+
}
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
export function inchesToPixels(value) {
|
|
29
|
+
if (!value) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
return Math.floor(100 * inchesToMm(value));
|
|
33
|
+
}
|
|
34
|
+
export function fixCharacters(text) {
|
|
35
|
+
return text
|
|
36
|
+
.replace(/’/g, "'")
|
|
37
|
+
.replace(/“/g, '"')
|
|
38
|
+
.replace(/”/g, '"')
|
|
39
|
+
// deno-lint-ignore no-control-regex
|
|
40
|
+
.replace(/\x0b/g, ' ')
|
|
41
|
+
.replace(/\u201d/g, '"')
|
|
42
|
+
.replace(/\u201c/g, '"');
|
|
43
|
+
}
|
|
44
|
+
export function numberString(num, symbol = '1') {
|
|
45
|
+
if (['a'].includes(symbol)) {
|
|
46
|
+
return String.fromCharCode('a'.charCodeAt(0) + num - 1) + '. ';
|
|
47
|
+
}
|
|
48
|
+
if (['A'].includes(symbol)) {
|
|
49
|
+
return String.fromCharCode('A'.charCodeAt(0) + num - 1) + '. ';
|
|
50
|
+
}
|
|
51
|
+
if (['I'].includes(symbol)) {
|
|
52
|
+
return `${romanize(num)}. `;
|
|
53
|
+
}
|
|
54
|
+
if (['i'].includes(symbol)) {
|
|
55
|
+
return `${romanize(num).toLowerCase()}. `;
|
|
56
|
+
}
|
|
57
|
+
if (['1'].includes(symbol)) {
|
|
58
|
+
return `${num}. `;
|
|
59
|
+
}
|
|
60
|
+
return `${num}. `;
|
|
61
|
+
}
|
|
62
|
+
export function romanize(num) {
|
|
63
|
+
const lookup = [
|
|
64
|
+
['M', 1000],
|
|
65
|
+
['CM', 900],
|
|
66
|
+
['D', 500],
|
|
67
|
+
['CD', 400],
|
|
68
|
+
['C', 100],
|
|
69
|
+
['XC', 90],
|
|
70
|
+
['L', 50],
|
|
71
|
+
['XL', 40],
|
|
72
|
+
['X', 10],
|
|
73
|
+
['IX', 9],
|
|
74
|
+
['V', 5],
|
|
75
|
+
['IV', 4],
|
|
76
|
+
['I', 1],
|
|
77
|
+
];
|
|
78
|
+
let roman = '';
|
|
79
|
+
for (const [symbol, value] of lookup) {
|
|
80
|
+
while (num >= value) {
|
|
81
|
+
roman += symbol;
|
|
82
|
+
num -= value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return roman;
|
|
86
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EditorState, Plugin } from 'prosemirror-state';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import type { CoreEditor } from '../../editor/src/mod.js';
|
|
4
|
-
import { CustomMenuOptions } from './ExtensionCustomMenu.js';
|
|
5
4
|
import type { MenuElement } from './menu.js';
|
|
6
5
|
interface ToolItem {
|
|
7
6
|
id: string;
|
|
@@ -19,6 +18,7 @@ export declare class CustomMenuView {
|
|
|
19
18
|
pinnedDropdownMenu: HTMLElement | null;
|
|
20
19
|
modal: HTMLElement | null;
|
|
21
20
|
tools: ToolItem[];
|
|
21
|
+
trailingElements: MenuElement[];
|
|
22
22
|
root: Document | ShadowRoot;
|
|
23
23
|
resizeHandle: HTMLElement;
|
|
24
24
|
editorContainer: HTMLElement;
|
|
@@ -26,7 +26,7 @@ export declare class CustomMenuView {
|
|
|
26
26
|
private closePinnedDropdownHandler;
|
|
27
27
|
private submenuStack;
|
|
28
28
|
private pinnedDropdownStack;
|
|
29
|
-
constructor(editorView: EditorView, editor: CoreEditor, content: readonly (readonly MenuElement[])[]);
|
|
29
|
+
constructor(editorView: EditorView, editor: CoreEditor, content: readonly (readonly MenuElement[])[], trailingElements?: readonly MenuElement[]);
|
|
30
30
|
private initializeTools;
|
|
31
31
|
/**
|
|
32
32
|
* Generate a stable ID from a label by converting it to a kebab-case slug.
|
|
@@ -54,8 +54,12 @@ export declare class CustomMenuView {
|
|
|
54
54
|
update(view: EditorView, prevState: EditorState): void;
|
|
55
55
|
destroy(): void;
|
|
56
56
|
}
|
|
57
|
+
export interface CustomMenuPluginOptions {
|
|
58
|
+
content: readonly (readonly MenuElement[])[];
|
|
59
|
+
trailingElements?: readonly MenuElement[];
|
|
60
|
+
}
|
|
57
61
|
export declare class CustomMenuPlugin extends Plugin {
|
|
58
|
-
constructor(editor: CoreEditor, options:
|
|
62
|
+
constructor(editor: CoreEditor, options: CustomMenuPluginOptions);
|
|
59
63
|
}
|
|
60
64
|
export {};
|
|
61
65
|
//# sourceMappingURL=CustomMenuPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMenuPlugin.d.ts","sourceRoot":"","sources":["../../../src/extension-menu/src/CustomMenuPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomMenuPlugin.d.ts","sourceRoot":"","sources":["../../../src/extension-menu/src/CustomMenuPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAuB7C,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,cAAc;IAmBvB,QAAQ,CAAC,UAAU,EAAE,UAAU;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE;IApBvD,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC;IAC1B,kBAAkB,EAAE,WAA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AAW,EAAE,CAAC;CAC3C;AAED,qBAAa,gBAAiB,SAAQ,MAAM;gBAC9B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB;CAYjE"}
|
|
@@ -20,7 +20,7 @@ function debug(...args) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export class CustomMenuView {
|
|
23
|
-
constructor(editorView, editor, content) {
|
|
23
|
+
constructor(editorView, editor, content, trailingElements) {
|
|
24
24
|
Object.defineProperty(this, "editorView", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
configurable: true,
|
|
@@ -75,6 +75,12 @@ export class CustomMenuView {
|
|
|
75
75
|
writable: true,
|
|
76
76
|
value: []
|
|
77
77
|
});
|
|
78
|
+
Object.defineProperty(this, "trailingElements", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
value: []
|
|
83
|
+
});
|
|
78
84
|
Object.defineProperty(this, "root", {
|
|
79
85
|
enumerable: true,
|
|
80
86
|
configurable: true,
|
|
@@ -120,6 +126,8 @@ export class CustomMenuView {
|
|
|
120
126
|
debug('CustomMenuView constructor called');
|
|
121
127
|
debug('Content groups:', content.length);
|
|
122
128
|
this.root = editorView.root;
|
|
129
|
+
// Store trailing elements
|
|
130
|
+
this.trailingElements = trailingElements ? [...trailingElements] : [];
|
|
123
131
|
// Create wrapper
|
|
124
132
|
this.wrapper = document.createElement('div');
|
|
125
133
|
this.wrapper.classList.add(CSS_PREFIX + '__wrapper');
|
|
@@ -434,6 +442,37 @@ export class CustomMenuView {
|
|
|
434
442
|
// Create dropdown menu
|
|
435
443
|
this.pinnedDropdownMenu = document.createElement('div');
|
|
436
444
|
this.pinnedDropdownMenu.classList.add(CSS_PREFIX + '__pinned-dropdown');
|
|
445
|
+
// Inherit theme CSS variables from editor container
|
|
446
|
+
// This ensures dropdowns match the editor's theme even when appended to body
|
|
447
|
+
const editorContainer = this.editorView.dom.closest('.kb-component') ||
|
|
448
|
+
this.editorView.dom.parentElement;
|
|
449
|
+
if (editorContainer) {
|
|
450
|
+
const computedStyle = getComputedStyle(editorContainer);
|
|
451
|
+
const themeVars = [
|
|
452
|
+
// New unified naming
|
|
453
|
+
'--kb-menu-dropdown-bg',
|
|
454
|
+
'--kb-menu-dropdown-border',
|
|
455
|
+
'--kb-menu-dropdown-text',
|
|
456
|
+
// Legacy naming (for backwards compatibility)
|
|
457
|
+
'--kb-menu-dropdown-dark-bg',
|
|
458
|
+
'--kb-menu-dropdown-dark-border',
|
|
459
|
+
'--kb-menu-dropdown-dark-text',
|
|
460
|
+
// General theme colors
|
|
461
|
+
'--kb-color-surface',
|
|
462
|
+
'--kb-color-surface-elevated',
|
|
463
|
+
'--kb-color-surface-hover',
|
|
464
|
+
'--kb-color-border',
|
|
465
|
+
'--kb-color-border-strong',
|
|
466
|
+
'--kb-color-text',
|
|
467
|
+
'--kb-color-text-muted',
|
|
468
|
+
];
|
|
469
|
+
themeVars.forEach((varName) => {
|
|
470
|
+
const value = computedStyle.getPropertyValue(varName).trim();
|
|
471
|
+
if (value) {
|
|
472
|
+
this.pinnedDropdownMenu.style.setProperty(varName, value);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
437
476
|
// Position it below the trigger element
|
|
438
477
|
const rect = triggerElement.getBoundingClientRect();
|
|
439
478
|
this.pinnedDropdownMenu.style.position = 'absolute';
|
|
@@ -933,10 +972,27 @@ export class CustomMenuView {
|
|
|
933
972
|
});
|
|
934
973
|
this.toolbar.appendChild(overflowToggle);
|
|
935
974
|
}
|
|
975
|
+
// Render trailing elements (always visible, not pinnable)
|
|
976
|
+
if (this.trailingElements.length > 0) {
|
|
977
|
+
// Add separator before trailing elements
|
|
978
|
+
const separator = document.createElement('div');
|
|
979
|
+
separator.classList.add(CSS_PREFIX + '__separator');
|
|
980
|
+
separator.classList.add(CSS_PREFIX + '__separator--trailing');
|
|
981
|
+
this.toolbar.appendChild(separator);
|
|
982
|
+
// Create a trailing group container
|
|
983
|
+
const trailingGroup = document.createElement('div');
|
|
984
|
+
trailingGroup.classList.add(CSS_PREFIX + '__trailing-group');
|
|
985
|
+
this.trailingElements.forEach((element) => {
|
|
986
|
+
const { dom, update } = element.render(this.editorView);
|
|
987
|
+
const wrapper = document.createElement('span');
|
|
988
|
+
wrapper.classList.add(CSS_PREFIX + '__trailing-item');
|
|
989
|
+
wrapper.appendChild(dom);
|
|
990
|
+
trailingGroup.appendChild(wrapper);
|
|
991
|
+
});
|
|
992
|
+
this.toolbar.appendChild(trailingGroup);
|
|
993
|
+
}
|
|
936
994
|
// Render overflow menu content
|
|
937
995
|
this.renderOverflowMenu();
|
|
938
|
-
console.log('[kb-custom-menu] render() complete. Toolbar children:', this.toolbar.children.length);
|
|
939
|
-
console.log('[kb-custom-menu] Toolbar HTML:', this.toolbar.innerHTML.substring(0, 200));
|
|
940
996
|
}
|
|
941
997
|
openManageModal() {
|
|
942
998
|
// Close overflow menu
|
|
@@ -1123,7 +1179,7 @@ export class CustomMenuPlugin extends Plugin {
|
|
|
1123
1179
|
constructor(editor, options) {
|
|
1124
1180
|
super({
|
|
1125
1181
|
view(editorView) {
|
|
1126
|
-
return new CustomMenuView(editorView, editor, options.content);
|
|
1182
|
+
return new CustomMenuView(editorView, editor, options.content, options.trailingElements);
|
|
1127
1183
|
},
|
|
1128
1184
|
});
|
|
1129
1185
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import "../../_dnt.polyfills.js";
|
|
1
2
|
import { Plugin } from 'prosemirror-state';
|
|
2
3
|
import { Extension } from '../../editor/src/mod.js';
|
|
3
4
|
import { type MenuElement } from './menu.js';
|
|
4
5
|
export interface CustomMenuOptions {
|
|
5
|
-
content
|
|
6
|
+
content?: readonly (readonly MenuElement[])[];
|
|
7
|
+
trailingElements?: readonly MenuElement[];
|
|
8
|
+
autoAddCollaborationStatus?: boolean;
|
|
9
|
+
autoAddLspStatus?: boolean;
|
|
6
10
|
}
|
|
7
|
-
export declare class ExtensionCustomMenu extends Extension {
|
|
11
|
+
export declare class ExtensionCustomMenu extends Extension<CustomMenuOptions> {
|
|
8
12
|
name: string;
|
|
9
13
|
getProseMirrorPlugins(): Plugin[];
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionCustomMenu.d.ts","sourceRoot":"","sources":["../../../src/extension-menu/src/ExtensionCustomMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ExtensionCustomMenu.d.ts","sourceRoot":"","sources":["../../../src/extension-menu/src/ExtensionCustomMenu.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,WAAW,iBAAiB;IAEhC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE,CAAC;IAG9C,gBAAgB,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAG1C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAGrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAGD,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACnE,IAAI,SAAgB;IAEX,qBAAqB,IAAI,MAAM,EAAE;CA2C3C"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import "../../_dnt.polyfills.js";
|
|
1
2
|
import { Extension } from '../../editor/src/mod.js';
|
|
2
3
|
import { buildMenu } from './buildMenu.js';
|
|
3
4
|
import { CustomMenuPlugin } from './CustomMenuPlugin.js';
|
|
5
|
+
import { CollaborationStatusElement } from '../../extension-yjs/src/CollaborationStatus.js';
|
|
6
|
+
import { LspStatusElement } from '../../extension-lsp/src/LspStatus.js';
|
|
4
7
|
/// Extension for a customizable menu with pinned items
|
|
5
8
|
export class ExtensionCustomMenu extends Extension {
|
|
6
9
|
constructor() {
|
|
@@ -13,10 +16,42 @@ export class ExtensionCustomMenu extends Extension {
|
|
|
13
16
|
});
|
|
14
17
|
}
|
|
15
18
|
getProseMirrorPlugins() {
|
|
16
|
-
const content =
|
|
19
|
+
const content = this.config?.content ??
|
|
20
|
+
buildMenu(this.editor, this.editor.schema);
|
|
21
|
+
const trailingElements = this.config?.trailingElements
|
|
22
|
+
? [...this.config.trailingElements]
|
|
23
|
+
: [];
|
|
24
|
+
// Auto-add collaboration status if YJS extension is present
|
|
25
|
+
const autoAdd = this.config?.autoAddCollaborationStatus ?? true;
|
|
26
|
+
if (autoAdd) {
|
|
27
|
+
const yjsExtension = this.editor.getExtension('yjs');
|
|
28
|
+
if (yjsExtension) {
|
|
29
|
+
const yjsConfig = yjsExtension.config;
|
|
30
|
+
if (yjsConfig?.provider?.awareness) {
|
|
31
|
+
const collabStatus = new CollaborationStatusElement({
|
|
32
|
+
awareness: yjsConfig.provider.awareness,
|
|
33
|
+
provider: yjsConfig.provider,
|
|
34
|
+
});
|
|
35
|
+
trailingElements.push(collabStatus);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Auto-add LSP status if LSP extension is present
|
|
40
|
+
const autoAddLsp = this.config?.autoAddLspStatus ?? true;
|
|
41
|
+
if (autoAddLsp) {
|
|
42
|
+
const lspExtension = this.editor.getExtension('lsp');
|
|
43
|
+
if (lspExtension) {
|
|
44
|
+
const lspStatus = new LspStatusElement({
|
|
45
|
+
lspExtension: lspExtension,
|
|
46
|
+
label: 'LSP',
|
|
47
|
+
});
|
|
48
|
+
trailingElements.push(lspStatus);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
17
51
|
return [
|
|
18
52
|
new CustomMenuPlugin(this.editor, {
|
|
19
53
|
content,
|
|
54
|
+
trailingElements,
|
|
20
55
|
}),
|
|
21
56
|
];
|
|
22
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/extension-menu/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,KAAK,WAAW,EAChB,QAAQ,EACR,KAAK,YAAY,GAClB,MAAM,WAAW,CAAC;AAEnB,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/extension-menu/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,eAAe,EACf,KAAK,WAAW,EAChB,QAAQ,EACR,KAAK,YAAY,GAClB,MAAM,WAAW,CAAC;AAEnB,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EditorState, Plugin, PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import type * as awarenessProtocol from 'y-protocols/awareness';
|
|
4
|
+
import type { MenuElement } from '../../extension-menu/src/mod.js';
|
|
5
|
+
export interface CollaborationUser {
|
|
6
|
+
clientId: number;
|
|
7
|
+
name: string;
|
|
8
|
+
color: string;
|
|
9
|
+
colorLight?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CollaborationStatusOptions {
|
|
12
|
+
/** The Yjs awareness instance */
|
|
13
|
+
awareness: awarenessProtocol.Awareness;
|
|
14
|
+
/** Called when connection status changes */
|
|
15
|
+
onStatusChange?: (status: 'connected' | 'connecting' | 'disconnected') => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Plugin key for accessing collaboration status state
|
|
19
|
+
*/
|
|
20
|
+
export declare const collaborationStatusPluginKey: PluginKey<CollaborationStatusState>;
|
|
21
|
+
export interface CollaborationStatusState {
|
|
22
|
+
status: 'connected' | 'connecting' | 'disconnected';
|
|
23
|
+
users: CollaborationUser[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a ProseMirror plugin that tracks collaboration status and user presence.
|
|
27
|
+
* This plugin maintains state that can be accessed by other components.
|
|
28
|
+
*/
|
|
29
|
+
export declare function collaborationStatusPlugin(awareness: awarenessProtocol.Awareness, options?: {
|
|
30
|
+
onStatusChange?: (status: 'connected' | 'connecting' | 'disconnected') => void;
|
|
31
|
+
}): Plugin;
|
|
32
|
+
/**
|
|
33
|
+
* A menu element that displays collaboration status, user count, and a dropdown of users.
|
|
34
|
+
*/
|
|
35
|
+
export declare class CollaborationStatusElement implements MenuElement {
|
|
36
|
+
private awareness;
|
|
37
|
+
private provider;
|
|
38
|
+
private dom;
|
|
39
|
+
private statusDot;
|
|
40
|
+
private userCount;
|
|
41
|
+
private dropdown;
|
|
42
|
+
private userList;
|
|
43
|
+
private isOpen;
|
|
44
|
+
private status;
|
|
45
|
+
constructor(options: {
|
|
46
|
+
awareness: awarenessProtocol.Awareness;
|
|
47
|
+
provider: any;
|
|
48
|
+
});
|
|
49
|
+
render(view: EditorView): {
|
|
50
|
+
dom: HTMLElement;
|
|
51
|
+
update: (state: EditorState) => boolean;
|
|
52
|
+
};
|
|
53
|
+
private setStatus;
|
|
54
|
+
private updateUserList;
|
|
55
|
+
private toggleDropdown;
|
|
56
|
+
private openDropdown;
|
|
57
|
+
private closeDropdown;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=CollaborationStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollaborationStatus.d.ts","sourceRoot":"","sources":["../../../src/extension-yjs/src/CollaborationStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAA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