* Create a new context object for our a FormKit node, given default information * * @param options - An options object of FormKitOptions | FormKitOptions to override the defaults. * * @returns A FormKitContext | FormKitContext * * @internal
(options: FormKitOptions)
| 3265 | * @internal |
| 3266 | */ |
| 3267 | function createContext(options: FormKitOptions): FormKitContext { |
| 3268 | const value = createValue(options) |
| 3269 | const config = createConfig(options.config || {}, options.parent) |
| 3270 | return { |
| 3271 | _d: 0, |
| 3272 | _e: createEmitter(), |
| 3273 | uid: Symbol(), |
| 3274 | _resolve: false, |
| 3275 | _tmo: false, |
| 3276 | _value: value, |
| 3277 | children: dedupe(options.children || []), |
| 3278 | config, |
| 3279 | hook: createHooks(), |
| 3280 | isCreated: false, |
| 3281 | isSettled: true, |
| 3282 | ledger: createLedger(), |
| 3283 | name: createName(options), |
| 3284 | parent: options.parent || null, |
| 3285 | plugins: new Set<FormKitPlugin>(), |
| 3286 | props: createProps(value), |
| 3287 | settled: Promise.resolve(value), |
| 3288 | store: createStore(true), |
| 3289 | sync: options.sync || false, |
| 3290 | traps: createTraps(), |
| 3291 | type: options.type || 'input', |
| 3292 | value, |
| 3293 | } |
| 3294 | } |
| 3295 | |
| 3296 | /** |
| 3297 | * Initialize a node object's internal properties. |
no test coverage detected