darkreader 4.9.112 → 4.9.114

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 (3) hide show
  1. package/darkreader.js +32 -10
  2. package/darkreader.mjs +30 -10
  3. package/package.json +12 -12
package/darkreader.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dark Reader v4.9.112
2
+ * Dark Reader v4.9.114
3
3
  * https://darkreader.org/
4
4
  */
5
5
 
@@ -124,7 +124,7 @@
124
124
  const isMacOS = platform.startsWith("mac");
125
125
  isNavigatorDefined && navigator.userAgentData
126
126
  ? navigator.userAgentData.mobile
127
- : userAgent.includes("mobile");
127
+ : userAgent.includes("mobile") || false;
128
128
  const isShadowDomSupported = typeof ShadowRoot === "function";
129
129
  const isMatchMediaChangeEventListenerSupported =
130
130
  typeof MediaQueryList === "function" &&
@@ -1870,10 +1870,12 @@
1870
1870
  m.startsWith("all") ||
1871
1871
  m.startsWith("(")
1872
1872
  );
1873
- const isPrintOrSpeech = media.some(
1874
- (m) => m.startsWith("print") || m.startsWith("speech")
1875
- );
1876
- if (isScreenOrAllOrQuery || !isPrintOrSpeech) {
1873
+ const isNotScreen =
1874
+ !isScreenOrAllOrQuery &&
1875
+ media.some((m) =>
1876
+ ignoredMedia.some((i) => m.startsWith(i))
1877
+ );
1878
+ if (isScreenOrAllOrQuery || !isNotScreen) {
1877
1879
  iterateCSSRules(rule.cssRules, iterate, onImportError);
1878
1880
  }
1879
1881
  } else if (isSupportsRule(rule)) {
@@ -1887,6 +1889,17 @@
1887
1889
  }
1888
1890
  });
1889
1891
  }
1892
+ const ignoredMedia = [
1893
+ "aural",
1894
+ "braille",
1895
+ "embossed",
1896
+ "handheld",
1897
+ "print",
1898
+ "projection",
1899
+ "speech",
1900
+ "tty",
1901
+ "tv"
1902
+ ];
1890
1903
  const shorthandVarDependantProperties = [
1891
1904
  "background",
1892
1905
  "border",
@@ -4453,9 +4466,9 @@
4453
4466
  fallback.startsWith("hsl(") ||
4454
4467
  fallback.startsWith("hsla(") ||
4455
4468
  fallback.startsWith("var(--darkreader-bg--") ||
4456
- fallback.match(
4457
- /^var\(--darkreader-background-[0-9a-z]+, #[0-9a-z]+\)$/
4458
- )
4469
+ fallback.startsWith("var(--darkreader-background-") ||
4470
+ (hasDoubleNestedBrackets &&
4471
+ fallback.includes("var(--darkreader-background-"))
4459
4472
  );
4460
4473
  }
4461
4474
  return fallback.match(/^(#[0-9a-f]+)|([a-z]+)$/i);
@@ -4554,6 +4567,9 @@
4554
4567
  if (isMediaRule(rule.parentRule)) {
4555
4568
  cssText = `${rule.parentRule.media.mediaText} { ${cssText} }`;
4556
4569
  }
4570
+ if (isLayerRule(rule.parentRule)) {
4571
+ cssText = `${rule.parentRule.name} { ${cssText} }`;
4572
+ }
4557
4573
  return getHashCode(cssText);
4558
4574
  }
4559
4575
  const rulesTextCache = new Set();
@@ -4659,6 +4675,12 @@
4659
4675
  if (emptyIsWhereSelector || viewTransitionSelector) {
4660
4676
  selectorText = ".darkreader-unsupported-selector";
4661
4677
  }
4678
+ if (isChromium && selectorText.endsWith("::picker")) {
4679
+ selectorText = selectorText.replaceAll(
4680
+ "::picker",
4681
+ "::picker(select)"
4682
+ );
4683
+ }
4662
4684
  let ruleText = `${selectorText} {`;
4663
4685
  for (const dec of declarations) {
4664
4686
  const {property, value, important} = dec;
@@ -6002,7 +6024,7 @@
6002
6024
  : true) &&
6003
6025
  !isFontsGoogleApiStyle(element))) &&
