vscode-css-languageservice 5.4.2 → 6.1.0

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/SECURITY.md +41 -0
  3. package/lib/esm/beautify/beautify-css.js +11 -4
  4. package/lib/esm/cssLanguageService.d.ts +2 -1
  5. package/lib/esm/cssLanguageService.js +15 -17
  6. package/lib/esm/cssLanguageTypes.js +2 -2
  7. package/lib/esm/data/webCustomData.js +356 -232
  8. package/lib/esm/languageFacts/builtinData.js +15 -15
  9. package/lib/esm/languageFacts/colors.js +66 -69
  10. package/lib/esm/languageFacts/dataManager.js +38 -42
  11. package/lib/esm/languageFacts/dataProvider.js +17 -23
  12. package/lib/esm/languageFacts/entry.js +22 -23
  13. package/lib/esm/parser/cssErrors.js +5 -7
  14. package/lib/esm/parser/cssNodes.js +869 -1377
  15. package/lib/esm/parser/cssParser.js +419 -376
  16. package/lib/esm/parser/cssScanner.js +168 -175
  17. package/lib/esm/parser/cssSymbolScope.js +107 -137
  18. package/lib/esm/parser/lessParser.js +177 -202
  19. package/lib/esm/parser/lessScanner.js +22 -43
  20. package/lib/esm/parser/scssErrors.js +5 -7
  21. package/lib/esm/parser/scssParser.js +196 -208
  22. package/lib/esm/parser/scssScanner.js +33 -54
  23. package/lib/esm/services/cssCodeActions.js +36 -40
  24. package/lib/esm/services/cssCompletion.js +300 -395
  25. package/lib/esm/services/cssFolding.js +32 -35
  26. package/lib/esm/services/cssFormatter.js +22 -22
  27. package/lib/esm/services/cssHover.js +30 -33
  28. package/lib/esm/services/cssNavigation.js +260 -289
  29. package/lib/esm/services/cssSelectionRange.js +6 -6
  30. package/lib/esm/services/cssValidation.js +13 -16
  31. package/lib/esm/services/lessCompletion.js +351 -370
  32. package/lib/esm/services/lint.js +161 -175
  33. package/lib/esm/services/lintRules.js +20 -27
  34. package/lib/esm/services/lintUtil.js +19 -28
  35. package/lib/esm/services/pathCompletion.js +84 -158
  36. package/lib/esm/services/scssCompletion.js +283 -307
  37. package/lib/esm/services/scssNavigation.js +65 -137
  38. package/lib/esm/services/selectorPrinting.js +131 -175
  39. package/lib/esm/utils/arrays.js +6 -12
  40. package/lib/esm/utils/objects.js +1 -1
  41. package/lib/esm/utils/resources.js +3 -16
  42. package/lib/esm/utils/strings.js +10 -12
  43. package/lib/umd/beautify/beautify-css.js +11 -4
  44. package/lib/umd/cssLanguageService.d.ts +2 -1
  45. package/lib/umd/cssLanguageService.js +34 -32
  46. package/lib/umd/cssLanguageTypes.js +4 -3
  47. package/lib/umd/data/webCustomData.js +355 -231
  48. package/lib/umd/languageFacts/colors.js +65 -68
  49. package/lib/umd/languageFacts/dataManager.js +41 -44
  50. package/lib/umd/languageFacts/dataProvider.js +17 -22
  51. package/lib/umd/languageFacts/entry.js +22 -23
  52. package/lib/umd/languageFacts/facts.js +5 -1
  53. package/lib/umd/parser/cssErrors.js +5 -6
  54. package/lib/umd/parser/cssNodes.js +870 -1307
  55. package/lib/umd/parser/cssParser.js +424 -380
  56. package/lib/umd/parser/cssScanner.js +168 -173
  57. package/lib/umd/parser/cssSymbolScope.js +109 -134
  58. package/lib/umd/parser/lessParser.js +182 -206
  59. package/lib/umd/parser/lessScanner.js +22 -42
  60. package/lib/umd/parser/scssErrors.js +5 -6
  61. package/lib/umd/parser/scssParser.js +202 -213
  62. package/lib/umd/parser/scssScanner.js +25 -45
  63. package/lib/umd/services/cssCodeActions.js +41 -44
  64. package/lib/umd/services/cssCompletion.js +308 -402
  65. package/lib/umd/services/cssFolding.js +35 -38
  66. package/lib/umd/services/cssFormatter.js +25 -25
  67. package/lib/umd/services/cssHover.js +36 -38
  68. package/lib/umd/services/cssNavigation.js +267 -295
  69. package/lib/umd/services/cssSelectionRange.js +8 -8
  70. package/lib/umd/services/cssValidation.js +17 -19
  71. package/lib/umd/services/lessCompletion.js +354 -372
  72. package/lib/umd/services/lint.js +167 -180
  73. package/lib/umd/services/lintRules.js +20 -24
  74. package/lib/umd/services/lintUtil.js +20 -28
  75. package/lib/umd/services/pathCompletion.js +87 -160
  76. package/lib/umd/services/scssCompletion.js +287 -310
  77. package/lib/umd/services/scssNavigation.js +69 -140
  78. package/lib/umd/services/selectorPrinting.js +134 -174
  79. package/lib/umd/utils/arrays.js +6 -12
  80. package/lib/umd/utils/objects.js +1 -1
  81. package/lib/umd/utils/resources.js +4 -17
  82. package/lib/umd/utils/strings.js +10 -12
  83. package/package.json +16 -15
