Skip to content

Commit 66ca6fc

Browse files
committed
Fix ThemePage activateColorScheme prop type
Prop was typed with 'unknown' parameters, which TypeScript rejected when assigned the narrower signature from useIframeManager. Replace with the canonical DesignSpecThemeSelector from schema and drop the duplicate SelectorLike alias in the iframe manager.
1 parent d55da4c commit 66ca6fc

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

src/shell/components/ThemePage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ref, computed, watch, type Ref, type MaybeRef, toRef } from 'vue'
33
import { useDesignSpec } from '../composables/useDesignSpec'
44
import { useThemePreview } from '../composables/useThemePreview'
55
import { useTasks } from '../composables/useTasks'
6-
import type { DesignSpecToken, DesignSpecTheme, ColorSchemeInfo } from '../../schema'
6+
import type { DesignSpecToken, DesignSpecTheme, DesignSpecThemeSelector, ColorSchemeInfo } from '../../schema'
77
import type { ColorSchemeResult } from '../../shared/bridge-types'
88
import ColorPalettePicker from './ColorPalettePicker.vue'
99
import ThemeLibrariesTab from './ThemeLibrariesTab.vue'
@@ -21,7 +21,7 @@ const props = defineProps<{
2121
* the app actually switches — without this, clicking only pins the edit
2222
* target and the user has to toggle the app manually to preview.
2323
*/
24-
activateColorScheme?: (selector: unknown, all: unknown[]) => Promise<void>
24+
activateColorScheme?: (selector: DesignSpecThemeSelector | null | undefined, all?: DesignSpecThemeSelector[]) => Promise<void>
2525
}>()
2626
2727
const { designSpec, isInitialized, isLoading } = useDesignSpec()

src/shell/composables/useIframeManager.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
ComputeAccessibilityInfoResult, AccessibilityInfo,
1414
ComputeTabOrderResult, TabOrderEntry,
1515
} from '../../shared/bridge-types'
16+
import type { DesignSpecThemeSelector } from '../../schema'
1617

1718
export function useIframeManager(iframeRef: Ref<HTMLIFrameElement | null>) {
1819
const currentRoute = ref('/')
@@ -363,15 +364,9 @@ export function useIframeManager(iframeRef: Ref<HTMLIFrameElement | null>) {
363364
* 'color-scheme:changed' push which seeds `colorScheme` — but we also set it
364365
* optimistically so the UI updates without a round-trip.
365366
*/
366-
type SelectorLike = {
367-
kind: 'attribute' | 'class' | 'media' | 'default'
368-
host?: 'html' | 'body'
369-
name?: string
370-
value?: string
371-
}
372367
async function activateColorScheme(
373-
selector: SelectorLike | null | undefined,
374-
all: SelectorLike[] = []
368+
selector: DesignSpecThemeSelector | null | undefined,
369+
all: DesignSpecThemeSelector[] = []
375370
): Promise<void> {
376371
const iframe = iframeRef.value
377372
const doc = iframe?.contentDocument

0 commit comments

Comments
 (0)