Docs@skmtc/core

Enrichments

FUNCTION

moduleSelect

@skmtc/core 0.63.4

Declare a moduleSelect enrichment field: the { schemaPath, module? } binding validated as one value. The enrichment editor renders it as a single composite control (path picker + type-matched component picker, the component gated on the path), and toEnrichmentDescriptor projects it as type: 'moduleSelect' carrying the declared moduleType.

moduleType is the TypeScript source of the contract a chosen module must satisfy for the field - a single export type XModule<F> = … the editor's matcher checks candidates against (typeof Candidate extends XModule<FieldType>). It is a required part of the declaration, so the contract is always explicit - there is no hidden editor-side default. For the common lens/input case pass lensInputModuleType; only generators with a genuinely custom binding write their own source.

import { lensInputModuleType, moduleSelect } from '@skmtc/core'

export const formFieldItem = v.object({
  moduleSelect: v.optional(v.pipe(moduleSelect(lensInputModuleType), v.title('Input'))),
  label: v.optional(v.string())
})

Signature

import { moduleSelect } from '@skmtc/core'

moduleSelect(moduleType: string): v.GenericSchema<ModuleSelect>

Parameters

moduleType, string required

Returns

v.GenericSchema<ModuleSelect>