@gravitee/ui-components 3.24.3-migrate-codemirror-bed237b → 3.24.3-migrate-codemirror-b21f678

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/ui-components",
3
- "version": "3.24.3-migrate-codemirror-bed237b",
3
+ "version": "3.24.3-migrate-codemirror-b21f678",
4
4
  "description": "Gravitee.io UI Components library, based on Web Components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -99,7 +99,6 @@
99
99
  "babel-plugin-template-html-minifier": "4.1.0",
100
100
  "bundle-phobia-cli": "0.14.13",
101
101
  "chromatic": "6.1.0",
102
- "codemirror-asciidoc": "1.0.4",
103
102
  "danger": "10.7.1",
104
103
  "del": "6.0.0",
105
104
  "eslint": "8.4.0",
@@ -146,7 +145,6 @@
146
145
  "@highcharts/map-collection": "^1.0.0",
147
146
  "asciidoctor": "^2.2.4",
148
147
  "asciidoctor-highlight.js": "^0.3.0 || ^0.4.0",
149
- "codemirror-asciidoc": "^1.0.4",
150
148
  "highcharts": "^8.0.0 || ^9.0.0",
151
149
  "highlight.js": "^10.7.0 || ^11.1.0"
152
150
  },
@@ -163,9 +161,6 @@
163
161
  "asciidoctor-highlight.js": {
164
162
  "optional": true
165
163
  },
166
- "codemirror-asciidoc": {
167
- "optional": true
168
- },
169
164
  "highcharts": {
170
165
  "optional": true
171
166
  },
@@ -15,17 +15,17 @@
15
15
  */
16
16
  import { css, LitElement, html } from 'lit';
17
17
 
18
- import { shapeClipboard, shapeCopied } from '../styles/shapes';
19
- import { dispatchCustomEvent } from '../lib/events';
20
- import { uuid } from '../lib/utils';
21
- import { classMap } from 'lit-html/directives/class-map';
22
-
23
18
  import { EditorView, basicSetup } from '@codemirror/basic-setup';
24
19
  import { EditorState, Compartment } from '@codemirror/state';
25
20
  import { autocompletion } from '@codemirror/autocomplete';
26
21
  import { json } from '@codemirror/lang-json';
27
22
  import { languages } from '@codemirror/language-data';
28
23
  import { placeholder } from '@codemirror/view';
24
+
25
+ import { shapeClipboard, shapeCopied } from '../styles/shapes';
26
+ import { dispatchCustomEvent } from '../lib/events';
27
+ import { uuid } from '../lib/utils';
28
+ import { classMap } from 'lit-html/directives/class-map';
29
29
  import { InputElement } from '../mixins/input-element';
30
30
  import { i18n } from '../lib/i18n';
31
31
  import { skeleton } from '../styles/skeleton';
@@ -78,7 +78,7 @@ export class GvExpressionLanguage extends GvCode {
78
78
  }
79
79
 
80
80
  buildMethods(type) {
81
- const modelType = this._getModelType(type);
81
+ const modelType = this.getModelType(type);
82
82
  return modelType.methods.map(({ name, params = [], returnType }) => {
83
83
  const command = `${name}()`;
84
84
  const displayParams = params.map((p) => `${p.type} ${p.name}`);
@@ -134,7 +134,6 @@ export class GvExpressionLanguage extends GvCode {
134
134
  if (type) {
135
135
  const lowerType = type.toLowerCase();
136
136
  if (lowerType === 'string') {
137
- // class, constant, enum, function, interface, keyword, method, namespace, property, text, type, and variable.
138
137
  return 'text';
139
138
  } else if (lowerType === 'httpheaders' || lowerType === 'multivaluemap') {
140
139
  return 'type';
@@ -159,7 +158,6 @@ export class GvExpressionLanguage extends GvCode {
159
158
  .filter((command) => !command.startsWith('_') && command.startsWith(prefix))
160
159
  .map((command) => {
161
160
  return {
162
- // class, constant, enum, function, interface, keyword, method, namespace, property, text, type, and variable.
163
161
  type: 'variable',
164
162
  command,
165
163
  apply: command,
@@ -176,11 +174,10 @@ export class GvExpressionLanguage extends GvCode {
176
174
  const tokens = match.text.split('.');
177
175
  const key = tokens[0].replaceAll('{#', '');
178
176
  const prefix = tokens[1];
179
- const candidate = this.grammar[key][prefix];
177
+ let candidate = this.grammar[key][prefix];
180
178
  let options = [];
181
179
  let from = completionContext.pos;
182
180
  if (candidate) {
183
- // const modelType = this._getModelType(candidate._type);
184
181
  if (this.isMap(candidate._type)) {
185
182
  options = this.getEnum(candidate._type).map((value) => {
186
183
  const type = this.convertType(candidate._type);
@@ -195,7 +192,7 @@ export class GvExpressionLanguage extends GvCode {
195
192
  }
196
193
  } else {
197
194
  from -= prefix.length;
198
- const candidate = this.grammar[key];
195
+ candidate = this.grammar[key];
199
196
  if (candidate._type) {
200
197
  options = this.buildMethods(candidate._type);
201
198
  } else {
@@ -224,16 +221,16 @@ export class GvExpressionLanguage extends GvCode {
224
221
  let options = [];
225
222
  let from = completionContext.pos;
226
223
  if (candidate) {
227
- if (this._isMap(candidate._type)) {
228
- options = this._getEnum(candidate._type)
224
+ if (this.isMap(candidate._type)) {
225
+ options = this.getEnum(candidate._type)
229
226
  .filter((command) => !command.startsWith('_') && command.startsWith(prefix))
230
227
  .map((label) => {
231
- const type = this._convertType(candidate._type);
228
+ const type = this.convertType(candidate._type);
232
229
  return {
233
230
  type,
234
231
  command: `['${label}'][0]`,
235
232
  apply(view, completion, _from, to) {
236
- const from = _from - prefix.length - 1;
233
+ from = _from - prefix.length - 1;
237
234
  view.dispatch({
238
235
  changes: { from, to, insert: completion.command },
239
236
  selection: { anchor: from + completion.command.length },
@@ -246,14 +243,14 @@ export class GvExpressionLanguage extends GvCode {
246
243
  });
247
244
  } else {
248
245
  if (candidate._type) {
249
- options = this._buildMethods(candidate._type);
246
+ options = this.buildMethods(candidate._type);
250
247
  } else {
251
248
  from -= prefix.length;
252
249
  options = Object.keys(candidate)
253
250
  .filter((command) => command.startsWith(prefix))
254
251
  .map((command) => {
255
252
  return {
256
- type: this._convertType(candidate[command]._type),
253
+ type: this.convertType(candidate[command]._type),
257
254
  command,
258
255
  apply: command,
259
256
  label: command,