Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-function-api

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-function-api - npm Package Compare versions

Comparing version 2.0.6 to 2.1.1

dist/reactivity/index.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# 2.1.1
* Add a new signature of `provide`: `provide(key, value)`.
* Fix multiple `provide` invoking per component.
* Fix order of `setup` invoking.
* `onErrorCaptured` not triggered ([#25](/vuejs/vue-function-api/issues/25)).
* Fix `this` losing in nested setup call ([#38](/vuejs/vue-function-api/issues/38)).
* Fix some edge cases of unwarpping.
* Change `context.slots`'s value. It now proxies to `$scopeSlots` instead of `$slots`.
# 2.0.6

@@ -2,0 +11,0 @@ ## Fixed

17

dist/functions/inject.d.ts

@@ -1,10 +0,7 @@

import { UnknownObject } from '../types/basic';
declare type InjectKey = string | symbol;
declare type ProvideOption = {
[key: string]: any;
} | (() => {
[key: string]: any;
});
export declare function provide(provideOption: ProvideOption): void;
export declare function inject(injectKey: InjectKey): void | UnknownObject;
export {};
import { AnyObject } from '../types/basic';
import { Wrapper } from '../wrappers';
export interface Key<T> extends Symbol {
}
export declare function provide(data: AnyObject): void;
export declare function provide<T>(key: Key<T>, value: T | Wrapper<T>): void;
export declare function inject<T>(key: Key<T>): Wrapper<T> | void;

@@ -10,4 +10,4 @@ import { Wrapper } from '../wrappers';

}
export declare function watch<T>(source: watchedValue<T>, cb: watcherCallBack<T>, options?: Partial<WatcherOption>): () => void;
export declare function watch<T>(source: Array<watchedValue<T>>, cb: watcherCallBack<T[]>, options?: Partial<WatcherOption>): () => void;
export declare function watch<T = any>(source: watchedValue<T>, cb: watcherCallBack<T>, options?: Partial<WatcherOption>): () => void;
export declare function watch<T = any>(source: Array<watchedValue<T>>, cb: watcherCallBack<T[]>, options?: Partial<WatcherOption>): () => void;
export {};

@@ -1,6 +0,3 @@

import { VueConstructor } from 'vue';
import { AbstractWrapper } from './wrappers';
export declare function isWrapper<T>(obj: any): obj is AbstractWrapper<T>;
export declare function ensureCurrentVMInFn(hook: string): InstanceType<VueConstructor>;
export declare function observable<T = any>(obj: T): T;
import { VueInstance } from './types/vue';
export declare function ensureCurrentVMInFn(hook: string): VueInstance;
export declare function compoundComputed(computed: {

@@ -7,0 +4,0 @@ [key: string]: (() => any) | {

import Vue, { VueConstructor } from 'vue';
import { Context } from './types/vue';
import { SetupContext } from './types/vue';
import { Wrapper } from './wrappers';
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
setup?: (this: undefined, props: {
setup?: (this: void, props: {
[x: string]: any;
}, context: Context) => object | null | undefined | void;
}, context: SetupContext) => object | null | undefined | void;
}

@@ -15,2 +15,3 @@ }

export { plugin, Wrapper };
export { set } from './reactivity';
export * from './ts-api';

@@ -17,0 +18,0 @@ export * from './functions/state';

export declare const WatcherPreFlushQueueKey: string;
export declare const WatcherPostFlushQueueKey: string;
export declare const AccessControIdentifierlKey: string;
export declare const ObservableIdentifierKey: string;
import Vue, { ComponentOptions } from 'vue';
import { Context } from '../types/vue';
import { SetupContext } from '../types/vue';
export declare type PropType<T> = T;

@@ -9,5 +9,5 @@ declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;

[K in keyof Props]: Props[K];
}, context: Context) => object | null | undefined | void;
}, context: SetupContext) => object | null | undefined | void;
};
export declare function createComponent<Props>(compOpions: ComponentOptionsWithSetup<Props>): ComponentOptions<Vue>;
export {};

@@ -1,3 +0,1 @@

export declare type UnknownObject = {
[x: string]: any;
};
export declare type AnyObject = Record<string | number | symbol, any>;

@@ -1,3 +0,4 @@

