( instance: ComponentInternalInstance, rawProps: Data | null, props: Data, attrs: Data, )
| 373 | } |
| 374 | |
| 375 | function setFullProps( |
| 376 | instance: ComponentInternalInstance, |
| 377 | rawProps: Data | null, |
| 378 | props: Data, |
| 379 | attrs: Data, |
| 380 | ) { |
| 381 | const [options, needCastKeys] = instance.propsOptions |
| 382 | let hasAttrsChanged = false |
| 383 | let rawCastValues: Data | undefined |
| 384 | if (rawProps) { |
| 385 | for (let key in rawProps) { |
| 386 | // key, ref are reserved and never passed down |
| 387 | if (isReservedProp(key)) { |
| 388 | continue |
| 389 | } |
| 390 | |
| 391 | if (__COMPAT__) { |
| 392 | if (key.startsWith('onHook:')) { |
| 393 | softAssertCompatEnabled( |
| 394 | DeprecationTypes.INSTANCE_EVENT_HOOKS, |
| 395 | instance, |
| 396 | key.slice(2).toLowerCase(), |
| 397 | ) |
| 398 | } |
| 399 | if (key === 'inline-template') { |
| 400 | continue |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | const value = rawProps[key] |
| 405 | // prop option names are camelized during normalization, so to support |
| 406 | // kebab -> camel conversion here we need to camelize the key. |
| 407 | let camelKey |
| 408 | if (options && hasOwn(options, (camelKey = camelize(key)))) { |
| 409 | if (!needCastKeys || !needCastKeys.includes(camelKey)) { |
| 410 | props[camelKey] = value |
| 411 | } else { |
| 412 | ;(rawCastValues || (rawCastValues = {}))[camelKey] = value |
| 413 | } |
| 414 | } else if (!isEmitListener(instance.emitsOptions, key)) { |
| 415 | // Any non-declared (either as a prop or an emitted event) props are put |
| 416 | // into a separate `attrs` object for spreading. Make sure to preserve |
| 417 | // original key casing |
| 418 | if (__COMPAT__) { |
| 419 | if (isOn(key) && key.endsWith('Native')) { |
| 420 | key = key.slice(0, -6) // remove Native postfix |
| 421 | } else if (shouldSkipAttr(key, instance)) { |
| 422 | continue |
| 423 | } |
| 424 | } |
| 425 | if (!(key in attrs) || value !== attrs[key]) { |
| 426 | attrs[key] = value |
| 427 | hasAttrsChanged = true |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 |
no test coverage detected