6004
6026
  !element.classList.contains("darkreader") &&
6005
- element.media.toLowerCase() !== "print" &&
6027
+ !ignoredMedia.includes(element.media.toLowerCase()) &&
6006
6028
  !element.classList.contains("stylus")
6007
6029
  );
6008
6030
  }
package/darkreader.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dark Reader v4.9.112
2
+ * Dark Reader v4.9.114
3
3
  * https://darkreader.org/
4
4
  */
5
5
 
@@ -107,7 +107,7 @@ const isWindows = platform.startsWith("win");
107
107
  const isMacOS = platform.startsWith("mac");
108
108
  isNavigatorDefined && navigator.userAgentData
109
109
  ? navigator.userAgentData.mobile
110
- : userAgent.includes("mobile");
110
+ : userAgent.includes("mobile") || false;
111
111
  const isShadowDomSupported = typeof ShadowRoot === "function";
112
112
  const isMatchMediaChangeEventListenerSupported =
113
113
  typeof MediaQueryList === "function" &&
@@ -1828,10 +1828,10 @@ function iterateCSSRules(rules, iterate, onImportError) {
1828
1828
  m.startsWith("all") ||
1829
1829
  m.startsWith("(")
1830
1830
  );
1831
- const isPrintOrSpeech = media.some(
1832
- (m) => m.startsWith("print") || m.startsWith("speech")
1833
- );
1834
- if (isScreenOrAllOrQuery || !isPrintOrSpeech) {
1831
+ const isNotScreen =
1832
+ !isScreenOrAllOrQuery &&
1833
+ media.some((m) => ignoredMedia.some((i) => m.startsWith(i)));
1834
+ if (isScreenOrAllOrQuery || !isNotScreen) {
1835
1835
  iterateCSSRules(rule.cssRules, iterate, onImportError);
1836
1836
  }
1837
1837
  } else if (isSupportsRule(rule)) {
@@ -1845,6 +1845,17 @@ function iterateCSSRules(rules, iterate, onImportError) {
1845
1845
  }
1846
1846
  });
1847
1847
  }
