@kerebron/extension-codemirror 0.4.8 → 0.4.10

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.
@@ -3,26 +3,12 @@ import { createNodeFromObject } from '@kerebron/editor/utilities';
3
3
  import { NodeCodeMirror } from './NodeCodeMirror.js';
4
4
  export * from './NodeCodeMirror.js';
5
5
  export class ExtensionCodeMirror extends Extension {
6
+ config;
7
+ name = 'code-mirror';
8
+ requires;
6
9
  constructor(config) {
7
10
  super(config);
8
- Object.defineProperty(this, "config", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: config
13
- });
14
- Object.defineProperty(this, "name", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: 'code-mirror'
19
- });
20
- Object.defineProperty(this, "requires", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: void 0
25
- });
11
+ this.config = config;
26
12
  this.requires = [
27
13
  new NodeCodeMirror({
28
14
  languageWhitelist: config.languageWhitelist,
@@ -42,14 +42,10 @@ const LANGS = [
42
42
  'html',
43
43
  ];
44
44
  export class NodeCodeMirror extends NodeCodeBlock {
45
+ config;
45
46
  constructor(config) {
46
47
  super(config);
47
- Object.defineProperty(this, "config", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: config
52
- });
48
+ this.config = config;
53
49
  }
54
50
  getCommandFactories(editor, type) {
55
51
  return {
@@ -11,85 +11,25 @@ import { languageServerExtensions, LSPPlugin } from './lsp/index.js';
11
11
  import { LSPExtension } from './lsp/LSPExtension.js';
12
12
  export const themeCallbacks = [];
13
13
  class CodeMirrorBlockNodeView {
14
+ node;
15
+ view;
16
+ getPos;
17
+ settings;
18
+ editor;
19
+ dom;
20
+ codeMirrorView;
21
+ updating;
22
+ createCopyButtonCB;
23
+ selectDeleteCB;
24
+ languageConf;
25
+ uri = 'file:///' + Math.random() + '.ts';
26
+ diagListener;
14
27
  constructor(node, view, getPos, settings, editor) {
15
- Object.defineProperty(this, "node", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: node
20
- });
21
- Object.defineProperty(this, "view", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: view
26
- });
27
- Object.defineProperty(this, "getPos", {
28
- enumerable: true,
29
- configurable: true,
30
- writable: true,
31
- value: getPos
32
- });
33
- Object.defineProperty(this, "settings", {
34
- enumerable: true,
35
- configurable: true,
36
- writable: true,
37
- value: settings
38
- });
39
- Object.defineProperty(this, "editor", {
40
- enumerable: true,
41
- configurable: true,
42
- writable: true,
43
- value: editor
44
- });
45
- Object.defineProperty(this, "dom", {
46
- enumerable: true,
47
- configurable: true,
48
- writable: true,
49
- value: void 0
50
- });
51
- Object.defineProperty(this, "codeMirrorView", {
52
- enumerable: true,
53
- configurable: true,
54
- writable: true,
55
- value: void 0
56
- });
57
- Object.defineProperty(this, "updating", {
58
- enumerable: true,
59
- configurable: true,
60
- writable: true,
61
- value: void 0
62
- });
63
- Object.defineProperty(this, "createCopyButtonCB", {
64
- enumerable: true,
65
- configurable: true,
66
- writable: true,
67
- value: void 0
68
- });
69
- Object.defineProperty(this, "selectDeleteCB", {
70
- enumerable: true,
71
- configurable: true,
72
- writable: true,
73
- value: void 0
74
- });
75
- Object.defineProperty(this, "languageConf", {
76
- enumerable: true,
77
- configurable: true,
78
- writable: true,
79
- value: void 0
80
- });
81
- Object.defineProperty(this, "uri", {
82
- enumerable: true,
83
- configurable: true,
84
- writable: true,
85
- value: 'file:///' + Math.random() + '.ts'
86
- });
87
- Object.defineProperty(this, "diagListener", {
88
- enumerable: true,
89
- configurable: true,
90
- writable: true,
91
- value: void 0
92
- });
28
+ this.node = node;
29
+ this.view = view;
30
+ this.getPos = getPos;
31
+ this.settings = settings;
32
+ this.editor = editor;
93
33
  this.updating = false;
94
34
  const dom = document.createElement('div');
95
35
  this.dom = dom;
@@ -1,19 +1,10 @@
1
1
  import { lspPlugin } from './plugin.js';
2
2
  import { lspTheme } from './theme.js';
3
3
  export class LSPExtension {
4
+ config;
5
+ extensions = [];
4
6
  constructor(config) {
5
- Object.defineProperty(this, "config", {
6
- enumerable: true,
7
- configurable: true,
8
- writable: true,
9
- value: config
10
- });
11
- Object.defineProperty(this, "extensions", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: []
16
- });
7
+ this.config = config;
17
8
  if (config.extensions) {
18
9
  for (const ext of config.extensions) {
19
10
  this.extensions.push(ext);
package/esm/lsp/plugin.js CHANGED
@@ -4,58 +4,19 @@ import { escHTML } from './text.js';
4
4
  import { PositionMapper } from '@kerebron/extension-markdown/PositionMapper';
5
5
  import { toRawTextResult } from '@kerebron/editor/utilities';
6
6
  export class LSPPlugin {
7
+ view;
8
+ extensionLsp;
9
+ uri;
10
+ editor;
11
+ extension;
12
+ lang = 'plaintext';
13
+ client;
14
+ source;
7
15
  /// @internal
8
16
  constructor(
9
17
  /// The editor view that this plugin belongs to.
10
18
  view, { extension, extensionLsp, uri, editor }) {
11
- Object.defineProperty(this, "view", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: view
16
- });
17
- Object.defineProperty(this, "extensionLsp", {
18
- enumerable: true,
19
- configurable: true,
20
- writable: true,
21
- value: void 0
22
- });
23
- Object.defineProperty(this, "uri", {
24
- enumerable: true,
25
- configurable: true,
26
- writable: true,
27
- value: void 0
28
- });
29
- Object.defineProperty(this, "editor", {
30
- enumerable: true,
31
- configurable: true,
32
- writable: true,
33
- value: void 0
34
- });
35
- Object.defineProperty(this, "extension", {
36
- enumerable: true,
37
- configurable: true,
38
- writable: true,
39
- value: void 0
40
- });
41
- Object.defineProperty(this, "lang", {
42
- enumerable: true,
43
- configurable: true,
44
- writable: true,
45
- value: 'plaintext'
46
- });
47
- Object.defineProperty(this, "client", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
52
- });
53
- Object.defineProperty(this, "source", {
54
- enumerable: true,
55
- configurable: true,
56
- writable: true,
57
- value: void 0
58
- });
19
+ this.view = view;
59
20
  this.extension = extension;
60
21
  this.extensionLsp = extensionLsp;
61
22
  this.uri = uri;
@@ -62,20 +62,12 @@ export const yRemoteSelectionsTheme = cmView.EditorView.baseTheme({
62
62
  });
63
63
  const yRemoteSelectionsAnnotation = cmState.Annotation.define();
64
64
  class YRemoteCaretWidget extends cmView.WidgetType {
65
+ color;
66
+ name;
65
67
  constructor(color, name) {
66
68
  super();
67
- Object.defineProperty(this, "color", {
68
- enumerable: true,
69
- configurable: true,
70
- writable: true,
71
- value: color
72
- });
73
- Object.defineProperty(this, "name", {
74
- enumerable: true,
75
- configurable: true,
76
- writable: true,
77
- value: name
78
- });
69
+ this.color = color;
70
+ this.name = name;
79
71
  }
80
72
  toDOM() {
81
73
  return (dom.element('span', [
@@ -108,31 +100,11 @@ class YRemoteCaretWidget extends cmView.WidgetType {
108
100
  }
109
101
  }
110
102
  export class YRemoteSelectionsPluginValue {
103
+ conf;
104
+ editor;
105
+ decorations;
106
+ _remoteSelectionChange;
111
107
  constructor(view) {
112
- Object.defineProperty(this, "conf", {
113
- enumerable: true,
114
- configurable: true,
115
- writable: true,
116
- value: void 0
117
- });
118
- Object.defineProperty(this, "editor", {
119
- enumerable: true,
120
- configurable: true,
121
- writable: true,
122
- value: void 0
123
- });
124
- Object.defineProperty(this, "decorations", {
125
- enumerable: true,
126
- configurable: true,
127
- writable: true,
128
- value: void 0
129
- });
130
- Object.defineProperty(this, "_remoteSelectionChange", {
131
- enumerable: true,
132
- configurable: true,
133
- writable: true,
134
- value: void 0
135
- });
136
108
  this.conf = view.state.facet(remoteSyncFacet);
137
109
  this.editor = this.conf.editor;
138
110
  this.decorations = cmState.RangeSet.of([]);
@@ -1,24 +1,12 @@
1
1
  import * as cmState from '@codemirror/state';
2
2
  export class RemoteSyncConfig {
3
+ getNode;
4
+ getPmPos;
5
+ editor;
3
6
  constructor(getNode, getPmPos, editor) {
4
- Object.defineProperty(this, "getNode", {
5
- enumerable: true,
6
- configurable: true,
7
- writable: true,
8
- value: getNode
9
- });
10
- Object.defineProperty(this, "getPmPos", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: getPmPos
15
- });
16
- Object.defineProperty(this, "editor", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: editor
21
- });
7
+ this.getNode = getNode;
8
+ this.getPmPos = getPmPos;
9
+ this.editor = editor;
22
10
  }
23
11
  }
24
12
  export const remoteSyncFacet = cmState.Facet
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@kerebron/extension-codemirror",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "license": "MIT",
5
5
  "module": "./esm/ExtensionCodeMirror.js",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./esm/ExtensionCodeMirror.js"
9
+ },
10
+ "./assets/*.css": {
11
+ "import": "./assets/*.css"
9
12
  }
10
13
  },
11
14
  "scripts": {},
@@ -31,10 +34,10 @@
31
34
  "@codemirror/search": "6.5.10",
32
35
  "@codemirror/state": "6.5.2",
33
36
  "@codemirror/view": "6.38.1",
34
- "@kerebron/editor": "0.4.8",
35
- "@kerebron/extension-basic-editor": "0.4.8",
36
- "@kerebron/extension-lsp": "0.4.8",
37
- "@kerebron/extension-markdown": "0.4.8",
37
+ "@kerebron/editor": "0.4.10",
38
+ "@kerebron/extension-basic-editor": "0.4.10",
39
+ "@kerebron/extension-lsp": "0.4.10",
40
+ "@kerebron/extension-markdown": "0.4.10",
38
41
  "lib0": "0.2.109",
39
42
  "prosemirror-model": "1.25.3",
40
43
  "prosemirror-state": "1.4.3",