You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
633 B
20 lines
633 B
import { getContext, setContext } from 'svelte'
|
|
import type { ComboboxColor, ComboboxSize, ComboboxVariant } from './types'
|
|
|
|
const COMBOBOX_VISUAL_CONTEXT = Symbol('uix.eidos.combobox.visual')
|
|
|
|
export interface ComboboxVisualContext {
|
|
getSize(): ComboboxSize
|
|
getVariant(): ComboboxVariant
|
|
getColor(): ComboboxColor
|
|
}
|
|
|
|
export function setComboboxVisualContext(ctx: ComboboxVisualContext): ComboboxVisualContext {
|
|
setContext(COMBOBOX_VISUAL_CONTEXT, ctx)
|
|
return ctx
|
|
}
|
|
|
|
export function getComboboxVisualContext(): ComboboxVisualContext | undefined {
|
|
return getContext<ComboboxVisualContext | undefined>(COMBOBOX_VISUAL_CONTEXT)
|
|
}
|