import Vue, { VNode } from 'vue/';
export interface Context {
import Vue, { VueConstructor, VNode } from 'vue/';
export declare type VueInstance = InstanceType<VueConstructor>;
export interface SetupContext {
readonly parent: Vue;

@@ -4,0 +5,0 @@ readonly root: Vue;

@@ -0,7 +1,16 @@

import Vue from 'vue';
export declare const hasSymbol: false | ((key: string) => symbol);
export declare const noopFn: any;
export declare function proxy(target: any, key: string, getter: Function, setter?: Function): void;
export declare function proxy(target: any, key: string, { get, set }: {
get?: Function;
set?: Function;
}): void;
export declare function def(obj: Object, key: string, val: any, enumerable?: boolean): void;
export declare function hasOwn(obj: Object | any[], key: string): boolean;
export declare function assert(condition: any, msg: string): void;
export declare function isArray<T>(x: unknown): x is T[];
export declare function isObject(val: unknown): val is Record<any, any>;
export declare function isPlainObject<T extends Object = {}>(x: unknown): x is T;
export declare function isFunction(x: unknown): x is Function;
export declare function warn(msg: string, vm?: Vue): void;
export declare function logError(err: Error, vm: Vue, info: string): void;

@@ -5,2 +5,6 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var Vue = _interopDefault(require('vue'));
var toString = function (x) { return Object.prototype.toString.call(x); };

@@ -15,7 +19,16 @@ var hasSymbol = typeof Symbol === 'function' && Symbol.for;

};
function proxy(target, key, getter, setter) {
sharedPropertyDefinition.get = getter;
sharedPropertyDefinition.set = setter || noopFn;
function proxy(target, key, _a) {
var get = _a.get, set = _a.set;
sharedPropertyDefinition.get = get || noopFn;
sharedPropertyDefinition.set = set || noopFn;
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function def(obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true,
});
}
var hasOwnProperty = Object.prototype.hasOwnProperty;

@@ -30,7 +43,24 @@ function hasOwn(obj, key) {

function isArray(x) {
return toString(x) === '[object Array]';
return Array.isArray(x);
}
function isObject(val) {
return val !== null && typeof val === 'object';
}
function isPlainObject(x) {
return toString(x) === '[object Object]';
}
function warn(msg, vm) {
Vue.util.warn(msg, vm);
}
function logError(err, vm, info) {
{
warn("Error in " + info + ": \"" + err.toString() + "\"", vm);
}
if (typeof window !== 'undefined' && typeof console !== 'undefined') {
console.error(err);
}
else {
throw err;
}
}

@@ -60,29 +90,23 @@ var currentVue = null;

var _this = this;
this._vm = vm;
this._propName = propName;
def(this, '_vm', vm);
def(this, '_propName', propName);
var props = vm.$options.props;
var methods = vm.$options.methods;
var computed = vm.$options.computed;
var warn = getCurrentVue().util.warn;
if (!(propName in vm)) {
proxy(vm, propName, function () { return _this.value; }, function (val) {
_this.value = val;
if (!(propName in vm) && !(props && hasOwn(props, propName))) {
proxy(vm, propName, {
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
});
{
this.exposeToDevtool();
// expose bindings after state has been resolved to prevent repeated works
vm.$nextTick(function () {
_this.exposeToDevtool();
});
}
}
else {
if (hasOwn(vm.$data, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a data.", vm);
}
else if (props && hasOwn(props, propName)) {
if (props && hasOwn(props, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a prop.", vm);
}
else if (methods && hasOwn(methods, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a method.", vm);
}
else if (computed && propName in computed) {
warn("The setup binding property \"" + propName + "\" is already declared as a computed.", vm);
}
else {

@@ -136,7 +160,24 @@ warn("The setup binding property \"" + propName + "\" is already declared.", vm);

function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
var ValueWrapper = /** @class */ (function (_super) {
__extends(ValueWrapper, _super);
function ValueWrapper(_internal) {
function ValueWrapper(internal) {
var _this = _super.call(this) || this;
_this._internal = _internal;
def(_this, '_internal', internal);
return _this;

@@ -159,4 +200,7 @@ }

var name_1 = this._propName;
proxy(vm._data, name_1, function () { return _this.value; }, function (val) {
_this.value = val;
proxy(vm._data, name_1, {
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
});

@@ -170,5 +214,5 @@ }

__extends(ComputedWrapper, _super);
function ComputedWrapper(_internal) {
function ComputedWrapper(internal) {
var _this = _super.call(this) || this;
_this._internal = _internal;
def(_this, '_internal', internal);
return _this;

@@ -183,3 +227,3 @@ }

{
getCurrentVue().util.warn('Computed property' +
warn('Computed property' +
(this._propName ? " \"" + this._propName + "\"" : '') +

@@ -204,8 +248,10 @@ ' was assigned to but it has no setter.', this._vm);

}
proxy(vm.$options.computed, name_1, function () { return ({
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
}); });
proxy(vm.$options.computed, name_1, {
get: function () { return ({
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
}); },
});
}

@@ -219,34 +265,2 @@ };

}
function ensureCurrentVMInFn(hook) {
var vm = getCurrentVM();
{
assert(vm, "\"" + hook + "\" get called outside of \"setup()\"");
}
return vm;
}
function observable(obj) {
var Vue = getCurrentVue();
if (Vue.observable) {
return Vue.observable(obj);
}
var silent = Vue.config.silent;
Vue.config.silent = true;
var vm = new Vue({
data: {
$$state: obj,
},
});
Vue.config.silent = silent;
return vm._data.$$state;
}
function compoundComputed(computed) {
var Vue = getCurrentVue();
var silent = Vue.config.silent;
Vue.config.silent = true;
var reactive = new Vue({
computed: computed,
});
Vue.config.silent = silent;
return reactive;
}

@@ -297,5 +311,178 @@ /**

function createSymbol(name) {
return hasSymbol ? Symbol.for(name) : name;
}
var WatcherPreFlushQueueKey = createSymbol('vfa.key.preFlushQueue');
var WatcherPostFlushQueueKey = createSymbol('vfa.key.postFlushQueue');
var AccessControIdentifierlKey = createSymbol('vfa.key.accessControIdentifier');
var ObservableIdentifierKey = createSymbol('vfa.key.observableIdentifier');
var AccessControlIdentifier = {};
var ObservableIdentifier = {};
/**
* Proxing property access of target.
* We can do unwrapping and other things here.
*/
function setupAccessControl(target) {
if (!isObject(target) || isWrapper(target)) {
return;
}
if (hasOwn(target, AccessControIdentifierlKey) &&
target[AccessControIdentifierlKey] === AccessControlIdentifier) {
return;
}
if (Object.isExtensible(target)) {
def(target, AccessControIdentifierlKey, AccessControlIdentifier);
}
var keys = Object.keys(target);
for (var i = 0; i < keys.length; i++) {
defineAccessControl(target, keys[i]);
}
}
function isObservable(obj) {
return (hasOwn(obj, ObservableIdentifierKey) && obj[ObservableIdentifierKey] === ObservableIdentifier);
}
/**
* Auto unwrapping when acccess property
*/
function defineAccessControl(target, key, val) {
var getter;
var setter;
var property = Object.getOwnPropertyDescriptor(target, key);
if (property) {
if (property.configurable === false) {
return;
}
getter = property.get;
setter = property.set;
val = target[key];
}
setupAccessControl(val);
Object.defineProperty(target, key, {
enumerable: true,
configurable: true,
get: function getterHandler() {
var value = getter ? getter.call(target) : val;
if (isWrapper(value)) {
return value.value;
}
else {
return value;
}
},
set: function setterHandler(newVal) {
if (getter && !setter)
return;
var value = getter ? getter.call(target) : val;
if (isWrapper(value)) {
if (isWrapper(newVal)) {
val = newVal;
}
else {
value.value = newVal;
}
}
else if (setter) {
setter.call(target, newVal);
}
else if (isWrapper(newVal)) {
val = newVal;
}
setupAccessControl(newVal);
},
});
}
/**
* Make obj reactivity
*/
function observable(obj) {
if (!isObject(obj) || isObservable(obj)) {
return obj;
}
var Vue = getCurrentVue();
var observed;
if (Vue.observable) {
observed = Vue.observable(obj);
}
else {
var silent = Vue.config.silent;
Vue.config.silent = true;
var vm = new Vue({
data: {
$$state: obj,
},
});
Vue.config.silent = silent;
observed = vm._data.$$state;
}
if (Object.isExtensible(observed)) {
def(observed, ObservableIdentifierKey, ObservableIdentifier);
}
setupAccessControl(observed);
return observed;
}
function isUndef(v) {
return v === undefined || v === null;
}
function isPrimitive(value) {
return (typeof value === 'string' ||
typeof value === 'number' ||
// $flow-disable-line
typeof value === 'symbol' ||
typeof value === 'boolean');
}
function isValidArrayIndex(val) {
var n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val);
}
/**
* Set a property on an object. Adds the new property, triggers change
* notification and intercept it's subsequent access if the property doesn't
* already exist.
*/
function set(target, key, val) {
var Vue = getCurrentVue();
var _a = Vue.util, warn = _a.warn, defineReactive = _a.defineReactive;
if (isUndef(target) || isPrimitive(target)) {
warn("Cannot set reactive property on undefined, null, or primitive value: " + target);
}
if (isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
// IMPORTANT: define access control before trigger watcher
defineAccessControl(target, key, val);
target.splice(key, 1, val);
return val;
}
if (key in target && !(key in Object.prototype)) {
target[key] = val;
return val;
}
var ob = target.__ob__;
if (target._isVue || (ob && ob.vmCount)) {
warn('Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.');
return val;
}
if (!ob) {
target[key] = val;
return val;
}
defineReactive(ob.value, key, val);
// IMPORTANT: define access control before trigger watcher
defineAccessControl(target, key, val);
ob.dep.notify();
return val;
}
function state(value) {
return observable(value);
}
function value(value) {
return new ValueWrapper(state({ $$state: value }));
}
function mixin(Vue) {
Vue.mixin({
created: vuexInit,
beforeCreate: functionApiInit,
});

@@ -305,5 +492,6 @@ /**

*/
function vuexInit() {
function functionApiInit() {
var vm = this;
var setup = vm.$options.setup;
var $options = vm.$options;
var setup = $options.setup;
if (!setup) {

@@ -314,20 +502,28 @@ return;

{
Vue.util.warn('The "setup" option should be a function that returns a object in component definitions.', vm);
warn('The "setup" option should be a function that returns a object in component definitions.', vm);
}
return;
}
var data = $options.data;
// wapper the data option, so we can invoke setup before data get resolved
$options.data = function wrappedData() {
initSetup(vm, vm.$props);
return typeof data === 'function' ? data.call(vm, vm) : data || {};
};
}
function initSetup(vm, props) {
if (props === void 0) { props = {}; }
var setup = vm.$options.setup;
var ctx = createSetupContext(vm);
var binding;
var preVm = getCurrentVM();
setCurrentVM(vm);
var ctx = createContext(vm);
try {
binding = setup(vm.$props || {}, ctx);
binding = setup(props, ctx);
}
catch (err) {
{
Vue.util.warn("there is an error occuring in \"setup\"", vm);
}
console.log(err);
logError(err, vm, 'setup()');
}
finally {
setCurrentVM(null);
setCurrentVM(preVm);
}

@@ -346,48 +542,51 @@ if (!binding)

var bindingValue = binding[name];
if (isWrapper(bindingValue)) {
bindingValue.setVmProperty(vm, name);
// make plain value reactive
if (!isWrapper(bindingValue)) {
bindingValue = value(bindingValue);
}
else {
vm[name] = bindingValue;
}
// bind to vm
bindingValue.setVmProperty(vm, name);
});
}
function createContext(vm) {
function createSetupContext(vm) {
var ctx = {};
var props = [
// 'el', // has workaround
// 'options',
'root',
'parent',
'root',
// 'children', // very likely
'refs',
'slots',
// 'scopedSlots', // has workaround
// 'isServer',
// 'ssrContext',
// 'vnode',
['slots', 'scopedSlots'],
'attrs',
];
var methodWithoutReturn = [
// 'on', // very likely
// 'once', // very likely
// 'off', // very likely
'emit',
];
var methodReturnVoid = ['emit'];
props.forEach(function (key) {
proxy(ctx, key, function () { return vm["$" + key]; }, function () {
Vue.util.warn("Cannot assign to '" + key + "' because it is a read-only property", vm);
var _a;
var targetKey;
var srcKey;
if (Array.isArray(key)) {
_a = __read(key, 2), targetKey = _a[0], srcKey = _a[1];
}
else {
targetKey = srcKey = key;
}
srcKey = "$" + srcKey;
proxy(ctx, targetKey, {
get: function () { return vm[srcKey]; },
set: function () {
warn("Cannot assign to '" + targetKey + "' because it is a read-only property", vm);
},
});
});
methodWithoutReturn.forEach(function (key) {
return proxy(ctx, key, function () {
var vmKey = "$" + key;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var fn = vm[vmKey];
fn.apply(vm, args);
};
methodReturnVoid.forEach(function (key) {
var srcKey = "$" + key;
proxy(ctx, key, {
get: function () {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var fn = vm[srcKey];
fn.apply(vm, args);
};
},
});

@@ -403,25 +602,19 @@ });

function upWrapping(obj) {
if (!obj) {
return obj;
function ensureCurrentVMInFn(hook) {
var vm = getCurrentVM();
{
assert(vm, "\"" + hook + "\" get called outside of \"setup()\"");
}
var keys = Object.keys(obj);
for (var index = 0; index < keys.length; index++) {
var key = keys[index];
var value_1 = obj[key];
if (isWrapper(value_1)) {
obj[key] = value_1.value;
}
else if (isPlainObject(value_1) || isArray(value_1)) {
obj[key] = upWrapping(value_1);
}
}
return obj;
return vm;
}
function state(value) {
return observable(isArray(value) || isPlainObject(value) ? upWrapping(value) : value);
function compoundComputed(computed) {
var Vue = getCurrentVue();
var silent = Vue.config.silent;
Vue.config.silent = true;
var reactive = new Vue({
computed: computed,
});
Vue.config.silent = silent;
return reactive;
}
function value(value) {
return new ValueWrapper(observable({ $$state: isArray(value) || isPlainObject(value) ? upWrapping(value) : value }));
}

@@ -432,3 +625,3 @@ var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); };

var vm = ensureCurrentVMInFn(genName(lifeCyclehook));
vm.$on("hook:" + lifeCyclehook, callback);
injectHookOption(getCurrentVue(), vm, lifeCyclehook, callback);
};

@@ -438,6 +631,14 @@ }

return function (callback) {
var currentVue = getCurrentVue();
var vm = ensureCurrentVMInFn(name);
lifeCyclehooks.forEach(function (lifeCyclehook) { return vm.$on("hook:" + lifeCyclehook, callback); });
lifeCyclehooks.forEach(function (lifeCyclehook) {
return injectHookOption(currentVue, vm, lifeCyclehook, callback);
});
};
}
function injectHookOption(Vue, vm, hook, val) {
var options = vm.$options;
var mergeFn = Vue.config.optionMergeStrategies[hook];
options[hook] = mergeFn(options[hook], val);
}
var onCreated = createLifeCycle('created');

@@ -456,8 +657,2 @@ var onBeforeMount = createLifeCycle('beforeMount');

function createSymbol(name) {
return hasSymbol ? Symbol.for(name) : name;
}
var WatcherPreFlushQueueKey = createSymbol('vfa.key.preFlushQueue');
var WatcherPostFlushQueueKey = createSymbol('vfa.key.postFlushQueue');
var initValue = {};

@@ -654,2 +849,3 @@ var fallbackVM;

var UNRESOLVED_INJECT = {};
function resolveInject(provideKey, vm) {

@@ -665,20 +861,37 @@ var source = vm;

}
{
getCurrentVue().util.warn("Injection \"" + String(provideKey) + "\" not found", vm);
}
return UNRESOLVED_INJECT;
}
function provide(provideOption) {
if (!provideOption) {
return;
function provide(keyOrData, value) {
var vm = ensureCurrentVMInFn('provide');
if (!vm._provided) {
vm._provided = {};
}
var vm = ensureCurrentVMInFn('provide');
vm._provided =
typeof provideOption === 'function' ? provideOption.call(vm) : provideOption;
if (isObject(keyOrData)) {
Object.assign(vm._provided, keyOrData);
}
else {
vm._provided[keyOrData] = value;
}
}
function inject(injectKey) {
if (!injectKey) {
function inject(key) {
if (!key) {
return;
}
var vm = ensureCurrentVMInFn('inject');
return resolveInject(injectKey, vm);
var val = resolveInject(key, vm);
if (val !== UNRESOLVED_INJECT) {
if (isWrapper(val)) {
return val;
}
var reactiveVal_1 = state(val);
return new ComputedWrapper({
read: function () { return reactiveVal_1; },
write: function () {
warn("The injectd value can't be re-assigned", vm);
},
});
}
else {
warn("Injection \"" + String(key) + "\" not found", vm);
}
}

@@ -712,4 +925,5 @@

exports.provide = provide;
exports.set = set;
exports.state = state;
exports.value = value;
exports.watch = watch;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var toString=function(e){return Object.prototype.toString.call(e)},hasSymbol="function"==typeof Symbol&&Symbol.for,noopFn=function(e){return e},sharedPropertyDefinition={enumerable:!0,configurable:!0,get:noopFn,set:noopFn};function proxy(e,t,n,r){sharedPropertyDefinition.get=n,sharedPropertyDefinition.set=r||noopFn,Object.defineProperty(e,t,sharedPropertyDefinition)}var hasOwnProperty=Object.prototype.hasOwnProperty;function hasOwn(e,t){return hasOwnProperty.call(e,t)}function assert(e,t){if(!e)throw new Error("[vue-function-api] "+t)}function isArray(e){return"[object Array]"===toString(e)}function isPlainObject(e){return"[object Object]"===toString(e)}var currentVue=null,currentVM=null;function getCurrentVue(){return currentVue}function setCurrentVue(e){currentVue=e}function getCurrentVM(){return currentVM}function setCurrentVM(e){currentVM=e}var AbstractWrapper=function(){function e(){}return e.prototype.setVmProperty=function(e,t){var n=this;this._vm=e,this._propName=t;e.$options.props,e.$options.methods,e.$options.computed,getCurrentVue().util.warn;t in e||proxy(e,t,function(){return n.value},function(e){n.value=e})},e}(),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return(__assign=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)},ValueWrapper=function(e){function t(t){var n=e.call(this)||this;return n._internal=t,n}return __extends(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this._internal.$$state},set:function(e){this._internal.$$state=e},enumerable:!0,configurable:!0}),t.prototype.exposeToDevtool=function(){},t}(AbstractWrapper),ComputedWrapper=function(e){function t(t){var n=e.call(this)||this;return n._internal=t,n}return __extends(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this._internal.read()},set:function(e){this._internal.write&&this._internal.write(e)},enumerable:!0,configurable:!0}),t.prototype.exposeToDevtool=function(){},t}(AbstractWrapper);function isWrapper(e){return e instanceof AbstractWrapper}function ensureCurrentVMInFn(e){return getCurrentVM()}function observable(e){var t=getCurrentVue();if(t.observable)return t.observable(e);var n=t.config.silent;t.config.silent=!0;var r=new t({data:{$$state:e}});return t.config.silent=n,r._data.$$state}function compoundComputed(e){var t=getCurrentVue(),n=t.config.silent;t.config.silent=!0;var r=new t({computed:e});return t.config.silent=n,r}function mergeData(e,t){if(!t)return e;for(var n,r,o,u=hasSymbol?Reflect.ownKeys(t):Object.keys(t),a=0;a<u.length;a++)"__ob__"!==(n=u[a])&&(r=e[n],o=t[n],hasOwn(e,n)?r!==o&&isPlainObject(r)&&!isWrapper(r)&&isPlainObject(o)&&!isWrapper(r)&&mergeData(r,o):e[n]=o);return e}function install(e,t){currentVue&&currentVue===e||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,r){return mergeData("function"==typeof t&&t(n,r)||{},"function"==typeof e&&e(n,r)||{})}},setCurrentVue(e),t(e))}function mixin(e){e.mixin({created:function(){var t,n=this,r=n.$options.setup;if(!r)return;if("function"!=typeof r)return;setCurrentVM(n);var o=function(t){var n={};return["parent","root","refs","slots","attrs"].forEach(function(r){proxy(n,r,function(){return t["$"+r]},function(){e.util.warn("Cannot assign to '"+r+"' because it is a read-only property",t)})}),["emit"].forEach(function(e){return proxy(n,e,function(){var n="$"+e;return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t[n].apply(t,e)}})}),n}(n);try{t=r(n.$props||{},o)}catch(e){console.log(e)}finally{setCurrentVM(null)}if(!t)return;if(!isPlainObject(t))return;Object.keys(t).forEach(function(e){var r=t[e];isWrapper(r)?r.setVmProperty(n,e):n[e]=r})}})}function createComponent(e){return e}function upWrapping(e){if(!e)return e;for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],o=e[r];isWrapper(o)?e[r]=o.value:(isPlainObject(o)||isArray(o))&&(e[r]=upWrapping(o))}return e}function state(e){return observable(isArray(e)||isPlainObject(e)?upWrapping(e):e)}function value(e){return new ValueWrapper(observable({$$state:isArray(e)||isPlainObject(e)?upWrapping(e):e}))}var genName=function(e){return"on"+(e[0].toUpperCase()+e.slice(1))};function createLifeCycle(e){return function(t){ensureCurrentVMInFn(genName(e)).$on("hook:"+e,t)}}function createLifeCycles(e,t){return function(n){var r=ensureCurrentVMInFn(t);e.forEach(function(e){return r.$on("hook:"+e,n)})}}var onCreated=createLifeCycle("created"),onBeforeMount=createLifeCycle("beforeMount"),onMounted=createLifeCycle("mounted"),onBeforeUpdate=createLifeCycle("beforeUpdate"),onUpdated=createLifeCycle("updated"),onActivated=createLifeCycle("activated"),onDeactivated=createLifeCycle("deactivated"),onBeforeDestroy=createLifeCycle("beforeDestroy"),onDestroyed=createLifeCycle("destroyed"),onErrorCaptured=createLifeCycle("errorCaptured"),onUnmounted=createLifeCycles(["destroyed","deactivated"],genName("unmounted"));function createSymbol(e){return hasSymbol?Symbol.for(e):e}var fallbackVM,WatcherPreFlushQueueKey=createSymbol("vfa.key.preFlushQueue"),WatcherPostFlushQueueKey=createSymbol("vfa.key.postFlushQueue"),initValue={};function hasWatchEnv(e){return void 0!==e[WatcherPreFlushQueueKey]}function installWatchEnv(e){e[WatcherPreFlushQueueKey]=[],e[WatcherPostFlushQueueKey]=[],e.$on("hook:beforeUpdate",createFlusher(WatcherPreFlushQueueKey)),e.$on("hook:updated",createFlusher(WatcherPostFlushQueueKey))}function createFlusher(e){return function(){flushQueue(this,e)}}function flushQueue(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function flushWatcherCallback(e,t,n){function r(){e.$nextTick(function(){e[WatcherPreFlushQueueKey].length&&flushQueue(e,WatcherPreFlushQueueKey),e[WatcherPostFlushQueueKey].length&&flushQueue(e,WatcherPostFlushQueueKey)})}switch(n){case"pre":r(),e[WatcherPreFlushQueueKey].push(t);break;case"post":r(),e[WatcherPostFlushQueueKey].push(t);break;case"sync":t();break;default:assert(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function createSingleSourceWatcher(e,t,n,r){var o;o=isWrapper(t)?function(){return t.value}:t;var u=function(e,t){u=a,r.lazy?a(e,t):n(e,t)},a=function(t,o){flushWatcherCallback(e,function(){n(t,o)},r.flush)};return e.$watch(o,function(e,t){u(e,t)},{immediate:!r.lazy,deep:r.deep,sync:"sync"===r.flush})}function createMuiltSourceWatcher(e,t,n,r){var o=!r.lazy&&t.length,u=!1,a=[];function i(){n.apply(e,a.reduce(function(e,t){return e[0].push(t.value===initValue?t.getter():t.value),e[1].push(t.oldValue===initValue?void 0:t.oldValue),e},[[],[]]))}var c=function(){!1!==o?0==--o&&(o=!1,c=s,i()):(c=s,s())},s=function(){u||(u=!0,e.$nextTick(function(){flushWatcherCallback(e,function(){u=!1,i()},r.flush)}))};return t.forEach(function(t){var n,o={getter:n=isWrapper(t)?function(){return t.value}:t,value:initValue,oldValue:initValue};a.push(o),o.watcherStopHandle=e.$watch(n,function(e,t){o.value=e,o.oldValue=t,c()},{immediate:!r.lazy,deep:r.deep,sync:!0})}),function(){a.forEach(function(e){return e.watcherStopHandle()})}}function watch(e,t,n){void 0===n&&(n={});var r=__assign({lazy:!1,deep:!1,flush:"post"},n),o=getCurrentVM();if(!o){if(!fallbackVM){var u=getCurrentVue(),a=u.config.silent;u.config.silent=!0,fallbackVM=new u,u.config.silent=a}o=fallbackVM,r.flush="sync"}return hasWatchEnv(o)||installWatchEnv(o),isArray(e)?createMuiltSourceWatcher(o,e,t,r):createSingleSourceWatcher(o,e,t,r)}function computed(e,t){var n=compoundComputed({$$state:{get:e,set:t}});return new ComputedWrapper(__assign({read:function(){return n.$$state}},t&&{write:function(e){n.$$state=e}}))}function resolveInject(e,t){for(var n=t;n;){if(n._provided&&hasOwn(n._provided,e))return n._provided[e];n=n.$parent}}function provide(e){if(e){var t=ensureCurrentVMInFn("provide");t._provided="function"==typeof e?e.call(t):e}}function inject(e){if(e)return resolveInject(e,ensureCurrentVMInFn("inject"))}var _install=function(e){return install(e,mixin)},plugin={install:_install};currentVue&&"undefined"!=typeof window&&window.Vue&&_install(window.Vue),exports.computed=computed,exports.createComponent=createComponent,exports.inject=inject,exports.onActivated=onActivated,exports.onBeforeDestroy=onBeforeDestroy,exports.onBeforeMount=onBeforeMount,exports.onBeforeUpdate=onBeforeUpdate,exports.onCreated=onCreated,exports.onDeactivated=onDeactivated,exports.onDestroyed=onDestroyed,exports.onErrorCaptured=onErrorCaptured,exports.onMounted=onMounted,exports.onUnmounted=onUnmounted,exports.onUpdated=onUpdated,exports.plugin=plugin,exports.provide=provide,exports.state=state,exports.value=value,exports.watch=watch;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var Vue=_interopDefault(require("vue")),toString=function(e){return Object.prototype.toString.call(e)},hasSymbol="function"==typeof Symbol&&Symbol.for,noopFn=function(e){return e},sharedPropertyDefinition={enumerable:!0,configurable:!0,get:noopFn,set:noopFn};function proxy(e,t,r){var n=r.get,o=r.set;sharedPropertyDefinition.get=n||noopFn,sharedPropertyDefinition.set=o||noopFn,Object.defineProperty(e,t,sharedPropertyDefinition)}function def(e,t,r,n){Object.defineProperty(e,t,{value:r,enumerable:!!n,writable:!0,configurable:!0})}var hasOwnProperty=Object.prototype.hasOwnProperty;function hasOwn(e,t){return hasOwnProperty.call(e,t)}function assert(e,t){if(!e)throw new Error("[vue-function-api] "+t)}function isArray(e){return Array.isArray(e)}function isObject(e){return null!==e&&"object"==typeof e}function isPlainObject(e){return"[object Object]"===toString(e)}function warn(e,t){Vue.util.warn(e,t)}function logError(e,t,r){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}var currentVue=null,currentVM=null;function getCurrentVue(){return currentVue}function setCurrentVue(e){currentVue=e}function getCurrentVM(){return currentVM}function setCurrentVM(e){currentVM=e}var AbstractWrapper=function(){function e(){}return e.prototype.setVmProperty=function(e,t){var r=this;def(this,"_vm",e),def(this,"_propName",t);var n=e.$options.props;t in e||n&&hasOwn(n,t)||proxy(e,t,{get:function(){return r.value},set:function(e){r.value=e}})},e}(),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}var ValueWrapper=function(e){function t(t){var r=e.call(this)||this;return def(r,"_internal",t),r}return __extends(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this._internal.$$state},set:function(e){this._internal.$$state=e},enumerable:!0,configurable:!0}),t.prototype.exposeToDevtool=function(){},t}(AbstractWrapper),ComputedWrapper=function(e){function t(t){var r=e.call(this)||this;return def(r,"_internal",t),r}return __extends(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this._internal.read()},set:function(e){this._internal.write&&this._internal.write(e)},enumerable:!0,configurable:!0}),t.prototype.exposeToDevtool=function(){},t}(AbstractWrapper);function isWrapper(e){return e instanceof AbstractWrapper}function mergeData(e,t){if(!t)return e;for(var r,n,o,i=hasSymbol?Reflect.ownKeys(t):Object.keys(t),u=0;u<i.length;u++)"__ob__"!==(r=i[u])&&(n=e[r],o=t[r],hasOwn(e,r)?n!==o&&isPlainObject(n)&&!isWrapper(n)&&isPlainObject(o)&&!isWrapper(n)&&mergeData(n,o):e[r]=o);return e}function install(e,t){currentVue&&currentVue===e||(e.config.optionMergeStrategies.setup=function(e,t){return function(r,n){return mergeData("function"==typeof t&&t(r,n)||{},"function"==typeof e&&e(r,n)||{})}},setCurrentVue(e),t(e))}function createSymbol(e){return hasSymbol?Symbol.for(e):e}var WatcherPreFlushQueueKey=createSymbol("vfa.key.preFlushQueue"),WatcherPostFlushQueueKey=createSymbol("vfa.key.postFlushQueue"),AccessControIdentifierlKey=createSymbol("vfa.key.accessControIdentifier"),ObservableIdentifierKey=createSymbol("vfa.key.observableIdentifier"),AccessControlIdentifier={},ObservableIdentifier={};function setupAccessControl(e){if(isObject(e)&&!isWrapper(e)&&(!hasOwn(e,AccessControIdentifierlKey)||e[AccessControIdentifierlKey]!==AccessControlIdentifier)){Object.isExtensible(e)&&def(e,AccessControIdentifierlKey,AccessControlIdentifier);for(var t=Object.keys(e),r=0;r<t.length;r++)defineAccessControl(e,t[r])}}function isObservable(e){return hasOwn(e,ObservableIdentifierKey)&&e[ObservableIdentifierKey]===ObservableIdentifier}function defineAccessControl(e,t,r){var n,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;n=i.get,o=i.set,r=e[t]}setupAccessControl(r),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):r;return isWrapper(t)?t.value:t},set:function(t){if(!n||o){var i=n?n.call(e):r;isWrapper(i)?isWrapper(t)?r=t:i.value=t:o?o.call(e,t):isWrapper(t)&&(r=t),setupAccessControl(t)}}})}function observable(e){if(!isObject(e)||isObservable(e))return e;var t,r=getCurrentVue();if(r.observable)t=r.observable(e);else{var n=r.config.silent;r.config.silent=!0;var o=new r({data:{$$state:e}});r.config.silent=n,t=o._data.$$state}return Object.isExtensible(t)&&def(t,ObservableIdentifierKey,ObservableIdentifier),setupAccessControl(t),t}function isValidArrayIndex(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function set(e,t,r){var n=getCurrentVue().util,o=(n.warn,n.defineReactive);if(isArray(e)&&isValidArrayIndex(t))return e.length=Math.max(e.length,t),defineAccessControl(e,t,r),e.splice(t,1,r),r;if(t in e&&!(t in Object.prototype))return e[t]=r,r;var i=e.__ob__;return e._isVue||i&&i.vmCount?r:i?(o(i.value,t,r),defineAccessControl(e,t,r),i.dep.notify(),r):(e[t]=r,r)}function state(e){return observable(e)}function value(e){return new ValueWrapper(state({$$state:e}))}function mixin(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,r=t.setup;if(!r)return;if("function"!=typeof r)return;var n=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var r,n=e.$options.setup,o=function(e){var t={};return["root","parent","refs",["slots","scopedSlots"],"attrs"].forEach(function(r){var n,o,i;Array.isArray(r)?(n=__read(r,2),o=n[0],i=n[1]):o=i=r,i="$"+i,proxy(t,o,{get:function(){return e[i]},set:function(){warn("Cannot assign to '"+o+"' because it is a read-only property",e)}})}),["emit"].forEach(function(r){var n="$"+r;proxy(t,r,{get:function(){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e[n].apply(e,t)}}})}),t}(e),i=getCurrentVM();setCurrentVM(e);try{r=n(t,o)}catch(t){logError(t,e,"setup()")}finally{setCurrentVM(i)}if(!r)return;if(!isPlainObject(r))return;Object.keys(r).forEach(function(t){var n=r[t];isWrapper(n)||(n=value(n)),n.setVmProperty(e,t)})}(e,e.$props),"function"==typeof n?n.call(e,e):n||{}}}})}function createComponent(e){return e}function ensureCurrentVMInFn(e){return getCurrentVM()}function compoundComputed(e){var t=getCurrentVue(),r=t.config.silent;t.config.silent=!0;var n=new t({computed:e});return t.config.silent=r,n}var genName=function(e){return"on"+(e[0].toUpperCase()+e.slice(1))};function createLifeCycle(e){return function(t){var r=ensureCurrentVMInFn(genName(e));injectHookOption(getCurrentVue(),r,e,t)}}function createLifeCycles(e,t){return function(r){var n=getCurrentVue(),o=ensureCurrentVMInFn(t);e.forEach(function(e){return injectHookOption(n,o,e,r)})}}function injectHookOption(e,t,r,n){var o=t.$options,i=e.config.optionMergeStrategies[r];o[r]=i(o[r],n)}var fallbackVM,onCreated=createLifeCycle("created"),onBeforeMount=createLifeCycle("beforeMount"),onMounted=createLifeCycle("mounted"),onBeforeUpdate=createLifeCycle("beforeUpdate"),onUpdated=createLifeCycle("updated"),onActivated=createLifeCycle("activated"),onDeactivated=createLifeCycle("deactivated"),onBeforeDestroy=createLifeCycle("beforeDestroy"),onDestroyed=createLifeCycle("destroyed"),onErrorCaptured=createLifeCycle("errorCaptured"),onUnmounted=createLifeCycles(["destroyed","deactivated"],genName("unmounted")),initValue={};function hasWatchEnv(e){return void 0!==e[WatcherPreFlushQueueKey]}function installWatchEnv(e){e[WatcherPreFlushQueueKey]=[],e[WatcherPostFlushQueueKey]=[],e.$on("hook:beforeUpdate",createFlusher(WatcherPreFlushQueueKey)),e.$on("hook:updated",createFlusher(WatcherPostFlushQueueKey))}function createFlusher(e){return function(){flushQueue(this,e)}}function flushQueue(e,t){for(var r=e[t],n=0;n<r.length;n++)r[n]();r.length=0}function flushWatcherCallback(e,t,r){function n(){e.$nextTick(function(){e[WatcherPreFlushQueueKey].length&&flushQueue(e,WatcherPreFlushQueueKey),e[WatcherPostFlushQueueKey].length&&flushQueue(e,WatcherPostFlushQueueKey)})}switch(r){case"pre":n(),e[WatcherPreFlushQueueKey].push(t);break;case"post":n(),e[WatcherPostFlushQueueKey].push(t);break;case"sync":t();break;default:assert(!1,'flush must be one of ["post", "pre", "sync"], but got '+r)}}function createSingleSourceWatcher(e,t,r,n){var o;o=isWrapper(t)?function(){return t.value}:t;var i=function(e,t){i=u,n.lazy?u(e,t):r(e,t)},u=function(t,o){flushWatcherCallback(e,function(){r(t,o)},n.flush)};return e.$watch(o,function(e,t){i(e,t)},{immediate:!n.lazy,deep:n.deep,sync:"sync"===n.flush})}function createMuiltSourceWatcher(e,t,r,n){var o=!n.lazy&&t.length,i=!1,u=[];function a(){r.apply(e,u.reduce(function(e,t){return e[0].push(t.value===initValue?t.getter():t.value),e[1].push(t.oldValue===initValue?void 0:t.oldValue),e},[[],[]]))}var c=function(){!1!==o?0==--o&&(o=!1,c=s,a()):(c=s,s())},s=function(){i||(i=!0,e.$nextTick(function(){flushWatcherCallback(e,function(){i=!1,a()},n.flush)}))};return t.forEach(function(t){var r,o={getter:r=isWrapper(t)?function(){return t.value}:t,value:initValue,oldValue:initValue};u.push(o),o.watcherStopHandle=e.$watch(r,function(e,t){o.value=e,o.oldValue=t,c()},{immediate:!n.lazy,deep:n.deep,sync:!0})}),function(){u.forEach(function(e){return e.watcherStopHandle()})}}function watch(e,t,r){void 0===r&&(r={});var n=__assign({lazy:!1,deep:!1,flush:"post"},r),o=getCurrentVM();if(!o){if(!fallbackVM){var i=getCurrentVue(),u=i.config.silent;i.config.silent=!0,fallbackVM=new i,i.config.silent=u}o=fallbackVM,n.flush="sync"}return hasWatchEnv(o)||installWatchEnv(o),isArray(e)?createMuiltSourceWatcher(o,e,t,n):createSingleSourceWatcher(o,e,t,n)}function computed(e,t){var r=compoundComputed({$$state:{get:e,set:t}});return new ComputedWrapper(__assign({read:function(){return r.$$state}},t&&{write:function(e){r.$$state=e}}))}var UNRESOLVED_INJECT={};function resolveInject(e,t){for(var r=t;r;){if(r._provided&&hasOwn(r._provided,e))return r._provided[e];r=r.$parent}return UNRESOLVED_INJECT}function provide(e,t){var r=ensureCurrentVMInFn("provide");r._provided||(r._provided={}),isObject(e)?Object.assign(r._provided,e):r._provided[e]=t}function inject(e){if(e){var t=ensureCurrentVMInFn("inject"),r=resolveInject(e,t);if(r!==UNRESOLVED_INJECT){if(isWrapper(r))return r;var n=state(r);return new ComputedWrapper({read:function(){return n},write:function(){warn("The injectd value can't be re-assigned",t)}})}}}var _install=function(e){return install(e,mixin)},plugin={install:_install};currentVue&&"undefined"!=typeof window&&window.Vue&&_install(window.Vue),exports.computed=computed,exports.createComponent=createComponent,exports.inject=inject,exports.onActivated=onActivated,exports.onBeforeDestroy=onBeforeDestroy,exports.onBeforeMount=onBeforeMount,exports.onBeforeUpdate=onBeforeUpdate,exports.onCreated=onCreated,exports.onDeactivated=onDeactivated,exports.onDestroyed=onDestroyed,exports.onErrorCaptured=onErrorCaptured,exports.onMounted=onMounted,exports.onUnmounted=onUnmounted,exports.onUpdated=onUpdated,exports.plugin=plugin,exports.provide=provide,exports.set=set,exports.state=state,exports.value=value,exports.watch=watch;

