@stencil/vue-output-target
Advanced tools
Comparing version 0.5.0 to 0.5.1-0
{ | ||
"name": "@stencil/vue-output-target", | ||
"version": "0.5.0", | ||
"version": "0.5.1-0", | ||
"description": "Vue output target for @stencil/core components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -13,2 +13,14 @@ import { VNode, defineComponent, getCurrentInstance, h, inject, ref, Ref } from 'vue'; | ||
/** | ||
* Starting in Vue 3.1.0, all properties are | ||
* added as keys to the props object, even if | ||
* they are not being used. In order to correctly | ||
* account for both value props and v-model props, | ||
* we need to check if the key exists for Vue <3.1.0 | ||
* and then check if it is not undefined for Vue >= 3.1.0. | ||
* See https://github.com/vuejs/vue-next/issues/3889 | ||
*/ | ||
const EMPTY_PROP = Symbol(); | ||
const DEFAULT_EMPTY_PROP = { default: EMPTY_PROP }; | ||
interface NavManager<T = any> { | ||
@@ -130,3 +142,2 @@ navigate: (options: T) => void; | ||
let propsToAdd = { | ||
...props, | ||
ref: containerRef, | ||
@@ -138,14 +149,18 @@ class: getElementClasses(containerRef, classes), | ||
/** | ||
* We can use Object.entries here | ||
* to avoid the hasOwnProperty check, | ||
* but that would require 2 iterations | ||
* where as this only requires 1. | ||
*/ | ||
for (const key in props) { | ||
if (props.hasOwnProperty(key)) { | ||
propsToAdd[key] = props[key]; | ||
} | ||
} | ||
if (modelProp) { | ||
/** | ||
* Starting in Vue 3.1.0, all properties are | ||
* added as keys to the props object, even if | ||
* they are not being used. In order to correctly | ||
* account for both value props and v-model props, | ||
* we need to check if the key exists for Vue <3.1.0 | ||
* and then check if it is not undefined for Vue >= 3.1.0. | ||
*/ | ||
propsToAdd = { | ||
...propsToAdd, | ||
[modelProp]: props.hasOwnProperty(MODEL_VALUE) && props[MODEL_VALUE] !== undefined ? props.modelValue : modelPropValue | ||
[modelProp]: props[MODEL_VALUE] !== EMPTY_PROP ? props.modelValue : modelPropValue | ||
} | ||
@@ -159,5 +174,13 @@ } | ||
Container.displayName = name; | ||
Container.props = [...componentProps, ROUTER_LINK_VALUE]; | ||
Container.props = { | ||
[ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP | ||
}; | ||
componentProps.forEach(componentProp => { | ||
Container.props[componentProp] = DEFAULT_EMPTY_PROP; | ||
}); | ||
if (modelProp) { | ||
Container.props.push(MODEL_VALUE); | ||
Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP; | ||
Container.emits = [UPDATE_VALUE_EVENT, externalModelUpdateEvent]; | ||
@@ -164,0 +187,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48003
992