@expo/styleguide 14.1.8 → 14.2.0

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.
@@ -283,3 +283,12 @@
283
283
  0 5px 10px rgba(0, 0, 0, 0.25);
284
284
  --expo-theme-shadows-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
285
285
  }
286
+
287
+ /* Must equal `palette.dark.gray1` from @expo/styleguide-base (test-enforced);
288
+ update when the dark theme background changes. */
289
+ @media (prefers-color-scheme: dark) {
290
+ :root:where(:not(.light-theme)) {
291
+ color-scheme: dark;
292
+ --expo-theme-background-default: #111113;
293
+ }
294
+ }
@@ -31,7 +31,8 @@ function resolvedActiveThemeFromName(themeName, prefersDark) {
31
31
  }
32
32
 
33
33
  /**
34
- * Toggle the `dark-theme` class on `<html>` cleanly across SPA navigations.
34
+ * Toggle the `dark-theme` and `light-theme` classes on `<html>` cleanly
35
+ * across SPA navigations.
35
36
  *
36
37
  * Two things conspire to make a naive `classList.toggle` visibly flashy:
37
38
  * 1. CSS transitions on consumer elements (e.g. a skeleton loader with
@@ -52,13 +53,14 @@ function resolvedActiveThemeFromName(themeName, prefersDark) {
52
53
  */
53
54
  function applyDarkThemeClass(shouldBeDark) {
54
55
  const html = document.documentElement;
55
- if (html.classList.contains('dark-theme') === shouldBeDark) {
56
+ if (html.classList.contains('dark-theme') === shouldBeDark && html.classList.contains('light-theme') === !shouldBeDark) {
56
57
  return;
57
58
  }
58
59
  const style = document.createElement('style');
59
60
  style.textContent = '*, *::before, *::after { transition: none !important; }';
60
61
  document.head.appendChild(style);
61
62
  html.classList.toggle('dark-theme', shouldBeDark);
63
+ html.classList.toggle('light-theme', !shouldBeDark);
62
64
  requestAnimationFrame(() => {
63
65
  requestAnimationFrame(() => {
64
66
  style.remove();
@@ -75,7 +77,14 @@ function getInitialActiveTheme(disabled, initialThemeName) {
75
77
  if (typeof document === 'undefined') {
76
78
  return undefined;
77
79
  }
78
- return document.documentElement.classList.contains('dark-theme') ? types.Themes.DARK : types.Themes.LIGHT;
80
+ const classList = document.documentElement.classList;
81
+ if (classList.contains('dark-theme')) {
82
+ return types.Themes.DARK;
83
+ }
84
+ if (classList.contains('light-theme')) {
85
+ return types.Themes.LIGHT;
86
+ }
87
+ return window.matchMedia?.('(prefers-color-scheme: dark)').matches ? types.Themes.DARK : types.Themes.LIGHT;
79
88
  }
80
89
  function ThemeProvider(t0) {
81
90
  const $ = compilerRuntime.c(24);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/styleguide",
3
- "version": "14.1.8",
3
+ "version": "14.2.0",
4
4
  "description": "Expo's styleguide components for use on the web.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "react": ">= 19",
56
56
  "tailwindcss": "^4.2.2"
57
57
  },
58
- "gitHead": "ff14b6b15a240255958ba6f0d7178fb72c67421b"
58
+ "gitHead": "1616a5aadf0b562cf918de808ee92195a0e13df1"
59
59
  }