1848
+ const ignoredMedia = [
1849
+ "aural",
1850
+ "braille",
1851
+ "embossed",
1852
+ "handheld",
1853
+ "print",
1854
+ "projection",
1855
+ "speech",
1856
+ "tty",
1857
+ "tv"
1858
+ ];
1848
1859
  const shorthandVarDependantProperties = [
1849
1860
  "background",
1850
1861
  "border",
@@ -4312,9 +4323,9 @@ function isFallbackResolved(modified) {
4312
4323
  fallback.startsWith("hsl(") ||
4313
4324
  fallback.startsWith("hsla(") ||
4314
4325
  fallback.startsWith("var(--darkreader-bg--") ||
4315
- fallback.match(
4316
- /^var\(--darkreader-background-[0-9a-z]+, #[0-9a-z]+\)$/
4317
- )
4326
+ fallback.startsWith("var(--darkreader-background-") ||
4327
+ (hasDoubleNestedBrackets &&
4328
+ fallback.includes("var(--darkreader-background-"))
4318
4329
  );
4319
4330
  }
4320
4331
  return fallback.match(/^(#[0-9a-f]+)|([a-z]+)$/i);
@@ -4413,6 +4424,9 @@ function createStyleSheetModifier() {
4413
4424
  if (isMediaRule(rule.parentRule)) {
4414
4425
  cssText = `${rule.parentRule.media.mediaText} { ${cssText} }`;
4415
4426
  }
4427
+ if (isLayerRule(rule.parentRule)) {
4428
+ cssText = `${rule.parentRule.name} { ${cssText} }`;
4429
+ }
4416
4430
  return getHashCode(cssText);
4417
4431
  }
4418
4432
  const rulesTextCache = new Set();
@@ -4515,6 +4529,12 @@ function createStyleSheetModifier() {
4515
4529
  if (emptyIsWhereSelector || viewTransitionSelector) {
4516
4530
  selectorText = ".darkreader-unsupported-selector";
4517
4531
  }
4532
+ if (isChromium && selectorText.endsWith("::picker")) {
4533
+ selectorText = selectorText.replaceAll(
4534
+ "::picker",
4535
+ "::picker(select)"
4536
+ );
4537
+ }
4518
4538
  let ruleText = `${selectorText} {`;
4519
4539
  for (const dec of declarations) {
4520
4540
  const {property, value, important} = dec;
@@ -5812,7 +5832,7 @@ function shouldManageStyle(element) {
5812
5832
  : true) &&
5813
5833
  !isFontsGoogleApiStyle(element))) &&
5814
5834
  !element.classList.contains("darkreader") &&
5815
- element.media.toLowerCase() !== "print" &&
5835
+ !ignoredMedia.includes(element.media.toLowerCase()) &&
5816
5836
  !element.classList.contains("stylus")
5817
5837
  );
5818
5838
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "darkreader",
3
- "version": "4.9.112",
3
+ "version": "4.9.114",
4
4
  "description": "Dark mode for every website",
5
5
  "scripts": {
6
6
  "api": "node --max-old-space-size=3072 tasks/cli.js build --api",
@@ -68,18 +68,18 @@
68
68
  "devDependencies": {
69
69
  "@eslint/compat": "1.4.0",
70
70
  "@eslint/eslintrc": "3.3.1",
71
- "@eslint/js": "9.37.0",
71
+ "@eslint/js": "9.38.0",
72
72
  "@rollup/plugin-node-resolve": "16.0.3",
73
73
  "@rollup/plugin-replace": "6.0.2",
74
- "@rollup/plugin-typescript": "12.1.4",
75
- "@stylistic/eslint-plugin": "5.4.0",
76
- "@types/chrome": "0.1.24",
74
+ "@rollup/plugin-typescript": "12.3.0",
75
+ "@stylistic/eslint-plugin": "5.5.0",
76
+ "@types/chrome": "0.1.26",
77
77
  "@types/eslint": "9.6.1",
78
- "@types/jasmine": "5.1.10",
78
+ "@types/jasmine": "5.1.12",
79
79
  "@types/jest": "30.0.0",
80
80
  "@types/karma": "6.3.9",
81
81
  "@types/karma-coverage": "2.0.3",
82
- "@types/node": "24.7.2",
82
+ "@types/node": "24.9.1",
83
83
  "@types/ws": "8.18.1",
84
84
  "chokidar": "4.0.3",
85
85
  "eslint-plugin-compat": "6.0.2",
@@ -99,18 +99,18 @@
99
99
  "karma-spec-reporter": "0.0.36",
100
100
  "less": "4.4.2",
101
101
  "prettier": "3.6.2",
102
- "puppeteer-core": "24.24.1",
103
- "rollup": "4.52.4",
102
+ "puppeteer-core": "24.26.1",
103
+ "rollup": "4.52.5",
104
104
  "rollup-plugin-istanbul": "5.0.0",
105
105
  "ts-jest": "29.4.5",
106
106
  "tslib": "2.8.1",
107
107
  "typescript": "5.9.3",
108
- "typescript-eslint": "8.46.1",
108
+ "typescript-eslint": "8.46.2",
109
109
  "ws": "8.18.3",
110
110
  "yazl": "3.3.1"
111
111
  },
112
112
  "optionalDependencies": {
113
- "@rollup/rollup-linux-x64-gnu": "4.52.4",
114
- "@rollup/rollup-win32-x64-msvc": "4.52.4"
113
+ "@rollup/rollup-linux-x64-gnu": "4.52.5",
114
+ "@rollup/rollup-win32-x64-msvc": "4.52.5"
115
115
  }
116
116
  }