svelte-search-engine
Version:
A wrapper for Google's Programmable Search Engine, providing a Svelte-friendly interface.
19 lines (18 loc) • 803 B
TypeScript
import type { Gname } from '../types/base';
import type { UIComponents } from '../types/components';
import type { ComponentConfig, OptComponentConfig } from '../types/google';
export type WithGname = {
gname: Gname;
};
export type WithTag<T extends ComponentConfig['tag']> = {
tag: T;
};
export type WithPartialComponents = {
components?: UIComponents;
};
export type ParamBase = ComponentConfig & WithGname & WithPartialComponents;
export type ParamObject = Omit<ParamBase, 'div'> & WithTag<'search' | 'searchbox-only' | 'searchresults-only'>;
export type ParamConf = ParamBase & WithTag<'searchbox'>;
export type ParamOptConf = OptComponentConfig & WithGname & WithPartialComponents;
export type ContextValue = ParamConf | ParamOptConf;
export type Context = Record<Gname, ContextValue>;