@bhsd/common 0.9.2 → 0.9.4

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 CHANGED
@@ -48,10 +48,10 @@ const normalizeTitle = (title) => {
48
48
  };
49
49
  const numToHex = (d) => Math.round(d * 255).toString(16).padStart(2, "0");
50
50
  const regex = /* @__PURE__ */ (() => {
51
- 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*\)`;
51
+ const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\p{N}_])`, 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*\)`;
52
52
  return {
53
- full: new RegExp(String.raw`(^|[^\p{L}\d_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
54
- rgb: new RegExp(String.raw`(^|[^\p{L}\d_])(${hexColor}|${rgbColor})`, "giu")
53
+ full: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
54
+ rgb: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor})`, "giu")
55
55
  };
56
56
  })();
57
57
  const splitColors = (str, hsl = true) => {
@@ -78,7 +78,7 @@ const loadScript = (src, globalConst, amd) => {
78
78
  return loading.get(src);
79
79
  }
80
80
  const promise = new Promise((resolve) => {
81
- const path = `${CDN}/${src}`;
81
+ const path = /^https?:\/\//iu.test(src) ? src : `${CDN}/${src}`;
82
82
  let obj = globalThis;
83
83
  for (const prop of globalConst.split(".")) {
84
84
  obj = obj?.[prop];
package/dist/index.mjs CHANGED
@@ -11,10 +11,10 @@ const normalizeTitle = (title) => {
11
11
  };
12
12
  const numToHex = (d) => Math.round(d * 255).toString(16).padStart(2, "0");
13
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*\)`;
14
+ const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\p{N}_])`, 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
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")
16
+ full: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
17
+ rgb: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor})`, "giu")
18
18
  };
19
19
  })();
20
20
  const splitColors = (str, hsl = true) => {
@@ -41,7 +41,7 @@ const loadScript = (src, globalConst, amd) => {
41
41
  return loading.get(src);
42
42
  }
43
43
  const promise = new Promise((resolve) => {
44
- const path = `${CDN}/${src}`;
44
+ const path = /^https?:\/\//iu.test(src) ? src : `${CDN}/${src}`;
45
45
  let obj = globalThis;
46
46
  for (const prop of globalConst.split(".")) {
47
47
  obj = obj?.[prop];
package/eslintrc.cjs CHANGED
@@ -720,6 +720,7 @@ module.exports = {
720
720
  '@stylistic/quotes': 0,
721
721
  strict: 0,
722
722
  'unicorn/prefer-string-raw': 0,
723
+ 'unicorn/numeric-separators-style': 0,
723
724
  },
724
725
  },
725
726
  {
package/eslintrc.dist.cjs CHANGED
@@ -7,16 +7,13 @@ module.exports = {
7
7
  es2024: true,
8
8
  },
9
9
  plugins: ['es-x'],
10
- extends: ['plugin:es-x/restrict-to-es2019'],
10
+ extends: ['plugin:es-x/restrict-to-es2020'],
11
11
  parserOptions: {
12
12
  ecmaVersion: 'latest',
13
13
  },
14
14
  rules: {
15
- 'es-x/no-global-this': 0,
16
- 'es-x/no-import-meta': 0,
17
- 'es-x/no-promise-all-settled': 0,
18
15
  'es-x/no-regexp-lookbehind-assertions': 2,
19
- 'es-x/no-string-prototype-matchall': 0,
16
+ 'es-x/no-regexp-unicode-property-escapes-2020': 2,
20
17
  },
21
18
  settings: {
22
19
  'es-x': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "license": "MIT",
5
5
  "author": "Bhsd",
6
6
  "files": [
@@ -39,7 +39,7 @@
39
39
  "lint": "npm run lint:ts"
40
40
  },
41
41
  "dependencies": {
42
- "stylelint-config-recommended": "^15.0.0"
42
+ "stylelint-config-recommended": "^16.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@stylistic/eslint-plugin": "^3.1.0",
@@ -61,8 +61,8 @@
61
61
  "eslint-plugin-unicorn": "^56.0.1",
62
62
  "http-server": "^14.1.1",
63
63
  "mocha": "^11.1.0",
64
- "stylelint": "^16.14.1",
64
+ "stylelint": "^16.19.1",
65
65
  "typescript": "^5.8.2",
66
- "wikiparser-node": "^1.19.0"
66
+ "wikiparser-node": "^1.20.1"
67
67
  }
68
68
  }
package/stylelintrc.cjs CHANGED
@@ -17,6 +17,7 @@ module.exports = {
17
17
  'declaration-block-single-line-max-declarations': 1,
18
18
  'number-max-precision': 2,
19
19
  'alpha-value-notation': 'number',
20
+ 'color-function-alias-notation': 'without-alpha',
20
21
  'color-function-notation': 'legacy',
21
22
  'color-hex-length': 'short',
22
23
  'font-weight-notation': 'named-where-possible',