@bhsd/common 0.6.4 → 0.6.6
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/dist/index.js +8 -1
- package/dist/index.mjs +8 -1
- package/eslintrc.cjs +6 -0
- package/package.json +3 -2
- package/.eslintrc.cjs +0 -16
package/dist/index.js
CHANGED
|
@@ -42,8 +42,15 @@ const normalizeTitle = (title) => {
|
|
|
42
42
|
return /[<>[\]|{}]/u.test(decoded) ? decoded : decodeHTML(decoded);
|
|
43
43
|
};
|
|
44
44
|
const numToHex = (d) => Math.round(d * 255).toString(16).padStart(2, "0");
|
|
45
|
+
const regex = /* @__PURE__ */ (() => {
|
|
46
|
+
const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\d_])`, rgbValue = String.raw`(?:\d*\.)?\d+%?`, hue = String.raw`(?:\d*\.)?\d+(?:deg|grad|rad|turn)?`, rgbColor = String.raw`rgba?\(\s*(?:${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s+`)}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s*,\s*`)}(?:\s*,\s*${rgbValue})?`})\s*\)`, hslColor = String.raw`hsla?\(\s*(?:${String.raw`${hue}\s+${rgbValue}\s+${rgbValue}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${hue}${String.raw`\s*,\s*(?:\d*\.)?\d+%`.repeat(2)}(?:\s*,\s*${rgbValue})?`})\s*\)`;
|
|
47
|
+
return {
|
|
48
|
+
full: new RegExp(String.raw`(^|[^\p{L}\d_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
|
|
49
|
+
rgb: new RegExp(String.raw`(^|[^\p{L}\d_])(${hexColor}|${rgbColor})`, "giu")
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
45
52
|
const splitColors = (str, hsl = true) => {
|
|
46
|
-
const
|
|
53
|
+
const pieces = [], re = regex[hsl ? "full" : "rgb"];
|
|
47
54
|
re.lastIndex = 0;
|
|
48
55
|
let mt = re.exec(str), lastIndex = 0;
|
|
49
56
|
while (mt) {
|
package/dist/index.mjs
CHANGED
|
@@ -10,8 +10,15 @@ const normalizeTitle = (title) => {
|
|
|
10
10
|
return /[<>[\]|{}]/u.test(decoded) ? decoded : decodeHTML(decoded);
|
|
11
11
|
};
|
|
12
12
|
const numToHex = (d) => Math.round(d * 255).toString(16).padStart(2, "0");
|
|
13
|
+
const regex = /* @__PURE__ */ (() => {
|
|
14
|
+
const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\d_])`, rgbValue = String.raw`(?:\d*\.)?\d+%?`, hue = String.raw`(?:\d*\.)?\d+(?:deg|grad|rad|turn)?`, rgbColor = String.raw`rgba?\(\s*(?:${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s+`)}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s*,\s*`)}(?:\s*,\s*${rgbValue})?`})\s*\)`, hslColor = String.raw`hsla?\(\s*(?:${String.raw`${hue}\s+${rgbValue}\s+${rgbValue}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${hue}${String.raw`\s*,\s*(?:\d*\.)?\d+%`.repeat(2)}(?:\s*,\s*${rgbValue})?`})\s*\)`;
|
|
15
|
+
return {
|
|
16
|
+
full: new RegExp(String.raw`(^|[^\p{L}\d_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
|
|
17
|
+
rgb: new RegExp(String.raw`(^|[^\p{L}\d_])(${hexColor}|${rgbColor})`, "giu")
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
13
20
|
const splitColors = (str, hsl = true) => {
|
|
14
|
-
const
|
|
21
|
+
const pieces = [], re = regex[hsl ? "full" : "rgb"];
|
|
15
22
|
re.lastIndex = 0;
|
|
16
23
|
let mt = re.exec(str), lastIndex = 0;
|
|
17
24
|
while (mt) {
|
package/eslintrc.cjs
CHANGED
|
@@ -615,6 +615,12 @@ module.exports = {
|
|
|
615
615
|
excludeTags: ['description'],
|
|
616
616
|
},
|
|
617
617
|
],
|
|
618
|
+
'jsdoc/check-param-names': [
|
|
619
|
+
1,
|
|
620
|
+
{
|
|
621
|
+
disableMissingParamChecks: true,
|
|
622
|
+
},
|
|
623
|
+
],
|
|
618
624
|
'jsdoc/check-tag-names': 1,
|
|
619
625
|
'jsdoc/check-types': 1,
|
|
620
626
|
'jsdoc/multiline-blocks': 1,
|
package/package.json
CHANGED