|
1 | 1 | <script setup> |
2 | | -import { computed, reactive, ref, shallowRef } from 'vue'; |
| 2 | +import { computed, onMounted, reactive, ref, shallowRef } from 'vue'; |
3 | 3 | import { locale } from '@query-kit/vue'; |
4 | 4 | import { generateRow } from './core/MockDataGenerator'; |
5 | 5 | import RequestDisplay from './components/RequestDisplay.vue'; |
@@ -140,9 +140,22 @@ function onFieldClick(value, item, fieldId, event) { |
140 | 140 | } |
141 | 141 |
|
142 | 142 | const theme = ref('auto'); |
| 143 | +// Temporary diagnostic for the mobile dark-mode issue: `set` is the inline |
| 144 | +// color-scheme assigned to <html>, `computed` is what the browser resolves it |
| 145 | +// to. The template swatch uses light-dark() directly to show whether the forced |
| 146 | +// scheme actually flips colors. |
| 147 | +const themeDebug = ref({ set: '', computed: '' }); |
| 148 | +function refreshThemeDebug() { |
| 149 | + themeDebug.value = { |
| 150 | + set: document.documentElement.style.colorScheme || '(unset)', |
| 151 | + computed: getComputedStyle(document.documentElement).colorScheme, |
| 152 | + }; |
| 153 | +} |
143 | 154 | function onThemeChange() { |
144 | 155 | document.documentElement.style.colorScheme = theme.value === 'auto' ? 'light dark' : theme.value; |
| 156 | + refreshThemeDebug(); |
145 | 157 | } |
| 158 | +onMounted(refreshThemeDebug); |
146 | 159 | </script> |
147 | 160 |
|
148 | 161 | <template> |
@@ -174,6 +187,16 @@ function onThemeChange() { |
174 | 187 | </select> |
175 | 188 | </div> |
176 | 189 |
|
| 190 | + <div |
| 191 | + class="theme-debug" |
| 192 | + style="margin: 8px 0; padding: 8px; border: 2px dashed currentColor; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font: 13px/1.4 monospace" |
| 193 | + > |
| 194 | + <span>select: <b>{{ theme }}</b></span> |
| 195 | + <span>style.colorScheme: <b>{{ themeDebug.set }}</b></span> |
| 196 | + <span>getComputedStyle: <b>{{ themeDebug.computed }}</b></span> |
| 197 | + <span style="padding: 4px 10px; border: 1px solid currentColor; background: light-dark(#fff, #111); color: light-dark(#111, #fff)">light-dark() swatch</span> |
| 198 | + </div> |
| 199 | +
|
177 | 200 | <!-- Default --> |
178 | 201 | <div v-if="activeTab === 'default'"> |
179 | 202 | <p class="playground-description"> |
|
0 commit comments