@master/css-language-service 2.0.0-rc.2 → 2.0.0-rc.21

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.
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ function oklabToRgb([L, a, b]) {
4
+ let l = L + a * +0.3963377774 + b * +0.2158037573;
5
+ let m = L + a * -0.1055613458 + b * -0.0638541728;
6
+ let s = L + a * -0.0894841775 + b * -1.2914855480;
7
+ l = l ** 3;
8
+ m = m ** 3;
9
+ s = s ** 3;
10
+ let red = l * +4.0767416621 + m * -3.3077115913 + s * +0.2309699292;
11
+ let green = l * -1.2684380046 + m * +2.6097574011 + s * -0.3413193965;
12
+ let blue = l * -0.0041960863 + m * -0.7034186147 + s * +1.7076147010;
13
+ red = 255 * linearToGamma(red);
14
+ green = 255 * linearToGamma(green);
15
+ blue = 255 * linearToGamma(blue);
16
+ red = clamp(red, 0, 255);
17
+ green = clamp(green, 0, 255);
18
+ blue = clamp(blue, 0, 255);
19
+ red = Math.round(red);
20
+ green = Math.round(green);
21
+ blue = Math.round(blue);
22
+ return [
23
+ red,
24
+ green,
25
+ blue
26
+ ];
27
+ }
28
+ function clamp(value, min, max) {
29
+ return Math.max(Math.min(value, max), min);
30
+ }
31
+ const linearToGamma = (c)=>c >= 0.0031308 ? 1.055 * Math.pow(c, 1 / 2.4) - 0.055 : 12.92 * c;
32
+
33
+ exports.oklabToRgb = oklabToRgb;
@@ -0,0 +1,31 @@
1
+ function oklabToRgb([L, a, b]) {
2
+ let l = L + a * +0.3963377774 + b * +0.2158037573;
3
+ let m = L + a * -0.1055613458 + b * -0.0638541728;
4
+ let s = L + a * -0.0894841775 + b * -1.2914855480;
5
+ l = l ** 3;
6
+ m = m ** 3;
7
+ s = s ** 3;
8
+ let red = l * +4.0767416621 + m * -3.3077115913 + s * +0.2309699292;
9
+ let green = l * -1.2684380046 + m * +2.6097574011 + s * -0.3413193965;
10
+ let blue = l * -0.0041960863 + m * -0.7034186147 + s * +1.7076147010;
11
+ red = 255 * linearToGamma(red);
12
+ green = 255 * linearToGamma(green);
13
+ blue = 255 * linearToGamma(blue);
14
+ red = clamp(red, 0, 255);
15
+ green = clamp(green, 0, 255);
16
+ blue = clamp(blue, 0, 255);
17
+ red = Math.round(red);
18
+ green = Math.round(green);
19
+ blue = Math.round(blue);
20
+ return [
21
+ red,
22
+ green,
23
+ blue
24
+ ];
25
+ }
26
+ function clamp(value, min, max) {
27
+ return Math.max(Math.min(value, max), min);
28
+ }
29
+ const linearToGamma = (c)=>c >= 0.0031308 ? 1.055 * Math.pow(c, 1 / 2.4) - 0.055 : 12.92 * c;
30
+
31
+ export { oklabToRgb };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ function oklchToOklab([l, c, h]) {
4
+ return [
5
+ l,
6
+ c * Math.cos(h * Math.PI / 180),
7
+ c * Math.sin(h * Math.PI / 180)
8
+ ];
9
+ }
10
+
11
+ exports.oklchToOklab = oklchToOklab;
@@ -0,0 +1,9 @@
1
+ function oklchToOklab([l, c, h]) {
2
+ return [
3
+ l,
4
+ c * Math.cos(h * Math.PI / 180),
5
+ c * Math.sin(h * Math.PI / 180)
6
+ ];
7
+ }
8
+
9
+ export { oklchToOklab };
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const instancePattern = /[^\s:]+:\w*\(?((?<!\\)["'`])((?:\\\1|(?:(?!\1))[\S\s])*)((?<!\\)\1)\)?|[^\s"'`]+/g;
4
+
5
+ exports.instancePattern = instancePattern;
@@ -0,0 +1,3 @@
1
+ const instancePattern = /[^\s:]+:\w*\(?((?<!\\)["'`])((?:\\\1|(?:(?!\1))[\S\s])*)((?<!\\)\1)\)?|[^\s"'`]+/g;
2
+
3
+ export { instancePattern };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ function toTwoDigitHex(n) {
4
+ const r = n.toString(16);
5
+ return r.length !== 2 ? '0' + r : r;
6
+ }
7
+
8
+ exports.toTwoDigitHex = toTwoDigitHex;
@@ -0,0 +1,6 @@
1
+ function toTwoDigitHex(n) {
2
+ const r = n.toString(16);
3
+ return r.length !== 2 ? '0' + r : r;
4
+ }
5
+
6
+ export { toTwoDigitHex };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/css-language-service","scripts":{"build":"techor pack --platform node --declare","dev":"pnpm run build --watch","type-check":"tsc --noEmit","lint":"eslint src"},"description":"Master CSS Language Service","author":"Aoyue Design LLC.","license":"MIT","dependencies":{"@babel/parser":"^7.22.7","@master/css":"^2.0.0-rc.2","color-convert":"^2.0.1","js-beautify":"^1.14.7"},"devDependencies":{"@types/color-convert":"^2.0.0","vscode-css-languageservice":"^6.2.5","vscode-languageserver-types":"^3.17.3"},"main":"./dist/index.bundle.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.bundle.js","./settings":"./dist/settings.bundle.js"},"typesVersions":{"*":{"./":["./dist/index.d.ts"],"./settings":["./dist/settings.d.ts"]}},"files":["dist"],"publishConfig":{"access":"public"},"version":"2.0.0-rc.2"}
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.21","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.21"}