@@ -14,9 +14,9 @@
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.getColorValue = exports.hwbFromColor = exports.colorFromHWB = exports.hslFromColor = exports.colorFromHSL = exports.colorFrom256RGB = exports.colorFromHex = exports.hexDigit = exports.isColorValue = exports.isColorConstructor = exports.colorKeywords = exports.colors = exports.colorFunctions = void 0;
17
- var nodes = require("../parser/cssNodes");
18
- var nls = require("vscode-nls");
19
- var localize = nls.loadMessageBundle();
17
+ const nodes = require("../parser/cssNodes");
18
+ const nls = require("vscode-nls");
19
+ const localize = nls.loadMessageBundle();
20
20
  exports.colorFunctions = [
21
21
  { func: 'rgb($red, $green, $blue)', desc: localize('css.builtin.rgb', 'Creates a Color from red, green, and blue values.') },
22
22
  { func: 'rgba($red, $green, $blue, $alpha)', desc: localize('css.builtin.rgba', 'Creates a Color from red, green, blue, and alpha values.') },
@@ -179,13 +179,13 @@
179
179
  'transparent': 'Fully transparent. This keyword can be considered a shorthand for rgba(0,0,0,0) which is its computed value.',
180
180
  };
181
181
  function getNumericValue(node, factor) {
182
- var val = node.getText();
183
- var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(%?)$/);
182
+ const val = node.getText();
183
+ const m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(%?)$/);
184
184
  if (m) {
185
185
  if (m[2]) {
186
186
  factor = 100.0;
187
187
  }
188
- var result = parseFloat(m[1]) / factor;
188
+ const result = parseFloat(m[1]) / factor;
189
189
  if (result >= 0 && result <= 1) {
190
190
  return result;
191
191
  }
@@ -193,8 +193,8 @@
193
193
  throw new Error();
194
194
  }
