@master/css-language-service 2.0.0-rc.26 → 2.0.0-rc.28

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 (111) hide show
  1. package/dist/common.cjs +57 -0
  2. package/dist/common.d.ts +9 -0
  3. package/dist/common.mjs +48 -0
  4. package/dist/core.cjs +188 -0
  5. package/dist/core.d.ts +30 -0
  6. package/dist/core.mjs +186 -0
  7. package/dist/features/edit-syntax-colors.cjs +19 -0
  8. package/dist/features/edit-syntax-colors.d.ts +4 -0
  9. package/dist/features/edit-syntax-colors.mjs +17 -0
  10. package/dist/features/inspect-syntax.cjs +70 -0
  11. package/dist/features/inspect-syntax.d.ts +4 -0
  12. package/dist/features/inspect-syntax.mjs +68 -0
  13. package/dist/features/render-syntax-colors.cjs +88 -0
  14. package/dist/features/render-syntax-colors.d.ts +4 -0
  15. package/dist/features/render-syntax-colors.mjs +86 -0
  16. package/dist/features/suggest-syntax.cjs +20 -0
  17. package/dist/features/suggest-syntax.d.ts +4 -0
  18. package/dist/features/suggest-syntax.mjs +18 -0
  19. package/dist/index.cjs +23 -15
  20. package/dist/index.d.ts +7 -5
  21. package/dist/index.mjs +7 -5
  22. package/dist/settings.cjs +130 -29
  23. package/dist/settings.d.ts +16 -8
  24. package/dist/settings.mjs +130 -29
  25. package/dist/utils/beautify-css.cjs +13 -0
  26. package/dist/utils/beautify-css.d.ts +1 -0
  27. package/dist/utils/beautify-css.mjs +11 -0
  28. package/dist/utils/convert-color-space.cjs +40 -0
  29. package/dist/utils/convert-color-space.d.ts +2 -0
  30. package/dist/utils/convert-color-space.mjs +38 -0
  31. package/dist/utils/convert-color-token.cjs +28 -0
  32. package/dist/utils/convert-color-token.d.ts +3 -0
  33. package/dist/utils/convert-color-token.mjs +26 -0
  34. package/dist/utils/create-doc.cjs +26 -0
  35. package/dist/utils/create-doc.d.ts +16 -0
  36. package/dist/utils/create-doc.mjs +21 -0
  37. package/dist/utils/css-data-provider.cjs +9 -0
  38. package/dist/utils/css-data-provider.d.ts +3 -0
  39. package/dist/utils/css-data-provider.mjs +7 -0
  40. package/dist/utils/find-matching-brackets.cjs +29 -0
  41. package/dist/utils/find-matching-brackets.d.ts +1 -0
  42. package/dist/utils/find-matching-brackets.mjs +27 -0
  43. package/dist/utils/get-color-completion-items.cjs +30 -0
  44. package/dist/utils/get-color-completion-items.d.ts +3 -0
  45. package/dist/utils/get-color-completion-items.mjs +28 -0
  46. package/dist/utils/get-css-data-documentation.cjs +90 -0
  47. package/dist/utils/get-css-data-documentation.d.ts +5 -0
  48. package/dist/utils/get-css-data-documentation.mjs +88 -0
  49. package/dist/utils/get-main-completion-items.cjs +105 -0
  50. package/dist/utils/get-main-completion-items.d.ts +3 -0
  51. package/dist/utils/get-main-completion-items.mjs +103 -0
  52. package/dist/utils/get-position.cjs +12 -0
  53. package/dist/utils/get-position.d.ts +1 -0
  54. package/dist/utils/get-position.mjs +10 -0
  55. package/dist/utils/get-pseudo-class-completion-items.cjs +65 -0
  56. package/dist/utils/get-pseudo-class-completion-items.d.ts +3 -0
  57. package/dist/utils/get-pseudo-class-completion-items.mjs +63 -0
  58. package/dist/utils/get-pseudo-element-completion-items.cjs +56 -0
  59. package/dist/utils/get-pseudo-element-completion-items.d.ts +3 -0
  60. package/dist/utils/get-pseudo-element-completion-items.mjs +54 -0
  61. package/dist/utils/get-query-completion-items.cjs +102 -0
  62. package/dist/utils/get-query-completion-items.d.ts +3 -0
  63. package/dist/utils/get-query-completion-items.mjs +100 -0
  64. package/dist/utils/get-range.cjs +21 -0
  65. package/dist/utils/get-range.d.ts +2 -0
  66. package/dist/utils/get-range.mjs +19 -0
  67. package/dist/utils/get-utility-info.cjs +32 -0
  68. package/dist/utils/get-utility-info.d.ts +7 -0
  69. package/dist/utils/get-utility-info.mjs +30 -0
  70. package/dist/utils/get-value-completion-items.cjs +185 -0
  71. package/dist/utils/get-value-completion-items.d.ts +3 -0
  72. package/dist/utils/get-value-completion-items.mjs +183 -0
  73. package/dist/utils/query-syntax-completions.cjs +115 -0
  74. package/dist/utils/query-syntax-completions.d.ts +3 -0
  75. package/dist/utils/query-syntax-completions.mjs +113 -0
  76. package/dist/utils/regex.cjs +1 -1
  77. package/dist/utils/regex.mjs +1 -1
  78. package/dist/utils/sort-completion-items.cjs +11 -0
  79. package/dist/utils/sort-completion-items.d.ts +2 -0
  80. package/dist/utils/sort-completion-items.mjs +9 -0
  81. package/package.json +1 -1
  82. package/dist/constant.cjs +0 -3064
  83. package/dist/constant.d.ts +0 -33
  84. package/dist/constant.mjs +0 -3055
  85. package/dist/position-check.cjs +0 -37
  86. package/dist/position-check.d.ts +0 -7
  87. package/dist/position-check.mjs +0 -35
  88. package/dist/providers/color.cjs +0 -319
  89. package/dist/providers/color.d.ts +0 -5
  90. package/dist/providers/color.mjs +0 -315
  91. package/dist/providers/completion.cjs +0 -309
  92. package/dist/providers/completion.d.ts +0 -14
  93. package/dist/providers/completion.mjs +0 -303
  94. package/dist/providers/hover.cjs +0 -65
  95. package/dist/providers/hover.d.ts +0 -2
  96. package/dist/providers/hover.mjs +0 -63
  97. package/dist/utils/get-css-entry-markdown-description.cjs +0 -77
  98. package/dist/utils/get-css-entry-markdown-description.d.ts +0 -1
  99. package/dist/utils/get-css-entry-markdown-description.mjs +0 -75
  100. package/dist/utils/hex-to-rgb.cjs +0 -13
  101. package/dist/utils/hex-to-rgb.d.ts +0 -2
  102. package/dist/utils/hex-to-rgb.mjs +0 -11
  103. package/dist/utils/oklab-to-rgb.cjs +0 -33
  104. package/dist/utils/oklab-to-rgb.d.ts +0 -1
  105. package/dist/utils/oklab-to-rgb.mjs +0 -31
  106. package/dist/utils/oklch-to-oklab.cjs +0 -11
  107. package/dist/utils/oklch-to-oklab.d.ts +0 -1
  108. package/dist/utils/oklch-to-oklab.mjs +0 -9
  109. package/dist/utils/to-two-digit-hex.cjs +0 -8
  110. package/dist/utils/to-two-digit-hex.d.ts +0 -1
  111. package/dist/utils/to-two-digit-hex.mjs +0 -6
