@difizen/libro-codemirror 0.2.35-next.0 → 0.2.36
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/auto-complete/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/auto-complete/theme.ts"],"names":[],"mappings":"AAGA,0BAAkB,IAAI;IACpB,MAAM,KAAK;IACX,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,SAAS,uCAsHpB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
2
3
|
export var Info = /*#__PURE__*/function (Info) {
|
|
3
4
|
Info[Info["Margin"] = 30] = "Margin";
|
|
4
5
|
Info[Info["Width"] = 400] = "Width";
|
|
@@ -102,22 +103,22 @@ export var baseTheme = EditorView.baseTheme({
|
|
|
102
103
|
},
|
|
103
104
|
'.cm-completionIcon-interface': {
|
|
104
105
|
'&:after': {
|
|
105
|
-
content: "'◌'"
|
|
106
|
+
content: l10n.t("'◌'")
|
|
106
107
|
}
|
|
107
108
|
},
|
|
108
109
|
'.cm-completionIcon-variable': {
|
|
109
110
|
'&:after': {
|
|
110
|
-
content: "'𝑥'"
|
|
111
|
+
content: l10n.t("'𝑥'")
|
|
111
112
|
}
|
|
112
113
|
},
|
|
113
114
|
'.cm-completionIcon-constant': {
|
|
114
115
|
'&:after': {
|
|
115
|
-
content: "'𝐶'"
|
|
116
|
+
content: l10n.t("'𝐶'")
|
|
116
117
|
}
|
|
117
118
|
},
|
|
118
119
|
'.cm-completionIcon-type': {
|
|
119
120
|
'&:after': {
|
|
120
|
-
content: "'𝑡'"
|
|
121
|
+
content: l10n.t("'𝑡'")
|
|
121
122
|
}
|
|
122
123
|
},
|
|
123
124
|
'.cm-completionIcon-enum': {
|
|
@@ -137,7 +138,7 @@ export var baseTheme = EditorView.baseTheme({
|
|
|
137
138
|
},
|
|
138
139
|
'.cm-completionIcon-namespace': {
|
|
139
140
|
'&:after': {
|
|
140
|
-
content: "'▢'"
|
|
141
|
+
content: l10n.t("'▢'")
|
|
141
142
|
}
|
|
142
143
|
},
|
|
143
144
|
'.cm-completionIcon-text': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../src/editor-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../src/editor-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAOpE,qBACa,4BAA6B,YAAW,sBAAsB;IAEzE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO/B,OAAO,EAAE,iBAAiB,CAA2B;IACrD,YAAY,0DAAgB;IAC5B,aAAa,mDAA2B;CACzC"}
|
|
@@ -6,6 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
import { CodeEditorContribution } from '@difizen/libro-code-editor';
|
|
9
|
+
import { MIME } from '@difizen/libro-common';
|
|
9
10
|
import { singleton } from '@difizen/mana-app';
|
|
10
11
|
import { codeMirrorDefaultConfig } from "./editor.js";
|
|
11
12
|
import { codeMirrorEditorFactory, stateFactory } from "./factory.js";
|
|
@@ -23,8 +24,11 @@ export var CodeMirrorEditorContribution = (_dec = singleton({
|
|
|
23
24
|
value:
|
|
24
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
26
|
function canHandle(mime) {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
var mimes = [MIME.codemirror, MIME.text];
|
|
28
|
+
if (mimes.includes(mime)) {
|
|
29
|
+
return 50 + 1;
|
|
30
|
+
}
|
|
31
|
+
return 10;
|
|
28
32
|
}
|
|
29
33
|
}]);
|
|
30
34
|
return CodeMirrorEditorContribution;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-codemirror",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -41,10 +41,11 @@
|
|
|
41
41
|
"@codemirror/search": "^6.0.0",
|
|
42
42
|
"@codemirror/state": "^6.4.0",
|
|
43
43
|
"@codemirror/view": "^6.23.0",
|
|
44
|
-
"@difizen/libro-code-editor": "^0.2.35
|
|
45
|
-
"@difizen/libro-common": "^0.2.35
|
|
46
|
-
"@difizen/libro-lsp": "^0.2.35
|
|
47
|
-
"@difizen/libro-rendermime": "^0.2.35
|
|
44
|
+
"@difizen/libro-code-editor": "^0.2.35",
|
|
45
|
+
"@difizen/libro-common": "^0.2.35",
|
|
46
|
+
"@difizen/libro-lsp": "^0.2.35",
|
|
47
|
+
"@difizen/libro-rendermime": "^0.2.35",
|
|
48
|
+
"@difizen/mana-l10n": "latest",
|
|
48
49
|
"@difizen/mana-app": "latest",
|
|
49
50
|
"@lezer/common": "^1.2.1",
|
|
50
51
|
"@lezer/highlight": "^1.1.4",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
2
3
|
|
|
3
4
|
export const enum Info {
|
|
4
5
|
Margin = 30,
|
|
@@ -97,16 +98,16 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
97
98
|
'&:after': { content: "'○'" },
|
|
98
99
|
},
|
|
99
100
|
'.cm-completionIcon-interface': {
|
|
100
|
-
'&:after': { content: "'◌'" },
|
|
101
|
+
'&:after': { content: l10n.t("'◌'") },
|
|
101
102
|
},
|
|
102
103
|
'.cm-completionIcon-variable': {
|
|
103
|
-
'&:after': { content: "'𝑥'" },
|
|
104
|
+
'&:after': { content: l10n.t("'𝑥'") },
|
|
104
105
|
},
|
|
105
106
|
'.cm-completionIcon-constant': {
|
|
106
|
-
'&:after': { content: "'𝐶'" },
|
|
107
|
+
'&:after': { content: l10n.t("'𝐶'") },
|
|
107
108
|
},
|
|
108
109
|
'.cm-completionIcon-type': {
|
|
109
|
-
'&:after': { content: "'𝑡'" },
|
|
110
|
+
'&:after': { content: l10n.t("'𝑡'") },
|
|
110
111
|
},
|
|
111
112
|
'.cm-completionIcon-enum': {
|
|
112
113
|
'&:after': { content: "'∪'" },
|
|
@@ -118,7 +119,7 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
118
119
|
'&:after': { content: "'🔑\uFE0E'" }, // Disable emoji rendering
|
|
119
120
|
},
|
|
120
121
|
'.cm-completionIcon-namespace': {
|
|
121
|
-
'&:after': { content: "'▢'" },
|
|
122
|
+
'&:after': { content: l10n.t("'▢'") },
|
|
122
123
|
},
|
|
123
124
|
'.cm-completionIcon-text': {
|
|
124
125
|
'&:after': { content: "'abc'", fontSize: '50%', verticalAlign: 'middle' },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CodeEditorFactory } from '@difizen/libro-code-editor';
|
|
2
2
|
import { CodeEditorContribution } from '@difizen/libro-code-editor';
|
|
3
|
+
import { MIME } from '@difizen/libro-common';
|
|
3
4
|
import { singleton } from '@difizen/mana-app';
|
|
4
5
|
|
|
5
6
|
import { codeMirrorDefaultConfig } from './editor.js';
|
|
@@ -9,8 +10,11 @@ import { codeMirrorEditorFactory, stateFactory } from './factory.js';
|
|
|
9
10
|
export class CodeMirrorEditorContribution implements CodeEditorContribution {
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
12
|
canHandle(mime: string): number {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const mimes = [MIME.codemirror, MIME.text] as string[];
|
|
14
|
+
if (mimes.includes(mime)) {
|
|
15
|
+
return 50 + 1;
|
|
16
|
+
}
|
|
17
|
+
return 10;
|
|
14
18
|
}
|
|
15
19
|
factory: CodeEditorFactory = codeMirrorEditorFactory;
|
|
16
20
|
stateFactory = stateFactory;
|