@vue/composition-api
Advanced tools
Comparing version 0.6.6 to 0.6.7
@@ -0,1 +1,18 @@ | ||
<a name="0.6.7"></a> | ||
## [0.6.7](https://github.com/vuejs/composition-api/compare/v0.6.6...v0.6.7) (2020-06-24) | ||
### Bug Fixes | ||
* **toRefs:** do not warn when toRefs is called in a prop value ([#405](https://github.com/vuejs/composition-api/issues/405)) ([048b6d3](https://github.com/vuejs/composition-api/commit/048b6d3)) | ||
* **type:** improve defineComponent type for option apis ([#406](https://github.com/vuejs/composition-api/issues/406)) ([1c64108](https://github.com/vuejs/composition-api/commit/1c64108)) | ||
### Features | ||
* auto install when using CDN ([#403](https://github.com/vuejs/composition-api/issues/403)) ([77ba15b](https://github.com/vuejs/composition-api/commit/77ba15b)) | ||
* export nextTick ([#401](https://github.com/vuejs/composition-api/issues/401)) ([d70c904](https://github.com/vuejs/composition-api/commit/d70c904)) | ||
<a name="0.6.6"></a> | ||
@@ -2,0 +19,0 @@ ## [0.6.6](https://github.com/vuejs/composition-api/compare/v0.6.5...v0.6.6) (2020-06-21) |
@@ -1,3 +0,7 @@ | ||
import Vue, { VNode, ComponentOptions, VueConstructor } from 'vue'; | ||
import Vue$1, { VueConstructor, ComponentOptions, VNode } from 'vue'; | ||
declare type Data = { | ||
[key: string]: unknown; | ||
}; | ||
declare type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[]; | ||
@@ -50,5 +54,94 @@ declare type ComponentObjectPropsOptions<P = Data> = { | ||
declare type ComponentInstance = InstanceType<VueConstructor>; | ||
declare type ComponentRenderProxy<P = {}, // props type extracted from props option | ||
B = {}, // raw bindings returned from setup() | ||
D = {}, // return from data() | ||
C extends ComputedOptions = {}, M extends MethodOptions = {}, PublicProps = P> = { | ||
$data: D; | ||
$props: Readonly<P & PublicProps>; | ||
$attrs: Data; | ||
$refs: Data; | ||
$slots: Data; | ||
$root: ComponentInstance | null; | ||
$parent: ComponentInstance | null; | ||
$emit: (event: string, ...args: unknown[]) => void; | ||
} & Readonly<P> & UnwrapRef<B> & D & M & ExtractComputedReturns<C> & Vue$1; | ||
declare type VueConstructorProxy<PropsOptions, RawBindings> = VueConstructor & { | ||
new (...args: any[]): ComponentRenderProxy<ExtractPropTypes<PropsOptions>, UnwrapRef<RawBindings>, ExtractPropTypes<PropsOptions, false>>; | ||
}; | ||
declare type DefaultData<V> = object | ((this: V) => object); | ||
declare type DefaultMethods<V> = { | ||
[key: string]: (this: V, ...args: any[]) => any; | ||
}; | ||
declare type DefaultComputed = { | ||
[key: string]: any; | ||
}; | ||
declare type VueProxy<PropsOptions, RawBindings, Data = DefaultData<Vue$1>, Computed = DefaultComputed, Methods = DefaultMethods<Vue$1>> = ComponentOptions<Vue$1, UnwrapRef<RawBindings> & Data, Methods, Computed, PropsOptions, ExtractPropTypes<PropsOptions, false>> & VueConstructorProxy<PropsOptions, RawBindings>; | ||
interface SetupContext { | ||
readonly attrs: Record<string, string>; | ||
readonly slots: { | ||
[key: string]: (...args: any[]) => VNode[]; | ||
}; | ||
readonly parent: ComponentInstance | null; | ||
readonly root: ComponentInstance; | ||
readonly listeners: { | ||
[key: string]: Function; | ||
}; | ||
emit(event: string, ...args: any[]): void; | ||
} | ||
declare type ComputedGetter<T> = (ctx?: any) => T; | ||
declare type ComputedSetter<T> = (v: T) => void; | ||
interface WritableComputedOptions<T> { | ||
get: ComputedGetter<T>; | ||
set: ComputedSetter<T>; | ||
} | ||
declare type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>; | ||
interface MethodOptions { | ||
[key: string]: Function; | ||
} | ||
declare type SetupFunction<Props, RawBindings> = (this: void, props: Props, ctx: SetupContext) => RawBindings | (() => VNode | null); | ||
interface ComponentOptionsBase<Props, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}> extends Omit<ComponentOptions<Vue, D, M, C, Props>, 'data' | 'computed' | 'method' | 'setup' | 'props'> { | ||
data?: (this: Props, vm: Props) => D; | ||
computed?: C; | ||
methods?: M; | ||
} | ||
declare type ExtractComputedReturns<T extends any> = { | ||
[key in keyof T]: T[key] extends { | ||
get: (...args: any[]) => infer TReturn; | ||
} ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never; | ||
}; | ||
declare type ComponentOptionsWithProps<PropsOptions = ComponentPropsOptions, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Props = ExtractPropTypes<PropsOptions>> = ComponentOptionsBase<Props, D, C, M> & { | ||
props?: PropsOptions; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>; | ||
declare type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Props = Readonly<{ | ||
[key in PropNames]?: any; | ||
}>> = ComponentOptionsBase<Props, D, C, M> & { | ||
props?: PropNames[]; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>; | ||
declare type ComponentOptionsWithoutProps<Props = unknown, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}> = ComponentOptionsBase<Props, D, C, M> & { | ||
props?: undefined; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>; | ||
declare type Equal<Left, Right> = (<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false; | ||
declare type HasDefined<T> = Equal<T, unknown> extends true ? false : true; | ||
declare function defineComponent<RawBindings, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}>(options: ComponentOptionsWithoutProps<unknown, RawBindings, D, C, M>): VueProxy<unknown, RawBindings, D, C, M>; | ||
declare function defineComponent<PropNames extends string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M>): VueProxy<Readonly<{ | ||
[key in PropNames]?: any; | ||
}>, RawBindings, D, C, M>; | ||
declare function defineComponent<Props, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: HasDefined<Props> extends true ? ComponentOptionsWithProps<PropsOptions, RawBindings, D, C, M, Props> : ComponentOptionsWithProps<PropsOptions, RawBindings, D, C, M>): VueProxy<PropsOptions, RawBindings, D, C, M>; | ||
declare const createComponent: typeof defineComponent; | ||
declare type NextTick = Vue$1['$nextTick']; | ||
declare const nextTick: NextTick; | ||
declare type CreateElement = Vue$1['$createElement']; | ||
declare const createElement: CreateElement; | ||
declare function getCurrentVM(): ComponentInstance | null; | ||
interface Option<T> { | ||
@@ -162,63 +255,2 @@ get: () => T; | ||
declare type Data = { | ||
[key: string]: unknown; | ||
}; | ||
declare type ComponentInstance = InstanceType<VueConstructor>; | ||
declare type ComponentRenderProxy<P = {}, S = {}, PublicProps = P> = { | ||
$data: S; | ||
$props: PublicProps; | ||
$attrs: Data; | ||
$refs: Data; | ||
$slots: Data; | ||
$root: ComponentInstance | null; | ||
$parent: ComponentInstance | null; | ||
$emit: (event: string, ...args: unknown[]) => void; | ||
} & P & S; | ||
declare type VueConstructorProxy<PropsOptions, RawBindings> = VueConstructor & { | ||
new (...args: any[]): ComponentRenderProxy<ExtractPropTypes<PropsOptions>, UnwrapRef<RawBindings>, ExtractPropTypes<PropsOptions, false>>; | ||
}; | ||
declare type VueProxy<PropsOptions, RawBindings> = ComponentOptions<Vue, UnwrapRef<RawBindings>, never, never, PropsOptions, ExtractPropTypes<PropsOptions, false>> & VueConstructorProxy<PropsOptions, RawBindings>; | ||
interface SetupContext { | ||
readonly attrs: Record<string, string>; | ||
readonly slots: { | ||
[key: string]: (...args: any[]) => VNode[]; | ||
}; | ||
readonly parent: ComponentInstance | null; | ||
readonly root: ComponentInstance; | ||
readonly listeners: { | ||
[key: string]: Function; | ||
}; | ||
emit(event: string, ...args: any[]): void; | ||
} | ||
declare type SetupFunction<Props, RawBindings> = (this: void, props: Props, ctx: SetupContext) => RawBindings | (() => VNode | null); | ||
interface ComponentOptionsWithProps<PropsOptions = ComponentPropsOptions, RawBindings = Data, Props = ExtractPropTypes<PropsOptions>> { | ||
props?: PropsOptions; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} | ||
interface ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = Data, Props = Readonly<{ | ||
[key in PropNames]?: any; | ||
}>> { | ||
props?: PropNames[]; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} | ||
interface ComponentOptionsWithoutProps<Props = unknown, RawBindings = Data> { | ||
props?: undefined; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} | ||
declare function defineComponent<RawBindings>(options: ComponentOptionsWithoutProps<unknown, RawBindings>): VueProxy<unknown, RawBindings>; | ||
declare function defineComponent<PropNames extends string, RawBindings = Data, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: (ComponentOptionsWithArrayProps<PropNames, RawBindings>) & Omit<ComponentOptions<Vue>, keyof ComponentOptionsWithProps<never, never>>): VueProxy<Readonly<{ | ||
[key in PropNames]?: any; | ||
}>, RawBindings>; | ||
declare function defineComponent<Props, RawBindings = Data, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: (HasDefined<Props> extends true ? ComponentOptionsWithProps<PropsOptions, RawBindings, Props> : ComponentOptionsWithProps<PropsOptions, RawBindings>) & Omit<ComponentOptions<Vue>, keyof ComponentOptionsWithProps<never, never>>): VueProxy<PropsOptions, RawBindings>; | ||
declare function createComponent<RawBindings>(options: ComponentOptionsWithoutProps<unknown, RawBindings>): VueProxy<unknown, RawBindings>; | ||
declare function createComponent<PropNames extends string, RawBindings = Data, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: (ComponentOptionsWithArrayProps<PropNames, RawBindings>) & Omit<ComponentOptions<Vue>, keyof ComponentOptionsWithProps<never, never>>): VueProxy<Readonly<{ | ||
[key in PropNames]?: any; | ||
}>, RawBindings>; | ||
declare function createComponent<Props, RawBindings = Data, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: (HasDefined<Props> extends true ? ComponentOptionsWithProps<PropsOptions, RawBindings, Props> : ComponentOptionsWithProps<PropsOptions, RawBindings>) & Omit<ComponentOptions<Vue>, keyof ComponentOptionsWithProps<never, never>>): VueProxy<PropsOptions, RawBindings>; | ||
declare type CreateElement = Vue['$createElement']; | ||
declare const createElement: CreateElement; | ||
declare function getCurrentVM(): ComponentInstance | null; | ||
declare const onBeforeMount: (callback: Function) => void; | ||
@@ -271,11 +303,11 @@ declare const onMounted: (callback: Function) => void; | ||
declare module 'vue/types/options' { | ||
interface ComponentOptions<V extends Vue> { | ||
interface ComponentOptions<V extends Vue$1> { | ||
setup?: SetupFunction<Data, Data>; | ||
} | ||
} | ||
declare const plugin: { | ||
declare const VueCompositionAPI: { | ||
install: (Vue: VueConstructor) => void; | ||
}; | ||
export default plugin; | ||
export { ComponentRenderProxy, ComputedRef, FlushMode, InjectionKey, PropOptions, PropType, Ref, SetupContext, UnwrapRef, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedRef, computed, createComponent, createElement, defineComponent, getCurrentVM as getCurrentInstance, inject, isReactive, isRef, markRaw, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect }; | ||
export default VueCompositionAPI; | ||
export { ComponentRenderProxy, ComputedRef, FlushMode, InjectionKey, PropOptions, PropType, Ref, SetupContext, UnwrapRef, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedRef, computed, createComponent, createElement, defineComponent, getCurrentVM as getCurrentInstance, inject, isReactive, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect }; |
@@ -69,20 +69,2 @@ 'use strict'; | ||
var currentVue = null; | ||
var currentVM = null; | ||
function getCurrentVue() { | ||
{ | ||
assert(currentVue, "must call Vue.use(plugin) before using any function."); | ||
} | ||
return currentVue; | ||
} | ||
function setCurrentVue(vue) { | ||
currentVue = vue; | ||
} | ||
function getCurrentVM() { | ||
return currentVM; | ||
} | ||
function setCurrentVM(vm) { | ||
currentVM = vm; | ||
} | ||
/*! ***************************************************************************** | ||
@@ -149,2 +131,20 @@ Copyright (c) Microsoft Corporation. | ||
var currentVue = null; | ||
var currentVM = null; | ||
function getCurrentVue() { | ||
{ | ||
assert(currentVue, "must call Vue.use(plugin) before using any function."); | ||
} | ||
return currentVue; | ||
} | ||
function setCurrentVue(vue) { | ||
currentVue = vue; | ||
} | ||
function getCurrentVM() { | ||
return currentVM; | ||
} | ||
function setCurrentVM(vm) { | ||
currentVM = vm; | ||
} | ||
function currentVMInFn(hook) { | ||
@@ -877,4 +877,8 @@ var vm = getCurrentVM(); | ||
} | ||
// unwrap all ref properties | ||
var unwrapped = unwrapRefProxy(bindingValue); | ||
// mark the object as reactive | ||
markReactive(unwrapped); | ||
// a non-reactive should not don't get reactivity | ||
bindingValue = ref(markRaw(unwrapRefProxy(bindingValue))); | ||
bindingValue = ref(markRaw(unwrapped)); | ||
} | ||
@@ -943,2 +947,10 @@ } | ||
var nextTick = function nextTick() { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
return currentVue === null || currentVue === void 0 ? void 0 : currentVue.nextTick.bind(this, args); | ||
}; | ||
var fallbackCreateElement; | ||
@@ -965,4 +977,3 @@ var createElement = function createElement() { | ||
} | ||
// implementation, deferring to defineComponent, but logging a warning in dev mode | ||
function createComponent(options) { | ||
var createComponent = (function (options) { | ||
{ | ||
@@ -972,3 +983,3 @@ Vue.util.warn('`createComponent` has been renamed to `defineComponent`.'); | ||
return defineComponent(options); | ||
} | ||
}); | ||
@@ -1343,10 +1354,8 @@ var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); }; | ||
var _install = function (Vue) { return install(Vue, mixin); }; | ||
var plugin = { | ||
install: _install, | ||
var VueCompositionAPI = { | ||
install: function (Vue) { return install(Vue, mixin); }, | ||
}; | ||
// Auto install if it is not done yet and `window` has `Vue`. | ||
// To allow users to avoid auto-installation in some cases, | ||
if (currentVue && typeof window !== 'undefined' && window.Vue) { | ||
_install(window.Vue); | ||
// auto install when using CDN | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(VueCompositionAPI); | ||
} | ||
@@ -1357,3 +1366,3 @@ | ||
exports.createElement = createElement; | ||
exports.default = plugin; | ||
exports.default = VueCompositionAPI; | ||
exports.defineComponent = defineComponent; | ||
@@ -1365,2 +1374,3 @@ exports.getCurrentInstance = getCurrentVM; | ||
exports.markRaw = markRaw; | ||
exports.nextTick = nextTick; | ||
exports.onActivated = onActivated; | ||
@@ -1367,0 +1377,0 @@ exports.onBeforeMount = onBeforeMount; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("vue"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&n(Symbol)&&"undefined"!=typeof Reflect&&n(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,t,n){var r=n.get,u=n.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,t,i)}function f(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function a(e,t){return Object.hasOwnProperty.call(e,t)}function c(e){return Array.isArray(e)}function s(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function l(e){return"function"==typeof e}function v(e,n){t.util.warn(e,n)}var p=null,d=null;function y(){return p}function b(){return d}function g(e){d=e} | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("vue"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&n(Symbol)&&"undefined"!=typeof Reflect&&n(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,t,n){var r=n.get,u=n.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,t,i)}function f(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function a(e,t){return Object.hasOwnProperty.call(e,t)}function c(e){return Array.isArray(e)}function s(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function l(e){return"function"==typeof e}function v(e,n){t.util.warn(e,n)} | ||
/*! ***************************************************************************** | ||
@@ -15,2 +15,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function _(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(x(arguments[t]));return e}function w(e){return b()}function O(e,t){void 0===t&&(t={});var n=e.config.silent;e.config.silent=!0;var r=new e(t);return e.config.silent=n,r}function j(e){return p&&e instanceof p}function $(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.$scopedSlots[t]?e.$scopedSlots[t].apply(e,n):v("slots."+t+'() got called outside of the "render()" scope',e)}}function k(e){return r?Symbol.for(e):e}var E=k("vfa.key.preFlushQueue"),S=k("vfa.key.postFlushQueue"),R=k("vfa.key.accessControlIdentifier"),P=k("vfa.key.reactiveIdentifier"),A=k("vfa.key.rawIdentifierKey"),C="vfa.key.refKey",M=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e){return Object.seal(new M(e))}function I(e){var t;if(B(e))return e;var n=G(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})}function B(e){return e instanceof M}function z(e,t){var n=e[t];return B(n)?n:U({get:function(){return e[t]},set:function(n){return e[t]=n}})}var D={},F={},K={};function V(e){return a(e,A)&&e[A]===K}function Q(e){return Object.isExtensible(e)&&a(e,P)&&e[P]===F}function T(e){if(!(!s(e)||V(e)||Array.isArray(e)||B(e)||j(e)||a(e,R)&&e[R]===D)){Object.isExtensible(e)&&f(e,R,D);for(var t=Object.keys(e),n=0;n<t.length;n++)q(e,t[n])}}function q(e,t,n){if("__ob__"!==t){var r,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=e[t])}T(n),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):n;return t!==C&&B(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):n;t!==C&&B(u)&&!B(i)?u.value=i:o?o.call(e,i):n=i,T(i)}}})}}function J(e){var t,n=y();n.observable?t=n.observable(e):t=O(n,{data:{$$state:e}})._data.$$state;return t}function N(e){var t,n;if(!s(e)||Q(e)||V(e)||!Object.isExtensible(e))return e;var r=J({});W(r,!0),T(r);var o=r.__ob__,i=function(t){var n,i,f=e[t],a=Object.getOwnPropertyDescriptor(e,t);if(a){if(!1===a.configurable)return"continue";n=a.get,i=a.set,n&&!i||2!==u.length||(f=e[t])}Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):f;return o.dep.depend(),t},set:function(t){n&&!i||(i?i.call(e,t):f=t,o.dep.notify())}})},u=arguments;try{for(var f=_(Object.keys(e)),a=f.next();!a.done;a=f.next()){var c=a.value;i(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return r}function W(e,t){if(void 0===t&&(t=!1),!(!s(e)||V(e)||Array.isArray(e)||B(e)||j(e)||a(e,P)&&e[P]===F||(Object.isExtensible(e)&&f(e,P,F),t)))for(var n=Object.keys(e),r=0;r<n.length;r++)W(e[n[r]])}function G(e){if(!s(e)||Q(e)||V(e)||!Object.isExtensible(e))return e;var t=J(e);return W(e),T(t),t}function H(e){return s(e)&&Object.isExtensible(e)?(f(e,"__ob__",J({}).__ob__),f(e,A,K),e):e}function L(e,t){p&&p===e||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,o){return function e(t,n){if(!t)return n;if(!n)return t;for(var o,i,u,f=r?Reflect.ownKeys(t):Object.keys(t),c=0;c<f.length;c++)"__ob__"!==(o=f[c])&&(i=n[o],u=t[o],a(n,o)?i!==u&&s(i)&&!B(i)&&s(u)&&!B(u)&&e(u,i):n[o]=u);return n}("function"==typeof e?e(n,o)||{}:void 0,"function"==typeof t?t(n,o)||{}:void 0)}},p=e,t(e))}var X,Y={set:function(e,t,n){(e.__secret_vfa_state__=e.__secret_vfa_state__||{})[t]=n},get:function(e,t){return(e.__secret_vfa_state__||{})[t]}};function Z(e){var t=Y.get(e,"rawBindings")||{};if(t&&Object.keys(t).length){for(var n=e.$refs,r=Y.get(e,"refs")||[],o=0;o<r.length;o++){var i=t[a=r[o]];!n[a]&&i&&B(i)&&(i.value=null)}var u=Object.keys(n),f=[];for(o=0;o<u.length;o++){var a;i=t[a=u[o]];n[a]&&i&&B(i)&&(i.value=n[a],f.push(a))}Y.set(e,"refs",f)}}function ee(e,t){var n=e.$options._parentVnode;if(n){for(var r=Y.get(e,"slots")||[],o=function(e,t){var n;if(e){if(e._normalized)return e._normalized;for(var r in n={},e)e[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in t)r in n||(n[r]=!0);return n}(n.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[f=r[i]]||delete t[f]}var u=Object.keys(o);for(i=0;i<u.length;i++){var f;t[f=u[i]]||(t[f]=$(e,f))}Y.set(e,"slots",u)}}function te(e,t,n){var r=b();g(e);try{return t(e)}catch(e){if(!n)throw e;n(e)}finally{g(r)}}function ne(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,n=t.setup,r=t.render;r&&(t.render=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return te(e,(function(){return r.apply(t,n)}))});if(!n)return;if("function"!=typeof n)return;var o=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var n,r=e.$options.setup,o=function(e){var t={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(n){var r,o,i;Array.isArray(n)?(r=x(n,2),o=r[0],i=r[1]):o=i=n,i="$"+i,u(t,o,{get:function(){return e[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(n){var r="$"+n;u(t,n,{get:function(){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e[r];o.apply(e,t)}}})})),t}(e);if(W(t),ee(e,o.slots),te(e,(function(){n=r(t,o)})),!n)return;if(l(n)){var i=n;return void(e.$options.render=function(){return ee(e,o.slots),te(e,(function(){return i()}))})}if(s(n)){var f=n;Y.set(e,"rawBindings",n),Object.keys(n).forEach((function(t){var n=f[t];B(n)||(Q(n)?n=I(n):(l(n)&&(n=n.bind(e)),n=I(H(function e(t,n){var r,o;if(void 0===n&&(n=new WeakMap),n.has(t))return n.get(t);if(l(t)||c(t)||Q(t)||!s(t)||!Object.isExtensible(t)||B(t)||V(t))return t;var i={};n.set(t,i),Object.getOwnPropertySymbols(t).forEach((function(e){return i[e]=t[e]}));var f=function(r){var o=t[r];if(!o||V(o))i[r]=o;else if(B(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,n)};try{for(var a=_(Object.keys(t)),v=a.next();!v.done;v=a.next()){f(v.value)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}(n))))),function(e,t,n){var r=e.$options.props;t in e||r&&a(r,t)||u(e,t,{get:function(){return n.value},set:function(e){n.value=e}})}(e,t,n)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){Z(this)},updated:function(){Z(this)}})}function re(e){return e}function oe(e){return function(t){var n,r=w(((n=e)[0].toUpperCase(),n.slice(1)));r&&function(e,t,n,r){var o=t.$options,i=e.config.optionMergeStrategies[n];o[n]=i(o[n],function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=b();g(e);try{return t.apply(void 0,m(n))}finally{g(o)}}}(t,r))}(y(),r,e,t)}}var ie,ue=oe("beforeMount"),fe=oe("mounted"),ae=oe("beforeUpdate"),ce=oe("updated"),se=oe("beforeDestroy"),le=oe("destroyed"),ve=oe("errorCaptured"),pe=oe("activated"),de=oe("deactivated"),ye=oe("serverPrefetch");function be(){_e(this,E)}function ge(){_e(this,S)}function he(){var e=b();return e?function(e){return void 0!==e[E]}(e)||function(e){e[E]=[],e[S]=[],e.$on("hook:beforeUpdate",be),e.$on("hook:updated",ge)}(e):(ie||(ie=O(y())),e=ie),e}function _e(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function xe(e,t,n){var r=function(){e.$nextTick((function(){e[E].length&&_e(e,E),e[S].length&&_e(e,S)}))};switch(n){case"pre":r(),e[E].push(t);break;case"post":r(),e[S].push(t);break;default:!function(e,t){if(!e)throw new Error("[vue-composition-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function me(e,t){var n=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(e,r),t()}}function we(e,t,n,r){var i,u=r.flush,f="sync"===u,a=function(e){i=function(){try{e()}catch(e){!function(e,t,n){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},s=function(t){return f||e===ie?t:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return xe(e,(function(){t.apply(void 0,m(n))}),u)}};if(null===n){var p=!1,d=function(e,t,n,r){var o=e._watchers.length;return e.$watch(t,n,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!p)try{p=!0,t(a)}finally{p=!1}}),o,{deep:r.deep||!1,sync:f,before:c});me(d,c),d.lazy=!1;var y=d.get.bind(d);return d.get=s(y),function(){d.teardown()}}var b,g=r.deep;Array.isArray(t)?b=function(){return t.map((function(e){return B(e)?e.value:e()}))}:B(t)?b=function(){return t.value}:Q(t)?(b=function(){return t},g=!0):l(t)?b=t:(b=o,v("Invalid watch source: "+JSON.stringify(t)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var h=function(e,t){c(),n(e,t,a)},_=s(h);if(r.immediate){var x=_,w=function(e,t){w=x,h(e,t)};_=function(e,t){w(e,t)}}var O=e.$watch(b,_,{immediate:r.immediate,deep:g,sync:f});return me(e._watchers[e._watchers.length-1],c),function(){O()}}var Oe={};var je=function(e){return L(e,ne)},$e={install:je};p&&"undefined"!=typeof window&&window.Vue&&je(window.Vue),exports.computed=function(e){var t,n,r=b();"function"==typeof e?t=e:(t=e.get,n=e.set);var o=O(y(),{computed:{$$state:{get:t,set:n}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}})},exports.createComponent=function(e){return e},exports.createElement=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return d?d.$createElement.apply(d,e):(v("`createElement()` has been called outside of render function."),X||(X=O(y()).$createElement),X.apply(X,e))},exports.default=$e,exports.defineComponent=re,exports.getCurrentInstance=b,exports.inject=function(e,t){if(!e)return t;var n=b();if(n){var r=function(e,t){for(var n=t;n;){if(n._provided&&a(n._provided,e))return n._provided[e];n=n.$parent}return Oe}(e,n);return r!==Oe?r:t}v("inject() can only be used inside setup() or functional components.")},exports.isReactive=Q,exports.isRef=B,exports.markRaw=H,exports.onActivated=pe,exports.onBeforeMount=ue,exports.onBeforeUnmount=se,exports.onBeforeUpdate=ae,exports.onDeactivated=de,exports.onErrorCaptured=ve,exports.onMounted=fe,exports.onServerPrefetch=ye,exports.onUnmounted=le,exports.onUpdated=ce,exports.provide=function(e,t){var n=w();if(n){if(!n._provided){var r={};Object.defineProperty(n,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}n._provided[e]=t}},exports.reactive=G,exports.ref=I,exports.set=function(e,t,n){var r=y().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var i=e.__ob__;return e._isVue||i&&i.vmCount?n:i?(o(i.value,t,n),q(e,t,n),W(i.value[t]),i.dep.notify(),n):(e[t]=n,n)},exports.shallowReactive=N,exports.shallowRef=function(e){var t;if(B(e))return e;var n=N(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})},exports.toRaw=function(e){return V(J)||!Object.isExtensible(e)?e:e.__ob__.value||e},exports.toRef=z,exports.toRefs=function(e){if(!s(e))return e;var t={};for(var n in e)t[n]=z(e,n);return t},exports.triggerRef=function(e){B(e)&&(e.value=e.value)},exports.unref=function(e){return B(e)?e.value:e},exports.watch=function(e,t,n){var r=null;"function"==typeof t?r=t:(n=t,r=null);var o=function(e){return h({immediate:!1,deep:!1,flush:"post"},e)}(n);return we(he(),e,r,o)},exports.watchEffect=function(e,t){var n=function(e){return h({immediate:!0,deep:!1,flush:"post"},e)}(t);return we(he(),e,null,n)}; | ||
***************************************************************************** */ | ||
var p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function d(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}var h=null,g=null;function _(){return h}function x(){return g}function m(e){g=e}function w(e){return x()}function O(e,t){void 0===t&&(t={});var n=e.config.silent;e.config.silent=!0;var r=new e(t);return e.config.silent=n,r}function j(e){return h&&e instanceof h}function $(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.$scopedSlots[t]?e.$scopedSlots[t].apply(e,n):v("slots."+t+'() got called outside of the "render()" scope',e)}}function k(e){return r?Symbol.for(e):e}var E=k("vfa.key.preFlushQueue"),S=k("vfa.key.postFlushQueue"),R=k("vfa.key.accessControlIdentifier"),P=k("vfa.key.reactiveIdentifier"),A=k("vfa.key.rawIdentifierKey"),C="vfa.key.refKey",M=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e){return Object.seal(new M(e))}function I(e){var t;if(B(e))return e;var n=G(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})}function B(e){return e instanceof M}function z(e,t){var n=e[t];return B(n)?n:U({get:function(){return e[t]},set:function(n){return e[t]=n}})}var D={},F={},K={};function T(e){return a(e,A)&&e[A]===K}function V(e){return Object.isExtensible(e)&&a(e,P)&&e[P]===F}function Q(e){if(!(!s(e)||T(e)||Array.isArray(e)||B(e)||j(e)||a(e,R)&&e[R]===D)){Object.isExtensible(e)&&f(e,R,D);for(var t=Object.keys(e),n=0;n<t.length;n++)q(e,t[n])}}function q(e,t,n){if("__ob__"!==t){var r,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=e[t])}Q(n),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):n;return t!==C&&B(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):n;t!==C&&B(u)&&!B(i)?u.value=i:o?o.call(e,i):n=i,Q(i)}}})}}function J(e){var t,n=_();n.observable?t=n.observable(e):t=O(n,{data:{$$state:e}})._data.$$state;return t}function N(e){var t,n;if(!s(e)||V(e)||T(e)||!Object.isExtensible(e))return e;var r=J({});W(r,!0),Q(r);var o=r.__ob__,i=function(t){var n,i,f=e[t],a=Object.getOwnPropertyDescriptor(e,t);if(a){if(!1===a.configurable)return"continue";n=a.get,i=a.set,n&&!i||2!==u.length||(f=e[t])}Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):f;return o.dep.depend(),t},set:function(t){n&&!i||(i?i.call(e,t):f=t,o.dep.notify())}})},u=arguments;try{for(var f=d(Object.keys(e)),a=f.next();!a.done;a=f.next()){var c=a.value;i(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return r}function W(e,t){if(void 0===t&&(t=!1),!(!s(e)||T(e)||Array.isArray(e)||B(e)||j(e)||a(e,P)&&e[P]===F||(Object.isExtensible(e)&&f(e,P,F),t)))for(var n=Object.keys(e),r=0;r<n.length;r++)W(e[n[r]])}function G(e){if(!s(e)||V(e)||T(e)||!Object.isExtensible(e))return e;var t=J(e);return W(e),Q(t),t}function H(e){return s(e)&&Object.isExtensible(e)?(f(e,"__ob__",J({}).__ob__),f(e,A,K),e):e}function L(e,t){h&&h===e||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,o){return function e(t,n){if(!t)return n;if(!n)return t;for(var o,i,u,f=r?Reflect.ownKeys(t):Object.keys(t),c=0;c<f.length;c++)"__ob__"!==(o=f[c])&&(i=n[o],u=t[o],a(n,o)?i!==u&&s(i)&&!B(i)&&s(u)&&!B(u)&&e(u,i):n[o]=u);return n}("function"==typeof e?e(n,o)||{}:void 0,"function"==typeof t?t(n,o)||{}:void 0)}},h=e,t(e))}var X={set:function(e,t,n){(e.__secret_vfa_state__=e.__secret_vfa_state__||{})[t]=n},get:function(e,t){return(e.__secret_vfa_state__||{})[t]}};function Y(e){var t=X.get(e,"rawBindings")||{};if(t&&Object.keys(t).length){for(var n=e.$refs,r=X.get(e,"refs")||[],o=0;o<r.length;o++){var i=t[a=r[o]];!n[a]&&i&&B(i)&&(i.value=null)}var u=Object.keys(n),f=[];for(o=0;o<u.length;o++){var a;i=t[a=u[o]];n[a]&&i&&B(i)&&(i.value=n[a],f.push(a))}X.set(e,"refs",f)}}function Z(e,t){var n=e.$options._parentVnode;if(n){for(var r=X.get(e,"slots")||[],o=function(e,t){var n;if(e){if(e._normalized)return e._normalized;for(var r in n={},e)e[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in t)r in n||(n[r]=!0);return n}(n.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[f=r[i]]||delete t[f]}var u=Object.keys(o);for(i=0;i<u.length;i++){var f;t[f=u[i]]||(t[f]=$(e,f))}X.set(e,"slots",u)}}function ee(e,t,n){var r=x();m(e);try{return t(e)}catch(e){if(!n)throw e;n(e)}finally{m(r)}}function te(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,n=t.setup,r=t.render;r&&(t.render=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return ee(e,(function(){return r.apply(t,n)}))});if(!n)return;if("function"!=typeof n)return;var o=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var n,r=e.$options.setup,o=function(e){var t={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(n){var r,o,i;Array.isArray(n)?(r=y(n,2),o=r[0],i=r[1]):o=i=n,i="$"+i,u(t,o,{get:function(){return e[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(n){var r="$"+n;u(t,n,{get:function(){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e[r];o.apply(e,t)}}})})),t}(e);if(W(t),Z(e,o.slots),ee(e,(function(){n=r(t,o)})),!n)return;if(l(n)){var i=n;return void(e.$options.render=function(){return Z(e,o.slots),ee(e,(function(){return i()}))})}if(s(n)){var f=n;X.set(e,"rawBindings",n),Object.keys(n).forEach((function(t){var n=f[t];if(!B(n))if(V(n))n=I(n);else{l(n)&&(n=n.bind(e));var r=function e(t,n){var r,o;if(void 0===n&&(n=new WeakMap),n.has(t))return n.get(t);if(l(t)||c(t)||V(t)||!s(t)||!Object.isExtensible(t)||B(t)||T(t))return t;var i={};n.set(t,i),Object.getOwnPropertySymbols(t).forEach((function(e){return i[e]=t[e]}));var f=function(r){var o=t[r];if(!o||T(o))i[r]=o;else if(B(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,n)};try{for(var a=d(Object.keys(t)),v=a.next();!v.done;v=a.next()){f(v.value)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}(n);W(r),n=I(H(r))}!function(e,t,n){var r=e.$options.props;t in e||r&&a(r,t)||u(e,t,{get:function(){return n.value},set:function(e){n.value=e}})}(e,t,n)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){Y(this)},updated:function(){Y(this)}})}var ne;function re(e){return e}function oe(e){return function(t){var n,r=w(((n=e)[0].toUpperCase(),n.slice(1)));r&&function(e,t,n,r){var o=t.$options,i=e.config.optionMergeStrategies[n];o[n]=i(o[n],function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=x();m(e);try{return t.apply(void 0,b(n))}finally{m(o)}}}(t,r))}(_(),r,e,t)}}var ie,ue=oe("beforeMount"),fe=oe("mounted"),ae=oe("beforeUpdate"),ce=oe("updated"),se=oe("beforeDestroy"),le=oe("destroyed"),ve=oe("errorCaptured"),pe=oe("activated"),de=oe("deactivated"),ye=oe("serverPrefetch");function be(){_e(this,E)}function he(){_e(this,S)}function ge(){var e=x();return e?function(e){return void 0!==e[E]}(e)||function(e){e[E]=[],e[S]=[],e.$on("hook:beforeUpdate",be),e.$on("hook:updated",he)}(e):(ie||(ie=O(_())),e=ie),e}function _e(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function xe(e,t,n){var r=function(){e.$nextTick((function(){e[E].length&&_e(e,E),e[S].length&&_e(e,S)}))};switch(n){case"pre":r(),e[E].push(t);break;case"post":r(),e[S].push(t);break;default:!function(e,t){if(!e)throw new Error("[vue-composition-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function me(e,t){var n=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(e,r),t()}}function we(e,t,n,r){var i,u=r.flush,f="sync"===u,a=function(e){i=function(){try{e()}catch(e){!function(e,t,n){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},s=function(t){return f||e===ie?t:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return xe(e,(function(){t.apply(void 0,b(n))}),u)}};if(null===n){var p=!1,d=function(e,t,n,r){var o=e._watchers.length;return e.$watch(t,n,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!p)try{p=!0,t(a)}finally{p=!1}}),o,{deep:r.deep||!1,sync:f,before:c});me(d,c),d.lazy=!1;var y=d.get.bind(d);return d.get=s(y),function(){d.teardown()}}var h,g=r.deep;Array.isArray(t)?h=function(){return t.map((function(e){return B(e)?e.value:e()}))}:B(t)?h=function(){return t.value}:V(t)?(h=function(){return t},g=!0):l(t)?h=t:(h=o,v("Invalid watch source: "+JSON.stringify(t)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var _=function(e,t){c(),n(e,t,a)},x=s(_);if(r.immediate){var m=x,w=function(e,t){w=m,_(e,t)};x=function(e,t){w(e,t)}}var O=e.$watch(h,x,{immediate:r.immediate,deep:g,sync:f});return me(e._watchers[e._watchers.length-1],c),function(){O()}}var Oe={};var je={install:function(e){return L(e,te)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(je),exports.computed=function(e){var t,n,r=x();"function"==typeof e?t=e:(t=e.get,n=e.set);var o=O(_(),{computed:{$$state:{get:t,set:n}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}})},exports.createComponent=function(e){return e},exports.createElement=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g?g.$createElement.apply(g,e):(v("`createElement()` has been called outside of render function."),ne||(ne=O(_()).$createElement),ne.apply(ne,e))},exports.default=je,exports.defineComponent=re,exports.getCurrentInstance=x,exports.inject=function(e,t){if(!e)return t;var n=x();if(n){var r=function(e,t){for(var n=t;n;){if(n._provided&&a(n._provided,e))return n._provided[e];n=n.$parent}return Oe}(e,n);return r!==Oe?r:t}v("inject() can only be used inside setup() or functional components.")},exports.isReactive=V,exports.isRef=B,exports.markRaw=H,exports.nextTick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null==h?void 0:h.nextTick.bind(this,e)},exports.onActivated=pe,exports.onBeforeMount=ue,exports.onBeforeUnmount=se,exports.onBeforeUpdate=ae,exports.onDeactivated=de,exports.onErrorCaptured=ve,exports.onMounted=fe,exports.onServerPrefetch=ye,exports.onUnmounted=le,exports.onUpdated=ce,exports.provide=function(e,t){var n=w();if(n){if(!n._provided){var r={};Object.defineProperty(n,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}n._provided[e]=t}},exports.reactive=G,exports.ref=I,exports.set=function(e,t,n){var r=_().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var i=e.__ob__;return e._isVue||i&&i.vmCount?n:i?(o(i.value,t,n),q(e,t,n),W(i.value[t]),i.dep.notify(),n):(e[t]=n,n)},exports.shallowReactive=N,exports.shallowRef=function(e){var t;if(B(e))return e;var n=N(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})},exports.toRaw=function(e){return T(J)||!Object.isExtensible(e)?e:e.__ob__.value||e},exports.toRef=z,exports.toRefs=function(e){if(!s(e))return e;var t={};for(var n in e)t[n]=z(e,n);return t},exports.triggerRef=function(e){B(e)&&(e.value=e.value)},exports.unref=function(e){return B(e)?e.value:e},exports.watch=function(e,t,n){var r=null;"function"==typeof t?r=t:(n=t,r=null);var o=function(e){return p({immediate:!1,deep:!1,flush:"post"},e)}(n);return we(ge(),e,r,o)},exports.watchEffect=function(e,t){var n=function(e){return p({immediate:!0,deep:!1,flush:"post"},e)}(t);return we(ge(),e,null,n)}; |
@@ -63,20 +63,2 @@ import Vue from 'vue'; | ||
var currentVue = null; | ||
var currentVM = null; | ||
function getCurrentVue() { | ||
if (("development" !== 'production')) { | ||
assert(currentVue, "must call Vue.use(plugin) before using any function."); | ||
} | ||
return currentVue; | ||
} | ||
function setCurrentVue(vue) { | ||
currentVue = vue; | ||
} | ||
function getCurrentVM() { | ||
return currentVM; | ||
} | ||
function setCurrentVM(vm) { | ||
currentVM = vm; | ||
} | ||
/*! ***************************************************************************** | ||
@@ -143,2 +125,20 @@ Copyright (c) Microsoft Corporation. | ||
var currentVue = null; | ||
var currentVM = null; | ||
function getCurrentVue() { | ||
if (("development" !== 'production')) { | ||
assert(currentVue, "must call Vue.use(plugin) before using any function."); | ||
} | ||
return currentVue; | ||
} | ||
function setCurrentVue(vue) { | ||
currentVue = vue; | ||
} | ||
function getCurrentVM() { | ||
return currentVM; | ||
} | ||
function setCurrentVM(vm) { | ||
currentVM = vm; | ||
} | ||
function currentVMInFn(hook) { | ||
@@ -871,4 +871,8 @@ var vm = getCurrentVM(); | ||
} | ||
// unwrap all ref properties | ||
var unwrapped = unwrapRefProxy(bindingValue); | ||
// mark the object as reactive | ||
markReactive(unwrapped); | ||
// a non-reactive should not don't get reactivity | ||
bindingValue = ref(markRaw(unwrapRefProxy(bindingValue))); | ||
bindingValue = ref(markRaw(unwrapped)); | ||
} | ||
@@ -937,2 +941,10 @@ } | ||
var nextTick = function nextTick() { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
return currentVue === null || currentVue === void 0 ? void 0 : currentVue.nextTick.bind(this, args); | ||
}; | ||
var fallbackCreateElement; | ||
@@ -959,4 +971,3 @@ var createElement = function createElement() { | ||
} | ||
// implementation, deferring to defineComponent, but logging a warning in dev mode | ||
function createComponent(options) { | ||
var createComponent = (function (options) { | ||
if (("development" !== 'production')) { | ||
@@ -966,3 +977,3 @@ Vue.util.warn('`createComponent` has been renamed to `defineComponent`.'); | ||
return defineComponent(options); | ||
} | ||
}); | ||
@@ -1337,13 +1348,11 @@ var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); }; | ||
var _install = function (Vue) { return install(Vue, mixin); }; | ||
var plugin = { | ||
install: _install, | ||
var VueCompositionAPI = { | ||
install: function (Vue) { return install(Vue, mixin); }, | ||
}; | ||
// Auto install if it is not done yet and `window` has `Vue`. | ||
// To allow users to avoid auto-installation in some cases, | ||
if (currentVue && typeof window !== 'undefined' && window.Vue) { | ||
_install(window.Vue); | ||
// auto install when using CDN | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(VueCompositionAPI); | ||
} | ||
export default plugin; | ||
export { computed, createComponent, createElement, defineComponent, getCurrentVM as getCurrentInstance, inject, isReactive, isRef, markRaw, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect }; | ||
export default VueCompositionAPI; | ||
export { computed, createComponent, createElement, defineComponent, getCurrentVM as getCurrentInstance, inject, isReactive, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect }; |
@@ -69,20 +69,2 @@ (function (global, factory) { | ||
var currentVue = null; | ||
var currentVM = null; | ||
function getCurrentVue() { | ||
{ | ||
assert(currentVue, "must call Vue.use(plugin) before using any function."); | ||
} | ||
return currentVue; | ||
} | ||
function setCurrentVue(vue) { | ||
currentVue = vue; | ||
} | ||
function getCurrentVM() { | ||
return currentVM; | ||
} | ||
function setCurrentVM(vm) { | ||
currentVM = vm; | ||
} | ||
/*! ***************************************************************************** | ||
@@ -149,2 +131,20 @@ Copyright (c) Microsoft Corporation. | ||
var currentVue = null; | ||
var currentVM = null; | ||
function getCurrentVue() { | ||
{ | ||
assert(currentVue, "must call Vue.use(plugin) before using any function."); | ||
} | ||
return currentVue; | ||
} | ||
function setCurrentVue(vue) { | ||
currentVue = vue; | ||
} | ||
function getCurrentVM() { | ||
return currentVM; | ||
} | ||
function setCurrentVM(vm) { | ||
currentVM = vm; | ||
} | ||
function currentVMInFn(hook) { | ||
@@ -877,4 +877,8 @@ var vm = getCurrentVM(); | ||
} | ||
// unwrap all ref properties | ||
var unwrapped = unwrapRefProxy(bindingValue); | ||
// mark the object as reactive | ||
markReactive(unwrapped); | ||
// a non-reactive should not don't get reactivity | ||
bindingValue = ref(markRaw(unwrapRefProxy(bindingValue))); | ||
bindingValue = ref(markRaw(unwrapped)); | ||
} | ||
@@ -943,2 +947,10 @@ } | ||
var nextTick = function nextTick() { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
return currentVue === null || currentVue === void 0 ? void 0 : currentVue.nextTick.bind(this, args); | ||
}; | ||
var fallbackCreateElement; | ||
@@ -965,4 +977,3 @@ var createElement = function createElement() { | ||
} | ||
// implementation, deferring to defineComponent, but logging a warning in dev mode | ||
function createComponent(options) { | ||
var createComponent = (function (options) { | ||
{ | ||
@@ -972,3 +983,3 @@ Vue.util.warn('`createComponent` has been renamed to `defineComponent`.'); | ||
return defineComponent(options); | ||
} | ||
}); | ||
@@ -1343,10 +1354,8 @@ var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); }; | ||
var _install = function (Vue) { return install(Vue, mixin); }; | ||
var plugin = { | ||
install: _install, | ||
var VueCompositionAPI = { | ||
install: function (Vue) { return install(Vue, mixin); }, | ||
}; | ||
// Auto install if it is not done yet and `window` has `Vue`. | ||
// To allow users to avoid auto-installation in some cases, | ||
if (currentVue && typeof window !== 'undefined' && window.Vue) { | ||
_install(window.Vue); | ||
// auto install when using CDN | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(VueCompositionAPI); | ||
} | ||
@@ -1357,3 +1366,3 @@ | ||
exports.createElement = createElement; | ||
exports.default = plugin; | ||
exports.default = VueCompositionAPI; | ||
exports.defineComponent = defineComponent; | ||
@@ -1365,2 +1374,3 @@ exports.getCurrentInstance = getCurrentVM; | ||
exports.markRaw = markRaw; | ||
exports.nextTick = nextTick; | ||
exports.onActivated = onActivated; | ||
@@ -1367,0 +1377,0 @@ exports.onBeforeMount = onBeforeMount; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).vueCompositionApi={},e.Vue)}(this,(function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function n(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&n(Symbol)&&"undefined"!=typeof Reflect&&n(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,t,n){var r=n.get,u=n.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,t,i)}function f(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function a(e,t){return Object.hasOwnProperty.call(e,t)}function c(e){return Array.isArray(e)}function l(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function s(e){return"function"==typeof e}function v(e,n){t.util.warn(e,n)}var d=null,p=null;function y(){return d}function b(){return p}function h(e){p=e} | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).vueCompositionApi={},e.Vue)}(this,(function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function n(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&n(Symbol)&&"undefined"!=typeof Reflect&&n(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,t,n){var r=n.get,u=n.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,t,i)}function f(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function a(e,t){return Object.hasOwnProperty.call(e,t)}function c(e){return Array.isArray(e)}function l(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function s(e){return"function"==typeof e}function v(e,n){t.util.warn(e,n)} | ||
/*! ***************************************************************************** | ||
@@ -15,2 +15,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var g=function(){return(g=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function _(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function O(e){return b()}function j(e,t){void 0===t&&(t={});var n=e.config.silent;e.config.silent=!0;var r=new e(t);return e.config.silent=n,r}function $(e){return d&&e instanceof d}function k(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.$scopedSlots[t]?e.$scopedSlots[t].apply(e,n):v("slots."+t+'() got called outside of the "render()" scope',e)}}function x(e){return r?Symbol.for(e):e}var E=x("vfa.key.preFlushQueue"),S=x("vfa.key.postFlushQueue"),P=x("vfa.key.accessControlIdentifier"),R=x("vfa.key.reactiveIdentifier"),A=x("vfa.key.rawIdentifierKey"),C="vfa.key.refKey",M=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e){return Object.seal(new M(e))}function I(e){var t;if(B(e))return e;var n=G(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})}function B(e){return e instanceof M}function V(e,t){var n=e[t];return B(n)?n:U({get:function(){return e[t]},set:function(n){return e[t]=n}})}var z={},D={},F={};function K(e){return a(e,A)&&e[A]===F}function Q(e){return Object.isExtensible(e)&&a(e,R)&&e[R]===D}function T(e){if(!(!l(e)||K(e)||Array.isArray(e)||B(e)||$(e)||a(e,P)&&e[P]===z)){Object.isExtensible(e)&&f(e,P,z);for(var t=Object.keys(e),n=0;n<t.length;n++)q(e,t[n])}}function q(e,t,n){if("__ob__"!==t){var r,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=e[t])}T(n),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):n;return t!==C&&B(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):n;t!==C&&B(u)&&!B(i)?u.value=i:o?o.call(e,i):n=i,T(i)}}})}}function J(e){var t,n=y();n.observable?t=n.observable(e):t=j(n,{data:{$$state:e}})._data.$$state;return t}function N(e){var t,n;if(!l(e)||Q(e)||K(e)||!Object.isExtensible(e))return e;var r=J({});W(r,!0),T(r);var o=r.__ob__,i=function(t){var n,i,f=e[t],a=Object.getOwnPropertyDescriptor(e,t);if(a){if(!1===a.configurable)return"continue";n=a.get,i=a.set,n&&!i||2!==u.length||(f=e[t])}Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):f;return o.dep.depend(),t},set:function(t){n&&!i||(i?i.call(e,t):f=t,o.dep.notify())}})},u=arguments;try{for(var f=_(Object.keys(e)),a=f.next();!a.done;a=f.next()){var c=a.value;i(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return r}function W(e,t){if(void 0===t&&(t=!1),!(!l(e)||K(e)||Array.isArray(e)||B(e)||$(e)||a(e,R)&&e[R]===D||(Object.isExtensible(e)&&f(e,R,D),t)))for(var n=Object.keys(e),r=0;r<n.length;r++)W(e[n[r]])}function G(e){if(!l(e)||Q(e)||K(e)||!Object.isExtensible(e))return e;var t=J(e);return W(e),T(t),t}function H(e){return l(e)&&Object.isExtensible(e)?(f(e,"__ob__",J({}).__ob__),f(e,A,F),e):e}function L(e,t){d&&d===e||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,o){return function e(t,n){if(!t)return n;if(!n)return t;for(var o,i,u,f=r?Reflect.ownKeys(t):Object.keys(t),c=0;c<f.length;c++)"__ob__"!==(o=f[c])&&(i=n[o],u=t[o],a(n,o)?i!==u&&l(i)&&!B(i)&&l(u)&&!B(u)&&e(u,i):n[o]=u);return n}("function"==typeof e?e(n,o)||{}:void 0,"function"==typeof t?t(n,o)||{}:void 0)}},d=e,t(e))}var X,Y={set:function(e,t,n){(e.__secret_vfa_state__=e.__secret_vfa_state__||{})[t]=n},get:function(e,t){return(e.__secret_vfa_state__||{})[t]}};function Z(e){var t=Y.get(e,"rawBindings")||{};if(t&&Object.keys(t).length){for(var n=e.$refs,r=Y.get(e,"refs")||[],o=0;o<r.length;o++){var i=t[a=r[o]];!n[a]&&i&&B(i)&&(i.value=null)}var u=Object.keys(n),f=[];for(o=0;o<u.length;o++){var a;i=t[a=u[o]];n[a]&&i&&B(i)&&(i.value=n[a],f.push(a))}Y.set(e,"refs",f)}}function ee(e,t){var n=e.$options._parentVnode;if(n){for(var r=Y.get(e,"slots")||[],o=function(e,t){var n;if(e){if(e._normalized)return e._normalized;for(var r in n={},e)e[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in t)r in n||(n[r]=!0);return n}(n.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[f=r[i]]||delete t[f]}var u=Object.keys(o);for(i=0;i<u.length;i++){var f;t[f=u[i]]||(t[f]=k(e,f))}Y.set(e,"slots",u)}}function te(e,t,n){var r=b();h(e);try{return t(e)}catch(e){if(!n)throw e;n(e)}finally{h(r)}}function ne(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,n=t.setup,r=t.render;r&&(t.render=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return te(e,(function(){return r.apply(t,n)}))});if(!n)return;if("function"!=typeof n)return;var o=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var n,r=e.$options.setup,o=function(e){var t={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(n){var r,o,i;Array.isArray(n)?(r=m(n,2),o=r[0],i=r[1]):o=i=n,i="$"+i,u(t,o,{get:function(){return e[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(n){var r="$"+n;u(t,n,{get:function(){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e[r];o.apply(e,t)}}})})),t}(e);if(W(t),ee(e,o.slots),te(e,(function(){n=r(t,o)})),!n)return;if(s(n)){var i=n;return void(e.$options.render=function(){return ee(e,o.slots),te(e,(function(){return i()}))})}if(l(n)){var f=n;Y.set(e,"rawBindings",n),Object.keys(n).forEach((function(t){var n=f[t];B(n)||(Q(n)?n=I(n):(s(n)&&(n=n.bind(e)),n=I(H(function e(t,n){var r,o;if(void 0===n&&(n=new WeakMap),n.has(t))return n.get(t);if(s(t)||c(t)||Q(t)||!l(t)||!Object.isExtensible(t)||B(t)||K(t))return t;var i={};n.set(t,i),Object.getOwnPropertySymbols(t).forEach((function(e){return i[e]=t[e]}));var f=function(r){var o=t[r];if(!o||K(o))i[r]=o;else if(B(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,n)};try{for(var a=_(Object.keys(t)),v=a.next();!v.done;v=a.next()){f(v.value)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}(n))))),function(e,t,n){var r=e.$options.props;t in e||r&&a(r,t)||u(e,t,{get:function(){return n.value},set:function(e){n.value=e}})}(e,t,n)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){Z(this)},updated:function(){Z(this)}})}function re(e){return e}function oe(e){return function(t){var n,r=O(((n=e)[0].toUpperCase(),n.slice(1)));r&&function(e,t,n,r){var o=t.$options,i=e.config.optionMergeStrategies[n];o[n]=i(o[n],function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=b();h(e);try{return t.apply(void 0,w(n))}finally{h(o)}}}(t,r))}(y(),r,e,t)}}var ie,ue=oe("beforeMount"),fe=oe("mounted"),ae=oe("beforeUpdate"),ce=oe("updated"),le=oe("beforeDestroy"),se=oe("destroyed"),ve=oe("errorCaptured"),de=oe("activated"),pe=oe("deactivated"),ye=oe("serverPrefetch");function be(){_e(this,E)}function he(){_e(this,S)}function ge(){var e=b();return e?function(e){return void 0!==e[E]}(e)||function(e){e[E]=[],e[S]=[],e.$on("hook:beforeUpdate",be),e.$on("hook:updated",he)}(e):(ie||(ie=j(y())),e=ie),e}function _e(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function me(e,t,n){var r=function(){e.$nextTick((function(){e[E].length&&_e(e,E),e[S].length&&_e(e,S)}))};switch(n){case"pre":r(),e[E].push(t);break;case"post":r(),e[S].push(t);break;default:!function(e,t){if(!e)throw new Error("[vue-composition-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function we(e,t){var n=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(e,r),t()}}function Oe(e,t,n,r){var i,u=r.flush,f="sync"===u,a=function(e){i=function(){try{e()}catch(e){!function(e,t,n){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},l=function(t){return f||e===ie?t:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return me(e,(function(){t.apply(void 0,w(n))}),u)}};if(null===n){var d=!1,p=function(e,t,n,r){var o=e._watchers.length;return e.$watch(t,n,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!d)try{d=!0,t(a)}finally{d=!1}}),o,{deep:r.deep||!1,sync:f,before:c});we(p,c),p.lazy=!1;var y=p.get.bind(p);return p.get=l(y),function(){p.teardown()}}var b,h=r.deep;Array.isArray(t)?b=function(){return t.map((function(e){return B(e)?e.value:e()}))}:B(t)?b=function(){return t.value}:Q(t)?(b=function(){return t},h=!0):s(t)?b=t:(b=o,v("Invalid watch source: "+JSON.stringify(t)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var g=function(e,t){c(),n(e,t,a)},_=l(g);if(r.immediate){var m=_,O=function(e,t){O=m,g(e,t)};_=function(e,t){O(e,t)}}var j=e.$watch(b,_,{immediate:r.immediate,deep:h,sync:f});return we(e._watchers[e._watchers.length-1],c),function(){j()}}var je={};var $e=function(e){return L(e,ne)},ke={install:$e};d&&"undefined"!=typeof window&&window.Vue&&$e(window.Vue),e.computed=function(e){var t,n,r=b();"function"==typeof e?t=e:(t=e.get,n=e.set);var o=j(y(),{computed:{$$state:{get:t,set:n}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}})},e.createComponent=function(e){return e},e.createElement=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p?p.$createElement.apply(p,e):(v("`createElement()` has been called outside of render function."),X||(X=j(y()).$createElement),X.apply(X,e))},e.default=ke,e.defineComponent=re,e.getCurrentInstance=b,e.inject=function(e,t){if(!e)return t;var n=b();if(n){var r=function(e,t){for(var n=t;n;){if(n._provided&&a(n._provided,e))return n._provided[e];n=n.$parent}return je}(e,n);return r!==je?r:t}v("inject() can only be used inside setup() or functional components.")},e.isReactive=Q,e.isRef=B,e.markRaw=H,e.onActivated=de,e.onBeforeMount=ue,e.onBeforeUnmount=le,e.onBeforeUpdate=ae,e.onDeactivated=pe,e.onErrorCaptured=ve,e.onMounted=fe,e.onServerPrefetch=ye,e.onUnmounted=se,e.onUpdated=ce,e.provide=function(e,t){var n=O();if(n){if(!n._provided){var r={};Object.defineProperty(n,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}n._provided[e]=t}},e.reactive=G,e.ref=I,e.set=function(e,t,n){var r=y().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var i=e.__ob__;return e._isVue||i&&i.vmCount?n:i?(o(i.value,t,n),q(e,t,n),W(i.value[t]),i.dep.notify(),n):(e[t]=n,n)},e.shallowReactive=N,e.shallowRef=function(e){var t;if(B(e))return e;var n=N(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})},e.toRaw=function(e){return K(J)||!Object.isExtensible(e)?e:e.__ob__.value||e},e.toRef=V,e.toRefs=function(e){if(!l(e))return e;var t={};for(var n in e)t[n]=V(e,n);return t},e.triggerRef=function(e){B(e)&&(e.value=e.value)},e.unref=function(e){return B(e)?e.value:e},e.watch=function(e,t,n){var r=null;"function"==typeof t?r=t:(n=t,r=null);var o=function(e){return g({immediate:!1,deep:!1,flush:"post"},e)}(n);return Oe(ge(),e,r,o)},e.watchEffect=function(e,t){var n=function(e){return g({immediate:!0,deep:!1,flush:"post"},e)}(t);return Oe(ge(),e,null,n)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
***************************************************************************** */ | ||
var d=function(){return(d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function p(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}var h=null,g=null;function _(){return h}function m(){return g}function w(e){g=e}function O(e){return m()}function j(e,t){void 0===t&&(t={});var n=e.config.silent;e.config.silent=!0;var r=new e(t);return e.config.silent=n,r}function $(e){return h&&e instanceof h}function k(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.$scopedSlots[t]?e.$scopedSlots[t].apply(e,n):v("slots."+t+'() got called outside of the "render()" scope',e)}}function x(e){return r?Symbol.for(e):e}var E=x("vfa.key.preFlushQueue"),S=x("vfa.key.postFlushQueue"),P=x("vfa.key.accessControlIdentifier"),R=x("vfa.key.reactiveIdentifier"),A=x("vfa.key.rawIdentifierKey"),C="vfa.key.refKey",M=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e){return Object.seal(new M(e))}function I(e){var t;if(B(e))return e;var n=G(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})}function B(e){return e instanceof M}function V(e,t){var n=e[t];return B(n)?n:U({get:function(){return e[t]},set:function(n){return e[t]=n}})}var z={},D={},F={};function K(e){return a(e,A)&&e[A]===F}function T(e){return Object.isExtensible(e)&&a(e,R)&&e[R]===D}function Q(e){if(!(!l(e)||K(e)||Array.isArray(e)||B(e)||$(e)||a(e,P)&&e[P]===z)){Object.isExtensible(e)&&f(e,P,z);for(var t=Object.keys(e),n=0;n<t.length;n++)q(e,t[n])}}function q(e,t,n){if("__ob__"!==t){var r,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=e[t])}Q(n),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):n;return t!==C&&B(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):n;t!==C&&B(u)&&!B(i)?u.value=i:o?o.call(e,i):n=i,Q(i)}}})}}function J(e){var t,n=_();n.observable?t=n.observable(e):t=j(n,{data:{$$state:e}})._data.$$state;return t}function N(e){var t,n;if(!l(e)||T(e)||K(e)||!Object.isExtensible(e))return e;var r=J({});W(r,!0),Q(r);var o=r.__ob__,i=function(t){var n,i,f=e[t],a=Object.getOwnPropertyDescriptor(e,t);if(a){if(!1===a.configurable)return"continue";n=a.get,i=a.set,n&&!i||2!==u.length||(f=e[t])}Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):f;return o.dep.depend(),t},set:function(t){n&&!i||(i?i.call(e,t):f=t,o.dep.notify())}})},u=arguments;try{for(var f=p(Object.keys(e)),a=f.next();!a.done;a=f.next()){var c=a.value;i(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return r}function W(e,t){if(void 0===t&&(t=!1),!(!l(e)||K(e)||Array.isArray(e)||B(e)||$(e)||a(e,R)&&e[R]===D||(Object.isExtensible(e)&&f(e,R,D),t)))for(var n=Object.keys(e),r=0;r<n.length;r++)W(e[n[r]])}function G(e){if(!l(e)||T(e)||K(e)||!Object.isExtensible(e))return e;var t=J(e);return W(e),Q(t),t}function H(e){return l(e)&&Object.isExtensible(e)?(f(e,"__ob__",J({}).__ob__),f(e,A,F),e):e}function L(e,t){h&&h===e||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,o){return function e(t,n){if(!t)return n;if(!n)return t;for(var o,i,u,f=r?Reflect.ownKeys(t):Object.keys(t),c=0;c<f.length;c++)"__ob__"!==(o=f[c])&&(i=n[o],u=t[o],a(n,o)?i!==u&&l(i)&&!B(i)&&l(u)&&!B(u)&&e(u,i):n[o]=u);return n}("function"==typeof e?e(n,o)||{}:void 0,"function"==typeof t?t(n,o)||{}:void 0)}},h=e,t(e))}var X={set:function(e,t,n){(e.__secret_vfa_state__=e.__secret_vfa_state__||{})[t]=n},get:function(e,t){return(e.__secret_vfa_state__||{})[t]}};function Y(e){var t=X.get(e,"rawBindings")||{};if(t&&Object.keys(t).length){for(var n=e.$refs,r=X.get(e,"refs")||[],o=0;o<r.length;o++){var i=t[a=r[o]];!n[a]&&i&&B(i)&&(i.value=null)}var u=Object.keys(n),f=[];for(o=0;o<u.length;o++){var a;i=t[a=u[o]];n[a]&&i&&B(i)&&(i.value=n[a],f.push(a))}X.set(e,"refs",f)}}function Z(e,t){var n=e.$options._parentVnode;if(n){for(var r=X.get(e,"slots")||[],o=function(e,t){var n;if(e){if(e._normalized)return e._normalized;for(var r in n={},e)e[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in t)r in n||(n[r]=!0);return n}(n.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[f=r[i]]||delete t[f]}var u=Object.keys(o);for(i=0;i<u.length;i++){var f;t[f=u[i]]||(t[f]=k(e,f))}X.set(e,"slots",u)}}function ee(e,t,n){var r=m();w(e);try{return t(e)}catch(e){if(!n)throw e;n(e)}finally{w(r)}}function te(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,n=t.setup,r=t.render;r&&(t.render=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return ee(e,(function(){return r.apply(t,n)}))});if(!n)return;if("function"!=typeof n)return;var o=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var n,r=e.$options.setup,o=function(e){var t={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(n){var r,o,i;Array.isArray(n)?(r=y(n,2),o=r[0],i=r[1]):o=i=n,i="$"+i,u(t,o,{get:function(){return e[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(n){var r="$"+n;u(t,n,{get:function(){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e[r];o.apply(e,t)}}})})),t}(e);if(W(t),Z(e,o.slots),ee(e,(function(){n=r(t,o)})),!n)return;if(s(n)){var i=n;return void(e.$options.render=function(){return Z(e,o.slots),ee(e,(function(){return i()}))})}if(l(n)){var f=n;X.set(e,"rawBindings",n),Object.keys(n).forEach((function(t){var n=f[t];if(!B(n))if(T(n))n=I(n);else{s(n)&&(n=n.bind(e));var r=function e(t,n){var r,o;if(void 0===n&&(n=new WeakMap),n.has(t))return n.get(t);if(s(t)||c(t)||T(t)||!l(t)||!Object.isExtensible(t)||B(t)||K(t))return t;var i={};n.set(t,i),Object.getOwnPropertySymbols(t).forEach((function(e){return i[e]=t[e]}));var f=function(r){var o=t[r];if(!o||K(o))i[r]=o;else if(B(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,n)};try{for(var a=p(Object.keys(t)),v=a.next();!v.done;v=a.next()){f(v.value)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}(n);W(r),n=I(H(r))}!function(e,t,n){var r=e.$options.props;t in e||r&&a(r,t)||u(e,t,{get:function(){return n.value},set:function(e){n.value=e}})}(e,t,n)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){Y(this)},updated:function(){Y(this)}})}var ne;function re(e){return e}function oe(e){return function(t){var n,r=O(((n=e)[0].toUpperCase(),n.slice(1)));r&&function(e,t,n,r){var o=t.$options,i=e.config.optionMergeStrategies[n];o[n]=i(o[n],function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=m();w(e);try{return t.apply(void 0,b(n))}finally{w(o)}}}(t,r))}(_(),r,e,t)}}var ie,ue=oe("beforeMount"),fe=oe("mounted"),ae=oe("beforeUpdate"),ce=oe("updated"),le=oe("beforeDestroy"),se=oe("destroyed"),ve=oe("errorCaptured"),de=oe("activated"),pe=oe("deactivated"),ye=oe("serverPrefetch");function be(){_e(this,E)}function he(){_e(this,S)}function ge(){var e=m();return e?function(e){return void 0!==e[E]}(e)||function(e){e[E]=[],e[S]=[],e.$on("hook:beforeUpdate",be),e.$on("hook:updated",he)}(e):(ie||(ie=j(_())),e=ie),e}function _e(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function me(e,t,n){var r=function(){e.$nextTick((function(){e[E].length&&_e(e,E),e[S].length&&_e(e,S)}))};switch(n){case"pre":r(),e[E].push(t);break;case"post":r(),e[S].push(t);break;default:!function(e,t){if(!e)throw new Error("[vue-composition-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function we(e,t){var n=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(e,r),t()}}function Oe(e,t,n,r){var i,u=r.flush,f="sync"===u,a=function(e){i=function(){try{e()}catch(e){!function(e,t,n){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},l=function(t){return f||e===ie?t:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return me(e,(function(){t.apply(void 0,b(n))}),u)}};if(null===n){var d=!1,p=function(e,t,n,r){var o=e._watchers.length;return e.$watch(t,n,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!d)try{d=!0,t(a)}finally{d=!1}}),o,{deep:r.deep||!1,sync:f,before:c});we(p,c),p.lazy=!1;var y=p.get.bind(p);return p.get=l(y),function(){p.teardown()}}var h,g=r.deep;Array.isArray(t)?h=function(){return t.map((function(e){return B(e)?e.value:e()}))}:B(t)?h=function(){return t.value}:T(t)?(h=function(){return t},g=!0):s(t)?h=t:(h=o,v("Invalid watch source: "+JSON.stringify(t)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var _=function(e,t){c(),n(e,t,a)},m=l(_);if(r.immediate){var w=m,O=function(e,t){O=w,_(e,t)};m=function(e,t){O(e,t)}}var j=e.$watch(h,m,{immediate:r.immediate,deep:g,sync:f});return we(e._watchers[e._watchers.length-1],c),function(){j()}}var je={};var $e={install:function(e){return L(e,te)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use($e),e.computed=function(e){var t,n,r=m();"function"==typeof e?t=e:(t=e.get,n=e.set);var o=j(_(),{computed:{$$state:{get:t,set:n}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}})},e.createComponent=function(e){return e},e.createElement=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g?g.$createElement.apply(g,e):(v("`createElement()` has been called outside of render function."),ne||(ne=j(_()).$createElement),ne.apply(ne,e))},e.default=$e,e.defineComponent=re,e.getCurrentInstance=m,e.inject=function(e,t){if(!e)return t;var n=m();if(n){var r=function(e,t){for(var n=t;n;){if(n._provided&&a(n._provided,e))return n._provided[e];n=n.$parent}return je}(e,n);return r!==je?r:t}v("inject() can only be used inside setup() or functional components.")},e.isReactive=T,e.isRef=B,e.markRaw=H,e.nextTick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null==h?void 0:h.nextTick.bind(this,e)},e.onActivated=de,e.onBeforeMount=ue,e.onBeforeUnmount=le,e.onBeforeUpdate=ae,e.onDeactivated=pe,e.onErrorCaptured=ve,e.onMounted=fe,e.onServerPrefetch=ye,e.onUnmounted=se,e.onUpdated=ce,e.provide=function(e,t){var n=O();if(n){if(!n._provided){var r={};Object.defineProperty(n,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}n._provided[e]=t}},e.reactive=G,e.ref=I,e.set=function(e,t,n){var r=_().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var i=e.__ob__;return e._isVue||i&&i.vmCount?n:i?(o(i.value,t,n),q(e,t,n),W(i.value[t]),i.dep.notify(),n):(e[t]=n,n)},e.shallowReactive=N,e.shallowRef=function(e){var t;if(B(e))return e;var n=N(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})},e.toRaw=function(e){return K(J)||!Object.isExtensible(e)?e:e.__ob__.value||e},e.toRef=V,e.toRefs=function(e){if(!l(e))return e;var t={};for(var n in e)t[n]=V(e,n);return t},e.triggerRef=function(e){B(e)&&(e.value=e.value)},e.unref=function(e){return B(e)?e.value:e},e.watch=function(e,t,n){var r=null;"function"==typeof t?r=t:(n=t,r=null);var o=function(e){return d({immediate:!1,deep:!1,flush:"post"},e)}(n);return Oe(ge(),e,r,o)},e.watchEffect=function(e,t){var n=function(e){return d({immediate:!0,deep:!1,flush:"post"},e)}(t);return Oe(ge(),e,null,n)},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@vue/composition-api", | ||
"version": "0.6.6", | ||
"version": "0.6.7", | ||
"description": "Provide logic composition capabilities for Vue.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
102
README.md
@@ -15,92 +15,63 @@ # Vue Composition API | ||
# Navigation | ||
## Installation | ||
- [Installation](#Installation) | ||
- [Usage](#Usage) | ||
- [TypeScript](#TypeScript) | ||
- [TSX](#tsx) | ||
- [Limitations](#Limitations) | ||
- [Changelog](https://github.com/vuejs/composition-api/blob/master/CHANGELOG.md) | ||
### NPM | ||
# Installation | ||
**npm** | ||
```bash | ||
npm install @vue/composition-api | ||
# or | ||
yarn add @vue/composition-api | ||
``` | ||
**yarn** | ||
You must install `@vue/composition-api` as a plugin via `Vue.use()` before you can use the [Composition API](https://composition-api.vuejs.org/) to compose your component. | ||
```bash | ||
yarn add @vue/composition-api | ||
```js | ||
import Vue from 'vue' | ||
import VueCompositionAPI from '@vue/composition-api' | ||
Vue.use(VueCompositionAPI) | ||
``` | ||
**CDN** | ||
```html | ||
<script src="https://unpkg.com/@vue/composition-api/dist/vue-composition-api.umd.js"></script> | ||
```js | ||
// use the APIs | ||
import { ref, reactive } from '@vue/composition-api' | ||
``` | ||
By using the global variable `window.vueCompositionApi` | ||
> :bulb: When you migrate to Vue 3, just replacing `@vue/composition-api` to `vue` and your code should just work. | ||
# Usage | ||
### CDN | ||
You must install `@vue/composition-api` via `Vue.use()` before using other APIs: | ||
Include `@vue/composition-api` after Vue and it will install itself automatically. | ||
```js | ||
import Vue from 'vue'; | ||
import VueCompositionApi from '@vue/composition-api'; | ||
<!--cdn-links-start--> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@0.6.7"></script> | ||
``` | ||
<!--cdn-links-end--> | ||
Vue.use(VueCompositionApi); | ||
`@vue/composition-api` will be exposed to global variable `window.vueCompositionApi`. | ||
```ts | ||
const { ref, reactive } = vueCompositionApi | ||
``` | ||
After installing the plugin you can use the [Composition API](https://vue-composition-api-rfc.netlify.com/) to compose your component. | ||
## TypeScript Support | ||
# TypeScript | ||
> TypeScript version **>3.5.1** is required | ||
**This plugin requires TypeScript version >3.5.1. If you are using vetur, make sure to set `vetur.useWorkspaceDependencies` to `true`.** | ||
To let TypeScript properly infer types inside Vue component options, you need to define components with `defineComponent` | ||
To let TypeScript properly infer types inside Vue component options, you need to define components with `defineComponent`: | ||
```ts | ||
import { defineComponent } from '@vue/composition-api'; | ||
import { defineComponent } from '@vue/composition-api' | ||
const Component = defineComponent({ | ||
export default defineComponent({ | ||
// type inference enabled | ||
}); | ||
const Component = { | ||
// this will NOT have type inference, | ||
// because TypeScript can't tell this is options for a Vue component. | ||
}; | ||
}) | ||
``` | ||
## TSX | ||
### JSX/TSX | ||
:rocket: An Example [Repository](https://github.com/liximomo/vue-composition-api-tsx-example) with TS and TSX support is provided to help you start. | ||
To make JSX/TSX work with `@vue/composition-api`, check out [babel-preset-vca-jsx](https://github.com/luwanquan/babel-preset-vca-jsx) by [@luwanquan](https://github.com/luwanquan). | ||
To support TSX, create a declaration file with following content in your project. | ||
```ts | ||
// file: shim-tsx.d.ts | ||
import Vue, { VNode } from 'vue'; | ||
import { ComponentRenderProxy } from '@vue/composition-api'; | ||
declare global { | ||
namespace JSX { | ||
// tslint:disable no-empty-interface | ||
interface Element extends VNode {} | ||
// tslint:disable no-empty-interface | ||
interface ElementClass extends ComponentRenderProxy {} | ||
interface ElementAttributesProperty { | ||
$props: any; // specify the property name to use | ||
} | ||
interface IntrinsicElements { | ||
[elem: string]: any; | ||
} | ||
} | ||
} | ||
``` | ||
# Limitations | ||
@@ -308,7 +279,4 @@ | ||
import Vue from 'vue'; | ||
import VueCompositionApi from '@vue/composition-api'; | ||
Vue.use(VueCompositionApi); | ||
declare module '@vue/composition-api/dist/component/component' { | ||
declare module '@vue/composition-api' { | ||
interface SetupContext { | ||
@@ -315,0 +283,0 @@ readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] }; |
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
205294
11
4471
322