195
195
  function getAngle(node) {
196
- var val = node.getText();
197
- var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg|rad|grad|turn)?$/);
196
+ const val = node.getText();
197
+ const m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg|rad|grad|turn)?$/);
198
198
  if (m) {
199
199
  switch (m[2]) {
200
200
  case 'deg':
@@ -214,7 +214,7 @@
214
214
  throw new Error();
215
215
  }
216
216
  function isColorConstructor(node) {
217
- var name = node.getName();
217
+ const name = node.getName();
218
218
  if (!name) {
219
219
  return false;
220
220
  }
@@ -237,7 +237,7 @@
237
237
  if (node.parent && node.parent.type !== nodes.NodeType.Term) {
238
238
  return false;
239
239
  }
240
- var candidateColor = node.getText().toLowerCase();
240
+ const candidateColor = node.getText().toLowerCase();
241
241
  if (candidateColor === 'none') {
242
242
  return false;
243
243
  }
@@ -248,12 +248,12 @@
248
248
  return false;
249
249
  }
250
250
  exports.isColorValue = isColorValue;
251
- var Digit0 = 48;
252
- var Digit9 = 57;
253
- var A = 65;
254
- var F = 70;
255
- var a = 97;
256
- var f = 102;
251
+ const Digit0 = 48;
252
+ const Digit9 = 57;
253
+ const A = 65;
254
+ const F = 70;
255
+ const a = 97;
256
+ const f = 102;
257
257
  function hexDigit(charCode) {
258
258
  if (charCode < Digit0) {
259
259
  return 0;
@@ -307,24 +307,22 @@
307
307
  return null;
308
308
  }
309
309
  exports.colorFromHex = colorFromHex;
310
- function colorFrom256RGB(red, green, blue, alpha) {
311
- if (alpha === void 0) { alpha = 1.0; }
310
+ function colorFrom256RGB(red, green, blue, alpha = 1.0) {
312
311
  return {
313
312
  red: red / 255.0,
314
313
  green: green / 255.0,
315
314
  blue: blue / 255.0,
316
- alpha: alpha
315
+ alpha
317
316
  };
318
317
  }
319
318
  exports.colorFrom256RGB = colorFrom256RGB;
320
- function colorFromHSL(hue, sat, light, alpha) {
321
- if (alpha === void 0) { alpha = 1.0; }
319
+ function colorFromHSL(hue, sat, light, alpha = 1.0) {
322
320
  hue = hue / 60.0;
323
321
  if (sat === 0) {
324
- return { red: light, green: light, blue: light, alpha: alpha };
322
+ return { red: light, green: light, blue: light, alpha };
325
323
  }
326
324
  else {
327
- var hueToRgb = function (t1, t2, hue) {
325
+ const hueToRgb = (t1, t2, hue) => {
328
326
  while (hue < 0) {
329
327
  hue += 6;
330
328
  }
@@ -342,23 +340,23 @@
342
340
  }
343
341
  return t1;
344
342
  };
345
- var t2 = light <= 0.5 ? (light * (sat + 1)) : (light + sat - (light * sat));
346
- var t1 = light * 2 - t2;
347
- return { red: hueToRgb(t1, t2, hue + 2), green: hueToRgb(t1, t2, hue), blue: hueToRgb(t1, t2, hue - 2), alpha: alpha };
343
+ const t2 = light <= 0.5 ? (light * (sat + 1)) : (light + sat - (light * sat));
344
+ const t1 = light * 2 - t2;
345
+ return { red: hueToRgb(t1, t2, hue + 2), green: hueToRgb(t1, t2, hue), blue: hueToRgb(t1, t2, hue - 2), alpha };
348
346
  }
349
347
  }
350
348
  exports.colorFromHSL = colorFromHSL;
351
349
  function hslFromColor(rgba) {
352
- var r = rgba.red;
353
- var g = rgba.green;
354
- var b = rgba.blue;
355
- var a = rgba.alpha;
356
- var max = Math.max(r, g, b);
357
- var min = Math.min(r, g, b);
358
- var h = 0;
359
- var s = 0;
360
- var l = (min + max) / 2;
361
- var chroma = max - min;
350
+ const r = rgba.red;
351
+ const g = rgba.green;
352
+ const b = rgba.blue;
353
+ const a = rgba.alpha;
354
+ const max = Math.max(r, g, b);
355
+ const min = Math.min(r, g, b);
356
+ let h = 0;
357
+ let s = 0;
358
+ const l = (min + max) / 2;
359
+ const chroma = max - min;
362
360
  if (chroma > 0) {
363
361
  s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1);
364
362
  switch (max) {
@@ -375,37 +373,36 @@
375
373
  h *= 60;
376
374
  h = Math.round(h);
377
375
  }
378
- return { h: h, s: s, l: l, a: a };
376
+ return { h, s, l, a };
379
377
  }
380
378
  exports.hslFromColor = hslFromColor;
381
- function colorFromHWB(hue, white, black, alpha) {
382
- if (alpha === void 0) { alpha = 1.0; }
379
+ function colorFromHWB(hue, white, black, alpha = 1.0) {
383
380
  if (white + black >= 1) {
384
- var gray = white / (white + black);
385
- return { red: gray, green: gray, blue: gray, alpha: alpha };
381
+ const gray = white / (white + black);
382
+ return { red: gray, green: gray, blue: gray, alpha };
386
383
  }
387
- var rgb = colorFromHSL(hue, 1, 0.5, alpha);
388
- var red = rgb.red;
384
+ const rgb = colorFromHSL(hue, 1, 0.5, alpha);
385
+ let red = rgb.red;
389
386
  red *= (1 - white - black);
390
387
  red += white;
391
- var green = rgb.green;
388
+ let green = rgb.green;
392
389
  green *= (1 - white - black);
393
390
  green += white;
394
- var blue = rgb.blue;
391
+ let blue = rgb.blue;
395
392
  blue *= (1 - white - black);
396
393
  blue += white;
397
394
  return {
398
395
  red: red,
399
396
  green: green,
400
397
  blue: blue,
401
- alpha: alpha
398
+ alpha
402
399
  };
403
400
  }
404
401
  exports.colorFromHWB = colorFromHWB;
405
402
  function hwbFromColor(rgba) {
406
- var hsl = hslFromColor(rgba);
407
- var white = Math.min(rgba.red, rgba.green, rgba.blue);
408
- var black = 1 - Math.max(rgba.red, rgba.green, rgba.blue);
403
+ const hsl = hslFromColor(rgba);
404
+ const white = Math.min(rgba.red, rgba.green, rgba.blue);
405
+ const black = 1 - Math.max(rgba.red, rgba.green, rgba.blue);
409
406
  return {
410
407
  h: hsl.h,
411
408
  w: white,
@@ -416,21 +413,21 @@
416
413
  exports.hwbFromColor = hwbFromColor;
417
414
  function getColorValue(node) {
418
415
  if (node.type === nodes.NodeType.HexColorValue) {
419
- var text = node.getText();
416
+ const text = node.getText();
420
417
  return colorFromHex(text);
421
418
  }
422
419
  else if (node.type === nodes.NodeType.Function) {
423
- var functionNode = node;
424
- var name = functionNode.getName();
425
- var colorValues = functionNode.getArguments().getChildren();
420
+ const functionNode = node;
421
+ const name = functionNode.getName();
422
+ let colorValues = functionNode.getArguments().getChildren();
426
423
  if (colorValues.length === 1) {
427
- var functionArg = colorValues[0].getChildren();
424
+ const functionArg = colorValues[0].getChildren();
428
425
  if (functionArg.length === 1 && functionArg[0].type === nodes.NodeType.Expression) {
429
426
  colorValues = functionArg[0].getChildren();
430
427
  if (colorValues.length === 3) {
431
- var lastValue = colorValues[2];
428
+ const lastValue = colorValues[2];
432
429
  if (lastValue instanceof nodes.BinaryExpression) {
433
- var left = lastValue.getLeft(), right = lastValue.getRight(), operator = lastValue.getOperator();
430
+ const left = lastValue.getLeft(), right = lastValue.getRight(), operator = lastValue.getOperator();
434
431
  if (left && right && operator && operator.matches('/')) {
435
432
  colorValues = [colorValues[0], colorValues[1], left, right];
436
433
  }
@@ -442,25 +439,25 @@
442
439
  return null;
443
440
  }
444
441
  try {
445
- var alpha = colorValues.length === 4 ? getNumericValue(colorValues[3], 1) : 1;
442
+ const alpha = colorValues.length === 4 ? getNumericValue(colorValues[3], 1) : 1;
446
443
  if (name === 'rgb' || name === 'rgba') {
447
444
  return {
448
445
  red: getNumericValue(colorValues[0], 255.0),
449
446
  green: getNumericValue(colorValues[1], 255.0),
450
447
  blue: getNumericValue(colorValues[2], 255.0),
451
- alpha: alpha
448
+ alpha
452
449
  };
453
450
  }
454
451
  else if (name === 'hsl' || name === 'hsla') {
455
- var h = getAngle(colorValues[0]);
456
- var s = getNumericValue(colorValues[1], 100.0);
457
- var l = getNumericValue(colorValues[2], 100.0);
452
+ const h = getAngle(colorValues[0]);
453
+ const s = getNumericValue(colorValues[1], 100.0);
454
+ const l = getNumericValue(colorValues[2], 100.0);
458
455
  return colorFromHSL(h, s, l, alpha);
459
456
  }
460
457
  else if (name === 'hwb') {
461
- var h = getAngle(colorValues[0]);
462
- var w = getNumericValue(colorValues[1], 100.0);
463
- var b = getNumericValue(colorValues[2], 100.0);
458
+ const h = getAngle(colorValues[0]);
459
+ const w = getNumericValue(colorValues[1], 100.0);
460
+ const b = getNumericValue(colorValues[2], 100.0);
464
461
  return colorFromHWB(h, w, b, alpha);
465
462
  }
466
463
  }
@@ -473,18 +470,18 @@
473
470
  if (node.parent && node.parent.type !== nodes.NodeType.Term) {
474
471
  return null;
475
472
  }
476
- var term = node.parent;
473
+ const term = node.parent;
477
474
  if (term && term.parent && term.parent.type === nodes.NodeType.BinaryExpression) {
478
- var expression = term.parent;
475
+ const expression = term.parent;
479
476
  if (expression.parent && expression.parent.type === nodes.NodeType.ListEntry && expression.parent.key === expression) {
480
477
  return null;
481
478
  }
482
479
  }
483
- var candidateColor = node.getText().toLowerCase();
480
+ const candidateColor = node.getText().toLowerCase();
484
481
  if (candidateColor === 'none') {
485
482
  return null;
486
483
  }
487
- var colorHex = exports.colors[candidateColor];
484
+ const colorHex = exports.colors[candidateColor];
488
485
  if (colorHex) {
489
486
  return colorFromHex(colorHex);
490
487
  }
@@ -14,11 +14,11 @@
14
14
  'use strict';
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CSSDataManager = void 0;
17
- var objects = require("../utils/objects");
18
- var webCustomData_1 = require("../data/webCustomData");
19
- var dataProvider_1 = require("./dataProvider");
20
- var CSSDataManager = /** @class */ (function () {
21
- function CSSDataManager(options) {
17
+ const objects = require("../utils/objects");
18
+ const webCustomData_1 = require("../data/webCustomData");
19
+ const dataProvider_1 = require("./dataProvider");
20
+ class CSSDataManager {
21
+ constructor(options) {
22
22
  this.dataProviders = [];
23
23
  this._propertySet = {};
24
24
  this._atDirectiveSet = {};
@@ -28,45 +28,43 @@
28
28
  this._atDirectives = [];
29
29
  this._pseudoClasses = [];
30
30
  this._pseudoElements = [];
31
- this.setDataProviders((options === null || options === void 0 ? void 0 : options.useDefaultDataProvider) !== false, (options === null || options === void 0 ? void 0 : options.customDataProviders) || []);
31
+ this.setDataProviders(options?.useDefaultDataProvider !== false, options?.customDataProviders || []);
32
32
  }
33
- CSSDataManager.prototype.setDataProviders = function (builtIn, providers) {
34
- var _a;
33
+ setDataProviders(builtIn, providers) {
35
34
  this.dataProviders = [];
36
35
  if (builtIn) {
37
36
  this.dataProviders.push(new dataProvider_1.CSSDataProvider(webCustomData_1.cssData));
38
37
  }
39
- (_a = this.dataProviders).push.apply(_a, providers);
38
+ this.dataProviders.push(...providers);
40
39
  this.collectData();
41
- };
40
+ }
42
41
  /**
43
42
  * Collect all data & handle duplicates
44
43
  */
45
- CSSDataManager.prototype.collectData = function () {
46
- var _this = this;
44
+ collectData() {
47
45
  this._propertySet = {};
48
46
  this._atDirectiveSet = {};
49
47
  this._pseudoClassSet = {};
50
48
  this._pseudoElementSet = {};
51
- this.dataProviders.forEach(function (provider) {
52
- provider.provideProperties().forEach(function (p) {
53
- if (!_this._propertySet[p.name]) {
54
- _this._propertySet[p.name] = p;
49
+ this.dataProviders.forEach(provider => {
50
+ provider.provideProperties().forEach(p => {
51
+ if (!this._propertySet[p.name]) {
52
+ this._propertySet[p.name] = p;
55
53
  }
56
54
  });
57
- provider.provideAtDirectives().forEach(function (p) {
58
- if (!_this._atDirectiveSet[p.name]) {
59
- _this._atDirectiveSet[p.name] = p;
55
+ provider.provideAtDirectives().forEach(p => {
56
+ if (!this._atDirectiveSet[p.name]) {
57
+ this._atDirectiveSet[p.name] = p;
60
58
  }
61
59
  });
62
- provider.providePseudoClasses().forEach(function (p) {
63
- if (!_this._pseudoClassSet[p.name]) {
64
- _this._pseudoClassSet[p.name] = p;
60
+ provider.providePseudoClasses().forEach(p => {
61
+ if (!this._pseudoClassSet[p.name]) {
62
+ this._pseudoClassSet[p.name] = p;
65
63
  }
66
64
  });
67
- provider.providePseudoElements().forEach(function (p) {
68
- if (!_this._pseudoElementSet[p.name]) {
69
- _this._pseudoElementSet[p.name] = p;
65
+ provider.providePseudoElements().forEach(p => {
66
+ if (!this._pseudoElementSet[p.name]) {
67
+ this._pseudoElementSet[p.name] = p;
70
68
  }
71
69
  });
72
70
  });
@@ -74,31 +72,30 @@
74
72
  this._atDirectives = objects.values(this._atDirectiveSet);
75
73
  this._pseudoClasses = objects.values(this._pseudoClassSet);
76
74
  this._pseudoElements = objects.values(this._pseudoElementSet);
77
- };
78
- CSSDataManager.prototype.getProperty = function (name) { return this._propertySet[name]; };
79
- CSSDataManager.prototype.getAtDirective = function (name) { return this._atDirectiveSet[name]; };
80
- CSSDataManager.prototype.getPseudoClass = function (name) { return this._pseudoClassSet[name]; };
81
- CSSDataManager.prototype.getPseudoElement = function (name) { return this._pseudoElementSet[name]; };
82
- CSSDataManager.prototype.getProperties = function () {
75
+ }
76
+ getProperty(name) { return this._propertySet[name]; }
77
+ getAtDirective(name) { return this._atDirectiveSet[name]; }
78
+ getPseudoClass(name) { return this._pseudoClassSet[name]; }
79
+ getPseudoElement(name) { return this._pseudoElementSet[name]; }
80
+ getProperties() {
83
81
  return this._properties;
84
- };
85
- CSSDataManager.prototype.getAtDirectives = function () {
82
+ }
83
+ getAtDirectives() {
86
84
  return this._atDirectives;
87
- };
88
- CSSDataManager.prototype.getPseudoClasses = function () {
85
+ }
86
+ getPseudoClasses() {
89
87
  return this._pseudoClasses;
90
- };
91
- CSSDataManager.prototype.getPseudoElements = function () {
88
+ }
89
+ getPseudoElements() {
92
90
  return this._pseudoElements;
93
- };
94
- CSSDataManager.prototype.isKnownProperty = function (name) {
91
+ }
92
+ isKnownProperty(name) {
95
93
  return name.toLowerCase() in this._propertySet;
96
- };
97
- CSSDataManager.prototype.isStandardProperty = function (name) {
94
+ }
95
+ isStandardProperty(name) {
98
96
  return this.isKnownProperty(name) &&
99
97
  (!this._propertySet[name.toLowerCase()].status || this._propertySet[name.toLowerCase()].status === 'standard');
100
- };
101
- return CSSDataManager;
102
- }());
98
+ }
99
+ }
103
100
  exports.CSSDataManager = CSSDataManager;
104
101
  });
@@ -14,67 +14,62 @@
14
14
  'use strict';
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CSSDataProvider = void 0;
17
- var CSSDataProvider = /** @class */ (function () {
17
+ class CSSDataProvider {
18
18
  /**
19
19
  * Currently, unversioned data uses the V1 implementation
20
20
  * In the future when the provider handles multiple versions of HTML custom data,
21
21
  * use the latest implementation for unversioned data
22
22
  */
23
- function CSSDataProvider(data) {
23
+ constructor(data) {
24
24
  this._properties = [];
25
25
  this._atDirectives = [];
26
26
  this._pseudoClasses = [];
27
27
  this._pseudoElements = [];
28
28
  this.addData(data);
29
29
  }
30
- CSSDataProvider.prototype.provideProperties = function () {
30
+ provideProperties() {
31
31
  return this._properties;
32
- };
33
- CSSDataProvider.prototype.provideAtDirectives = function () {
32
+ }
33
+ provideAtDirectives() {
34
34
  return this._atDirectives;
35
- };
36
- CSSDataProvider.prototype.providePseudoClasses = function () {
35
+ }
36
+ providePseudoClasses() {
37
37
  return this._pseudoClasses;
38
- };
39
- CSSDataProvider.prototype.providePseudoElements = function () {
38
+ }
39
+ providePseudoElements() {
40
40
  return this._pseudoElements;
41
- };
42
- CSSDataProvider.prototype.addData = function (data) {
41
+ }
42
+ addData(data) {
43
43
  if (Array.isArray(data.properties)) {
44
- for (var _i = 0, _a = data.properties; _i < _a.length; _i++) {
45
- var prop = _a[_i];
44
+ for (const prop of data.properties) {
46
45
  if (isPropertyData(prop)) {
47
46
  this._properties.push(prop);
48
47
  }
49
48
  }
50
49
  }
51
50
  if (Array.isArray(data.atDirectives)) {
52
- for (var _b = 0, _c = data.atDirectives; _b < _c.length; _b++) {
53
- var prop = _c[_b];
51
+ for (const prop of data.atDirectives) {
54
52
  if (isAtDirective(prop)) {
55
53
  this._atDirectives.push(prop);
56
54
  }
57
55
  }
58
56
  }
59
57
  if (Array.isArray(data.pseudoClasses)) {
60
- for (var _d = 0, _e = data.pseudoClasses; _d < _e.length; _d++) {
61
- var prop = _e[_d];
58
+ for (const prop of data.pseudoClasses) {
62
59
  if (isPseudoClassData(prop)) {
63
60
  this._pseudoClasses.push(prop);
64
61
  }
65
62
  }
66
63
  }
67
64
  if (Array.isArray(data.pseudoElements)) {
68
- for (var _f = 0, _g = data.pseudoElements; _f < _g.length; _f++) {
69
- var prop = _g[_f];
65
+ for (const prop of data.pseudoElements) {
70
66
  if (isPseudoElementData(prop)) {
71
67
  this._pseudoElements.push(prop);
72
68
  }
73
69
  }
74
70
  }
75
- };
76
- return CSSDataProvider;
77
- }());
71
+ }
72
+ }
78
73
  exports.CSSDataProvider = CSSDataProvider;
79
74
  function isPropertyData(d) {
80
75
  return typeof d.name === 'string';
@@ -14,7 +14,7 @@
14
14
  'use strict';
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.getBrowserLabel = exports.textToMarkedString = exports.getEntryDescription = exports.browserNames = void 0;
17
- var cssLanguageTypes_1 = require("../cssLanguageTypes");
17
+ const cssLanguageTypes_1 = require("../cssLanguageTypes");
18
18
  exports.browserNames = {
19
19
  E: 'Edge',
20
20
  FF: 'Firefox',
@@ -36,7 +36,7 @@
36
36
  }
37
37
  }
38
38
  function getEntryDescription(entry, doesSupportMarkdown, settings) {
39
- var result;
39
+ let result;
40
40
  if (doesSupportMarkdown) {
41
41
  result = {
42
42
  kind: 'markdown',
@@ -67,26 +67,26 @@
67
67
  if (typeof entry.description !== 'string') {
68
68
  return entry.description.value;
69
69
  }
70
- var result = '';
71
- if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) {
70
+ let result = '';
71
+ if (settings?.documentation !== false) {
72
72
  if (entry.status) {
73
73
  result += getEntryStatus(entry.status);
74
74
  }
75
75
  result += entry.description;
76
- var browserLabel = getBrowserLabel(entry.browsers);
76
+ const browserLabel = getBrowserLabel(entry.browsers);
77
77
  if (browserLabel) {
78
78
  result += '\n(' + browserLabel + ')';
79
79
  }
80
80
  if ('syntax' in entry) {
81
- result += "\n\nSyntax: ".concat(entry.syntax);
81
+ result += `\n\nSyntax: ${entry.syntax}`;
82
82
  }
83
83
  }
84
- if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
84
+ if (entry.references && entry.references.length > 0 && settings?.references !== false) {
85
85
  if (result.length > 0) {
86
86
  result += '\n\n';
87
87
  }
88
- result += entry.references.map(function (r) {
89
- return "".concat(r.name, ": ").concat(r.url);
88
+ result += entry.references.map(r => {
89
+ return `${r.name}: ${r.url}`;
90
90
  }).join(' | ');
91
91
  }
92
92
  return result;
@@ -95,8 +95,8 @@
95
95
  if (!entry.description || entry.description === '') {
96
96
  return '';
97
97
  }
98
- var result = '';
99
- if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) {
98
+ let result = '';
99
+ if (settings?.documentation !== false) {
100
100
  if (entry.status) {
101
101
  result += getEntryStatus(entry.status);
102
102
  }
@@ -106,20 +106,20 @@
106
106
  else {
107
107
  result += entry.description.kind === cssLanguageTypes_1.MarkupKind.Markdown ? entry.description.value : textToMarkedString(entry.description.value);
108
108
  }
109
- var browserLabel = getBrowserLabel(entry.browsers);
109
+ const browserLabel = getBrowserLabel(entry.browsers);
110
110
  if (browserLabel) {
111
111
  result += '\n\n(' + textToMarkedString(browserLabel) + ')';
112
112
  }
113
113
  if ('syntax' in entry && entry.syntax) {
114
- result += "\n\nSyntax: ".concat(textToMarkedString(entry.syntax));
114
+ result += `\n\nSyntax: ${textToMarkedString(entry.syntax)}`;
115
115
  }
116
116
  }
117
- if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
117
+ if (entry.references && entry.references.length > 0 && settings?.references !== false) {
118
118
  if (result.length > 0) {
119
119
  result += '\n\n';
120
120
  }
121
- result += entry.references.map(function (r) {
122
- return "[".concat(r.name, "](").concat(r.url, ")");
121
+ result += entry.references.map(r => {
122
+ return `[${r.name}](${r.url})`;
123
123
  }).join(' | ');
124
124
  }
125
125
  return result;
@@ -128,17 +128,16 @@
128
128
  * Input is like `["E12","FF49","C47","IE","O"]`
129
129
  * Output is like `Edge 12, Firefox 49, Chrome 47, IE, Opera`
130
130
  */
131
- function getBrowserLabel(browsers) {
132
- if (browsers === void 0) { browsers = []; }
131
+ function getBrowserLabel(browsers = []) {
133
132
  if (browsers.length === 0) {
134
133
  return null;
135
134
  }
136
135
  return browsers
137
- .map(function (b) {
138
- var result = '';
139
- var matches = b.match(/([A-Z]+)(\d+)?/);
140
- var name = matches[1];
141
- var version = matches[2];
136
+ .map(b => {
137
+ let result = '';
138
+ const matches = b.match(/([A-Z]+)(\d+)?/);
139
+ const name = matches[1];
140
+ const version = matches[2];
142
141
  if (name in exports.browserNames) {
143
142
  result += exports.browserNames[name];
144
143
  }
@@ -1,6 +1,10 @@
1
1
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
2
  if (k2 === undefined) k2 = k;
3
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
4
8
  }) : (function(o, m, k, k2) {
5
9
  if (k2 === undefined) k2 = k;
6
10
  o[k2] = m[k];
@@ -14,15 +14,14 @@
14
14
  'use strict';
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ParseError = exports.CSSIssueType = void 0;
17
- var nls = require("vscode-nls");
18
- var localize = nls.loadMessageBundle();
19
- var CSSIssueType = /** @class */ (function () {
20
- function CSSIssueType(id, message) {
17
+ const nls = require("vscode-nls");
18
+ const localize = nls.loadMessageBundle();
19
+ class CSSIssueType {
20
+ constructor(id, message) {
21
21
  this.id = id;
22
22
  this.message = message;
23
23
  }
24
- return CSSIssueType;
25
- }());
24
+ }
26
25
  exports.CSSIssueType = CSSIssueType;
27
26
  exports.ParseError = {
28
27
  NumberExpected: new CSSIssueType('css-numberexpected', localize('expected.number', "number expected")),