Skip to main content
Glama
deleonio
by deleonio
options.ts1.6 kB
import type { Generic } from 'adopted-style-sheets'; import type { Optgroup, Option, RadioOption, StencilUnknown } from '../types'; import type { Stringified } from '../types/common'; import type { WatchOptions } from '../utils'; import { watchJsonArrayString } from '../utils'; import { validateInputSelectOptions } from '../validators'; /* types */ export type OptionsPropType = Stringified<Option<StencilUnknown>[]>; export type OptionsWithOptgroupPropType = Stringified<(Option<StencilUnknown> | Optgroup<StencilUnknown>)[]>; export type RadioOptionsPropType = Stringified<RadioOption<StencilUnknown>[]>; /** * Options the user can choose from. */ export type PropOptions = { options: OptionsPropType; }; export type PropRadioOptions = { options: RadioOptionsPropType; }; /** * Options the user can choose from, also supporting Optgroup. */ export type PropOptionsWithOptgroup = { options: OptionsWithOptgroupPropType; }; /* validators */ export const validateOptions = (component: Generic.Element.Component, value: OptionsPropType | undefined, options: WatchOptions = {}): void => { watchJsonArrayString( component, '_options', (item: Option<StencilUnknown>) => typeof item === 'object' && item !== null && typeof item.label === 'string' && item.label.length > 0, value, undefined, options, ); }; export const validateOptionsWithOptgroup = ( component: Generic.Element.Component, value: OptionsWithOptgroupPropType | undefined, options: WatchOptions = {}, ) => { watchJsonArrayString(component, '_options', validateInputSelectOptions, value, undefined, options); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server