Mixins / foldkit-mixins/theme

KnobOf

interface · packages/mixins/src/theme/knob.ts:30

interface Knob<Value, Names extends string = string> {
  readonly schema: Schema.Codec<Value>
  write(value: Value): Readonly<Partial<Record<Names, string>>>
  readonly unset: Variables<Names>
  readonly default: Value
  readonly title: string
  readonly description: string
  readonly control: Control
}

A knob of Value writing the variables Names. write gives those a value sets (a light-only value leaves the dark one out); unset gives every one, as no theme set it.

Members

KnobOf.schema

property · packages/mixins/src/theme/knob.ts:31

readonly schema: Schema.Codec<Value>

KnobOf.write

method · packages/mixins/src/theme/knob.ts:33

write(value: Value): Readonly<Partial<Record<Names, string>>>

A method, so a knob of any value is a Knob<unknown>.

KnobOf.unset

property · packages/mixins/src/theme/knob.ts:34

readonly unset: Variables<Names>

KnobOf.default

property · packages/mixins/src/theme/knob.ts:36

readonly default: Value

The value it stands at unset: a control's starting point.

KnobOf.title

property · packages/mixins/src/theme/knob.ts:38

readonly title: string

What the knob is called: a control's label.

KnobOf.description

property · packages/mixins/src/theme/knob.ts:40

readonly description: string

What the knob does, in a sentence: a control's tooltip.

KnobOf.control

property · packages/mixins/src/theme/knob.ts:41

readonly control: Control