@@ -0,0 +1,68 @@
1
+ import { getCSSDataDocumentation } from '../utils/get-css-data-documentation.mjs';
2
+ import { generateCSS, Layer, isCoreRule } from '@master/css';
3
+ import cssDataProvider from '../utils/css-data-provider.mjs';
4
+ import getUtilityInfo from '../utils/get-utility-info.mjs';
5
+
6
+ function inspectSyntax(document, position) {
7
+ const classPosition = this.getClassPosition(document, position);
8
+ if (!classPosition) return;
9
+ const { token } = classPosition;
10
+ const range = {
11
+ start: document.positionAt(classPosition.range.start),
12
+ end: document.positionAt(classPosition.range.end)
13
+ };
14
+ const styleClasses = this.css.styles[token];
15
+ if (styleClasses) {
16
+ const documentation = getCSSDataDocumentation({}, {
17
+ generatedCSS: generateCSS([
18
+ token
19
+ ], this.css),
20
+ docs: 'styles'
21
+ });
22
+ if (documentation) {
23
+ return {
24
+ contents: {
25
+ kind: documentation.kind,
26
+ value: `(style) ` + styleClasses.join(' ') + '\n' + documentation.value
27
+ }
28
+ };
29
+ }
30
+ } else {
31
+ const rules = this.css.generate(token);
32
+ const rule = rules[0];
33
+ if (rule) {
34
+ if (rule.layer === Layer.Utility) {
35
+ const { data, docs } = getUtilityInfo(rule.RegisteredRule, this.css);
36
+ const documentation = getCSSDataDocumentation(data, {
37
+ generatedCSS: generateCSS([
38
+ token
39
+ ], this.css),
40
+ docs
41
+ });
42
+ if (documentation) {
43
+ return {
44
+ contents: documentation,
45
+ range
46
+ };
47
+ }
48
+ } else {
49
+ const nativeProperties = cssDataProvider.provideProperties();
50
+ const nativeCSSPropertyData = nativeProperties.find(({ name })=>name === rule.id);
51
+ const documentation = getCSSDataDocumentation(nativeCSSPropertyData, {
52
+ generatedCSS: generateCSS([
53
+ token
54
+ ], this.css),
55
+ docs: isCoreRule(rule.id) && rule.id
56
+ });
57
+ if (documentation) {
58
+ return {
59
+ contents: documentation,
60
+ range
61
+ };
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ export { inspectSyntax as default };
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ var regex = require('../utils/regex.cjs');
4
+ var culori = require('culori');
5
+ var css = require('@master/css');
6
+
7
+ async function renderSyntaxColors(document) {
8
+ const text = document.getText() ?? '';
9
+ const colorInformations = [];
10
+ for (const instanceMatch of text.matchAll(regex.instancePattern)){
11
+ if (instanceMatch.index === undefined) break;
12
+ const instanceStartIndex = instanceMatch.index;
13
+ const syntax = instanceMatch[0];
14
+ const rule = this.css.generate(syntax)[0];
15
+ if (rule && rule.layer !== css.Layer.Utility) {
16
+ const keyTokenLength = rule.keyToken?.length ?? 0;
17
+ let currentLength = 0;
18
+ const resolveValueComponent = (valueComponent)=>{
19
+ if (valueComponent.text === undefined) return; // text is always existing, just for type
20
+ const startOffset = instanceStartIndex + keyTokenLength + currentLength;
21
+ // TODO: check number mt:30
22
+ const valueComponentTokenLength = valueComponent.token.length;
23
+ let color;
24
+ switch(valueComponent.type){
25
+ case 'function':
26
+ if ([
27
+ 'rgb',
28
+ 'rgba',
29
+ 'hsl',
30
+ 'hsla',
31
+ 'hwb',
32
+ 'lab',
33
+ 'lch',
34
+ 'oklab',
35
+ 'oklch',
36
+ 'color'
37
+ ].includes(valueComponent.name)) {
38
+ color = culori.parse(valueComponent.text);
39
+ } else if (valueComponent.children.length) {
40
+ currentLength += valueComponent.name.length + 1 // function name + '('
41
+ ;
42
+ valueComponent.children.forEach(resolveValueComponent);
43
+ }
44
+ break;
45
+ case 'variable':
46
+ if (valueComponent.variable?.type === 'color') {
47
+ color = culori.parse(valueComponent.text);
48
+ }
49
+ break;
50
+ case 'string':
51
+ if (valueComponent.text !== '#' && valueComponent.text?.startsWith('#')) {
52
+ color = culori.parse(valueComponent.text);
53
+ }
54
+ break;
55
+ }
56
+ // check if rgba is valid
57
+ if (color) {
58
+ const rgbaColor = color.mode !== 'rgb' ? culori.converter('rgb')(color) : color;
59
+ colorInformations.push({
60
+ range: {
61
+ start: document.positionAt(startOffset),
62
+ end: document.positionAt(startOffset + valueComponentTokenLength)
63
+ },
64
+ color: {
65
+ red: rgbaColor.r,
66
+ green: rgbaColor.g,
67
+ blue: rgbaColor.b,
68
+ alpha: rgbaColor.alpha === undefined ? 1 : rgbaColor.alpha
69
+ }
70
+ });
71
+ }
72
+ currentLength += valueComponentTokenLength || 0;
73
+ };
74
+ rule.valueComponents.forEach(resolveValueComponent);
75
+ }
76
+ }
77
+ const colorIndexSet = new Set();
78
+ return colorInformations.filter((item)=>{
79
+ if (colorIndexSet.has(item.range.start)) {
80
+ return false;
81
+ } else {
82
+ colorIndexSet.add(item.range.start);
83
+ return true;
84
+ }
85
+ });
86
+ }
87
+
88
+ module.exports = renderSyntaxColors;
@@ -0,0 +1,4 @@
1
+ import type { ColorInformation } from 'vscode-languageserver-protocol';
2
+ import CSSLanguageService from '../core';
3
+ import type { TextDocument } from 'vscode-languageserver-textdocument';
4
+ export default function renderSyntaxColors(this: CSSLanguageService, document: TextDocument): Promise<ColorInformation[] | undefined>;
@@ -0,0 +1,86 @@
1
+ import { instancePattern } from '../utils/regex.mjs';
2
+ import { parse, converter } from 'culori';
3
+ import { Layer } from '@master/css';
4
+
5
+ async function renderSyntaxColors(document) {
6
+ const text = document.getText() ?? '';
7
+ const colorInformations = [];
8
+ for (const instanceMatch of text.matchAll(instancePattern)){
9
+ if (instanceMatch.index === undefined) break;
10
+ const instanceStartIndex = instanceMatch.index;
11
+ const syntax = instanceMatch[0];
12
+ const rule = this.css.generate(syntax)[0];
13
+ if (rule && rule.layer !== Layer.Utility) {
14
+ const keyTokenLength = rule.keyToken?.length ?? 0;
15
+ let currentLength = 0;
16
+ const resolveValueComponent = (valueComponent)=>{
17
+ if (valueComponent.text === undefined) return; // text is always existing, just for type
18
+ const startOffset = instanceStartIndex + keyTokenLength + currentLength;
19
+ // TODO: check number mt:30
20
+ const valueComponentTokenLength = valueComponent.token.length;
21
+ let color;
22
+ switch(valueComponent.type){
23
+ case 'function':
24
+ if ([
25
+ 'rgb',
26
+ 'rgba',
27
+ 'hsl',
28
+ 'hsla',
29
+ 'hwb',
30
+ 'lab',
31
+ 'lch',
32
+ 'oklab',
33
+ 'oklch',
34
+ 'color'
35
+ ].includes(valueComponent.name)) {
36
+ color = parse(valueComponent.text);
37
+ } else if (valueComponent.children.length) {
38
+ currentLength += valueComponent.name.length + 1 // function name + '('
39
+ ;
40
+ valueComponent.children.forEach(resolveValueComponent);
41
+ }
42
+ break;
43
+ case 'variable':
44
+ if (valueComponent.variable?.type === 'color') {
45
+ color = parse(valueComponent.text);
46
+ }
47
+ break;
48
+ case 'string':
49
+ if (valueComponent.text !== '#' && valueComponent.text?.startsWith('#')) {
50
+ color = parse(valueComponent.text);
51
+ }
52
+ break;
53
+ }
54
+ // check if rgba is valid
55
+ if (color) {
56
+ const rgbaColor = color.mode !== 'rgb' ? converter('rgb')(color) : color;
57
+ colorInformations.push({
58
+ range: {
59
+ start: document.positionAt(startOffset),
60
+ end: document.positionAt(startOffset + valueComponentTokenLength)
61
+ },
62
+ color: {
63
+ red: rgbaColor.r,
64
+ green: rgbaColor.g,
65
+ blue: rgbaColor.b,
66
+ alpha: rgbaColor.alpha === undefined ? 1 : rgbaColor.alpha
67
+ }
68
+ });
69
+ }
70
+ currentLength += valueComponentTokenLength || 0;
71
+ };
72
+ rule.valueComponents.forEach(resolveValueComponent);
73
+ }
74
+ }
75
+ const colorIndexSet = new Set();
76
+ return colorInformations.filter((item)=>{
77
+ if (colorIndexSet.has(item.range.start)) {
78
+ return false;
79
+ } else {
80
+ colorIndexSet.add(item.range.start);
81
+ return true;
82
+ }
83
+ });
84
+ }
85
+
86
+ export { renderSyntaxColors as default };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var querySyntaxCompletions = require('../utils/query-syntax-completions.cjs');
4
+
5
+ function suggestSyntax(document, position, context) {
6
+ const classPosition = this.getClassPosition(document, position);
7
+ if (classPosition !== undefined) {
8
+ const q = context?.triggerCharacter === ' ' ? '' : document.getText({
9
+ start: document.positionAt(classPosition.range.start),
10
+ end: position
11
+ });
12
+ return querySyntaxCompletions(q, this.css);
13
+ }
14
+ // todo
15
+ // else if (isInstance === true && checkConfigColorsBlock(document, position) === true) {
16
+ // return getColorCompletionItems(this.css)
17
+ // }
18
+ }
19
+
20
+ module.exports = suggestSyntax;
@@ -0,0 +1,4 @@
1
+ import type { CompletionItem, CompletionParams } from 'vscode-languageserver-protocol';
2
+ import type { TextDocument } from 'vscode-languageserver-textdocument';
3
+ import CSSLanguageService from '../core';
4
+ export default function suggestSyntax(this: CSSLanguageService, document: TextDocument, position: CompletionParams['position'], context: CompletionParams['context']): CompletionItem[] | undefined;
@@ -0,0 +1,18 @@
1
+ import querySyntaxCompletions from '../utils/query-syntax-completions.mjs';
2
+
3
+ function suggestSyntax(document, position, context) {
4
+ const classPosition = this.getClassPosition(document, position);
5
+ if (classPosition !== undefined) {
6
+ const q = context?.triggerCharacter === ' ' ? '' : document.getText({
7
+ start: document.positionAt(classPosition.range.start),
8
+ end: position
9
+ });
10
+ return querySyntaxCompletions(q, this.css);
11
+ }
12
+ // todo
13
+ // else if (isInstance === true && checkConfigColorsBlock(document, position) === true) {
14
+ // return getColorCompletionItems(this.css)
15
+ // }
16
+ }
17
+
18
+ export { suggestSyntax as default };
package/dist/index.cjs CHANGED
@@ -1,21 +1,29 @@
1
1
  'use strict';
2
2
 
3
- var color = require('./providers/color.cjs');
4
- var completion = require('./providers/completion.cjs');
5
- var hover = require('./providers/hover.cjs');
6
- var positionCheck = require('./position-check.cjs');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('./core.cjs');
7
6
  var settings = require('./settings.cjs');
7
+ var common = require('./common.cjs');
8
+ var inspectSyntax = require('./features/inspect-syntax.cjs');
9
+ var renderSyntaxColors = require('./features/render-syntax-colors.cjs');
10
+ var editSyntaxColors = require('./features/edit-syntax-colors.cjs');
11
+ var suggestSyntax = require('./features/suggest-syntax.cjs');
8
12
 
9
13
 
10
14
 
11
- exports.getColorPresentation = color.getColorPresentation;
12
- exports.getColorValue = color.getColorValue;
13
- exports.getDocumentColors = color.getDocumentColors;
14
- exports.checkConfigColorsBlock = completion.checkConfigColorsBlock;
15
- exports.getCompletionItem = completion.getCompletionItem;
16
- exports.getConfigColorsCompletionItem = completion.getConfigColorsCompletionItem;
17
- exports.getLastInstance = completion.getLastInstance;
18
- exports.getReturnItem = completion.getReturnItem;
19
- exports.doHover = hover.doHover;
20
- exports.positionCheck = positionCheck.positionCheck;
21
- exports.settings = settings.settings;
15
+ exports.CSSLanguageService = core;
16
+ exports.default = core;
17
+ exports.settings = settings;
18
+ exports.AT_TRIGGER_CHARACTER = common.AT_TRIGGER_CHARACTER;
19
+ exports.DECLARATION_SEPARATOR_TRIGGER_CHARACTER = common.DECLARATION_SEPARATOR_TRIGGER_CHARACTER;
20
+ exports.GROUP_TRIGGER_CHARACTER = common.GROUP_TRIGGER_CHARACTER;
21
+ exports.INVOKED_TRIGGER_CHARACTERS = common.INVOKED_TRIGGER_CHARACTERS;
22
+ exports.QUERY_TRIGGER_CHARACTERS = common.QUERY_TRIGGER_CHARACTERS;
23
+ exports.SELECTOR_TRIGGER_CHARACTERS = common.SELECTOR_TRIGGER_CHARACTERS;
24
+ exports.SERVER_CAPABILITIES = common.SERVER_CAPABILITIES;
25
+ exports.VALUE_TRIGGER_CHARACTERS = common.VALUE_TRIGGER_CHARACTERS;
26
+ exports.inspectSyntax = inspectSyntax;
27
+ exports.renderSyntaxColors = renderSyntaxColors;
28
+ exports.editSyntaxColors = editSyntaxColors;
29
+ exports.suggestSyntax = suggestSyntax;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export * from './providers/color';
2
- export * from './providers/completion';
3
- export * from './providers/hover';
4
- export * from './position-check';
5
- export * from './settings';
1
+ export { default, default as CSSLanguageService } from './core';
2
+ export { default as settings, type Settings } from './settings';
3
+ export * from './common';
4
+ export { default as inspectSyntax } from './features/inspect-syntax';
5
+ export { default as renderSyntaxColors } from './features/render-syntax-colors';
6
+ export { default as editSyntaxColors } from './features/edit-syntax-colors';
7
+ export { default as suggestSyntax } from './features/suggest-syntax';
package/dist/index.mjs CHANGED
@@ -1,5 +1,7 @@
1
- export { getColorPresentation, getColorValue, getDocumentColors } from './providers/color.mjs';
2
- export { checkConfigColorsBlock, getCompletionItem, getConfigColorsCompletionItem, getLastInstance, getReturnItem } from './providers/completion.mjs';
3
- export { doHover } from './providers/hover.mjs';
4
- export { positionCheck } from './position-check.mjs';
5
- export { settings } from './settings.mjs';
1
+ export { default as CSSLanguageService, default } from './core.mjs';
2
+ export { default as settings } from './settings.mjs';
3
+ export { AT_TRIGGER_CHARACTER, DECLARATION_SEPARATOR_TRIGGER_CHARACTER, GROUP_TRIGGER_CHARACTER, INVOKED_TRIGGER_CHARACTERS, QUERY_TRIGGER_CHARACTERS, SELECTOR_TRIGGER_CHARACTERS, SERVER_CAPABILITIES, VALUE_TRIGGER_CHARACTERS } from './common.mjs';
4
+ export { default as inspectSyntax } from './features/inspect-syntax.mjs';
5
+ export { default as renderSyntaxColors } from './features/render-syntax-colors.mjs';
6
+ export { default as editSyntaxColors } from './features/edit-syntax-colors.mjs';
7
+ export { default as suggestSyntax } from './features/suggest-syntax.mjs';
package/dist/settings.cjs CHANGED
@@ -1,37 +1,138 @@
1
1
  'use strict';
2
2
 
3
- const settings = {
4
- languages: [
5
- 'html',
6
- 'php',
7
- 'javascript',
8
- 'typescript',
9
- 'javascriptreact',
10
- 'typescriptreact',
11
- 'vue',
12
- 'svelte',
13
- 'rust'
3
+ /* eslint-disable quotes */ /**
4
+ * @example styles https://regex101.com/r/HLPdsw/1
5
+ **/ const settings = {
6
+ includedLanguages: [
7
+ "html",
8
+ "php",
9
+ "javascript",
10
+ "typescript",
11
+ "javascriptreact",
12
+ "typescriptreact",
13
+ "vue",
14
+ "svelte",
15
+ "rust",
16
+ "astro",
17
+ "markdown",
18
+ "mdx",
19
+ "astro"
14
20
  ],
15
- classMatch: [
16
- '(class(?:Name)?\\s?=\\s?)((?:"[^"]+")|(?:\'[^\']+\')|(?:`[^`]+`))',
17
- '(class(?:Name)?={)([^}]*)}',
18
- '(?:(\\$|(?:(?:element|el|style)\\.[^\\s.`]+)`)([^`]+)`)',
19
- '(style\\.(?:.*)\\()([^)]*)\\)',
20
- '(classList.(?:add|remove|replace|replace|toggle)\\()([^)]*)\\)',
21
- '(template\\s*\\:\\s*)((?:"[^"]+")|(?:\'[^\']+\')|(?:`[^`]+`))',
22
- '(?<=styles\\s*(?:=|:)\\s*{[\\s\\S]*)([^\']*)(\'[^\']*\')',
23
- '(?<=styles\\s*(?:=|:)\\s*{[\\s\\S]*)([^"]*)("[^"]*")',
24
- '(?<=styles\\s*(?:=|:)\\s*{[\\s\\S]*)([^`]*)(`[^`]*`)'
21
+ classStrings: [
22
+ [
23
+ "\\sclass=",
24
+ "\""
25
+ ],
26
+ [
27
+ "\\sclass=",
28
+ "'"
29
+ ],
30
+ [
31
+ "\\sclassName=",
32
+ "\""
33
+ ],
34
+ [
35
+ "\\sclassName=",
36
+ "'"
37
+ ],
38
+ [
39
+ "\\sstyled(?:\\s+)?(?:\\.\\w+)?",
40
+ "`"
41
+ ],
42
+ [
43
+ "\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
44
+ "\""
45
+ ],
46
+ [
47
+ "\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
48
+ "'"
49
+ ],
50
+ [
51
+ "\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
52
+ "`"
53
+ ]
54
+ ],
55
+ classAssignments: [
56
+ [
57
+ "\\sclassName=",
58
+ "{",
59
+ "}"
60
+ ],
61
+ [
62
+ "\\sclass=",
63
+ "{",
64
+ "}"
65
+ ],
66
+ [
67
+ "\\sclass:list=",
68
+ "{",
69
+ "}"
70
+ ],
71
+ [
72
+ "\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
73
+ "{",
74
+ "}"
75
+ ],
76
+ [
77
+ "\\s:class=",
78
+ "\"",
79
+ "\""
80
+ ],
81
+ [
82
+ "\\sv-bind:class=",
83
+ "\"",
84
+ "\""
85
+ ],
86
+ [
87
+ "\\s[class]=",
88
+ "\"",
89
+ "\""
90
+ ],
91
+ [
92
+ "\\s[className]=",
93
+ "\"",
94
+ "\""
95
+ ],
96
+ [
97
+ "\\s[ngClass]=",
98
+ "\"",
99
+ "\""
100
+ ],
101
+ [
102
+ "\\sclsx",
103
+ "(",
104
+ ")"
105
+ ],
106
+ [
107
+ "\\scva",
108
+ "(",
109
+ ")"
110
+ ],
111
+ [
112
+ "\\.class",
113
+ "(",
114
+ ")"
115
+ ],
116
+ [
117
+ "\\sstyled(?:\\s+)?(?:\\.\\w+)?",
118
+ "(",
119
+ ")"
120
+ ],
121
+ [
122
+ "\\.classList(?:\\s+)?(?:\\.(add|remove|toggle|replace))",
123
+ "(",
124
+ ")"
125
+ ]
25
126
  ],
26
127
  exclude: [
27
- '**/.git/**',
28
- '**/node_modules/**',
29
- '**/.hg/**'
128
+ "**/.git/**",
129
+ "**/node_modules/**",
130
+ "**/.hg/**"
30
131
  ],
31
- suggestions: true,
32
- inspect: true,
33
- previewColors: true,
34
- config: 'master.css'
132
+ suggestSyntax: true,
133
+ inspectSyntax: true,
134
+ renderSyntaxColors: true,
135
+ editSyntaxColors: true
35
136
  };
36
137
 
37
- exports.settings = settings;
138
+ module.exports = settings;
@@ -1,9 +1,17 @@
1
- export declare const settings: {
2
- languages: string[];
3
- classMatch: string[];
4
- exclude: string[];
5
- suggestions: boolean;
6
- inspect: boolean;
7
- previewColors: boolean;
8
- config: string;
1
+ import { Config } from '@master/css';
2
+ /**
3
+ * @example styles https://regex101.com/r/HLPdsw/1
4
+ **/
5
+ declare const settings: Settings;
6
+ export default settings;
7
+ export declare type Settings = {
8
+ includedLanguages?: string[];
9
+ classStrings?: [string, string][];
10
+ classAssignments?: [string, string, string][];
11
+ exclude?: string[];
12
+ config?: Config;
13
+ suggestSyntax?: boolean;
14
+ inspectSyntax?: boolean;
15
+ renderSyntaxColors?: boolean;
16
+ editSyntaxColors?: boolean;
9
17
  };