@kerebron/extension-codejar 0.4.27 → 0.4.29
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/esm/CodeJar.d.ts +51 -0
- package/esm/CodeJar.d.ts.map +1 -0
- package/esm/CodeJar.js +549 -0
- package/esm/CodeJar.js.map +1 -0
- package/esm/Decorator.d.ts +11 -0
- package/esm/Decorator.d.ts.map +1 -0
- package/esm/Decorator.js +46 -0
- package/esm/Decorator.js.map +1 -0
- package/esm/ExtensionCodeJar.d.ts +15 -0
- package/esm/ExtensionCodeJar.d.ts.map +1 -0
- package/esm/ExtensionCodeJar.js +62 -0
- package/esm/ExtensionCodeJar.js.map +1 -0
- package/esm/NodeCodeJar.d.ts +18 -0
- package/esm/NodeCodeJar.d.ts.map +1 -0
- package/esm/NodeCodeJar.js +70 -0
- package/esm/NodeCodeJar.js.map +1 -0
- package/esm/TreeSitterHighlighter.d.ts +11 -0
- package/esm/TreeSitterHighlighter.d.ts.map +1 -0
- package/esm/TreeSitterHighlighter.js +63 -0
- package/esm/TreeSitterHighlighter.js.map +1 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +58 -0
- package/esm/_dnt.shims.js.map +1 -0
- package/esm/codeJarBlockNodeView.d.ts +6 -0
- package/esm/codeJarBlockNodeView.d.ts.map +1 -0
- package/esm/codeJarBlockNodeView.js +254 -0
- package/esm/codeJarBlockNodeView.js.map +1 -0
- package/esm/codeJarLineNumbers.d.ts +13 -0
- package/esm/codeJarLineNumbers.d.ts.map +1 -0
- package/esm/codeJarLineNumbers.js +86 -0
- package/esm/codeJarLineNumbers.js.map +1 -0
- package/esm/mod.d.ts +2 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +2 -0
- package/esm/mod.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/utils.d.ts +13 -0
- package/esm/utils.d.ts.map +1 -0
- package/esm/utils.js +49 -0
- package/esm/utils.js.map +1 -0
- package/package.json +11 -8
- package/src/CodeJar.ts +636 -0
- package/src/Decorator.ts +67 -0
- package/src/ExtensionCodeJar.ts +83 -0
- package/src/NodeCodeJar.ts +107 -0
- package/src/TreeSitterHighlighter.ts +85 -0
- package/src/_dnt.shims.ts +60 -0
- package/src/codeJarBlockNodeView.ts +372 -0
- package/src/codeJarLineNumbers.ts +129 -0
- package/src/mod.ts +1 -0
- package/src/utils.ts +77 -0
package/esm/Decorator.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export class Decorator {
|
|
2
|
+
decorationGroups = {};
|
|
3
|
+
highlight(code) {
|
|
4
|
+
const decorations = [];
|
|
5
|
+
for (const groupName in this.decorationGroups) {
|
|
6
|
+
const group = this.decorationGroups[groupName];
|
|
7
|
+
decorations.push(...group);
|
|
8
|
+
}
|
|
9
|
+
const cutIndexes = new Set();
|
|
10
|
+
for (const d of decorations) {
|
|
11
|
+
cutIndexes.add(d.startIndex);
|
|
12
|
+
cutIndexes.add(d.endIndex);
|
|
13
|
+
}
|
|
14
|
+
cutIndexes.add(0);
|
|
15
|
+
cutIndexes.add(code.length);
|
|
16
|
+
const cutIndexesArr = Array.from(cutIndexes);
|
|
17
|
+
cutIndexesArr.sort((a, b) => a - b);
|
|
18
|
+
let html = '';
|
|
19
|
+
let lastIndex = 0;
|
|
20
|
+
for (const currentIdx of cutIndexesArr) {
|
|
21
|
+
const text = code.substring(lastIndex, currentIdx);
|
|
22
|
+
const activeDecors = decorations.filter((d) => lastIndex >= d.startIndex && currentIdx <= d.endIndex);
|
|
23
|
+
for (const decor of activeDecors) {
|
|
24
|
+
if (decor.title) {
|
|
25
|
+
html += `<span class="${decor.className}" title="${escapeHtml(decor.title || '')}">`;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
html += `<span class="${decor.className}">`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
html += escapeHtml(text);
|
|
32
|
+
for (const decor of activeDecors) {
|
|
33
|
+
html += '</span>';
|
|
34
|
+
}
|
|
35
|
+
lastIndex = currentIdx;
|
|
36
|
+
}
|
|
37
|
+
return html;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function escapeHtml(text) {
|
|
41
|
+
return text
|
|
42
|
+
.replace(/&/g, '&')
|
|
43
|
+
.replace(/</g, '<')
|
|
44
|
+
.replace(/>/g, '>');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decorator.js","sourceRoot":"","sources":["../src/Decorator.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,SAAS;IACb,gBAAgB,GAAuC,EAAE,CAAC;IAEjE,SAAS,CAAC,IAAY;QACpB,MAAM,WAAW,GAAuB,EAAE,CAAC;QAE3C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAC/C,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;QACrC,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC7B,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAClB,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE5B,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAEpC,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACnD,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC5C,SAAS,IAAI,CAAC,CAAC,UAAU,IAAI,UAAU,IAAI,CAAC,CAAC,QAAQ,CACtD,CAAC;YAEF,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;gBACjC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;oBAChB,IAAI,IAAI,gBAAgB,KAAK,CAAC,SAAS,YACrC,UAAU,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAC9B,IAAI,CAAC;gBACP,CAAC;qBAAM,CAAC;oBACN,IAAI,IAAI,gBAAgB,KAAK,CAAC,SAAS,IAAI,CAAC;gBAC9C,CAAC;YACH,CAAC;YAED,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;YAEzB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;gBACjC,IAAI,IAAI,SAAS,CAAC;YACpB,CAAC;YAED,SAAS,GAAG,UAAU,CAAC;QACzB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Schema } from 'prosemirror-model';
|
|
2
|
+
import { AnyExtensionOrReq, type Converter, type CoreEditor, Extension } from '@kerebron/editor';
|
|
3
|
+
export * from './NodeCodeJar.js';
|
|
4
|
+
export interface ExtensionCodeJarConfig {
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
languageWhitelist?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare class ExtensionCodeJar extends Extension {
|
|
9
|
+
protected config: ExtensionCodeJarConfig;
|
|
10
|
+
name: string;
|
|
11
|
+
requires: AnyExtensionOrReq[];
|
|
12
|
+
constructor(config?: ExtensionCodeJarConfig);
|
|
13
|
+
getConverters(editor: CoreEditor, schema: Schema): Record<string, Converter>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ExtensionCodeJar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionCodeJar.d.ts","sourceRoot":"","sources":["../src/ExtensionCodeJar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,SAAS,EACV,MAAM,kBAAkB,CAAC;AAI1B,cAAc,kBAAkB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,qBAAa,gBAAiB,SAAQ,SAAS;cAId,MAAM,EAAE,sBAAsB;IAHpD,IAAI,SAAc;IAC3B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAEC,MAAM,GAAE,sBAA2B;IAWzD,aAAa,CACpB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;CA+C7B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Extension, } from '@kerebron/editor';
|
|
2
|
+
import { createNodeFromObject } from '@kerebron/editor/utilities';
|
|
3
|
+
import { NodeCodeJar } from './NodeCodeJar.js';
|
|
4
|
+
export * from './NodeCodeJar.js';
|
|
5
|
+
export class ExtensionCodeJar extends Extension {
|
|
6
|
+
config;
|
|
7
|
+
name = 'code-jar';
|
|
8
|
+
requires;
|
|
9
|
+
constructor(config = {}) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.requires = [
|
|
13
|
+
new NodeCodeJar({
|
|
14
|
+
languageWhitelist: config.languageWhitelist,
|
|
15
|
+
// theme: config.theme,
|
|
16
|
+
}),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
getConverters(editor, schema) {
|
|
20
|
+
return {
|
|
21
|
+
'text/code-only': {
|
|
22
|
+
fromDoc: async (document) => {
|
|
23
|
+
const retVal = [];
|
|
24
|
+
if (document.content) {
|
|
25
|
+
for (const node of document.content.toJSON()) {
|
|
26
|
+
if ('code_block' === node.type && Array.isArray(node.content)) {
|
|
27
|
+
for (const content of node.content) {
|
|
28
|
+
retVal.push(content.text);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return new TextEncoder().encode(retVal.join(''));
|
|
34
|
+
},
|
|
35
|
+
toDoc: async (buffer) => {
|
|
36
|
+
const code = new TextDecoder().decode(buffer);
|
|
37
|
+
const content = {
|
|
38
|
+
'type': 'doc_code',
|
|
39
|
+
'content': [
|
|
40
|
+
{
|
|
41
|
+
'type': 'code_block',
|
|
42
|
+
'attrs': {
|
|
43
|
+
'lang': schema.topNodeType.spec.defaultAttrs?.lang,
|
|
44
|
+
},
|
|
45
|
+
'content': [
|
|
46
|
+
{
|
|
47
|
+
'type': 'text',
|
|
48
|
+
'text': code,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
return createNodeFromObject(content, schema, {
|
|
55
|
+
errorOnInvalidContent: false,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|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CAAC;oBACD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnD,CAAC;gBACD,KAAK,EAAE,KAAK,EAAE,MAAkB,EAAiB,EAAE;oBACjD,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC9C,MAAM,OAAO,GAAG;wBACd,MAAM,EAAE,UAAU;wBAClB,SAAS,EAAE;4BACT;gCACE,MAAM,EAAE,YAAY;gCACpB,OAAO,EAAE;oCACP,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI;iCACnD;gCACD,SAAS,EAAE;oCACT;wCACE,MAAM,EAAE,MAAM;wCACd,MAAM,EAAE,IAAI;qCACb;iCACF;6BACF;yBACF;qBACF,CAAC;oBAEF,OAAO,oBAAoB,CACzB,OAAO,EACP,MAAM,EACN;wBACE,qBAAqB,EAAE,KAAK;qBAC7B,CACF,CAAC;gBACJ,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
|
+
import type { NodeType } from 'prosemirror-model';
|
|
3
|
+
import { type CoreEditor } from '@kerebron/editor';
|
|
4
|
+
import { type CommandFactories, type CommandShortcuts } from '@kerebron/editor/commands';
|
|
5
|
+
import { NodeCodeBlock } from '@kerebron/extension-basic-editor/NodeCodeBlock';
|
|
6
|
+
export declare const codeJarBlockKey: PluginKey<any>;
|
|
7
|
+
export interface NodeCodeJarConfig {
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
languageWhitelist?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare class NodeCodeJar extends NodeCodeBlock {
|
|
12
|
+
config: NodeCodeJarConfig;
|
|
13
|
+
constructor(config: NodeCodeJarConfig);
|
|
14
|
+
getCommandFactories(editor: CoreEditor, type: NodeType): Partial<CommandFactories>;
|
|
15
|
+
getKeyboardShortcuts(): Partial<CommandShortcuts>;
|
|
16
|
+
getProseMirrorPlugins(): Plugin[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=NodeCodeJar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeCodeJar.d.ts","sourceRoot":"","sources":["../src/NodeCodeJar.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EACN,SAAS,EAGV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAI/E,eAAO,MAAM,eAAe,gBAAkC,CAAC;AAwB/D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,qBAAa,WAAY,SAAQ,aAAa;IACvB,MAAM,EAAE,iBAAiB;gBAAzB,MAAM,EAAE,iBAAiB;IAIrC,mBAAmB,CAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,gBAAgB,CAAC;IAWnB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAUjD,qBAAqB,IAAI,MAAM,EAAE;CA0B3C"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Plugin, PluginKey, Selection, } from 'prosemirror-state';
|
|
2
|
+
import { getShadowRoot } from '@kerebron/editor/utilities';
|
|
3
|
+
import { getLangsList } from '@kerebron/wasm';
|
|
4
|
+
import { NodeCodeBlock } from '@kerebron/extension-basic-editor/NodeCodeBlock';
|
|
5
|
+
import { codeJarBlockNodeView } from './codeJarBlockNodeView.js';
|
|
6
|
+
export const codeJarBlockKey = new PluginKey('code-jar-block');
|
|
7
|
+
function arrowHandler(dir) {
|
|
8
|
+
return (state, dispatch, view) => {
|
|
9
|
+
if (state.selection.empty && view.endOfTextblock(dir)) {
|
|
10
|
+
let side = dir == 'left' || dir == 'up' ? -1 : 1;
|
|
11
|
+
let $head = state.selection.$head;
|
|
12
|
+
let nextPos = Selection.near(state.doc.resolve(side > 0 ? $head.after() : $head.before()), side);
|
|
13
|
+
if (nextPos.$head && nextPos.$head.parent.type.name == 'code_block') {
|
|
14
|
+
dispatch(state.tr.setSelection(nextPos));
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export class NodeCodeJar extends NodeCodeBlock {
|
|
22
|
+
config;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
super(config);
|
|
25
|
+
this.config = config;
|
|
26
|
+
}
|
|
27
|
+
getCommandFactories(editor, type) {
|
|
28
|
+
return {
|
|
29
|
+
'setCodeBlock': (lang) => editor.commandFactories.setBlockType(type, { lang }),
|
|
30
|
+
// ArrowLeft: () => arrowHandler('left'),
|
|
31
|
+
// ArrowRight: () => arrowHandler('right'),
|
|
32
|
+
// ArrowUp: () => arrowHandler('up'),
|
|
33
|
+
// ArrowDown: () => arrowHandler('down'),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
getKeyboardShortcuts() {
|
|
37
|
+
return {
|
|
38
|
+
'Shift-Ctrl-"': 'setCodeBlock',
|
|
39
|
+
'ArrowLeft': 'ArrowLeft',
|
|
40
|
+
'ArrowRight': 'ArrowRight',
|
|
41
|
+
'ArrowUp': 'ArrowUp',
|
|
42
|
+
'ArrowDown': 'ArrowDown',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
getProseMirrorPlugins() {
|
|
46
|
+
const shadowRoot = getShadowRoot(this.editor.config.element);
|
|
47
|
+
const settings = {
|
|
48
|
+
languageWhitelist: this.config.languageWhitelist || getLangsList(),
|
|
49
|
+
shadowRoot,
|
|
50
|
+
readOnly: this.editor.config.readOnly || this.config.readOnly,
|
|
51
|
+
undo: () => {
|
|
52
|
+
this.editor.chain().undo().run();
|
|
53
|
+
},
|
|
54
|
+
redo: () => {
|
|
55
|
+
this.editor.chain().redo().run();
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
return [
|
|
59
|
+
new Plugin({
|
|
60
|
+
key: codeJarBlockKey,
|
|
61
|
+
props: {
|
|
62
|
+
nodeViews: {
|
|
63
|
+
[this.name]: codeJarBlockNodeView(settings, this.editor),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=NodeCodeJar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeCodeJar.js","sourceRoot":"","sources":["../src/NodeCodeJar.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EACN,SAAS,EACT,SAAS,GAEV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAM3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAE/D,SAAS,YAAY,CAAC,GAAqC;IACzD,OAAO,CACL,KAAkB,EAClB,QAAmC,EACnC,IAAgB,EAChB,EAAE;QACF,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACtD,IAA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AE,WAAW;SACzB,CAAC;IACJ,CAAC;IAEQ,qBAAqB;QAC5B,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE7D,MAAM,QAAQ,GAAG;YACf,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI,YAAY,EAAE;YAClE,UAAU;YACV,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC7D,IAAI,EAAE,GAAG,EAAE;gBACT,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC;YACnC,CAAC;YACD,IAAI,EAAE,GAAG,EAAE;gBACT,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC;YACnC,CAAC;SACF,CAAC;QAEF,OAAO;YACL,IAAI,MAAM,CAAC;gBACT,GAAG,EAAE,eAAe;gBACpB,KAAK,EAAE;oBACL,SAAS,EAAE;wBACT,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;qBACzD;iBACF;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Parser } from '@kerebron/tree-sitter';
|
|
2
|
+
import { Decorator } from './Decorator.js';
|
|
3
|
+
export declare class TreeSitterHighlighter {
|
|
4
|
+
parser: Parser | undefined;
|
|
5
|
+
hightligtScm: string | undefined;
|
|
6
|
+
cdnUrl?: string | undefined;
|
|
7
|
+
lang?: string;
|
|
8
|
+
init(lang: string): Promise<boolean>;
|
|
9
|
+
highlight(code: string, decorator: Decorator): string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=TreeSitterHighlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeSitterHighlighter.d.ts","sourceRoot":"","sources":["../src/TreeSitterHighlighter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQlE,OAAO,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,qBAAa,qBAAqB;IAChC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,MAAM,CAAC,qBAAiC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IAER,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgC1C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;CAoC7C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createParser } from '@kerebron/tree-sitter';
|
|
2
|
+
import { fetchTextResource, fetchWasm, getLangTreeSitter, } from '@kerebron/wasm';
|
|
3
|
+
export class TreeSitterHighlighter {
|
|
4
|
+
parser;
|
|
5
|
+
hightligtScm;
|
|
6
|
+
cdnUrl = 'http://localhost:8000/wasm/';
|
|
7
|
+
lang;
|
|
8
|
+
async init(lang) {
|
|
9
|
+
this.lang = lang;
|
|
10
|
+
if (!lang) {
|
|
11
|
+
this.parser = undefined;
|
|
12
|
+
this.hightligtScm = undefined;
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
const treeSitterConfig = getLangTreeSitter(lang, this.cdnUrl);
|
|
16
|
+
const wasmUrl = treeSitterConfig.files[0]; // TODO add support for split parsers like markdown
|
|
17
|
+
const highlightUrl = treeSitterConfig.queries['highlights.scm'];
|
|
18
|
+
try {
|
|
19
|
+
const wasm = await fetchWasm(wasmUrl);
|
|
20
|
+
this.parser = await createParser(wasm);
|
|
21
|
+
this.hightligtScm = await fetchTextResource(highlightUrl);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
console.error('Error init highlight for: ' + lang, err);
|
|
25
|
+
}
|
|
26
|
+
if (!this.parser) {
|
|
27
|
+
console.warn('Parser not inited');
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (!this.hightligtScm) {
|
|
31
|
+
console.warn('hightligtScm not inited');
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
highlight(code, decorator) {
|
|
37
|
+
if (!this.lang || !this.parser || !this.hightligtScm) {
|
|
38
|
+
decorator.decorationGroups['highlight'] = [];
|
|
39
|
+
return decorator.highlight(code);
|
|
40
|
+
}
|
|
41
|
+
const tree = this.parser.parse(code);
|
|
42
|
+
const root = tree.rootNode;
|
|
43
|
+
const highlightsQuery = root.query(this.hightligtScm);
|
|
44
|
+
const captures = [];
|
|
45
|
+
for (const item of highlightsQuery) {
|
|
46
|
+
captures.push(...item.captures);
|
|
47
|
+
}
|
|
48
|
+
const decorations = [];
|
|
49
|
+
for (const capture of captures) {
|
|
50
|
+
const { node, name } = capture; // name is the capture like "@string"
|
|
51
|
+
const startIndex = node.startIndex;
|
|
52
|
+
const endIndex = node.endIndex;
|
|
53
|
+
decorations.push({
|
|
54
|
+
startIndex,
|
|
55
|
+
endIndex,
|
|
56
|
+
className: 'ts-' + name.replaceAll('.', '_'),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
decorator.decorationGroups['highlight'] = decorations;
|
|
60
|
+
return decorator.highlight(code);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=TreeSitterHighlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeSitterHighlighter.js","sourceRoot":"","sources":["../src/TreeSitterHighlighter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAC;AAElE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,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,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const dntGlobals = {};
|
|
2
|
+
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
3
|
+
function createMergeProxy(baseObj, extObj) {
|
|
4
|
+
return new Proxy(baseObj, {
|
|
5
|
+
get(_target, prop, _receiver) {
|
|
6
|
+
if (prop in extObj) {
|
|
7
|
+
return extObj[prop];
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return baseObj[prop];
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
set(_target, prop, value) {
|
|
14
|
+
if (prop in extObj) {
|
|
15
|
+
delete extObj[prop];
|
|
16
|
+
}
|
|
17
|
+
baseObj[prop] = value;
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
deleteProperty(_target, prop) {
|
|
21
|
+
let success = false;
|
|
22
|
+
if (prop in extObj) {
|
|
23
|
+
delete extObj[prop];
|
|
24
|
+
success = true;
|
|
25
|
+
}
|
|
26
|
+
if (prop in baseObj) {
|
|
27
|
+
delete baseObj[prop];
|
|
28
|
+
success = true;
|
|
29
|
+
}
|
|
30
|
+
return success;
|
|
31
|
+
},
|
|
32
|
+
ownKeys(_target) {
|
|
33
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
34
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
35
|
+
const extKeysSet = new Set(extKeys);
|
|
36
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
37
|
+
},
|
|
38
|
+
defineProperty(_target, prop, desc) {
|
|
39
|
+
if (prop in extObj) {
|
|
40
|
+
delete extObj[prop];
|
|
41
|
+
}
|
|
42
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
43
|
+
return true;
|
|
44
|
+
},
|
|
45
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
46
|
+
if (prop in extObj) {
|
|
47
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
has(_target, prop) {
|
|
54
|
+
return prop in extObj || prop in baseObj;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=_dnt.shims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.js","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,EAClB,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAEtE,SAAS,gBAAgB,CACvB,OAAU,EACV,MAAS;IAET,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE;QACxB,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS;YAC1B,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBACnB,OAAQ,MAAc,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,OAAQ,OAAe,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QACD,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK;YACtB,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBACnB,OAAQ,MAAc,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YACA,OAAe,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,cAAc,CAAC,OAAO,EAAE,IAAI;YAC1B,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,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ACf,OAAO,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,CAAC;QAC3C,CAAC;KACF,CAAQ,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { Decoration, DecorationSource, EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { CoreEditor } from '@kerebron/editor';
|
|
4
|
+
import { NodeCodeJarConfig } from './NodeCodeJar.js';
|
|
5
|
+
export declare const codeJarBlockNodeView: (settings: NodeCodeJarConfig, editor: CoreEditor) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView;
|
|
6
|
+
//# sourceMappingURL=codeJarBlockNodeView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeJarBlockNodeView.d.ts","sourceRoot":"","sources":["../src/codeJarBlockNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAc7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAkUrD,eAAO,MAAM,oBAAoB,EAAE,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,UAAU,KACf,CACH,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,EAChC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,gBAAgB,EAAE,gBAAgB,KAC/B,QAgBJ,CAAC"}
|