@stainless-api/docs 0.1.0-beta.33 → 0.1.0-beta.34

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @stainless-api/docs
2
2
 
3
+ ## 0.1.0-beta.34
4
+
5
+ ### Patch Changes
6
+
7
+ - f5173e9: fix: theme flickering
8
+
3
9
  ## 0.1.0-beta.33
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs",
3
- "version": "0.1.0-beta.33",
3
+ "version": "0.1.0-beta.34",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -84,36 +84,36 @@ const options = [
84
84
  window.didInitThemePickers = window.didInitThemePickers ?? false;
85
85
 
86
86
  // Only run once.
87
- if (window.didInitThemePickers) return;
88
- window.didInitThemePickers = true;
89
-
90
- // The stored theme will be either 'auto', 'light', 'dark' or null.
91
- const storedTheme = typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
92
-
93
- // This theme is either 'light' or 'dark'. It's used for setting the data-theme attribute.
94
- const theme =
95
- !storedTheme || storedTheme === 'auto'
96
- ? window.matchMedia('(prefers-color-scheme: light)').matches
97
- ? 'light'
98
- : 'dark'
99
- : storedTheme;
100
-
101
- document.documentElement.dataset.theme = theme === 'light' ? 'light' : 'dark';
102
-
103
- const themeSelects = document.querySelectorAll('[data-theme-select]');
104
- const selectedThemeValue = storedTheme || 'auto';
105
-
106
- themeSelects.forEach((select) => {
107
- const tmpl = select.querySelector(`[data-value="${selectedThemeValue}"] template`);
108
- const selectedSlot = select.querySelector('[data-part="trigger-selected"]');
109
-
110
- selectedSlot.innerHTML = '';
111
- if (tmpl) {
112
- selectedSlot.appendChild(tmpl.content.cloneNode(true));
113
- selectedSlot.removeAttribute('data-placeholder');
114
- return;
115
- }
116
- });
87
+ if (!window.didInitThemePickers) {
88
+ window.didInitThemePickers = true;
89
+
90
+ // The stored theme will be either 'auto', 'light', 'dark' or null.
91
+ const storedTheme = typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
92
+
93
+ // This theme is either 'light' or 'dark'. It's used for setting the data-theme attribute.
94
+ const theme =
95
+ !storedTheme || storedTheme === 'auto'
96
+ ? window.matchMedia('(prefers-color-scheme: light)').matches
97
+ ? 'light'
98
+ : 'dark'
99
+ : storedTheme;
100
+
101
+ document.documentElement.dataset.theme = theme === 'light' ? 'light' : 'dark';
102
+
103
+ const themeSelects = document.querySelectorAll('[data-theme-select]');
104
+ const selectedThemeValue = storedTheme || 'auto';
105
+
106
+ themeSelects.forEach((select) => {
107
+ const tmpl = select.querySelector(`[data-value="${selectedThemeValue}"] template`);
108
+ const selectedSlot = select.querySelector('[data-part="trigger-selected"]');
109
+
110
+ selectedSlot.innerHTML = '';
111
+ if (tmpl) {
112
+ selectedSlot.appendChild(tmpl.content.cloneNode(true));
113
+ return;
114
+ }
115
+ });
116
+ }
117
117
  </script>
118
118
 
119
119
  <script>