@@ -0,1 +1,3 @@

import Vue from 'vue';
var toString = function (x) { return Object.prototype.toString.call(x); };

@@ -10,7 +12,16 @@ var hasSymbol = typeof Symbol === 'function' && Symbol.for;

};
function proxy(target, key, getter, setter) {
sharedPropertyDefinition.get = getter;
sharedPropertyDefinition.set = setter || noopFn;
function proxy(target, key, _a) {
var get = _a.get, set = _a.set;
sharedPropertyDefinition.get = get || noopFn;
sharedPropertyDefinition.set = set || noopFn;
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function def(obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true,
});
}
var hasOwnProperty = Object.prototype.hasOwnProperty;

@@ -25,7 +36,24 @@ function hasOwn(obj, key) {

function isArray(x) {
return toString(x) === '[object Array]';
return Array.isArray(x);
}
function isObject(val) {
return val !== null && typeof val === 'object';
}
function isPlainObject(x) {
return toString(x) === '[object Object]';
}
function warn(msg, vm) {
Vue.util.warn(msg, vm);
}
function logError(err, vm, info) {
{
warn("Error in " + info + ": \"" + err.toString() + "\"", vm);
}
if (typeof window !== 'undefined' && typeof console !== 'undefined') {
console.error(err);
}
else {
throw err;
}
}

@@ -55,29 +83,23 @@ var currentVue = null;

var _this = this;
this._vm = vm;
this._propName = propName;
def(this, '_vm', vm);
def(this, '_propName', propName);
var props = vm.$options.props;
var methods = vm.$options.methods;
var computed = vm.$options.computed;
var warn = getCurrentVue().util.warn;
if (!(propName in vm)) {
proxy(vm, propName, function () { return _this.value; }, function (val) {
_this.value = val;
if (!(propName in vm) && !(props && hasOwn(props, propName))) {
proxy(vm, propName, {
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
});
{
this.exposeToDevtool();
// expose bindings after state has been resolved to prevent repeated works
vm.$nextTick(function () {
_this.exposeToDevtool();
});
}
}
else {
if (hasOwn(vm.$data, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a data.", vm);
}
else if (props && hasOwn(props, propName)) {
if (props && hasOwn(props, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a prop.", vm);
}
else if (methods && hasOwn(methods, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a method.", vm);
}
else if (computed && propName in computed) {
warn("The setup binding property \"" + propName + "\" is already declared as a computed.", vm);
}
else {

@@ -131,7 +153,24 @@ warn("The setup binding property \"" + propName + "\" is already declared.", vm);

function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
var ValueWrapper = /** @class */ (function (_super) {
__extends(ValueWrapper, _super);
function ValueWrapper(_internal) {
function ValueWrapper(internal) {
var _this = _super.call(this) || this;
_this._internal = _internal;
def(_this, '_internal', internal);
return _this;

@@ -154,4 +193,7 @@ }

var name_1 = this._propName;
proxy(vm._data, name_1, function () { return _this.value; }, function (val) {
_this.value = val;
proxy(vm._data, name_1, {
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
});

@@ -165,5 +207,5 @@ }

__extends(ComputedWrapper, _super);
function ComputedWrapper(_internal) {
function ComputedWrapper(internal) {
var _this = _super.call(this) || this;
_this._internal = _internal;
def(_this, '_internal', internal);
return _this;

@@ -178,3 +220,3 @@ }

{
getCurrentVue().util.warn('Computed property' +
warn('Computed property' +
(this._propName ? " \"" + this._propName + "\"" : '') +

@@ -199,8 +241,10 @@ ' was assigned to but it has no setter.', this._vm);

}
proxy(vm.$options.computed, name_1, function () { return ({
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
}); });
proxy(vm.$options.computed, name_1, {
get: function () { return ({
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
}); },
});
}

@@ -214,34 +258,2 @@ };

}
function ensureCurrentVMInFn(hook) {
var vm = getCurrentVM();
{
assert(vm, "\"" + hook + "\" get called outside of \"setup()\"");
}
return vm;
}
function observable(obj) {
var Vue = getCurrentVue();
if (Vue.observable) {
return Vue.observable(obj);
}
var silent = Vue.config.silent;
Vue.config.silent = true;
var vm = new Vue({
data: {
$$state: obj,
},
});
Vue.config.silent = silent;
return vm._data.$$state;
}
function compoundComputed(computed) {
var Vue = getCurrentVue();
var silent = Vue.config.silent;
Vue.config.silent = true;
var reactive = new Vue({
computed: computed,
});
Vue.config.silent = silent;
return reactive;
}

@@ -292,5 +304,178 @@ /**

function createSymbol(name) {
return hasSymbol ? Symbol.for(name) : name;
}
var WatcherPreFlushQueueKey = createSymbol('vfa.key.preFlushQueue');
var WatcherPostFlushQueueKey = createSymbol('vfa.key.postFlushQueue');
var AccessControIdentifierlKey = createSymbol('vfa.key.accessControIdentifier');
var ObservableIdentifierKey = createSymbol('vfa.key.observableIdentifier');
var AccessControlIdentifier = {};
var ObservableIdentifier = {};
/**
* Proxing property access of target.
* We can do unwrapping and other things here.
*/
function setupAccessControl(target) {
if (!isObject(target) || isWrapper(target)) {
return;
}
if (hasOwn(target, AccessControIdentifierlKey) &&
target[AccessControIdentifierlKey] === AccessControlIdentifier) {
return;
}
if (Object.isExtensible(target)) {
def(target, AccessControIdentifierlKey, AccessControlIdentifier);
}
var keys = Object.keys(target);
for (var i = 0; i < keys.length; i++) {
defineAccessControl(target, keys[i]);
}
}
function isObservable(obj) {
return (hasOwn(obj, ObservableIdentifierKey) && obj[ObservableIdentifierKey] === ObservableIdentifier);
}
/**
* Auto unwrapping when acccess property
*/
function defineAccessControl(target, key, val) {
var getter;
var setter;
var property = Object.getOwnPropertyDescriptor(target, key);
if (property) {
if (property.configurable === false) {
return;
}
getter = property.get;
setter = property.set;
val = target[key];
}
setupAccessControl(val);
Object.defineProperty(target, key, {
enumerable: true,
configurable: true,
get: function getterHandler() {
var value = getter ? getter.call(target) : val;
if (isWrapper(value)) {
return value.value;
}
else {
return value;
}
},
set: function setterHandler(newVal) {
if (getter && !setter)
return;
var value = getter ? getter.call(target) : val;
if (isWrapper(value)) {
if (isWrapper(newVal)) {
val = newVal;
}
else {
value.value = newVal;
}
}
else if (setter) {
setter.call(target, newVal);
}
else if (isWrapper(newVal)) {
val = newVal;
}
setupAccessControl(newVal);
},
});
}
/**
* Make obj reactivity
*/
function observable(obj) {
if (!isObject(obj) || isObservable(obj)) {
return obj;
}
var Vue = getCurrentVue();
var observed;
if (Vue.observable) {
observed = Vue.observable(obj);
}
else {
var silent = Vue.config.silent;
Vue.config.silent = true;
var vm = new Vue({
data: {
$$state: obj,
},
});
Vue.config.silent = silent;
observed = vm._data.$$state;
}
if (Object.isExtensible(observed)) {
def(observed, ObservableIdentifierKey, ObservableIdentifier);
}
setupAccessControl(observed);
return observed;
}
function isUndef(v) {
return v === undefined || v === null;
}
function isPrimitive(value) {
return (typeof value === 'string' ||
typeof value === 'number' ||
// $flow-disable-line
typeof value === 'symbol' ||
typeof value === 'boolean');
}
function isValidArrayIndex(val) {
var n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val);
}
/**
* Set a property on an object. Adds the new property, triggers change
* notification and intercept it's subsequent access if the property doesn't
* already exist.
*/
function set(target, key, val) {
var Vue = getCurrentVue();
var _a = Vue.util, warn = _a.warn, defineReactive = _a.defineReactive;
if (isUndef(target) || isPrimitive(target)) {
warn("Cannot set reactive property on undefined, null, or primitive value: " + target);
}
if (isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
// IMPORTANT: define access control before trigger watcher
defineAccessControl(target, key, val);
target.splice(key, 1, val);
return val;
}
if (key in target && !(key in Object.prototype)) {
target[key] = val;
return val;
}
var ob = target.__ob__;
if (target._isVue || (ob && ob.vmCount)) {
warn('Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.');
return val;
}
if (!ob) {
target[key] = val;
return val;
}
defineReactive(ob.value, key, val);
// IMPORTANT: define access control before trigger watcher
defineAccessControl(target, key, val);
ob.dep.notify();
return val;
}
function state(value) {
return observable(value);
}
function value(value) {
return new ValueWrapper(state({ $$state: value }));
}
function mixin(Vue) {
Vue.mixin({
created: vuexInit,
beforeCreate: functionApiInit,
});

@@ -300,5 +485,6 @@ /**

*/
function vuexInit() {
function functionApiInit() {
var vm = this;
var setup = vm.$options.setup;
var $options = vm.$options;
var setup = $options.setup;
if (!setup) {

@@ -309,20 +495,28 @@ return;

{
Vue.util.warn('The "setup" option should be a function that returns a object in component definitions.', vm);
warn('The "setup" option should be a function that returns a object in component definitions.', vm);
}
return;
}
var data = $options.data;
// wapper the data option, so we can invoke setup before data get resolved
$options.data = function wrappedData() {
initSetup(vm, vm.$props);
return typeof data === 'function' ? data.call(vm, vm) : data || {};
};
}
function initSetup(vm, props) {
if (props === void 0) { props = {}; }
var setup = vm.$options.setup;
var ctx = createSetupContext(vm);
var binding;
var preVm = getCurrentVM();
setCurrentVM(vm);
var ctx = createContext(vm);
try {
binding = setup(vm.$props || {}, ctx);
binding = setup(props, ctx);
}
catch (err) {
{
Vue.util.warn("there is an error occuring in \"setup\"", vm);
}
console.log(err);
logError(err, vm, 'setup()');
}
finally {
setCurrentVM(null);
setCurrentVM(preVm);
}

@@ -341,48 +535,51 @@ if (!binding)

var bindingValue = binding[name];
if (isWrapper(bindingValue)) {
bindingValue.setVmProperty(vm, name);
// make plain value reactive
if (!isWrapper(bindingValue)) {
bindingValue = value(bindingValue);
}
else {
vm[name] = bindingValue;
}
// bind to vm
bindingValue.setVmProperty(vm, name);
});
}
function createContext(vm) {
function createSetupContext(vm) {
var ctx = {};
var props = [
// 'el', // has workaround
// 'options',
'root',
'parent',
'root',
// 'children', // very likely
'refs',
'slots',
// 'scopedSlots', // has workaround
// 'isServer',
// 'ssrContext',
// 'vnode',
['slots', 'scopedSlots'],
'attrs',
];
var methodWithoutReturn = [
// 'on', // very likely
// 'once', // very likely
// 'off', // very likely
'emit',
];
var methodReturnVoid = ['emit'];
props.forEach(function (key) {
proxy(ctx, key, function () { return vm["$" + key]; }, function () {
Vue.util.warn("Cannot assign to '" + key + "' because it is a read-only property", vm);
var _a;
var targetKey;
var srcKey;
if (Array.isArray(key)) {
_a = __read(key, 2), targetKey = _a[0], srcKey = _a[1];
}
else {
targetKey = srcKey = key;
}
srcKey = "$" + srcKey;
proxy(ctx, targetKey, {
get: function () { return vm[srcKey]; },
set: function () {
warn("Cannot assign to '" + targetKey + "' because it is a read-only property", vm);
},
});
});
methodWithoutReturn.forEach(function (key) {
return proxy(ctx, key, function () {
var vmKey = "$" + key;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var fn = vm[vmKey];
fn.apply(vm, args);
};
methodReturnVoid.forEach(function (key) {
var srcKey = "$" + key;
proxy(ctx, key, {
get: function () {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var fn = vm[srcKey];
fn.apply(vm, args);
};
},
});

@@ -398,25 +595,19 @@ });

function upWrapping(obj) {
if (!obj) {
return obj;
function ensureCurrentVMInFn(hook) {
var vm = getCurrentVM();
{
assert(vm, "\"" + hook + "\" get called outside of \"setup()\"");
}
var keys = Object.keys(obj);
for (var index = 0; index < keys.length; index++) {
var key = keys[index];
var value_1 = obj[key];
if (isWrapper(value_1)) {
obj[key] = value_1.value;
}
else if (isPlainObject(value_1) || isArray(value_1)) {
obj[key] = upWrapping(value_1);
}
}
return obj;
return vm;
}
function state(value) {
return observable(isArray(value) || isPlainObject(value) ? upWrapping(value) : value);
function compoundComputed(computed) {
var Vue = getCurrentVue();
var silent = Vue.config.silent;
Vue.config.silent = true;
var reactive = new Vue({
computed: computed,
});
Vue.config.silent = silent;
return reactive;
}
function value(value) {
return new ValueWrapper(observable({ $$state: isArray(value) || isPlainObject(value) ? upWrapping(value) : value }));
}

@@ -427,3 +618,3 @@ var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); };

var vm = ensureCurrentVMInFn(genName(lifeCyclehook));
vm.$on("hook:" + lifeCyclehook, callback);
injectHookOption(getCurrentVue(), vm, lifeCyclehook, callback);
};

@@ -433,6 +624,14 @@ }

return function (callback) {
var currentVue = getCurrentVue();
var vm = ensureCurrentVMInFn(name);
lifeCyclehooks.forEach(function (lifeCyclehook) { return vm.$on("hook:" + lifeCyclehook, callback); });
lifeCyclehooks.forEach(function (lifeCyclehook) {
return injectHookOption(currentVue, vm, lifeCyclehook, callback);
});
};
}
function injectHookOption(Vue, vm, hook, val) {
var options = vm.$options;
var mergeFn = Vue.config.optionMergeStrategies[hook];
options[hook] = mergeFn(options[hook], val);
}
var onCreated = createLifeCycle('created');

@@ -451,8 +650,2 @@ var onBeforeMount = createLifeCycle('beforeMount');

function createSymbol(name) {
return hasSymbol ? Symbol.for(name) : name;
}
var WatcherPreFlushQueueKey = createSymbol('vfa.key.preFlushQueue');
var WatcherPostFlushQueueKey = createSymbol('vfa.key.postFlushQueue');
var initValue = {};

@@ -649,2 +842,3 @@ var fallbackVM;

var UNRESOLVED_INJECT = {};
function resolveInject(provideKey, vm) {

@@ -660,20 +854,37 @@ var source = vm;

}
{
getCurrentVue().util.warn("Injection \"" + String(provideKey) + "\" not found", vm);
}
return UNRESOLVED_INJECT;
}
function provide(provideOption) {
if (!provideOption) {
return;
function provide(keyOrData, value) {
var vm = ensureCurrentVMInFn('provide');
if (!vm._provided) {
vm._provided = {};
}
var vm = ensureCurrentVMInFn('provide');
vm._provided =
typeof provideOption === 'function' ? provideOption.call(vm) : provideOption;
if (isObject(keyOrData)) {
Object.assign(vm._provided, keyOrData);
}
else {
vm._provided[keyOrData] = value;
}
}
function inject(injectKey) {
if (!injectKey) {
function inject(key) {
if (!key) {
return;
}
var vm = ensureCurrentVMInFn('inject');
return resolveInject(injectKey, vm);
var val = resolveInject(key, vm);
if (val !== UNRESOLVED_INJECT) {
if (isWrapper(val)) {
return val;
}
var reactiveVal_1 = state(val);
return new ComputedWrapper({
read: function () { return reactiveVal_1; },
write: function () {
warn("The injectd value can't be re-assigned", vm);
},
});
}
else {
warn("Injection \"" + String(key) + "\" not found", vm);
}
}

@@ -691,2 +902,2 @@

export { computed, createComponent, inject, onActivated, onBeforeDestroy, onBeforeMount, onBeforeUpdate, onCreated, onDeactivated, onDestroyed, onErrorCaptured, onMounted, onUnmounted, onUpdated, plugin, provide, state, value, watch };
export { computed, createComponent, inject, onActivated, onBeforeDestroy, onBeforeMount, onBeforeUpdate, onCreated, onDeactivated, onDestroyed, onErrorCaptured, onMounted, onUnmounted, onUpdated, plugin, provide, set, state, value, watch };
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.vueFunctionApi = {}));
}(this, function (exports) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
(global = global || self, factory(global.vueFunctionApi = {}, global.Vue));
}(this, function (exports, Vue) { 'use strict';
Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
var toString = function (x) { return Object.prototype.toString.call(x); };

@@ -16,7 +18,16 @@ var hasSymbol = typeof Symbol === 'function' && Symbol.for;

};
function proxy(target, key, getter, setter) {
sharedPropertyDefinition.get = getter;
sharedPropertyDefinition.set = setter || noopFn;
function proxy(target, key, _a) {
var get = _a.get, set = _a.set;
sharedPropertyDefinition.get = get || noopFn;
sharedPropertyDefinition.set = set || noopFn;
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function def(obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true,
});
}
var hasOwnProperty = Object.prototype.hasOwnProperty;

@@ -31,7 +42,24 @@ function hasOwn(obj, key) {

function isArray(x) {
return toString(x) === '[object Array]';
return Array.isArray(x);
}
function isObject(val) {
return val !== null && typeof val === 'object';
}
function isPlainObject(x) {
return toString(x) === '[object Object]';
}
function warn(msg, vm) {
Vue.util.warn(msg, vm);
}
function logError(err, vm, info) {
{
warn("Error in " + info + ": \"" + err.toString() + "\"", vm);
}
if (typeof window !== 'undefined' && typeof console !== 'undefined') {
console.error(err);
}
else {
throw err;
}
}

@@ -61,29 +89,23 @@ var currentVue = null;

var _this = this;
this._vm = vm;
this._propName = propName;
def(this, '_vm', vm);
def(this, '_propName', propName);
var props = vm.$options.props;
var methods = vm.$options.methods;
var computed = vm.$options.computed;
var warn = getCurrentVue().util.warn;
if (!(propName in vm)) {
proxy(vm, propName, function () { return _this.value; }, function (val) {
_this.value = val;
if (!(propName in vm) && !(props && hasOwn(props, propName))) {
proxy(vm, propName, {
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
});
{
this.exposeToDevtool();
// expose bindings after state has been resolved to prevent repeated works
vm.$nextTick(function () {
_this.exposeToDevtool();
});
}
}
else {
if (hasOwn(vm.$data, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a data.", vm);
}
else if (props && hasOwn(props, propName)) {
if (props && hasOwn(props, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a prop.", vm);
}
else if (methods && hasOwn(methods, propName)) {
warn("The setup binding property \"" + propName + "\" is already declared as a method.", vm);
}
else if (computed && propName in computed) {
warn("The setup binding property \"" + propName + "\" is already declared as a computed.", vm);
}
else {

@@ -137,7 +159,24 @@ warn("The setup binding property \"" + propName + "\" is already declared.", vm);

function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
var ValueWrapper = /** @class */ (function (_super) {
__extends(ValueWrapper, _super);
function ValueWrapper(_internal) {
function ValueWrapper(internal) {
var _this = _super.call(this) || this;
_this._internal = _internal;
def(_this, '_internal', internal);
return _this;

@@ -160,4 +199,7 @@ }

var name_1 = this._propName;
proxy(vm._data, name_1, function () { return _this.value; }, function (val) {
_this.value = val;
proxy(vm._data, name_1, {
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
});

@@ -171,5 +213,5 @@ }

__extends(ComputedWrapper, _super);
function ComputedWrapper(_internal) {
function ComputedWrapper(internal) {
var _this = _super.call(this) || this;
_this._internal = _internal;
def(_this, '_internal', internal);
return _this;

@@ -184,3 +226,3 @@ }

{
getCurrentVue().util.warn('Computed property' +
warn('Computed property' +
(this._propName ? " \"" + this._propName + "\"" : '') +

@@ -205,8 +247,10 @@ ' was assigned to but it has no setter.', this._vm);

}
proxy(vm.$options.computed, name_1, function () { return ({
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
}); });
proxy(vm.$options.computed, name_1, {
get: function () { return ({
get: function () { return _this.value; },
set: function (val) {
_this.value = val;
},
}); },
});
}

@@ -220,34 +264,2 @@ };

}
function ensureCurrentVMInFn(hook) {
var vm = getCurrentVM();
{
assert(vm, "\"" + hook + "\" get called outside of \"setup()\"");
}
return vm;
}
function observable(obj) {
var Vue = getCurrentVue();
if (Vue.observable) {
return Vue.observable(obj);
}
var silent = Vue.config.silent;
Vue.config.silent = true;
var vm = new Vue({
data: {
$$state: obj,
},
});
Vue.config.silent = silent;
return vm._data.$$state;
}
function compoundComputed(computed) {
var Vue = getCurrentVue();
var silent = Vue.config.silent;
Vue.config.silent = true;
var reactive = new Vue({
computed: computed,
});
Vue.config.silent = silent;
return reactive;
}

@@ -298,5 +310,178 @@ /**

function createSymbol(name) {
return hasSymbol ? Symbol.for(name) : name;
}
var WatcherPreFlushQueueKey = createSymbol('vfa.key.preFlushQueue');
var WatcherPostFlushQueueKey = createSymbol('vfa.key.postFlushQueue');
var AccessControIdentifierlKey = createSymbol('vfa.key.accessControIdentifier');
var ObservableIdentifierKey = createSymbol('vfa.key.observableIdentifier');
var AccessControlIdentifier = {};
var ObservableIdentifier = {};
/**
* Proxing property access of target.
* We can do unwrapping and other things here.
*/
function setupAccessControl(target) {
if (!isObject(target) || isWrapper(target)) {
return;
}
if (hasOwn(target, AccessControIdentifierlKey) &&
target[AccessControIdentifierlKey] === AccessControlIdentifier) {
return;
}
if (Object.isExtensible(target)) {
def(target, AccessControIdentifierlKey, AccessControlIdentifier);
}
var keys = Object.keys(target);
for (var i = 0; i < keys.length; i++) {
defineAccessControl(target, keys[i]);
}
}
function isObservable(obj) {
return (hasOwn(obj, ObservableIdentifierKey) && obj[ObservableIdentifierKey] === ObservableIdentifier);
}
/**
* Auto unwrapping when acccess property
*/
function defineAccessControl(target, key, val) {
var getter;
var setter;
var property = Object.getOwnPropertyDescriptor(target, key);
if (property) {
if (property.configurable === false) {
return;
}
getter = property.get;
setter = property.set;
val = target[key];
}
setupAccessControl(val);
Object.defineProperty(target, key, {
enumerable: true,
configurable: true,
get: function getterHandler() {
var value = getter ? getter.call(target) : val;
if (isWrapper(value)) {
return value.value;
}
else {
return value;
}
},
set: function setterHandler(newVal) {
if (getter && !setter)
return;
var value = getter ? getter.call(target) : val;
if (isWrapper(value)) {
if (isWrapper(newVal)) {
val = newVal;
}
else {
value.value = newVal;
}
}
else if (setter) {
setter.call(target, newVal);
}
else if (isWrapper(newVal)) {
val = newVal;
}
setupAccessControl(newVal);
},
});
}
/**
* Make obj reactivity
*/
function observable(obj) {
if (!isObject(obj) || isObservable(obj)) {
return obj;
}
var Vue = getCurrentVue();
var observed;
if (Vue.observable) {
observed = Vue.observable(obj);
}
else {
var silent = Vue.config.silent;
Vue.config.silent = true;
var vm = new Vue({
data: {
$$state: obj,
},
});
Vue.config.silent = silent;
observed = vm._data.$$state;
}
if (Object.isExtensible(observed)) {
def(observed, ObservableIdentifierKey, ObservableIdentifier);
}
setupAccessControl(observed);
return observed;
}
function isUndef(v) {
return v === undefined || v === null;
}
function isPrimitive(value) {
return (typeof value === 'string' ||
typeof value === 'number' ||
// $flow-disable-line
typeof value === 'symbol' ||
typeof value === 'boolean');
}
function isValidArrayIndex(val) {
var n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val);
}
/**
* Set a property on an object. Adds the new property, triggers change
* notification and intercept it's subsequent access if the property doesn't
* already exist.
*/
function set(target, key, val) {
var Vue = getCurrentVue();
var _a = Vue.util, warn = _a.warn, defineReactive = _a.defineReactive;
if (isUndef(target) || isPrimitive(target)) {
warn("Cannot set reactive property on undefined, null, or primitive value: " + target);
}
if (isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
// IMPORTANT: define access control before trigger watcher
defineAccessControl(target, key, val);
target.splice(key, 1, val);
return val;
}
if (key in target && !(key in Object.prototype)) {
target[key] = val;
return val;
}
var ob = target.__ob__;
if (target._isVue || (ob && ob.vmCount)) {
warn('Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.');
return val;
}
if (!ob) {
target[key] = val;
return val;
}
defineReactive(ob.value, key, val);
// IMPORTANT: define access control before trigger watcher
defineAccessControl(target, key, val);
ob.dep.notify();
return val;
}
function state(value) {
return observable(value);
}
function value(value) {
return new ValueWrapper(state({ $$state: value }));
}
function mixin(Vue) {
Vue.mixin({
created: vuexInit,
beforeCreate: functionApiInit,
});

@@ -306,5 +491,6 @@ /**

*/
function vuexInit() {
function functionApiInit() {
var vm = this;
var setup = vm.$options.setup;
var $options = vm.$options;
var setup = $options.setup;
if (!setup) {

@@ -315,20 +501,28 @@ return;

{
Vue.util.warn('The "setup" option should be a function that returns a object in component definitions.', vm);
warn('The "setup" option should be a function that returns a object in component definitions.', vm);
}
return;
}
var data = $options.data;
// wapper the data option, so we can invoke setup before data get resolved
$options.data = function wrappedData() {
initSetup(vm, vm.$props);
return typeof data === 'function' ? data.call(vm, vm) : data || {};
};
}
function initSetup(vm, props) {
if (props === void 0) { props = {}; }
var setup = vm.$options.setup;
var ctx = createSetupContext(vm);
var binding;
var preVm = getCurrentVM();
setCurrentVM(vm);
var ctx = createContext(vm);
try {
binding = setup(vm.$props || {}, ctx);
binding = setup(props, ctx);
}
catch (err) {
{
Vue.util.warn("there is an error occuring in \"setup\"", vm);
}
console.log(err);
logError(err, vm, 'setup()');
}
finally {
setCurrentVM(null);
setCurrentVM(preVm);
}

@@ -347,48 +541,51 @@ if (!binding)

var bindingValue = binding[name];
if (isWrapper(bindingValue)) {
bindingValue.setVmProperty(vm, name);
// make plain value reactive
if (!isWrapper(bindingValue)) {
bindingValue = value(bindingValue);
}
else {
vm[name] = bindingValue;
}
// bind to vm
bindingValue.setVmProperty(vm, name);
});
}
function createContext(vm) {
function createSetupContext(vm) {
var ctx = {};
var props = [
// 'el', // has workaround
// 'options',
'root',
'parent',
'root',
// 'children', // very likely
'refs',
'slots',
// 'scopedSlots', // has workaround
// 'isServer',
// 'ssrContext',
// 'vnode',
['slots', 'scopedSlots'],
'attrs',
];
var methodWithoutReturn = [
// 'on', // very likely
// 'once', // very likely
// 'off', // very likely
'emit',
];
var methodReturnVoid = ['emit'];
props.forEach(function (key) {
proxy(ctx, key, function () { return vm["$" + key]; }, function () {
Vue.util.warn("Cannot assign to '" + key + "' because it is a read-only property", vm);
var _a;
var targetKey;
var srcKey;
if (Array.isArray(key)) {
_a = __read(key, 2), targetKey = _a[0], srcKey = _a[1];
}
else {
targetKey = srcKey = key;
}
srcKey = "$" + srcKey;
proxy(ctx, targetKey, {
get: function () { return vm[srcKey]; },
set: function () {
warn("Cannot assign to '" + targetKey + "' because it is a read-only property", vm);
},
});
});
methodWithoutReturn.forEach(function (key) {
return proxy(ctx, key, function () {
var vmKey = "$" + key;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var fn = vm[vmKey];
fn.apply(vm, args);
};
methodReturnVoid.forEach(function (key) {
var srcKey = "$" + key;
proxy(ctx, key, {
get: function () {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var fn = vm[srcKey];
fn.apply(vm, args);
};
},
});

@@ -404,25 +601,19 @@ });

function upWrapping(obj) {
if (!obj) {
return obj;
function ensureCurrentVMInFn(hook) {
var vm = getCurrentVM();
{
assert(vm, "\"" + hook + "\" get called outside of \"setup()\"");
}
var keys = Object.keys(obj);
for (var index = 0; index < keys.length; index++) {
var key = keys[index];
var value_1 = obj[key];
if (isWrapper(value_1)) {
obj[key] = value_1.value;
}
else if (isPlainObject(value_1) || isArray(value_1)) {
obj[key] = upWrapping(value_1);
}
}
return obj;
return vm;
}
function state(value) {
return observable(isArray(value) || isPlainObject(value) ? upWrapping(value) : value);
function compoundComputed(computed) {
var Vue = getCurrentVue();
var silent = Vue.config.silent;
Vue.config.silent = true;
var reactive = new Vue({
computed: computed,
});
Vue.config.silent = silent;
return reactive;
}
function value(value) {
return new ValueWrapper(observable({ $$state: isArray(value) || isPlainObject(value) ? upWrapping(value) : value }));
}

@@ -433,3 +624,3 @@ var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); };

var vm = ensureCurrentVMInFn(genName(lifeCyclehook));
vm.$on("hook:" + lifeCyclehook, callback);
injectHookOption(getCurrentVue(), vm, lifeCyclehook, callback);
};

@@ -439,6 +630,14 @@ }

return function (callback) {
var currentVue = getCurrentVue();
var vm = ensureCurrentVMInFn(name);
lifeCyclehooks.forEach(function (lifeCyclehook) { return vm.$on("hook:" + lifeCyclehook, callback); });
lifeCyclehooks.forEach(function (lifeCyclehook) {
return injectHookOption(currentVue, vm, lifeCyclehook, callback);
});
};
}
function injectHookOption(Vue, vm, hook, val) {
var options = vm.$options;
var mergeFn = Vue.config.optionMergeStrategies[hook];
options[hook] = mergeFn(options[hook], val);
}
var onCreated = createLifeCycle('created');

@@ -457,8 +656,2 @@ var onBeforeMount = createLifeCycle('beforeMount');

function createSymbol(name) {
return hasSymbol ? Symbol.for(name) : name;
}
var WatcherPreFlushQueueKey = createSymbol('vfa.key.preFlushQueue');
var WatcherPostFlushQueueKey = createSymbol('vfa.key.postFlushQueue');
var initValue = {};

@@ -655,2 +848,3 @@ var fallbackVM;

var UNRESOLVED_INJECT = {};
function resolveInject(provideKey, vm) {

@@ -666,20 +860,37 @@ var source = vm;

}
{
getCurrentVue().util.warn("Injection \"" + String(provideKey) + "\" not found", vm);
}
return UNRESOLVED_INJECT;
}
function provide(provideOption) {
if (!provideOption) {
return;
function provide(keyOrData, value) {
var vm = ensureCurrentVMInFn('provide');
if (!vm._provided) {
vm._provided = {};
}
var vm = ensureCurrentVMInFn('provide');
vm._provided =
typeof provideOption === 'function' ? provideOption.call(vm) : provideOption;
if (isObject(keyOrData)) {
Object.assign(vm._provided, keyOrData);
}
else {
vm._provided[keyOrData] = value;
}
}
function inject(injectKey) {
if (!injectKey) {
function inject(key) {
if (!key) {
return;
}
var vm = ensureCurrentVMInFn('inject');
return resolveInject(injectKey, vm);
var val = resolveInject(key, vm);
if (val !== UNRESOLVED_INJECT) {
if (isWrapper(val)) {
return val;
}
var reactiveVal_1 = state(val);
return new ComputedWrapper({
read: function () { return reactiveVal_1; },
write: function () {
warn("The injectd value can't be re-assigned", vm);
},
});
}
else {
warn("Injection \"" + String(key) + "\" not found", vm);
}
}

@@ -713,2 +924,3 @@

exports.provide = provide;
exports.set = set;
exports.state = state;

@@ -715,0 +927,0 @@ exports.value = value;

@@ -1,1 +0,1 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).vueFunctionApi={})}(this,function(n){"use strict";var t=function(n){return Object.prototype.toString.call(n)},e="function"==typeof Symbol&&Symbol.for,o=function(n){return n},r={enumerable:!0,configurable:!0,get:o,set:o};function u(n,t,e,u){r.get=e,r.set=u||o,Object.defineProperty(n,t,r)}var i=Object.prototype.hasOwnProperty;function c(n,t){return i.call(n,t)}function f(n){return"[object Array]"===t(n)}function a(n){return"[object Object]"===t(n)}var s=null,l=null;function p(){return s}function d(){return l}function v(n){l=n}var y=function(){function n(){}return n.prototype.setVmProperty=function(n,t){var e=this;this._vm=n,this._propName=t;n.$options.props,n.$options.methods,n.$options.computed,p().util.warn;t in n||u(n,t,function(){return e.value},function(n){e.value=n})},n}(),h=function(n,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)t.hasOwnProperty(e)&&(n[e]=t[e])})(n,t)};function b(n,t){function e(){this.constructor=n}h(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}var g=function(){return(g=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}).apply(this,arguments)},$=function(n){function t(t){var e=n.call(this)||this;return e._internal=t,e}return b(t,n),Object.defineProperty(t.prototype,"value",{get:function(){return this._internal.$$state},set:function(n){this._internal.$$state=n},enumerable:!0,configurable:!0}),t.prototype.exposeToDevtool=function(){},t}(y),w=function(n){function t(t){var e=n.call(this)||this;return e._internal=t,e}return b(t,n),Object.defineProperty(t.prototype,"value",{get:function(){return this._internal.read()},set:function(n){this._internal.write&&this._internal.write(n)},enumerable:!0,configurable:!0}),t.prototype.exposeToDevtool=function(){},t}(y);function _(n){return n instanceof y}function m(n){return d()}function j(n){var t=p();if(t.observable)return t.observable(n);var e=t.config.silent;t.config.silent=!0;var o=new t({data:{$$state:n}});return t.config.silent=e,o._data.$$state}function O(n,t){s&&s===n||(n.config.optionMergeStrategies.setup=function(n,t){return function(o,r){return function n(t,o){if(!o)return t;for(var r,u,i,f=e?Reflect.ownKeys(o):Object.keys(o),s=0;s<f.length;s++)"__ob__"!==(r=f[s])&&(u=t[r],i=o[r],c(t,r)?u!==i&&a(u)&&!_(u)&&a(i)&&!_(u)&&n(u,i):t[r]=i);return t}("function"==typeof t&&t(o,r)||{},"function"==typeof n&&n(o,r)||{})}},s=n,t(n))}function k(n){n.mixin({created:function(){var t,e=this,o=e.$options.setup;if(!o)return;if("function"!=typeof o)return;v(e);var r=function(t){var e={};return["parent","root","refs","slots","attrs"].forEach(function(o){u(e,o,function(){return t["$"+o]},function(){n.util.warn("Cannot assign to '"+o+"' because it is a read-only property",t)})}),["emit"].forEach(function(n){return u(e,n,function(){var e="$"+n;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t[e].apply(t,n)}})}),e}(e);try{t=o(e.$props||{},r)}catch(n){console.log(n)}finally{v(null)}if(!t)return;if(!a(t))return;Object.keys(t).forEach(function(n){var o=t[n];_(o)?o.setVmProperty(e,n):e[n]=o})}})}function P(n){if(!n)return n;for(var t=Object.keys(n),e=0;e<t.length;e++){var o=t[e],r=n[o];_(r)?n[o]=r.value:(a(r)||f(r))&&(n[o]=P(r))}return n}var x=function(n){return"on"+(n[0].toUpperCase()+n.slice(1))};function E(n){return function(t){m(x(n)).$on("hook:"+n,t)}}var V,S=E("created"),C=E("beforeMount"),D=E("mounted"),U=E("beforeUpdate"),z=E("updated"),M=E("activated"),A=E("deactivated"),T=E("beforeDestroy"),B=E("destroyed"),F=E("errorCaptured"),H=(V=["destroyed","deactivated"],x("unmounted"),function(n){var t=m();V.forEach(function(e){return t.$on("hook:"+e,n)})});function Q(n){return e?Symbol.for(n):n}var K,N=Q("vfa.key.preFlushQueue"),R=Q("vfa.key.postFlushQueue"),q={};function G(n){return function(){I(this,n)}}function I(n,t){for(var e=n[t],o=0;o<e.length;o++)e[o]();e.length=0}function J(n,t,e){function o(){n.$nextTick(function(){n[N].length&&I(n,N),n[R].length&&I(n,R)})}switch(e){case"pre":o(),n[N].push(t);break;case"post":o(),n[R].push(t);break;case"sync":t();break;default:!function(n,t){if(!n)throw new Error("[vue-function-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+e)}}var L=function(n){return O(n,k)},W={install:L};s&&"undefined"!=typeof window&&window.Vue&&L(window.Vue),n.computed=function(n,t){var e=function(n){var t=p(),e=t.config.silent;t.config.silent=!0;var o=new t({computed:n});return t.config.silent=e,o}({$$state:{get:n,set:t}});return new w(g({read:function(){return e.$$state}},t&&{write:function(n){e.$$state=n}}))},n.createComponent=function(n){return n},n.inject=function(n){if(n)return function(n,t){for(var e=t;e;){if(e._provided&&c(e._provided,n))return e._provided[n];e=e.$parent}}(n,m())},n.onActivated=M,n.onBeforeDestroy=T,n.onBeforeMount=C,n.onBeforeUpdate=U,n.onCreated=S,n.onDeactivated=A,n.onDestroyed=B,n.onErrorCaptured=F,n.onMounted=D,n.onUnmounted=H,n.onUpdated=z,n.plugin=W,n.provide=function(n){if(n){var t=m();t._provided="function"==typeof n?n.call(t):n}},n.state=function(n){return j(f(n)||a(n)?P(n):n)},n.value=function(n){return new $(j({$$state:f(n)||a(n)?P(n):n}))},n.watch=function(n,t,e){void 0===e&&(e={});var o=g({lazy:!1,deep:!1,flush:"post"},e),r=d();if(!r){if(!K){var u=p(),i=u.config.silent;u.config.silent=!0,K=new u,u.config.silent=i}r=K,o.flush="sync"}return function(n){return void 0!==n[N]}(r)||function(n){n[N]=[],n[R]=[],n.$on("hook:beforeUpdate",G(N)),n.$on("hook:updated",G(R))}(r),f(n)?function(n,t,e,o){var r=!o.lazy&&t.length,u=!1,i=[];function c(){e.apply(n,i.reduce(function(n,t){return n[0].push(t.value===q?t.getter():t.value),n[1].push(t.oldValue===q?void 0:t.oldValue),n},[[],[]]))}var f=function(){!1!==r?0==--r&&(r=!1,f=a,c()):(f=a,a())},a=function(){u||(u=!0,n.$nextTick(function(){J(n,function(){u=!1,c()},o.flush)}))};return t.forEach(function(t){var e,r={getter:e=_(t)?function(){return t.value}:t,value:q,oldValue:q};i.push(r),r.watcherStopHandle=n.$watch(e,function(n,t){r.value=n,r.oldValue=t,f()},{immediate:!o.lazy,deep:o.deep,sync:!0})}),function(){i.forEach(function(n){return n.watcherStopHandle()})}}(r,n,t,o):function(n,t,e,o){var r;r=_(t)?function(){return t.value}:t;var u=function(n,t){u=i,o.lazy?i(n,t):e(n,t)},i=function(t,r){J(n,function(){e(t,r)},o.flush)};return n.$watch(r,function(n,t){u(n,t)},{immediate:!o.lazy,deep:o.deep,sync:"sync"===o.flush})}(r,n,t,o)},Object.defineProperty(n,"__esModule",{value:!0})});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((t=t||self).vueFunctionApi={},t.Vue)}(this,function(t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var e=function(t){return Object.prototype.toString.call(t)},r="function"==typeof Symbol&&Symbol.for,o=function(t){return t},i={enumerable:!0,configurable:!0,get:o,set:o};function u(t,n,e){var r=e.get,u=e.set;i.get=r||o,i.set=u||o,Object.defineProperty(t,n,i)}function f(t,n,e,r){Object.defineProperty(t,n,{value:e,enumerable:!!r,writable:!0,configurable:!0})}var a=Object.prototype.hasOwnProperty;function c(t,n){return a.call(t,n)}function l(t){return Array.isArray(t)}function s(t){return null!==t&&"object"==typeof t}function p(t){return"[object Object]"===e(t)}function v(t,e){n.util.warn(t,e)}var d=null,y=null;function h(){return d}function b(){return y}function g(t){y=t}var w=function(){function t(){}return t.prototype.setVmProperty=function(t,n){var e=this;f(this,"_vm",t),f(this,"_propName",n);var r=t.$options.props;n in t||r&&c(r,n)||u(t,n,{get:function(){return e.value},set:function(t){e.value=t}})},t}(),_=function(t,n){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function m(t,n){function e(){this.constructor=t}_(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var $=function(){return($=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};var O=function(t){function n(n){var e=t.call(this)||this;return f(e,"_internal",n),e}return m(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this._internal.$$state},set:function(t){this._internal.$$state=t},enumerable:!0,configurable:!0}),n.prototype.exposeToDevtool=function(){},n}(w),j=function(t){function n(n){var e=t.call(this)||this;return f(e,"_internal",n),e}return m(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this._internal.read()},set:function(t){this._internal.write&&this._internal.write(t)},enumerable:!0,configurable:!0}),n.prototype.exposeToDevtool=function(){},n}(w);function k(t){return t instanceof w}function P(t,n){d&&d===t||(t.config.optionMergeStrategies.setup=function(t,n){return function(e,o){return function t(n,e){if(!e)return n;for(var o,i,u,f=r?Reflect.ownKeys(e):Object.keys(e),a=0;a<f.length;a++)"__ob__"!==(o=f[a])&&(i=n[o],u=e[o],c(n,o)?i!==u&&p(i)&&!k(i)&&p(u)&&!k(i)&&t(i,u):n[o]=u);return n}("function"==typeof n&&n(e,o)||{},"function"==typeof t&&t(e,o)||{})}},d=t,n(t))}function x(t){return r?Symbol.for(t):t}var S=x("vfa.key.preFlushQueue"),E=x("vfa.key.postFlushQueue"),V=x("vfa.key.accessControIdentifier"),C=x("vfa.key.observableIdentifier"),M={},A={};function D(t){if(s(t)&&!k(t)&&(!c(t,V)||t[V]!==M)){Object.isExtensible(t)&&f(t,V,M);for(var n=Object.keys(t),e=0;e<n.length;e++)U(t,n[e])}}function U(t,n,e){var r,o,i=Object.getOwnPropertyDescriptor(t,n);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,e=t[n]}D(e),Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:function(){var n=r?r.call(t):e;return k(n)?n.value:n},set:function(n){if(!r||o){var i=r?r.call(t):e;k(i)?k(n)?e=n:i.value=n:o?o.call(t,n):k(n)&&(e=n),D(n)}}})}function z(t){if(!s(t)||function(t){return c(t,C)&&t[C]===A}(t))return t;var n,e=h();if(e.observable)n=e.observable(t);else{var r=e.config.silent;e.config.silent=!0;var o=new e({data:{$$state:t}});e.config.silent=r,n=o._data.$$state}return Object.isExtensible(n)&&f(n,C,A),D(n),n}function F(t){return z(t)}function T(t){return new O(F({$$state:t}))}function B(t){t.mixin({beforeCreate:function(){var t=this,n=t.$options,e=n.setup;if(!e)return;if("function"!=typeof e)return;var r=n.data;n.data=function(){return function(t,n){void 0===n&&(n={});var e,r=t.$options.setup,o=function(t){var n={};return["root","parent","refs",["slots","scopedSlots"],"attrs"].forEach(function(e){var r,o,i;Array.isArray(e)?(r=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u}(e,2),o=r[0],i=r[1]):o=i=e,i="$"+i,u(n,o,{get:function(){return t[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",t)}})}),["emit"].forEach(function(e){var r="$"+e;u(n,e,{get:function(){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];t[r].apply(t,n)}}})}),n}(t),i=b();g(t);try{e=r(n,o)}catch(t){!function(t,n,e){if("undefined"==typeof window||"undefined"==typeof console)throw t;console.error(t)}(t)}finally{g(i)}if(!e)return;if(!p(e))return;Object.keys(e).forEach(function(n){var r=e[n];k(r)||(r=T(r)),r.setVmProperty(t,n)})}(t,t.$props),"function"==typeof r?r.call(t,t):r||{}}}})}function H(t){return b()}var I=function(t){return"on"+(t[0].toUpperCase()+t.slice(1))};function Q(t){return function(n){var e=H(I(t));R(h(),e,t,n)}}function R(t,n,e,r){var o=n.$options,i=t.config.optionMergeStrategies[e];o[e]=i(o[e],r)}var q,K,N=Q("created"),G=Q("beforeMount"),J=Q("mounted"),L=Q("beforeUpdate"),W=Q("updated"),X=Q("activated"),Y=Q("deactivated"),Z=Q("beforeDestroy"),tt=Q("destroyed"),nt=Q("errorCaptured"),et=(q=["destroyed","deactivated"],I("unmounted"),function(t){var n=h(),e=H();q.forEach(function(r){return R(n,e,r,t)})}),rt={};function ot(t){return function(){it(this,t)}}function it(t,n){for(var e=t[n],r=0;r<e.length;r++)e[r]();e.length=0}function ut(t,n,e){function r(){t.$nextTick(function(){t[S].length&&it(t,S),t[E].length&&it(t,E)})}switch(e){case"pre":r(),t[S].push(n);break;case"post":r(),t[E].push(n);break;case"sync":n();break;default:!function(t,n){if(!t)throw new Error("[vue-function-api] "+n)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+e)}}var ft={};var at=function(t){return P(t,B)},ct={install:at};d&&"undefined"!=typeof window&&window.Vue&&at(window.Vue),t.computed=function(t,n){var e=function(t){var n=h(),e=n.config.silent;n.config.silent=!0;var r=new n({computed:t});return n.config.silent=e,r}({$$state:{get:t,set:n}});return new j($({read:function(){return e.$$state}},n&&{write:function(t){e.$$state=t}}))},t.createComponent=function(t){return t},t.inject=function(t){if(t){var n=H(),e=function(t,n){for(var e=n;e;){if(e._provided&&c(e._provided,t))return e._provided[t];e=e.$parent}return ft}(t,n);if(e!==ft){if(k(e))return e;var r=F(e);return new j({read:function(){return r},write:function(){v("The injectd value can't be re-assigned",n)}})}}},t.onActivated=X,t.onBeforeDestroy=Z,t.onBeforeMount=G,t.onBeforeUpdate=L,t.onCreated=N,t.onDeactivated=Y,t.onDestroyed=tt,t.onErrorCaptured=nt,t.onMounted=J,t.onUnmounted=et,t.onUpdated=W,t.plugin=ct,t.provide=function(t,n){var e=H();e._provided||(e._provided={}),s(t)?Object.assign(e._provided,t):e._provided[t]=n},t.set=function(t,n,e){var r=h().util,o=(r.warn,r.defineReactive);if(l(t)&&function(t){var n=parseFloat(String(t));return n>=0&&Math.floor(n)===n&&isFinite(t)}(n))return t.length=Math.max(t.length,n),U(t,n,e),t.splice(n,1,e),e;if(n in t&&!(n in Object.prototype))return t[n]=e,e;var i=t.__ob__;return t._isVue||i&&i.vmCount?e:i?(o(i.value,n,e),U(t,n,e),i.dep.notify(),e):(t[n]=e,e)},t.state=F,t.value=T,t.watch=function(t,n,e){void 0===e&&(e={});var r=$({lazy:!1,deep:!1,flush:"post"},e),o=b();if(!o){if(!K){var i=h(),u=i.config.silent;i.config.silent=!0,K=new i,i.config.silent=u}o=K,r.flush="sync"}return function(t){return void 0!==t[S]}(o)||function(t){t[S]=[],t[E]=[],t.$on("hook:beforeUpdate",ot(S)),t.$on("hook:updated",ot(E))}(o),l(t)?function(t,n,e,r){var o=!r.lazy&&n.length,i=!1,u=[];function f(){e.apply(t,u.reduce(function(t,n){return t[0].push(n.value===rt?n.getter():n.value),t[1].push(n.oldValue===rt?void 0:n.oldValue),t},[[],[]]))}var a=function(){!1!==o?0==--o&&(o=!1,a=c,f()):(a=c,c())},c=function(){i||(i=!0,t.$nextTick(function(){ut(t,function(){i=!1,f()},r.flush)}))};return n.forEach(function(n){var e,o={getter:e=k(n)?function(){return n.value}:n,value:rt,oldValue:rt};u.push(o),o.watcherStopHandle=t.$watch(e,function(t,n){o.value=t,o.oldValue=n,a()},{immediate:!r.lazy,deep:r.deep,sync:!0})}),function(){u.forEach(function(t){return t.watcherStopHandle()})}}(o,t,n,r):function(t,n,e,r){var o;o=k(n)?function(){return n.value}:n;var i=function(t,n){i=u,r.lazy?u(t,n):e(t,n)},u=function(n,o){ut(t,function(){e(n,o)},r.flush)};return t.$watch(o,function(t,n){i(t,n)},{immediate:!r.lazy,deep:r.deep,sync:"sync"===r.flush})}(o,t,n,r)},Object.defineProperty(t,"__esModule",{value:!0})});

@@ -8,3 +8,3 @@ import AbstractWrapper from './AbstractWrapper';

private _internal;
constructor(_internal: ComputedInternal<V>);
constructor(internal: ComputedInternal<V>);
value: V;

@@ -11,0 +11,0 @@ exposeToDevtool(): void;

@@ -7,2 +7,3 @@ import AbstractWrapper from './AbstractWrapper';

}
export declare function isWrapper<T>(obj: any): obj is AbstractWrapper<T>;
export { ValueWrapper, ComputedWrapper, AbstractWrapper };

@@ -7,3 +7,3 @@ import AbstractWrapper from './AbstractWrapper';

private _internal;
constructor(_internal: ValueInternal<V>);
constructor(internal: ValueInternal<V>);
value: V;

@@ -10,0 +10,0 @@ exposeToDevtool(): void;

{
"name": "vue-function-api",
"version": "2.0.6",
"version": "2.1.1",
"description": "Provide logic composition capabilities for Vue.",

@@ -13,3 +13,6 @@ "keywords": [

"typings": "dist/index.d.ts",
"author": "liximomo",
"author": {
"name": "liximomo",
"email": "liximomo@gmail.com"
},
"license": "MIT",

@@ -35,3 +38,6 @@ "sideEffects": false,

"cross-env": "^5.2.0",
"husky": "^2.7.0",
"jest": "^24.8.0",
"lint-staged": "^8.2.1",
"prettier": "^1.18.2",
"rollup": "^1.12.0",

@@ -42,6 +48,8 @@ "rollup-plugin-node-resolve": "^5.0.0",

"rollup-plugin-typescript2": "^0.21.0",
"typescript": "^3.4.5"
"ts-jest": "^24.0.2",
"typescript": "^3.4.5",
"vue": "^2.5.22"
},
"peerDependencies": {
"vue": "^2.0.0"
"vue": "^2.5.22"
},

@@ -51,2 +59,17 @@ "dependencies": {

},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"prettier --write",
"git add"
],
"*.ts": [
"prettier --parser=typescript --write",
"git add"
]
},
"jest": {

@@ -61,9 +84,12 @@ "verbose": true,

],
"transform": {
"^.+\\.[jt]s$": "<rootDir>/test/tsTransform.js"
},
"testMatch": [
"<rootDir>/test/**/*.spec.js"
]
"<rootDir>/test/**/*.spec.{js,ts}"
],
"preset": "ts-jest"
},
"prettier": {
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5"
}
}

@@ -5,3 +5,3 @@ # Vue Function API

Future-Oriented Programming, `vue-function-api` provides function api from `Vue3.x` to `Vue2.x` for developing next-generation Vue applications.
`vue-function-api` provides a way to use **function api** from `Vue3` in `Vue2.x`.

@@ -285,3 +285,3 @@ [**中文文档**](./README.zh-CN.md)

## provide, inject
▸ **provide**(value: *`Object`*)
▸ **provide**(key: *`string` | `symbol`*, value: *`any`*)

@@ -303,5 +303,3 @@ ▸ **inject**(key: *`string` | `symbol`*)

const count = value(0)
provide({
[CountSymbol]: count
})
provide(CountSymbol, count)
}

@@ -347,7 +345,5 @@ }

- `vue-function-api` will keep updated with `Vue3.x` API. When `3.0` released, you can replace this library seamlessly.
- `vue-function-api` only relies on `Vue2.x` itself. Wheather `Vue3.x` is released or not, it's not affect you using this library.
- Due the the limitation of `Vue2.x`'s public API. `vue-function-api` inevitably introduce some extract workload. It doesn't concern you if you are now working on extreme environment.
- Due the the limitation of `Vue2.x`'s public API. `vue-function-api` inevitably introduces some extra workload. This shouldn't concern you unless are already pushing your environment to the extreme.
[wrapper]: https://github.com/vuejs/rfcs/blob/function-apis/active-rfcs/0000-function-api.md#why-do-we-need-value-wrappers

@@ -5,3 +5,3 @@ # Vue Function API

面向未来编程(Future-Oriented Programming),`vue-function-api` 提供 Vue3 中的组件逻辑复用机制帮助开发者开发下一代 vue 应用程序,允许开发者利用 Vue3 的响应性 API 建设未来 Vue 生态。
`vue-function-api` 使开发者们可以在 `Vue2.x` 中使用 `Vue3` 引入的**基于函数**的**逻辑复用机制**。

@@ -288,3 +288,3 @@ [**English Version**](./README.md)

## provide, inject
▸ **provide**(value: *`Object`*)
▸ **provide**(key: *`string` | `symbol`*, value: *`any`*)

@@ -306,5 +306,3 @@ ▸ **inject**(key: *`string` | `symbol`*)

const count = value(0)
provide({
[CountSymbol]: count
})
provide(CountSymbol, count)
}

@@ -411,4 +409,2 @@ }

- `vue-function-api` 会一直保持与 `Vue3.x` 的兼容性,当 `3.0` 发布时,您可以无缝替换掉本库。
- `vue-function-api` 的实现只依赖 `Vue2.x` 本身,不伦 `Vue3.x` 的发布与否,都不会影响您正常使用本库。
- 由于 `Vue2.x` 的公共 API 限制,`vue-function-api` 无法避免的会产生一些额外的内存负载。如果您的应用并不工作在极端内存环境下,无需关心此项。
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc