@master/css-language-service 2.0.0-rc.22 → 2.0.0-rc.24
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.
|
@@ -247,13 +247,33 @@ function getReturnItem(items, kind, insertText = '') {
|
|
|
247
247
|
}
|
|
248
248
|
function getColorsItem(css$1 = new css.MasterCSS()) {
|
|
249
249
|
const masterStyleCompletionItem = [];
|
|
250
|
-
// todo: refactor css.variables
|
|
251
250
|
for(const eachVariableName in css$1.variables){
|
|
252
251
|
const eachVariable = css$1.variables[eachVariableName];
|
|
253
252
|
if (eachVariable.type === 'color') {
|
|
253
|
+
let colorValue;
|
|
254
|
+
let colorSpace;
|
|
255
|
+
if (eachVariable.themes) {
|
|
256
|
+
colorValue = Object.values(eachVariable.themes)[0].value;
|
|
257
|
+
colorSpace = Object.values(eachVariable.themes)[0].space;
|
|
258
|
+
} else {
|
|
259
|
+
colorValue = eachVariable.value;
|
|
260
|
+
colorSpace = eachVariable.space;
|
|
261
|
+
}
|
|
262
|
+
let colorResult;
|
|
263
|
+
switch(colorSpace){
|
|
264
|
+
case 'rgb':
|
|
265
|
+
colorResult = `rgb(${colorValue?.split(' ')?.slice(0, 3).join(',')})`;
|
|
266
|
+
break;
|
|
267
|
+
case 'hsl':
|
|
268
|
+
colorResult = `hsl(${colorValue?.split(' ')?.slice(0, 3).join(',')})`;
|
|
269
|
+
break;
|
|
270
|
+
case 'hex':
|
|
271
|
+
colorResult = `#${colorValue}`;
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
254
274
|
masterStyleCompletionItem.push({
|
|
255
275
|
label: eachVariableName,
|
|
256
|
-
documentation:
|
|
276
|
+
documentation: colorResult,
|
|
257
277
|
kind: 16,
|
|
258
278
|
sortText: eachVariableName
|
|
259
279
|
});
|
|
@@ -245,13 +245,33 @@ function getReturnItem(items, kind, insertText = '') {
|
|
|
245
245
|
}
|
|
246
246
|
function getColorsItem(css = new MasterCSS()) {
|
|
247
247
|
const masterStyleCompletionItem = [];
|
|
248
|
-
// todo: refactor css.variables
|
|
249
248
|
for(const eachVariableName in css.variables){
|
|
250
249
|
const eachVariable = css.variables[eachVariableName];
|
|
251
250
|
if (eachVariable.type === 'color') {
|
|
251
|
+
let colorValue;
|
|
252
|
+
let colorSpace;
|
|
253
|
+
if (eachVariable.themes) {
|
|
254
|
+
colorValue = Object.values(eachVariable.themes)[0].value;
|
|
255
|
+
colorSpace = Object.values(eachVariable.themes)[0].space;
|
|
256
|
+
} else {
|
|
257
|
+
colorValue = eachVariable.value;
|
|
258
|
+
colorSpace = eachVariable.space;
|
|
259
|
+
}
|
|
260
|
+
let colorResult;
|
|
261
|
+
switch(colorSpace){
|
|
262
|
+
case 'rgb':
|
|
263
|
+
colorResult = `rgb(${colorValue?.split(' ')?.slice(0, 3).join(',')})`;
|
|
264
|
+
break;
|
|
265
|
+
case 'hsl':
|
|
266
|
+
colorResult = `hsl(${colorValue?.split(' ')?.slice(0, 3).join(',')})`;
|
|
267
|
+
break;
|
|
268
|
+
case 'hex':
|
|
269
|
+
colorResult = `#${colorValue}`;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
252
272
|
masterStyleCompletionItem.push({
|
|
253
273
|
label: eachVariableName,
|
|
254
|
-
documentation:
|
|
274
|
+
documentation: colorResult,
|
|
255
275
|
kind: 16,
|
|
256
276
|
sortText: eachVariableName
|
|
257
277
|
});
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@master/css-language-service","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","type-check":"tsc --noEmit","lint":"eslint src"},"description":"Master CSS Language Service","author":"Aoyue Design LLC.","license":"MIT","repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/language-service"},"dependencies":{"@babel/parser":"^7.23.9","@master/css":"^2.0.0-rc.
|
|
1
|
+
{"name":"@master/css-language-service","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","type-check":"tsc --noEmit","lint":"eslint src"},"description":"Master CSS Language Service","author":"Aoyue Design LLC.","license":"MIT","repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/language-service"},"dependencies":{"@babel/parser":"^7.23.9","@master/css":"^2.0.0-rc.24","color-convert":"^2.0.1","js-beautify":"^1.15.1","vscode-css-languageservice":"^6.2.12"},"devDependencies":{"@types/color-convert":"^2.0.3","vscode-languageserver-types":"^3.17.5"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"},"./settings":{"import":"./dist/settings/index.mjs","require":"./dist/settings/index.cjs","types":"./dist/settings/index.d.ts"}},"typesVersions":{"*":{"./":["./dist/index.d.ts"],"./settings":["./dist/settings.d.ts"]}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"version":"2.0.0-rc.24"}
|