MCPcopy Create free account
hub / github.com/formkit/formkit / classesToNodeProps

Function classesToNodeProps

packages/vue/src/composables/useInput.ts:83–97  ·  view source on GitHub ↗

* Given some props, map those props to individualized props internally. * @param node - A formkit node * @param props - Some props that may include a classes object

(node: FormKitNode, props: Record<string, any>)

Source from the content-addressed store, hash-verified

81 * @param props - Some props that may include a classes object
82 */
83function classesToNodeProps(node: FormKitNode, props: Record<string, any>) {
84 if (props.classes) {
85 Object.keys(props.classes).forEach(
86 (key: keyof (typeof props)['classes']) => {
87 if (typeof key === 'string') {
88 node.props[`_${key}Class`] = props.classes[key]
89 // We need to ensure Vue is aware that we want to actually observe the
90 // child values too, so we touch them here.
91 if (isObject(props.classes[key]) && key === 'inner')
92 Object.values(props.classes[key])
93 }
94 }
95 )
96 }
97}
98
99/**
100 * Extracts known FormKit listeners.

Callers 2

createInitialPropsFunction · 0.70
useInputFunction · 0.70

Calls 1

isObjectFunction · 0.90

Tested by

no test coverage detected