@vue/composition-api
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
@@ -0,1 +1,11 @@ | ||
<a name="1.0.0-beta.6"></a> | ||
# [1.0.0-beta.6](https://github.com/vuejs/composition-api/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2020-07-22) | ||
### Features | ||
* **shallowReadonly:** add shallowReadonly and set computed to be shallowReadonly ([#447](https://github.com/vuejs/composition-api/issues/447)) ([cfbbcec](https://github.com/vuejs/composition-api/commit/cfbbcec)) | ||
<a name="1.0.0-beta.5"></a> | ||
@@ -2,0 +12,0 @@ # [1.0.0-beta.5](https://github.com/vuejs/composition-api/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2020-07-20) |
@@ -231,2 +231,3 @@ import Vue$1, { VueConstructor, ComponentOptions, VNode, CreateElement } from 'vue'; | ||
declare function isReadonly(obj: any): boolean; | ||
declare function isReactive(obj: any): boolean; | ||
@@ -239,2 +240,3 @@ declare function shallowReactive<T extends object = any>(obj: T): T; | ||
declare function reactive<T extends object>(obj: T): UnwrapRef<T>; | ||
declare function shallowReadonly<T extends object>(obj: T): Readonly<T>; | ||
/** | ||
@@ -326,2 +328,2 @@ * Make sure obj can't be a reactive | ||
export default Plugin; | ||
export { ComponentRenderProxy, ComputedRef, FlushMode, InjectionKey, PropOptions, PropType, Ref, SetupContext, UnwrapRef, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedRef, computed, createApp, customRef, defineComponent, getCurrentInstance, createElement as h, inject, isReactive, isRef, markRaw, markReactive, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useCSSModule, watch, watchEffect }; | ||
export { ComponentRenderProxy, ComputedRef, FlushMode, InjectionKey, PropOptions, PropType, Ref, SetupContext, UnwrapRef, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedRef, computed, createApp, customRef, defineComponent, getCurrentInstance, createElement as h, inject, isReactive, isReadonly, isRef, markRaw, markReactive, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useCSSModule, watch, watchEffect }; |
@@ -230,2 +230,3 @@ 'use strict'; | ||
var RawIdentifierKey = createSymbol('composition-api.rawIdentifierKey'); | ||
var ReadonlyIdentifierKey = createSymbol('composition-api.readonlyIdentifierKey'); | ||
// must be a string, symbol key is ignored in reactive | ||
@@ -244,7 +245,13 @@ var RefKey = 'composition-api.refKey'; | ||
}()); | ||
function createRef(options) { | ||
function createRef(options, readonly) { | ||
if (readonly === void 0) { readonly = false; } | ||
var r = new RefImpl(options); | ||
if (readonly) { | ||
//@ts-ignore | ||
r[ReadonlyIdentifierKey] = readonly; | ||
} | ||
// seal the ref, this could prevent ref from being observed | ||
// It's safe to seal the ref, since we really shouldn't extend it. | ||
// related issues: #79 | ||
return Object.seal(new RefImpl(options)); | ||
return Object.seal(r); | ||
} | ||
@@ -318,2 +325,5 @@ function ref(raw) { | ||
} | ||
function isReadonly(obj) { | ||
return hasOwn(obj, ReadonlyIdentifierKey) && obj[ReadonlyIdentifierKey]; | ||
} | ||
function isReactive(obj) { | ||
@@ -535,2 +545,60 @@ return (isObject(obj) && | ||
} | ||
function shallowReadonly(obj) { | ||
var _a, e_2, _b; | ||
if (!isPlainObject(obj) || !Object.isExtensible(obj)) { | ||
//@ts-ignore | ||
return obj; // just typing | ||
} | ||
var readonlyObj = (_a = {}, | ||
_a[ReadonlyIdentifierKey] = true, | ||
_a); | ||
var source = reactive({}); | ||
var ob = source.__ob__; | ||
var _loop_2 = function (key) { | ||
var val = obj[key]; | ||
var getter; | ||
var setter = void 0; | ||
var property = Object.getOwnPropertyDescriptor(obj, key); | ||
if (property) { | ||
if (property.configurable === false) { | ||
return "continue"; | ||
} | ||
getter = property.get; | ||
setter = property.set; | ||
if ((!getter || setter) /* not only have getter */ && | ||
arguments_2.length === 2) { | ||
val = obj[key]; | ||
} | ||
} | ||
Object.defineProperty(readonlyObj, key, { | ||
enumerable: true, | ||
configurable: true, | ||
get: function getterHandler() { | ||
var value = getter ? getter.call(obj) : val; | ||
ob.dep.depend(); | ||
return value; | ||
}, | ||
set: function (v) { | ||
{ | ||
warn("Set operation on key \"" + key + "\" failed: target is readonly."); | ||
} | ||
}, | ||
}); | ||
}; | ||
var arguments_2 = arguments; | ||
try { | ||
for (var _c = __values(Object.keys(obj)), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var key = _d.value; | ||
_loop_2(key); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (_d && !_d.done && (_b = _c.return)) _b.call(_c); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return readonlyObj; | ||
} | ||
/** | ||
@@ -979,3 +1047,3 @@ * Make sure obj can't be a reactive | ||
if ( !set) { | ||
warn('Computed property was assigned to but it has no setter.', vm); | ||
warn('Write operation failed: computed value is readonly.', vm); | ||
return; | ||
@@ -985,3 +1053,3 @@ } | ||
}, | ||
}); | ||
}, !set); | ||
} | ||
@@ -1460,2 +1528,3 @@ | ||
exports.isReactive = isReactive; | ||
exports.isReadonly = isReadonly; | ||
exports.isRef = isRef; | ||
@@ -1480,2 +1549,3 @@ exports.markRaw = markRaw; | ||
exports.shallowReactive = shallowReactive; | ||
exports.shallowReadonly = shallowReadonly; | ||
exports.shallowRef = shallowRef; | ||
@@ -1482,0 +1552,0 @@ exports.toRaw = toRaw; |
@@ -16,2 +16,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("vue"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&n(Symbol)&&"undefined"!=typeof Reflect&&n(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,t,n){var r=n.get,u=n.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,t,i)}function a(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function f(e,t){return Object.hasOwnProperty.call(e,t)}function c(e){return Array.isArray(e)}function s(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function l(e){return"function"==typeof e}function p(e,n){t.util.warn(e,n)}var v=null,d=null;function y(){return v}function b(){return d}function g(e){d=e}function h(e){return b()}function _(e,t){void 0===t&&(t={});var n=e.config.silent;e.config.silent=!0;var r=new e(t);return e.config.silent=n,r}function m(e){var t=y();return t&&e instanceof t}function x(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.$scopedSlots[t]?e.$scopedSlots[t].apply(e,n):p("slots."+t+'() got called outside of the "render()" scope',e)}} | ||
***************************************************************************** */ | ||
var w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function j(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function O(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function $(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(O(arguments[t]));return e}function k(e){return r?Symbol.for(e):e}var S=k("composition-api.preFlushQueue"),E=k("composition-api.postFlushQueue"),R=k("composition-api.accessControlIdentifier"),P=k("composition-api.reactiveIdentifier"),A=k("composition-api.rawIdentifierKey"),C="composition-api.refKey",M=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e){return Object.seal(new M(e))}function I(e){var t;if(B(e))return e;var n=G(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})}function B(e){return e instanceof M}function D(e,t){var n=e[t];return B(n)?n:U({get:function(){return e[t]},set:function(n){return e[t]=n}})}var z={},F={},K={};function T(e){return f(e,A)&&e[A]===K}function V(e){return null!==(t=e)&&"object"==typeof t&&Object.isExtensible(e)&&f(e,P)&&e[P]===F;var t}function Q(e){if(!(!s(e)||T(e)||Array.isArray(e)||B(e)||m(e)||f(e,R)&&e[R]===z)){Object.isExtensible(e)&&a(e,R,z);for(var t=Object.keys(e),n=0;n<t.length;n++)q(e,t[n])}}function q(e,t,n){if("__ob__"!==t){var r,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=e[t])}Q(n),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):n;return t!==C&&B(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):n;t!==C&&B(u)&&!B(i)?u.value=i:o?o.call(e,i):n=i,Q(i)}}})}}function J(e){var t,n=y();n.observable?t=n.observable(e):t=_(n,{data:{$$state:e}})._data.$$state;return t}function N(e){var t,n;if(!s(e)||V(e)||T(e)||!Object.isExtensible(e))return e;var r=J({});W(r,!0),Q(r);var o=r.__ob__,i=function(t){var n,i,a=e[t],f=Object.getOwnPropertyDescriptor(e,t);if(f){if(!1===f.configurable)return"continue";n=f.get,i=f.set,n&&!i||2!==u.length||(a=e[t])}Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):a;return o.dep.depend(),t},set:function(t){n&&!i||(i?i.call(e,t):a=t,o.dep.notify())}})},u=arguments;try{for(var a=j(Object.keys(e)),f=a.next();!f.done;f=a.next()){var c=f.value;i(c)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return r}function W(e,t){if(void 0===t&&(t=!1),!(!s(e)||T(e)||Array.isArray(e)||B(e)||m(e)||f(e,P)&&e[P]===F||(Object.isExtensible(e)&&a(e,P,F),t)))for(var n=Object.keys(e),r=0;r<n.length;r++)W(e[n[r]])}function G(e){if(!s(e)||V(e)||T(e)||!Object.isExtensible(e))return e;var t=J(e);return W(e),Q(t),t}function H(e){return s(e)&&Object.isExtensible(e)?(a(e,"__ob__",J({}).__ob__),a(e,A,K),e):e}function L(e){return function(t){var n,r=h(((n=e)[0].toUpperCase(),n.slice(1)));r&&function(e,t,n,r){var o=t.$options,i=e.config.optionMergeStrategies[n];o[n]=i(o[n],function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=b();g(e);try{return t.apply(void 0,$(n))}finally{g(o)}}}(t,r))}(y(),r,e,t)}}var X,Y=L("beforeMount"),Z=L("mounted"),ee=L("beforeUpdate"),te=L("updated"),ne=L("beforeDestroy"),re=L("destroyed"),oe=L("errorCaptured"),ie=L("activated"),ue=L("deactivated"),ae=L("serverPrefetch");function fe(){le(this,S)}function ce(){le(this,E)}function se(){var e=b();return e?function(e){return void 0!==e[S]}(e)||function(e){e[S]=[],e[E]=[],e.$on("hook:beforeUpdate",fe),e.$on("hook:updated",ce)}(e):(X||(X=_(y())),e=X),e}function le(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function pe(e,t,n){var r=function(){e.$nextTick((function(){e[S].length&&le(e,S),e[E].length&&le(e,E)}))};switch(n){case"pre":r(),e[S].push(t);break;case"post":r(),e[E].push(t);break;default:!function(e,t){if(!e)throw new Error("[vue-composition-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function ve(e,t){var n=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(e,r),t()}}function de(e,t,n,r){var i,u=r.flush,a="sync"===u,f=function(e){i=function(){try{e()}catch(e){!function(e,t,n){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},s=function(t){return a||e===X?t:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return pe(e,(function(){t.apply(void 0,$(n))}),u)}};if(null===n){var v=!1,d=function(e,t,n,r){var o=e._watchers.length;return e.$watch(t,n,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!v)try{v=!0,t(f)}finally{v=!1}}),o,{deep:r.deep||!1,sync:a,before:c});ve(d,c),d.lazy=!1;var y=d.get.bind(d);return d.get=s(y),function(){d.teardown()}}var b,g=r.deep;Array.isArray(t)?b=function(){return t.map((function(e){return B(e)?e.value:e()}))}:B(t)?b=function(){return t.value}:V(t)?(b=function(){return t},g=!0):l(t)?b=t:(b=o,p("Invalid watch source: "+JSON.stringify(t)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var h=function(e,t){c(),n(e,t,f)},_=s(h);if(r.immediate){var m=_,x=function(e,t){x=m,h(e,t)};_=function(e,t){x(e,t)}}var w=e.$watch(b,_,{immediate:r.immediate,deep:g,sync:a});return ve(e._watchers[e._watchers.length-1],c),function(){w()}}var ye={};var be={};var ge;var he={set:function(e,t,n){(e.__composition_api_state__=e.__composition_api_state__||{})[t]=n},get:function(e,t){return(e.__composition_api_state__||{})[t]}};function _e(e){var t=he.get(e,"rawBindings")||{};if(t&&Object.keys(t).length){for(var n=e.$refs,r=he.get(e,"refs")||[],o=0;o<r.length;o++){var i=t[f=r[o]];!n[f]&&i&&B(i)&&(i.value=null)}var u=Object.keys(n),a=[];for(o=0;o<u.length;o++){var f;i=t[f=u[o]];n[f]&&i&&B(i)&&(i.value=n[f],a.push(f))}he.set(e,"refs",a)}}function me(e,t){var n=e.$options._parentVnode;if(n){for(var r=he.get(e,"slots")||[],o=function(e,t){var n;if(e){if(e._normalized)return e._normalized;for(var r in n={},e)e[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in t)r in n||(n[r]=!0);return n}(n.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[a=r[i]]||delete t[a]}var u=Object.keys(o);for(i=0;i<u.length;i++){var a;t[a=u[i]]||(t[a]=x(e,a))}he.set(e,"slots",u)}}function xe(e,t,n){var r=b();g(e);try{return t(e)}catch(e){if(!n)throw e;n(e)}finally{g(r)}}function we(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,n=t.setup,r=t.render;r&&(t.render=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return xe(e,(function(){return r.apply(t,n)}))});if(!n)return;if("function"!=typeof n)return;var o=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var n,r=e.$options.setup,o=function(e){var t={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(n){var r,o,i;Array.isArray(n)?(r=O(n,2),o=r[0],i=r[1]):o=i=n,i="$"+i,u(t,o,{get:function(){return e[i]},set:function(){p("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(n){var r="$"+n;u(t,n,{get:function(){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e[r];o.apply(e,t)}}})})),t}(e);if(W(t),me(e,o.slots),xe(e,(function(){n=r(t,o)})),!n)return;if(l(n)){var i=n;return void(e.$options.render=function(){return me(e,o.slots),xe(e,(function(){return i()}))})}if(s(n)){var a=n;he.set(e,"rawBindings",n),Object.keys(n).forEach((function(t){var n=a[t];if(!B(n))if(V(n))n=I(n);else{l(n)&&(n=n.bind(e));var r=function e(t,n){var r,o;if(void 0===n&&(n=new WeakMap),n.has(t))return n.get(t);if(l(t)||c(t)||V(t)||!s(t)||!Object.isExtensible(t)||B(t)||T(t))return t;var i={};n.set(t,i),Object.getOwnPropertySymbols(t).forEach((function(e){return i[e]=t[e]})),f(t,"__ob__")&&Object.defineProperty(i,"__ob__",{enumerable:!1,value:t.__ob__});var a=function(r){var o=t[r];if(!o||T(o))i[r]=o;else if(B(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,n)};try{for(var p=j(Object.keys(t)),v=p.next();!v.done;v=p.next()){a(v.value)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}return i}(n);W(r),n=I(H(r))}!function(e,t,n){var r=e.$options.props;t in e||r&&f(r,t)||u(e,t,{get:function(){return n.value},set:function(e){n.value=e}})}(e,t,n)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){_e(this)},updated:function(){_e(this)}})}function je(e){v||function(e){return f(e,"__composition_api_installed__")}(e)||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,o){return function e(t,n){if(!t)return n;if(!n)return t;for(var o,i,u,a=r?Reflect.ownKeys(t):Object.keys(t),c=0;c<a.length;c++)"__ob__"!==(o=a[c])&&(i=n[o],u=t[o],f(n,o)?i!==u&&s(i)&&!B(i)&&s(u)&&!B(u)&&e(u,i):n[o]=u);return n}("function"==typeof e?e(n,o)||{}:void 0,"function"==typeof t?t(n,o)||{}:void 0)}},function(e){v=e,Object.defineProperty(e,"__composition_api_installed__",{configurable:!0,writable:!0,value:!0})}(e),we(e))}var Oe={install:function(e){return je(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(Oe),exports.computed=function(e){var t,n,r=b();"function"==typeof e?t=e:(t=e.get,n=e.set);var o=_(y(),{computed:{$$state:{get:t,set:n}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}})},exports.createApp=function(e,t){void 0===t&&(t=void 0);var n=y(),r=void 0;return{config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),directive:n.directive.bind(n),mount:function(o,i){return r||((r=new n(w({propsData:t},e))).$mount(o,i),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}}},exports.customRef=function(e){var t=I(0);return U(e((function(){t.value}),(function(){++t.value})))},exports.default=Oe,exports.defineComponent=function(e){return e},exports.getCurrentInstance=b,exports.h=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=b();return n?n.$createElement.apply(n,e):(p("`createElement()` has been called outside of render function."),ge||(ge=_(y()).$createElement),ge.apply(ge,e))},exports.inject=function(e,t){if(!e)return t;var n=b();if(n){var r=function(e,t){for(var n=t;n;){if(n._provided&&f(n._provided,e))return n._provided[e];n=n.$parent}return ye}(e,n);return r!==ye?r:t}p("inject() can only be used inside setup() or functional components.")},exports.isReactive=V,exports.isRef=B,exports.markRaw=H,exports.markReactive=W,exports.nextTick=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return null===(e=y())||void 0===e?void 0:e.nextTick.apply(this,t)},exports.onActivated=ie,exports.onBeforeMount=Y,exports.onBeforeUnmount=ne,exports.onBeforeUpdate=ee,exports.onDeactivated=ue,exports.onErrorCaptured=oe,exports.onMounted=Z,exports.onServerPrefetch=ae,exports.onUnmounted=re,exports.onUpdated=te,exports.provide=function(e,t){var n=h();if(n){if(!n._provided){var r={};Object.defineProperty(n,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}n._provided[e]=t}},exports.reactive=G,exports.ref=I,exports.set=function(e,t,n){var r=y().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var i=e.__ob__;return e._isVue||i&&i.vmCount?n:i?(o(i.value,t,n),q(e,t,n),W(i.value[t]),i.dep.notify(),n):(e[t]=n,n)},exports.shallowReactive=N,exports.shallowRef=function(e){var t;if(B(e))return e;var n=N(((t={})[C]=e,t));return U({get:function(){return n[C]},set:function(e){return n[C]=e}})},exports.toRaw=function(e){return T(e)||!Object.isExtensible(e)?e:e.__ob__.value||e},exports.toRef=D,exports.toRefs=function(e){if(!s(e))return e;var t={};for(var n in e)t[n]=D(e,n);return t},exports.triggerRef=function(e){B(e)&&(e.value=e.value)},exports.unref=function(e){return B(e)?e.value:e},exports.useCSSModule=function(e){void 0===e&&(e="$style");var t=b();if(!t)return be;var n=t[e];return n||be},exports.watch=function(e,t,n){var r=null;"function"==typeof t?r=t:(n=t,r=null);var o=function(e){return w({immediate:!1,deep:!1,flush:"post"},e)}(n);return de(se(),e,r,o)},exports.watchEffect=function(e,t){var n=function(e){return w({immediate:!0,deep:!1,flush:"post"},e)}(t);return de(se(),e,null,n)}; | ||
var w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function O(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function $(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(j(arguments[t]));return e}function k(e){return r?Symbol.for(e):e}var S=k("composition-api.preFlushQueue"),E=k("composition-api.postFlushQueue"),R=k("composition-api.accessControlIdentifier"),P=k("composition-api.reactiveIdentifier"),A=k("composition-api.rawIdentifierKey"),C=k("composition-api.readonlyIdentifierKey"),M="composition-api.refKey",I=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e,t){void 0===t&&(t=!1);var n=new I(e);return t&&(n[C]=t),Object.seal(n)}function D(e){var t;if(B(e))return e;var n=H(((t={})[M]=e,t));return U({get:function(){return n[M]},set:function(e){return n[M]=e}})}function B(e){return e instanceof I}function K(e,t){var n=e[t];return B(n)?n:U({get:function(){return e[t]},set:function(n){return e[t]=n}})}var z={},F={},T={};function V(e){return f(e,A)&&e[A]===T}function Q(e){return null!==(t=e)&&"object"==typeof t&&Object.isExtensible(e)&&f(e,P)&&e[P]===F;var t}function q(e){if(!(!s(e)||V(e)||Array.isArray(e)||B(e)||m(e)||f(e,R)&&e[R]===z)){Object.isExtensible(e)&&a(e,R,z);for(var t=Object.keys(e),n=0;n<t.length;n++)J(e,t[n])}}function J(e,t,n){if("__ob__"!==t){var r,o,i=Object.getOwnPropertyDescriptor(e,t);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=e[t])}q(n),Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):n;return t!==M&&B(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):n;t!==M&&B(u)&&!B(i)?u.value=i:o?o.call(e,i):n=i,q(i)}}})}}function N(e){var t,n=y();n.observable?t=n.observable(e):t=_(n,{data:{$$state:e}})._data.$$state;return t}function W(e){var t,n;if(!s(e)||Q(e)||V(e)||!Object.isExtensible(e))return e;var r=N({});G(r,!0),q(r);var o=r.__ob__,i=function(t){var n,i,a=e[t],f=Object.getOwnPropertyDescriptor(e,t);if(f){if(!1===f.configurable)return"continue";n=f.get,i=f.set,n&&!i||2!==u.length||(a=e[t])}Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):a;return o.dep.depend(),t},set:function(t){n&&!i||(i?i.call(e,t):a=t,o.dep.notify())}})},u=arguments;try{for(var a=O(Object.keys(e)),f=a.next();!f.done;f=a.next()){var c=f.value;i(c)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return r}function G(e,t){if(void 0===t&&(t=!1),!(!s(e)||V(e)||Array.isArray(e)||B(e)||m(e)||f(e,P)&&e[P]===F||(Object.isExtensible(e)&&a(e,P,F),t)))for(var n=Object.keys(e),r=0;r<n.length;r++)G(e[n[r]])}function H(e){if(!s(e)||Q(e)||V(e)||!Object.isExtensible(e))return e;var t=N(e);return G(e),q(t),t}function L(e){return s(e)&&Object.isExtensible(e)?(a(e,"__ob__",N({}).__ob__),a(e,A,T),e):e}function X(e){return function(t){var n,r=h(((n=e)[0].toUpperCase(),n.slice(1)));r&&function(e,t,n,r){var o=t.$options,i=e.config.optionMergeStrategies[n];o[n]=i(o[n],function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=b();g(e);try{return t.apply(void 0,$(n))}finally{g(o)}}}(t,r))}(y(),r,e,t)}}var Y,Z=X("beforeMount"),ee=X("mounted"),te=X("beforeUpdate"),ne=X("updated"),re=X("beforeDestroy"),oe=X("destroyed"),ie=X("errorCaptured"),ue=X("activated"),ae=X("deactivated"),fe=X("serverPrefetch");function ce(){pe(this,S)}function se(){pe(this,E)}function le(){var e=b();return e?function(e){return void 0!==e[S]}(e)||function(e){e[S]=[],e[E]=[],e.$on("hook:beforeUpdate",ce),e.$on("hook:updated",se)}(e):(Y||(Y=_(y())),e=Y),e}function pe(e,t){for(var n=e[t],r=0;r<n.length;r++)n[r]();n.length=0}function ve(e,t,n){var r=function(){e.$nextTick((function(){e[S].length&&pe(e,S),e[E].length&&pe(e,E)}))};switch(n){case"pre":r(),e[S].push(t);break;case"post":r(),e[E].push(t);break;default:!function(e,t){if(!e)throw new Error("[vue-composition-api] "+t)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+n)}}function de(e,t){var n=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(e,r),t()}}function ye(e,t,n,r){var i,u=r.flush,a="sync"===u,f=function(e){i=function(){try{e()}catch(e){!function(e,t,n){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},s=function(t){return a||e===Y?t:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return ve(e,(function(){t.apply(void 0,$(n))}),u)}};if(null===n){var v=!1,d=function(e,t,n,r){var o=e._watchers.length;return e.$watch(t,n,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!v)try{v=!0,t(f)}finally{v=!1}}),o,{deep:r.deep||!1,sync:a,before:c});de(d,c),d.lazy=!1;var y=d.get.bind(d);return d.get=s(y),function(){d.teardown()}}var b,g=r.deep;Array.isArray(t)?b=function(){return t.map((function(e){return B(e)?e.value:e()}))}:B(t)?b=function(){return t.value}:Q(t)?(b=function(){return t},g=!0):l(t)?b=t:(b=o,p("Invalid watch source: "+JSON.stringify(t)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var h=function(e,t){c(),n(e,t,f)},_=s(h);if(r.immediate){var m=_,x=function(e,t){x=m,h(e,t)};_=function(e,t){x(e,t)}}var w=e.$watch(b,_,{immediate:r.immediate,deep:g,sync:a});return de(e._watchers[e._watchers.length-1],c),function(){w()}}var be={};var ge={};var he;var _e={set:function(e,t,n){(e.__composition_api_state__=e.__composition_api_state__||{})[t]=n},get:function(e,t){return(e.__composition_api_state__||{})[t]}};function me(e){var t=_e.get(e,"rawBindings")||{};if(t&&Object.keys(t).length){for(var n=e.$refs,r=_e.get(e,"refs")||[],o=0;o<r.length;o++){var i=t[f=r[o]];!n[f]&&i&&B(i)&&(i.value=null)}var u=Object.keys(n),a=[];for(o=0;o<u.length;o++){var f;i=t[f=u[o]];n[f]&&i&&B(i)&&(i.value=n[f],a.push(f))}_e.set(e,"refs",a)}}function xe(e,t){var n=e.$options._parentVnode;if(n){for(var r=_e.get(e,"slots")||[],o=function(e,t){var n;if(e){if(e._normalized)return e._normalized;for(var r in n={},e)e[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in t)r in n||(n[r]=!0);return n}(n.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[a=r[i]]||delete t[a]}var u=Object.keys(o);for(i=0;i<u.length;i++){var a;t[a=u[i]]||(t[a]=x(e,a))}_e.set(e,"slots",u)}}function we(e,t,n){var r=b();g(e);try{return t(e)}catch(e){if(!n)throw e;n(e)}finally{g(r)}}function Oe(e){e.mixin({beforeCreate:function(){var e=this,t=e.$options,n=t.setup,r=t.render;r&&(t.render=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return we(e,(function(){return r.apply(t,n)}))});if(!n)return;if("function"!=typeof n)return;var o=t.data;t.data=function(){return function(e,t){void 0===t&&(t={});var n,r=e.$options.setup,o=function(e){var t={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(n){var r,o,i;Array.isArray(n)?(r=j(n,2),o=r[0],i=r[1]):o=i=n,i="$"+i,u(t,o,{get:function(){return e[i]},set:function(){p("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(n){var r="$"+n;u(t,n,{get:function(){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e[r];o.apply(e,t)}}})})),t}(e);if(G(t),xe(e,o.slots),we(e,(function(){n=r(t,o)})),!n)return;if(l(n)){var i=n;return void(e.$options.render=function(){return xe(e,o.slots),we(e,(function(){return i()}))})}if(s(n)){var a=n;_e.set(e,"rawBindings",n),Object.keys(n).forEach((function(t){var n=a[t];if(!B(n))if(Q(n))n=D(n);else{l(n)&&(n=n.bind(e));var r=function e(t,n){var r,o;if(void 0===n&&(n=new WeakMap),n.has(t))return n.get(t);if(l(t)||c(t)||Q(t)||!s(t)||!Object.isExtensible(t)||B(t)||V(t))return t;var i={};n.set(t,i),Object.getOwnPropertySymbols(t).forEach((function(e){return i[e]=t[e]})),f(t,"__ob__")&&Object.defineProperty(i,"__ob__",{enumerable:!1,value:t.__ob__});var a=function(r){var o=t[r];if(!o||V(o))i[r]=o;else if(B(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,n)};try{for(var p=O(Object.keys(t)),v=p.next();!v.done;v=p.next()){a(v.value)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}return i}(n);G(r),n=D(L(r))}!function(e,t,n){var r=e.$options.props;t in e||r&&f(r,t)||u(e,t,{get:function(){return n.value},set:function(e){n.value=e}})}(e,t,n)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){me(this)},updated:function(){me(this)}})}function je(e){v||function(e){return f(e,"__composition_api_installed__")}(e)||(e.config.optionMergeStrategies.setup=function(e,t){return function(n,o){return function e(t,n){if(!t)return n;if(!n)return t;for(var o,i,u,a=r?Reflect.ownKeys(t):Object.keys(t),c=0;c<a.length;c++)"__ob__"!==(o=a[c])&&(i=n[o],u=t[o],f(n,o)?i!==u&&s(i)&&!B(i)&&s(u)&&!B(u)&&e(u,i):n[o]=u);return n}("function"==typeof e?e(n,o)||{}:void 0,"function"==typeof t?t(n,o)||{}:void 0)}},function(e){v=e,Object.defineProperty(e,"__composition_api_installed__",{configurable:!0,writable:!0,value:!0})}(e),Oe(e))}var $e={install:function(e){return je(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use($e),exports.computed=function(e){var t,n,r=b();"function"==typeof e?t=e:(t=e.get,n=e.set);var o=_(y(),{computed:{$$state:{get:t,set:n}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}},!n)},exports.createApp=function(e,t){void 0===t&&(t=void 0);var n=y(),r=void 0;return{config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),directive:n.directive.bind(n),mount:function(o,i){return r||((r=new n(w({propsData:t},e))).$mount(o,i),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}}},exports.customRef=function(e){var t=D(0);return U(e((function(){t.value}),(function(){++t.value})))},exports.default=$e,exports.defineComponent=function(e){return e},exports.getCurrentInstance=b,exports.h=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=b();return n?n.$createElement.apply(n,e):(p("`createElement()` has been called outside of render function."),he||(he=_(y()).$createElement),he.apply(he,e))},exports.inject=function(e,t){if(!e)return t;var n=b();if(n){var r=function(e,t){for(var n=t;n;){if(n._provided&&f(n._provided,e))return n._provided[e];n=n.$parent}return be}(e,n);return r!==be?r:t}p("inject() can only be used inside setup() or functional components.")},exports.isReactive=Q,exports.isReadonly=function(e){return f(e,C)&&e[C]},exports.isRef=B,exports.markRaw=L,exports.markReactive=G,exports.nextTick=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return null===(e=y())||void 0===e?void 0:e.nextTick.apply(this,t)},exports.onActivated=ue,exports.onBeforeMount=Z,exports.onBeforeUnmount=re,exports.onBeforeUpdate=te,exports.onDeactivated=ae,exports.onErrorCaptured=ie,exports.onMounted=ee,exports.onServerPrefetch=fe,exports.onUnmounted=oe,exports.onUpdated=ne,exports.provide=function(e,t){var n=h();if(n){if(!n._provided){var r={};Object.defineProperty(n,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}n._provided[e]=t}},exports.reactive=H,exports.ref=D,exports.set=function(e,t,n){var r=y().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var i=e.__ob__;return e._isVue||i&&i.vmCount?n:i?(o(i.value,t,n),J(e,t,n),G(i.value[t]),i.dep.notify(),n):(e[t]=n,n)},exports.shallowReactive=W,exports.shallowReadonly=function(e){var t,n,r;if(!s(e)||!Object.isExtensible(e))return e;var o=((t={})[C]=!0,t),i=H({}),u=i.__ob__,a=function(t){var n,r=e[t],i=void 0,a=Object.getOwnPropertyDescriptor(e,t);if(a){if(!1===a.configurable)return"continue";n=a.get,i=a.set,n&&!i||2!==f.length||(r=e[t])}Object.defineProperty(o,t,{enumerable:!0,configurable:!0,get:function(){var t=n?n.call(e):r;return u.dep.depend(),t},set:function(e){}})},f=arguments;try{for(var c=O(Object.keys(e)),l=c.next();!l.done;l=c.next()){var p=l.value;a(p)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return o},exports.shallowRef=function(e){var t;if(B(e))return e;var n=W(((t={})[M]=e,t));return U({get:function(){return n[M]},set:function(e){return n[M]=e}})},exports.toRaw=function(e){return V(e)||!Object.isExtensible(e)?e:e.__ob__.value||e},exports.toRef=K,exports.toRefs=function(e){if(!s(e))return e;var t={};for(var n in e)t[n]=K(e,n);return t},exports.triggerRef=function(e){B(e)&&(e.value=e.value)},exports.unref=function(e){return B(e)?e.value:e},exports.useCSSModule=function(e){void 0===e&&(e="$style");var t=b();if(!t)return ge;var n=t[e];return n||ge},exports.watch=function(e,t,n){var r=null;"function"==typeof t?r=t:(n=t,r=null);var o=function(e){return w({immediate:!1,deep:!1,flush:"post"},e)}(n);return ye(le(),e,r,o)},exports.watchEffect=function(e,t){var n=function(e){return w({immediate:!0,deep:!1,flush:"post"},e)}(t);return ye(le(),e,null,n)}; |
@@ -224,2 +224,3 @@ import Vue from 'vue'; | ||
var RawIdentifierKey = createSymbol('composition-api.rawIdentifierKey'); | ||
var ReadonlyIdentifierKey = createSymbol('composition-api.readonlyIdentifierKey'); | ||
// must be a string, symbol key is ignored in reactive | ||
@@ -238,7 +239,13 @@ var RefKey = 'composition-api.refKey'; | ||
}()); | ||
function createRef(options) { | ||
function createRef(options, readonly) { | ||
if (readonly === void 0) { readonly = false; } | ||
var r = new RefImpl(options); | ||
if (readonly) { | ||
//@ts-ignore | ||
r[ReadonlyIdentifierKey] = readonly; | ||
} | ||
// seal the ref, this could prevent ref from being observed | ||
// It's safe to seal the ref, since we really shouldn't extend it. | ||
// related issues: #79 | ||
return Object.seal(new RefImpl(options)); | ||
return Object.seal(r); | ||
} | ||
@@ -312,2 +319,5 @@ function ref(raw) { | ||
} | ||
function isReadonly(obj) { | ||
return hasOwn(obj, ReadonlyIdentifierKey) && obj[ReadonlyIdentifierKey]; | ||
} | ||
function isReactive(obj) { | ||
@@ -529,2 +539,60 @@ return (isObject(obj) && | ||
} | ||
function shallowReadonly(obj) { | ||
var _a, e_2, _b; | ||
if (!isPlainObject(obj) || !Object.isExtensible(obj)) { | ||
//@ts-ignore | ||
return obj; // just typing | ||
} | ||
var readonlyObj = (_a = {}, | ||
_a[ReadonlyIdentifierKey] = true, | ||
_a); | ||
var source = reactive({}); | ||
var ob = source.__ob__; | ||
var _loop_2 = function (key) { | ||
var val = obj[key]; | ||
var getter; | ||
var setter = void 0; | ||
var property = Object.getOwnPropertyDescriptor(obj, key); | ||
if (property) { | ||
if (property.configurable === false) { | ||
return "continue"; | ||
} | ||
getter = property.get; | ||
setter = property.set; | ||
if ((!getter || setter) /* not only have getter */ && | ||
arguments_2.length === 2) { | ||
val = obj[key]; | ||
} | ||
} | ||
Object.defineProperty(readonlyObj, key, { | ||
enumerable: true, | ||
configurable: true, | ||
get: function getterHandler() { | ||
var value = getter ? getter.call(obj) : val; | ||
ob.dep.depend(); | ||
return value; | ||
}, | ||
set: function (v) { | ||
if ((process.env.NODE_ENV !== 'production')) { | ||
warn("Set operation on key \"" + key + "\" failed: target is readonly."); | ||
} | ||
}, | ||
}); | ||
}; | ||
var arguments_2 = arguments; | ||
try { | ||
for (var _c = __values(Object.keys(obj)), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var key = _d.value; | ||
_loop_2(key); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (_d && !_d.done && (_b = _c.return)) _b.call(_c); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return readonlyObj; | ||
} | ||
/** | ||
@@ -973,3 +1041,3 @@ * Make sure obj can't be a reactive | ||
if ((process.env.NODE_ENV !== 'production') && !set) { | ||
warn('Computed property was assigned to but it has no setter.', vm); | ||
warn('Write operation failed: computed value is readonly.', vm); | ||
return; | ||
@@ -979,3 +1047,3 @@ } | ||
}, | ||
}); | ||
}, !set); | ||
} | ||
@@ -1450,2 +1518,2 @@ | ||
export default Plugin; | ||
export { computed, createApp, customRef, defineComponent, getCurrentInstance, createElement as h, inject, isReactive, isRef, markRaw, markReactive, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useCSSModule, watch, watchEffect }; | ||
export { computed, createApp, customRef, defineComponent, getCurrentInstance, createElement as h, inject, isReactive, isReadonly, isRef, markRaw, markReactive, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useCSSModule, watch, watchEffect }; |
@@ -230,2 +230,3 @@ (function (global, factory) { | ||
var RawIdentifierKey = createSymbol('composition-api.rawIdentifierKey'); | ||
var ReadonlyIdentifierKey = createSymbol('composition-api.readonlyIdentifierKey'); | ||
// must be a string, symbol key is ignored in reactive | ||
@@ -244,7 +245,13 @@ var RefKey = 'composition-api.refKey'; | ||
}()); | ||
function createRef(options) { | ||
function createRef(options, readonly) { | ||
if (readonly === void 0) { readonly = false; } | ||
var r = new RefImpl(options); | ||
if (readonly) { | ||
//@ts-ignore | ||
r[ReadonlyIdentifierKey] = readonly; | ||
} | ||
// seal the ref, this could prevent ref from being observed | ||
// It's safe to seal the ref, since we really shouldn't extend it. | ||
// related issues: #79 | ||
return Object.seal(new RefImpl(options)); | ||
return Object.seal(r); | ||
} | ||
@@ -318,2 +325,5 @@ function ref(raw) { | ||
} | ||
function isReadonly(obj) { | ||
return hasOwn(obj, ReadonlyIdentifierKey) && obj[ReadonlyIdentifierKey]; | ||
} | ||
function isReactive(obj) { | ||
@@ -535,2 +545,60 @@ return (isObject(obj) && | ||
} | ||
function shallowReadonly(obj) { | ||
var _a, e_2, _b; | ||
if (!isPlainObject(obj) || !Object.isExtensible(obj)) { | ||
//@ts-ignore | ||
return obj; // just typing | ||
} | ||
var readonlyObj = (_a = {}, | ||
_a[ReadonlyIdentifierKey] = true, | ||
_a); | ||
var source = reactive({}); | ||
var ob = source.__ob__; | ||
var _loop_2 = function (key) { | ||
var val = obj[key]; | ||
var getter; | ||
var setter = void 0; | ||
var property = Object.getOwnPropertyDescriptor(obj, key); | ||
if (property) { | ||
if (property.configurable === false) { | ||
return "continue"; | ||
} | ||
getter = property.get; | ||
setter = property.set; | ||
if ((!getter || setter) /* not only have getter */ && | ||
arguments_2.length === 2) { | ||
val = obj[key]; | ||
} | ||
} | ||
Object.defineProperty(readonlyObj, key, { | ||
enumerable: true, | ||
configurable: true, | ||
get: function getterHandler() { | ||
var value = getter ? getter.call(obj) : val; | ||
ob.dep.depend(); | ||
return value; | ||
}, | ||
set: function (v) { | ||
{ | ||
warn("Set operation on key \"" + key + "\" failed: target is readonly."); | ||
} | ||
}, | ||
}); | ||
}; | ||
var arguments_2 = arguments; | ||
try { | ||
for (var _c = __values(Object.keys(obj)), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var key = _d.value; | ||
_loop_2(key); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (_d && !_d.done && (_b = _c.return)) _b.call(_c); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return readonlyObj; | ||
} | ||
/** | ||
@@ -979,3 +1047,3 @@ * Make sure obj can't be a reactive | ||
if ( !set) { | ||
warn('Computed property was assigned to but it has no setter.', vm); | ||
warn('Write operation failed: computed value is readonly.', vm); | ||
return; | ||
@@ -985,3 +1053,3 @@ } | ||
}, | ||
}); | ||
}, !set); | ||
} | ||
@@ -1460,2 +1528,3 @@ | ||
exports.isReactive = isReactive; | ||
exports.isReadonly = isReadonly; | ||
exports.isRef = isRef; | ||
@@ -1480,2 +1549,3 @@ exports.markRaw = markRaw; | ||
exports.shallowReactive = shallowReactive; | ||
exports.shallowReadonly = shallowReadonly; | ||
exports.shallowRef = shallowRef; | ||
@@ -1482,0 +1552,0 @@ exports.toRaw = toRaw; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e=e||self).VueCompositionAPI={},e.Vue)}(this,(function(e,n){"use strict";n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;function t(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&t(Symbol)&&"undefined"!=typeof Reflect&&t(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,n,t){var r=t.get,u=t.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,n,i)}function f(e,n,t,r){Object.defineProperty(e,n,{value:t,enumerable:!!r,writable:!0,configurable:!0})}function a(e,n){return Object.hasOwnProperty.call(e,n)}function c(e){return Array.isArray(e)}function l(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function s(e){return"function"==typeof e}function v(e,t){n.util.warn(e,t)}var p=null,d=null;function y(){return p}function b(){return d}function h(e){d=e}function g(e){return b()}function _(e,n){void 0===n&&(n={});var t=e.config.silent;e.config.silent=!0;var r=new e(n);return e.config.silent=t,r}function m(e){var n=y();return n&&e instanceof n}function w(e,n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.$scopedSlots[n]?e.$scopedSlots[n].apply(e,t):v("slots."+n+'() got called outside of the "render()" scope',e)}} | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e=e||self).VueCompositionAPI={},e.Vue)}(this,(function(e,n){"use strict";n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;function t(e){return"function"==typeof e&&/native code/.test(e.toString())}var r="undefined"!=typeof Symbol&&t(Symbol)&&"undefined"!=typeof Reflect&&t(Reflect.ownKeys),o=function(e){return e},i={enumerable:!0,configurable:!0,get:o,set:o};function u(e,n,t){var r=t.get,u=t.set;i.get=r||o,i.set=u||o,Object.defineProperty(e,n,i)}function a(e,n,t,r){Object.defineProperty(e,n,{value:t,enumerable:!!r,writable:!0,configurable:!0})}function f(e,n){return Object.hasOwnProperty.call(e,n)}function c(e){return Array.isArray(e)}function l(e){return"[object Object]"===function(e){return Object.prototype.toString.call(e)}(e)}function s(e){return"function"==typeof e}function v(e,t){n.util.warn(e,t)}var d=null,p=null;function y(){return d}function b(){return p}function g(e){p=e}function h(e){return b()}function _(e,n){void 0===n&&(n={});var t=e.config.silent;e.config.silent=!0;var r=new e(n);return e.config.silent=t,r}function m(e){var n=y();return n&&e instanceof n}function w(e,n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.$scopedSlots[n]?e.$scopedSlots[n].apply(e,t):v("slots."+n+'() got called outside of the "render()" scope',e)}} | ||
/*! ***************************************************************************** | ||
@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
var O=function(){return(O=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function j(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function x(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat($(arguments[n]));return e}function k(e){return r?Symbol.for(e):e}var S=k("composition-api.preFlushQueue"),E=k("composition-api.postFlushQueue"),P=k("composition-api.accessControlIdentifier"),R=k("composition-api.reactiveIdentifier"),A=k("composition-api.rawIdentifierKey"),C="composition-api.refKey",M=function(e){u(this,"value",{get:e.get,set:e.set})};function I(e){return Object.seal(new M(e))}function U(e){var n;if(V(e))return e;var t=G(((n={})[C]=e,n));return I({get:function(){return t[C]},set:function(e){return t[C]=e}})}function V(e){return e instanceof M}function B(e,n){var t=e[n];return V(t)?t:I({get:function(){return e[n]},set:function(t){return e[n]=t}})}var D={},z={},F={};function K(e){return a(e,A)&&e[A]===F}function T(e){return null!==(n=e)&&"object"==typeof n&&Object.isExtensible(e)&&a(e,R)&&e[R]===z;var n}function Q(e){if(!(!l(e)||K(e)||Array.isArray(e)||V(e)||m(e)||a(e,P)&&e[P]===D)){Object.isExtensible(e)&&f(e,P,D);for(var n=Object.keys(e),t=0;t<n.length;t++)q(e,n[t])}}function q(e,n,t){if("__ob__"!==n){var r,o,i=Object.getOwnPropertyDescriptor(e,n);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(t=e[n])}Q(t),Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):t;return n!==C&&V(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):t;n!==C&&V(u)&&!V(i)?u.value=i:o?o.call(e,i):t=i,Q(i)}}})}}function J(e){var n,t=y();t.observable?n=t.observable(e):n=_(t,{data:{$$state:e}})._data.$$state;return n}function N(e){var n,t;if(!l(e)||T(e)||K(e)||!Object.isExtensible(e))return e;var r=J({});W(r,!0),Q(r);var o=r.__ob__,i=function(n){var t,i,f=e[n],a=Object.getOwnPropertyDescriptor(e,n);if(a){if(!1===a.configurable)return"continue";t=a.get,i=a.set,t&&!i||2!==u.length||(f=e[n])}Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:function(){var n=t?t.call(e):f;return o.dep.depend(),n},set:function(n){t&&!i||(i?i.call(e,n):f=n,o.dep.notify())}})},u=arguments;try{for(var f=j(Object.keys(e)),a=f.next();!a.done;a=f.next()){var c=a.value;i(c)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}return r}function W(e,n){if(void 0===n&&(n=!1),!(!l(e)||K(e)||Array.isArray(e)||V(e)||m(e)||a(e,R)&&e[R]===z||(Object.isExtensible(e)&&f(e,R,z),n)))for(var t=Object.keys(e),r=0;r<t.length;r++)W(e[t[r]])}function G(e){if(!l(e)||T(e)||K(e)||!Object.isExtensible(e))return e;var n=J(e);return W(e),Q(n),n}function H(e){return l(e)&&Object.isExtensible(e)?(f(e,"__ob__",J({}).__ob__),f(e,A,F),e):e}function L(e){return function(n){var t,r=g(((t=e)[0].toUpperCase(),t.slice(1)));r&&function(e,n,t,r){var o=n.$options,i=e.config.optionMergeStrategies[t];o[t]=i(o[t],function(e,n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=b();h(e);try{return n.apply(void 0,x(t))}finally{h(o)}}}(n,r))}(y(),r,e,n)}}var X,Y=L("beforeMount"),Z=L("mounted"),ee=L("beforeUpdate"),ne=L("updated"),te=L("beforeDestroy"),re=L("destroyed"),oe=L("errorCaptured"),ie=L("activated"),ue=L("deactivated"),fe=L("serverPrefetch");function ae(){se(this,S)}function ce(){se(this,E)}function le(){var e=b();return e?function(e){return void 0!==e[S]}(e)||function(e){e[S]=[],e[E]=[],e.$on("hook:beforeUpdate",ae),e.$on("hook:updated",ce)}(e):(X||(X=_(y())),e=X),e}function se(e,n){for(var t=e[n],r=0;r<t.length;r++)t[r]();t.length=0}function ve(e,n,t){var r=function(){e.$nextTick((function(){e[S].length&&se(e,S),e[E].length&&se(e,E)}))};switch(t){case"pre":r(),e[S].push(n);break;case"post":r(),e[E].push(n);break;default:!function(e,n){if(!e)throw new Error("[vue-composition-api] "+n)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+t)}}function pe(e,n){var t=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];t.apply(e,r),n()}}function de(e,n,t,r){var i,u=r.flush,f="sync"===u,a=function(e){i=function(){try{e()}catch(e){!function(e,n,t){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},l=function(n){return f||e===X?n:function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ve(e,(function(){n.apply(void 0,x(t))}),u)}};if(null===t){var p=!1,d=function(e,n,t,r){var o=e._watchers.length;return e.$watch(n,t,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!p)try{p=!0,n(a)}finally{p=!1}}),o,{deep:r.deep||!1,sync:f,before:c});pe(d,c),d.lazy=!1;var y=d.get.bind(d);return d.get=l(y),function(){d.teardown()}}var b,h=r.deep;Array.isArray(n)?b=function(){return n.map((function(e){return V(e)?e.value:e()}))}:V(n)?b=function(){return n.value}:T(n)?(b=function(){return n},h=!0):s(n)?b=n:(b=o,v("Invalid watch source: "+JSON.stringify(n)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var g=function(e,n){c(),t(e,n,a)},_=l(g);if(r.immediate){var m=_,w=function(e,n){w=m,g(e,n)};_=function(e,n){w(e,n)}}var O=e.$watch(b,_,{immediate:r.immediate,deep:h,sync:f});return pe(e._watchers[e._watchers.length-1],c),function(){O()}}var ye={};var be={};var he;var ge={set:function(e,n,t){(e.__composition_api_state__=e.__composition_api_state__||{})[n]=t},get:function(e,n){return(e.__composition_api_state__||{})[n]}};function _e(e){var n=ge.get(e,"rawBindings")||{};if(n&&Object.keys(n).length){for(var t=e.$refs,r=ge.get(e,"refs")||[],o=0;o<r.length;o++){var i=n[a=r[o]];!t[a]&&i&&V(i)&&(i.value=null)}var u=Object.keys(t),f=[];for(o=0;o<u.length;o++){var a;i=n[a=u[o]];t[a]&&i&&V(i)&&(i.value=t[a],f.push(a))}ge.set(e,"refs",f)}}function me(e,n){var t=e.$options._parentVnode;if(t){for(var r=ge.get(e,"slots")||[],o=function(e,n){var t;if(e){if(e._normalized)return e._normalized;for(var r in t={},e)e[r]&&"$"!==r[0]&&(t[r]=!0)}else t={};for(var r in n)r in t||(t[r]=!0);return t}(t.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[f=r[i]]||delete n[f]}var u=Object.keys(o);for(i=0;i<u.length;i++){var f;n[f=u[i]]||(n[f]=w(e,f))}ge.set(e,"slots",u)}}function we(e,n,t){var r=b();h(e);try{return n(e)}catch(e){if(!t)throw e;t(e)}finally{h(r)}}function Oe(e){e.mixin({beforeCreate:function(){var e=this,n=e.$options,t=n.setup,r=n.render;r&&(n.render=function(){for(var n=this,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return we(e,(function(){return r.apply(n,t)}))});if(!t)return;if("function"!=typeof t)return;var o=n.data;n.data=function(){return function(e,n){void 0===n&&(n={});var t,r=e.$options.setup,o=function(e){var n={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(t){var r,o,i;Array.isArray(t)?(r=$(t,2),o=r[0],i=r[1]):o=i=t,i="$"+i,u(n,o,{get:function(){return e[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(t){var r="$"+t;u(n,t,{get:function(){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var o=e[r];o.apply(e,n)}}})})),n}(e);if(W(n),me(e,o.slots),we(e,(function(){t=r(n,o)})),!t)return;if(s(t)){var i=t;return void(e.$options.render=function(){return me(e,o.slots),we(e,(function(){return i()}))})}if(l(t)){var f=t;ge.set(e,"rawBindings",t),Object.keys(t).forEach((function(n){var t=f[n];if(!V(t))if(T(t))t=U(t);else{s(t)&&(t=t.bind(e));var r=function e(n,t){var r,o;if(void 0===t&&(t=new WeakMap),t.has(n))return t.get(n);if(s(n)||c(n)||T(n)||!l(n)||!Object.isExtensible(n)||V(n)||K(n))return n;var i={};t.set(n,i),Object.getOwnPropertySymbols(n).forEach((function(e){return i[e]=n[e]})),a(n,"__ob__")&&Object.defineProperty(i,"__ob__",{enumerable:!1,value:n.__ob__});var f=function(r){var o=n[r];if(!o||K(o))i[r]=o;else if(V(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,t)};try{for(var v=j(Object.keys(n)),p=v.next();!p.done;p=v.next()){f(p.value)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}return i}(t);W(r),t=U(H(r))}!function(e,n,t){var r=e.$options.props;n in e||r&&a(r,n)||u(e,n,{get:function(){return t.value},set:function(e){t.value=e}})}(e,n,t)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){_e(this)},updated:function(){_e(this)}})}function je(e){p||function(e){return a(e,"__composition_api_installed__")}(e)||(e.config.optionMergeStrategies.setup=function(e,n){return function(t,o){return function e(n,t){if(!n)return t;if(!t)return n;for(var o,i,u,f=r?Reflect.ownKeys(n):Object.keys(n),c=0;c<f.length;c++)"__ob__"!==(o=f[c])&&(i=t[o],u=n[o],a(t,o)?i!==u&&l(i)&&!V(i)&&l(u)&&!V(u)&&e(u,i):t[o]=u);return t}("function"==typeof e?e(t,o)||{}:void 0,"function"==typeof n?n(t,o)||{}:void 0)}},function(e){p=e,Object.defineProperty(e,"__composition_api_installed__",{configurable:!0,writable:!0,value:!0})}(e),Oe(e))}var $e={install:function(e){return je(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use($e),e.computed=function(e){var n,t,r=b();"function"==typeof e?n=e:(n=e.get,t=e.set);var o=_(y(),{computed:{$$state:{get:n,set:t}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),I({get:function(){return o.$$state},set:function(e){o.$$state=e}})},e.createApp=function(e,n){void 0===n&&(n=void 0);var t=y(),r=void 0;return{config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),directive:t.directive.bind(t),mount:function(o,i){return r||((r=new t(O({propsData:n},e))).$mount(o,i),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}}},e.customRef=function(e){var n=U(0);return I(e((function(){n.value}),(function(){++n.value})))},e.default=$e,e.defineComponent=function(e){return e},e.getCurrentInstance=b,e.h=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=b();return t?t.$createElement.apply(t,e):(v("`createElement()` has been called outside of render function."),he||(he=_(y()).$createElement),he.apply(he,e))},e.inject=function(e,n){if(!e)return n;var t=b();if(t){var r=function(e,n){for(var t=n;t;){if(t._provided&&a(t._provided,e))return t._provided[e];t=t.$parent}return ye}(e,t);return r!==ye?r:n}v("inject() can only be used inside setup() or functional components.")},e.isReactive=T,e.isRef=V,e.markRaw=H,e.markReactive=W,e.nextTick=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return null===(e=y())||void 0===e?void 0:e.nextTick.apply(this,n)},e.onActivated=ie,e.onBeforeMount=Y,e.onBeforeUnmount=te,e.onBeforeUpdate=ee,e.onDeactivated=ue,e.onErrorCaptured=oe,e.onMounted=Z,e.onServerPrefetch=fe,e.onUnmounted=re,e.onUpdated=ne,e.provide=function(e,n){var t=g();if(t){if(!t._provided){var r={};Object.defineProperty(t,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}t._provided[e]=n}},e.reactive=G,e.ref=U,e.set=function(e,n,t){var r=y().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var n=parseFloat(String(e));return n>=0&&Math.floor(n)===n&&isFinite(e)}(n))return e.length=Math.max(e.length,n),e.splice(n,1,t),t;if(n in e&&!(n in Object.prototype))return e[n]=t,t;var i=e.__ob__;return e._isVue||i&&i.vmCount?t:i?(o(i.value,n,t),q(e,n,t),W(i.value[n]),i.dep.notify(),t):(e[n]=t,t)},e.shallowReactive=N,e.shallowRef=function(e){var n;if(V(e))return e;var t=N(((n={})[C]=e,n));return I({get:function(){return t[C]},set:function(e){return t[C]=e}})},e.toRaw=function(e){return K(e)||!Object.isExtensible(e)?e:e.__ob__.value||e},e.toRef=B,e.toRefs=function(e){if(!l(e))return e;var n={};for(var t in e)n[t]=B(e,t);return n},e.triggerRef=function(e){V(e)&&(e.value=e.value)},e.unref=function(e){return V(e)?e.value:e},e.useCSSModule=function(e){void 0===e&&(e="$style");var n=b();if(!n)return be;var t=n[e];return t||be},e.watch=function(e,n,t){var r=null;"function"==typeof n?r=n:(t=n,r=null);var o=function(e){return O({immediate:!1,deep:!1,flush:"post"},e)}(t);return de(le(),e,r,o)},e.watchEffect=function(e,n){var t=function(e){return O({immediate:!0,deep:!1,flush:"post"},e)}(n);return de(le(),e,null,t)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
var O=function(){return(O=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function j(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function x(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat($(arguments[n]));return e}function k(e){return r?Symbol.for(e):e}var S=k("composition-api.preFlushQueue"),E=k("composition-api.postFlushQueue"),P=k("composition-api.accessControlIdentifier"),R=k("composition-api.reactiveIdentifier"),A=k("composition-api.rawIdentifierKey"),C=k("composition-api.readonlyIdentifierKey"),M="composition-api.refKey",I=function(e){u(this,"value",{get:e.get,set:e.set})};function U(e,n){void 0===n&&(n=!1);var t=new I(e);return n&&(t[C]=n),Object.seal(t)}function D(e){var n;if(V(e))return e;var t=H(((n={})[M]=e,n));return U({get:function(){return t[M]},set:function(e){return t[M]=e}})}function V(e){return e instanceof I}function B(e,n){var t=e[n];return V(t)?t:U({get:function(){return e[n]},set:function(t){return e[n]=t}})}var K={},z={},F={};function T(e){return f(e,A)&&e[A]===F}function Q(e){return null!==(n=e)&&"object"==typeof n&&Object.isExtensible(e)&&f(e,R)&&e[R]===z;var n}function q(e){if(!(!l(e)||T(e)||Array.isArray(e)||V(e)||m(e)||f(e,P)&&e[P]===K)){Object.isExtensible(e)&&a(e,P,K);for(var n=Object.keys(e),t=0;t<n.length;t++)J(e,n[t])}}function J(e,n,t){if("__ob__"!==n){var r,o,i=Object.getOwnPropertyDescriptor(e,n);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(t=e[n])}q(t),Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:function(){var o=r?r.call(e):t;return n!==M&&V(o)?o.value:o},set:function(i){if(!r||o){var u=r?r.call(e):t;n!==M&&V(u)&&!V(i)?u.value=i:o?o.call(e,i):t=i,q(i)}}})}}function N(e){var n,t=y();t.observable?n=t.observable(e):n=_(t,{data:{$$state:e}})._data.$$state;return n}function W(e){var n,t;if(!l(e)||Q(e)||T(e)||!Object.isExtensible(e))return e;var r=N({});G(r,!0),q(r);var o=r.__ob__,i=function(n){var t,i,a=e[n],f=Object.getOwnPropertyDescriptor(e,n);if(f){if(!1===f.configurable)return"continue";t=f.get,i=f.set,t&&!i||2!==u.length||(a=e[n])}Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:function(){var n=t?t.call(e):a;return o.dep.depend(),n},set:function(n){t&&!i||(i?i.call(e,n):a=n,o.dep.notify())}})},u=arguments;try{for(var a=j(Object.keys(e)),f=a.next();!f.done;f=a.next()){var c=f.value;i(c)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}return r}function G(e,n){if(void 0===n&&(n=!1),!(!l(e)||T(e)||Array.isArray(e)||V(e)||m(e)||f(e,R)&&e[R]===z||(Object.isExtensible(e)&&a(e,R,z),n)))for(var t=Object.keys(e),r=0;r<t.length;r++)G(e[t[r]])}function H(e){if(!l(e)||Q(e)||T(e)||!Object.isExtensible(e))return e;var n=N(e);return G(e),q(n),n}function L(e){return l(e)&&Object.isExtensible(e)?(a(e,"__ob__",N({}).__ob__),a(e,A,F),e):e}function X(e){return function(n){var t,r=h(((t=e)[0].toUpperCase(),t.slice(1)));r&&function(e,n,t,r){var o=n.$options,i=e.config.optionMergeStrategies[t];o[t]=i(o[t],function(e,n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=b();g(e);try{return n.apply(void 0,x(t))}finally{g(o)}}}(n,r))}(y(),r,e,n)}}var Y,Z=X("beforeMount"),ee=X("mounted"),ne=X("beforeUpdate"),te=X("updated"),re=X("beforeDestroy"),oe=X("destroyed"),ie=X("errorCaptured"),ue=X("activated"),ae=X("deactivated"),fe=X("serverPrefetch");function ce(){ve(this,S)}function le(){ve(this,E)}function se(){var e=b();return e?function(e){return void 0!==e[S]}(e)||function(e){e[S]=[],e[E]=[],e.$on("hook:beforeUpdate",ce),e.$on("hook:updated",le)}(e):(Y||(Y=_(y())),e=Y),e}function ve(e,n){for(var t=e[n],r=0;r<t.length;r++)t[r]();t.length=0}function de(e,n,t){var r=function(){e.$nextTick((function(){e[S].length&&ve(e,S),e[E].length&&ve(e,E)}))};switch(t){case"pre":r(),e[S].push(n);break;case"post":r(),e[E].push(n);break;default:!function(e,n){if(!e)throw new Error("[vue-composition-api] "+n)}(!1,'flush must be one of ["post", "pre", "sync"], but got '+t)}}function pe(e,n){var t=e.teardown;e.teardown=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];t.apply(e,r),n()}}function ye(e,n,t,r){var i,u=r.flush,a="sync"===u,f=function(e){i=function(){try{e()}catch(e){!function(e,n,t){if("undefined"==typeof window||"undefined"==typeof console)throw e;console.error(e)}(e)}}},c=function(){i&&(i(),i=null)},l=function(n){return a||e===Y?n:function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return de(e,(function(){n.apply(void 0,x(t))}),u)}};if(null===t){var d=!1,p=function(e,n,t,r){var o=e._watchers.length;return e.$watch(n,t,{immediate:r.immediateInvokeCallback,deep:r.deep,lazy:r.noRun,sync:r.sync,before:r.before}),e._watchers[o]}(e,(function(){if(!d)try{d=!0,n(f)}finally{d=!1}}),o,{deep:r.deep||!1,sync:a,before:c});pe(p,c),p.lazy=!1;var y=p.get.bind(p);return p.get=l(y),function(){p.teardown()}}var b,g=r.deep;Array.isArray(n)?b=function(){return n.map((function(e){return V(e)?e.value:e()}))}:V(n)?b=function(){return n.value}:Q(n)?(b=function(){return n},g=!0):s(n)?b=n:(b=o,v("Invalid watch source: "+JSON.stringify(n)+".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.",e));var h=function(e,n){c(),t(e,n,f)},_=l(h);if(r.immediate){var m=_,w=function(e,n){w=m,h(e,n)};_=function(e,n){w(e,n)}}var O=e.$watch(b,_,{immediate:r.immediate,deep:g,sync:a});return pe(e._watchers[e._watchers.length-1],c),function(){O()}}var be={};var ge={};var he;var _e={set:function(e,n,t){(e.__composition_api_state__=e.__composition_api_state__||{})[n]=t},get:function(e,n){return(e.__composition_api_state__||{})[n]}};function me(e){var n=_e.get(e,"rawBindings")||{};if(n&&Object.keys(n).length){for(var t=e.$refs,r=_e.get(e,"refs")||[],o=0;o<r.length;o++){var i=n[f=r[o]];!t[f]&&i&&V(i)&&(i.value=null)}var u=Object.keys(t),a=[];for(o=0;o<u.length;o++){var f;i=n[f=u[o]];t[f]&&i&&V(i)&&(i.value=t[f],a.push(f))}_e.set(e,"refs",a)}}function we(e,n){var t=e.$options._parentVnode;if(t){for(var r=_e.get(e,"slots")||[],o=function(e,n){var t;if(e){if(e._normalized)return e._normalized;for(var r in t={},e)e[r]&&"$"!==r[0]&&(t[r]=!0)}else t={};for(var r in n)r in t||(t[r]=!0);return t}(t.data.scopedSlots,e.$slots),i=0;i<r.length;i++){o[a=r[i]]||delete n[a]}var u=Object.keys(o);for(i=0;i<u.length;i++){var a;n[a=u[i]]||(n[a]=w(e,a))}_e.set(e,"slots",u)}}function Oe(e,n,t){var r=b();g(e);try{return n(e)}catch(e){if(!t)throw e;t(e)}finally{g(r)}}function je(e){e.mixin({beforeCreate:function(){var e=this,n=e.$options,t=n.setup,r=n.render;r&&(n.render=function(){for(var n=this,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return Oe(e,(function(){return r.apply(n,t)}))});if(!t)return;if("function"!=typeof t)return;var o=n.data;n.data=function(){return function(e,n){void 0===n&&(n={});var t,r=e.$options.setup,o=function(e){var n={slots:{}};return["root","parent","refs","attrs","listeners","isServer","ssrContext"].forEach((function(t){var r,o,i;Array.isArray(t)?(r=$(t,2),o=r[0],i=r[1]):o=i=t,i="$"+i,u(n,o,{get:function(){return e[i]},set:function(){v("Cannot assign to '"+o+"' because it is a read-only property",e)}})})),["emit"].forEach((function(t){var r="$"+t;u(n,t,{get:function(){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var o=e[r];o.apply(e,n)}}})})),n}(e);if(G(n),we(e,o.slots),Oe(e,(function(){t=r(n,o)})),!t)return;if(s(t)){var i=t;return void(e.$options.render=function(){return we(e,o.slots),Oe(e,(function(){return i()}))})}if(l(t)){var a=t;_e.set(e,"rawBindings",t),Object.keys(t).forEach((function(n){var t=a[n];if(!V(t))if(Q(t))t=D(t);else{s(t)&&(t=t.bind(e));var r=function e(n,t){var r,o;if(void 0===t&&(t=new WeakMap),t.has(n))return t.get(n);if(s(n)||c(n)||Q(n)||!l(n)||!Object.isExtensible(n)||V(n)||T(n))return n;var i={};t.set(n,i),Object.getOwnPropertySymbols(n).forEach((function(e){return i[e]=n[e]})),f(n,"__ob__")&&Object.defineProperty(i,"__ob__",{enumerable:!1,value:n.__ob__});var a=function(r){var o=n[r];if(!o||T(o))i[r]=o;else if(V(o)){u(i,r,{get:function(){return o.value},set:function(e){return o.value=e}})}else i[r]=e(o,t)};try{for(var v=j(Object.keys(n)),d=v.next();!d.done;d=v.next()){a(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}return i}(t);G(r),t=D(L(r))}!function(e,n,t){var r=e.$options.props;n in e||r&&f(r,n)||u(e,n,{get:function(){return t.value},set:function(e){t.value=e}})}(e,n,t)}))}}(e,e.$props),"function"==typeof o?o.call(e,e):o||{}}},mounted:function(){me(this)},updated:function(){me(this)}})}function $e(e){d||function(e){return f(e,"__composition_api_installed__")}(e)||(e.config.optionMergeStrategies.setup=function(e,n){return function(t,o){return function e(n,t){if(!n)return t;if(!t)return n;for(var o,i,u,a=r?Reflect.ownKeys(n):Object.keys(n),c=0;c<a.length;c++)"__ob__"!==(o=a[c])&&(i=t[o],u=n[o],f(t,o)?i!==u&&l(i)&&!V(i)&&l(u)&&!V(u)&&e(u,i):t[o]=u);return t}("function"==typeof e?e(t,o)||{}:void 0,"function"==typeof n?n(t,o)||{}:void 0)}},function(e){d=e,Object.defineProperty(e,"__composition_api_installed__",{configurable:!0,writable:!0,value:!0})}(e),je(e))}var xe={install:function(e){return $e(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(xe),e.computed=function(e){var n,t,r=b();"function"==typeof e?n=e:(n=e.get,t=e.set);var o=_(y(),{computed:{$$state:{get:n,set:t}}});return r&&r.$on("hook:destroyed",(function(){return o.$destroy()})),U({get:function(){return o.$$state},set:function(e){o.$$state=e}},!t)},e.createApp=function(e,n){void 0===n&&(n=void 0);var t=y(),r=void 0;return{config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),directive:t.directive.bind(t),mount:function(o,i){return r||((r=new t(O({propsData:n},e))).$mount(o,i),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}}},e.customRef=function(e){var n=D(0);return U(e((function(){n.value}),(function(){++n.value})))},e.default=xe,e.defineComponent=function(e){return e},e.getCurrentInstance=b,e.h=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=b();return t?t.$createElement.apply(t,e):(v("`createElement()` has been called outside of render function."),he||(he=_(y()).$createElement),he.apply(he,e))},e.inject=function(e,n){if(!e)return n;var t=b();if(t){var r=function(e,n){for(var t=n;t;){if(t._provided&&f(t._provided,e))return t._provided[e];t=t.$parent}return be}(e,t);return r!==be?r:n}v("inject() can only be used inside setup() or functional components.")},e.isReactive=Q,e.isReadonly=function(e){return f(e,C)&&e[C]},e.isRef=V,e.markRaw=L,e.markReactive=G,e.nextTick=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return null===(e=y())||void 0===e?void 0:e.nextTick.apply(this,n)},e.onActivated=ue,e.onBeforeMount=Z,e.onBeforeUnmount=re,e.onBeforeUpdate=ne,e.onDeactivated=ae,e.onErrorCaptured=ie,e.onMounted=ee,e.onServerPrefetch=fe,e.onUnmounted=oe,e.onUpdated=te,e.provide=function(e,n){var t=h();if(t){if(!t._provided){var r={};Object.defineProperty(t,"_provided",{get:function(){return r},set:function(e){return Object.assign(r,e)}})}t._provided[e]=n}},e.reactive=H,e.ref=D,e.set=function(e,n,t){var r=y().util,o=(r.warn,r.defineReactive);if(c(e)&&function(e){var n=parseFloat(String(e));return n>=0&&Math.floor(n)===n&&isFinite(e)}(n))return e.length=Math.max(e.length,n),e.splice(n,1,t),t;if(n in e&&!(n in Object.prototype))return e[n]=t,t;var i=e.__ob__;return e._isVue||i&&i.vmCount?t:i?(o(i.value,n,t),J(e,n,t),G(i.value[n]),i.dep.notify(),t):(e[n]=t,t)},e.shallowReactive=W,e.shallowReadonly=function(e){var n,t,r;if(!l(e)||!Object.isExtensible(e))return e;var o=((n={})[C]=!0,n),i=H({}),u=i.__ob__,a=function(n){var t,r=e[n],i=void 0,a=Object.getOwnPropertyDescriptor(e,n);if(a){if(!1===a.configurable)return"continue";t=a.get,i=a.set,t&&!i||2!==f.length||(r=e[n])}Object.defineProperty(o,n,{enumerable:!0,configurable:!0,get:function(){var n=t?t.call(e):r;return u.dep.depend(),n},set:function(e){}})},f=arguments;try{for(var c=j(Object.keys(e)),s=c.next();!s.done;s=c.next()){var v=s.value;a(v)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return o},e.shallowRef=function(e){var n;if(V(e))return e;var t=W(((n={})[M]=e,n));return U({get:function(){return t[M]},set:function(e){return t[M]=e}})},e.toRaw=function(e){return T(e)||!Object.isExtensible(e)?e:e.__ob__.value||e},e.toRef=B,e.toRefs=function(e){if(!l(e))return e;var n={};for(var t in e)n[t]=B(e,t);return n},e.triggerRef=function(e){V(e)&&(e.value=e.value)},e.unref=function(e){return V(e)?e.value:e},e.useCSSModule=function(e){void 0===e&&(e="$style");var n=b();if(!n)return ge;var t=n[e];return t||ge},e.watch=function(e,n,t){var r=null;"function"==typeof n?r=n:(t=n,r=null);var o=function(e){return O({immediate:!1,deep:!1,flush:"post"},e)}(t);return ye(se(),e,r,o)},e.watchEffect=function(e,n){var t=function(e){return O({immediate:!0,deep:!1,flush:"post"},e)}(n);return ye(se(),e,null,t)},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -0,0 +0,0 @@ 'use strict' |
{ | ||
"name": "@vue/composition-api", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"description": "Provide logic composition capabilities for Vue.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -43,7 +43,7 @@ # @vue/composition-api | ||
<script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.0.0-beta.5"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.0.0-beta.6"></script> | ||
``` | ||
<!--cdn-links-end--> | ||
`@vue/composition-api` will be exposed to global variable `window.VueCompositionAPI`. | ||
`@vue/composition-api` will be exposed to global variable `window.VueCompositionAPI`. | ||
@@ -72,4 +72,2 @@ ```ts | ||
## SSR | ||
@@ -83,3 +81,3 @@ | ||
export default { | ||
setup (props, { ssrContext }) { | ||
setup(props, { ssrContext }) { | ||
const result = ref() | ||
@@ -94,4 +92,4 @@ | ||
} | ||
}, | ||
}; | ||
} | ||
} | ||
``` | ||
@@ -131,3 +129,2 @@ | ||
```js | ||
@@ -170,4 +167,4 @@ const a = { | ||
count: ref(0), | ||
}) | ||
], | ||
}), | ||
] | ||
}) | ||
@@ -188,3 +185,2 @@ // unwrapped | ||
### Template Refs | ||
@@ -222,3 +218,2 @@ | ||
<details> | ||
@@ -249,5 +244,5 @@ <summary> | ||
``` | ||
</details> | ||
<details> | ||
@@ -278,3 +273,2 @@ <summary> | ||
<details> | ||
@@ -314,3 +308,2 @@ <summary> | ||
```jsx | ||
@@ -361,3 +354,2 @@ export default { | ||
</details> | ||
@@ -374,7 +366,7 @@ | ||
watch(() => { | ||
/* ... */ | ||
/* ... */ | ||
}, { | ||
immediate: true, | ||
onTrack() {}, // not available | ||
onTrigger() {}, // not available | ||
onTrack() {}, // not available | ||
onTrigger() {}, // not available | ||
}) | ||
@@ -405,3 +397,13 @@ ``` | ||
### shallowReadonly | ||
<details> | ||
<summary> | ||
⚠️ <code>shallowReadonly()</code> will create a new object and with the same root properties, new properties added will <b>not</b> be readonly or reactive. | ||
</summary> | ||
> :bulb: In Vue 3, it will return an new proxy object. | ||
</details> | ||
### Missing APIs | ||
@@ -412,3 +414,2 @@ | ||
- `readonly` | ||
- `shallowReadonly` | ||
- `defineAsyncComponent` | ||
@@ -418,3 +419,2 @@ - `onRenderTracked` | ||
- `isProxy` | ||
- `isReadonly` | ||
- `isVNode` | ||
@@ -434,3 +434,3 @@ | ||
// will result { a: { value: 1 } } in template | ||
a: ref(1) | ||
a: ref(1), | ||
} | ||
@@ -443,3 +443,2 @@ }, | ||
### Performance Impact | ||
@@ -450,2 +449,1 @@ | ||
You can check the [benchmark results](https://antfu.github.io/vue-composition-api-benchmark-results/) for more details. | ||
@@ -45,3 +45,3 @@ # @vue/composition-api | ||
<script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.0.0-beta.5"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.0.0-beta.6"></script> | ||
``` | ||
@@ -82,3 +82,3 @@ <!--cdn-links-end--> | ||
export default { | ||
setup (props, { ssrContext }) { | ||
setup(props, { ssrContext }) { | ||
const result = ref() | ||
@@ -91,5 +91,5 @@ | ||
return { | ||
result, | ||
result | ||
} | ||
}, | ||
} | ||
} | ||
@@ -136,10 +136,10 @@ ``` | ||
const a = { | ||
count: ref(0), | ||
count: ref(0) | ||
} | ||
const b = reactive({ | ||
list: [a], // `a.count` 不会自动展开!! | ||
list: [a] // `a.count` 不会自动展开!! | ||
}) | ||
// `count` 不会自动展开, 须使用 `.value` | ||
b.list[0].count.value === 0; // true | ||
b.list[0].count.value === 0 // true | ||
``` | ||
@@ -151,9 +151,9 @@ | ||
{ | ||
count: ref(0), // 不会自动展开!! | ||
}, | ||
], | ||
count: ref(0) // 不会自动展开!! | ||
} | ||
] | ||
}) | ||
// `count` 不会自动展开, 须使用 `.value` | ||
b.list[0].count.value === 0; // true | ||
b.list[0].count.value === 0 // true | ||
``` | ||
@@ -171,6 +171,6 @@ | ||
const a = reactive({ | ||
count: ref(0), | ||
count: ref(0) | ||
}) | ||
const b = reactive({ | ||
list: [a], | ||
list: [a] | ||
}) | ||
@@ -182,3 +182,3 @@ // 自动展开 | ||
reactive({ | ||
count: ref(1), | ||
count: ref(1) | ||
}) | ||
@@ -215,5 +215,5 @@ ) | ||
return { | ||
root, | ||
root | ||
} | ||
}, | ||
} | ||
} | ||
@@ -243,3 +243,3 @@ </script> | ||
return { | ||
root, | ||
root | ||
} | ||
@@ -250,3 +250,3 @@ }, | ||
return () => <div ref="root" /> | ||
}, | ||
} | ||
} | ||
@@ -275,5 +275,5 @@ ``` | ||
return { | ||
root, | ||
root | ||
} | ||
}, | ||
} | ||
} | ||
@@ -303,3 +303,3 @@ </script> | ||
return () => <div ref={root} /> | ||
}, | ||
} | ||
} | ||
@@ -363,3 +363,3 @@ ``` | ||
> :bulb: 在 Vue 3 中,`reactive()` 会返回一个新的的代理对象. | ||
> :bulb: 在 Vue 3 中,`reactive()` 会返回一个新的的代理对象 | ||
@@ -377,9 +377,11 @@ </details> | ||
```js | ||
watch(() => { | ||
/* ... */ | ||
}, { | ||
immediate: true, | ||
onTrack() {}, // 不可用 | ||
onTrigger() {}, // 不可用 | ||
}) | ||
watch( | ||
() => { | ||
/* ... */ | ||
}, { | ||
immediate: true, | ||
onTrack() {}, // 不可用 | ||
onTrigger() {}, // 不可用 | ||
} | ||
) | ||
``` | ||
@@ -389,3 +391,13 @@ | ||
### shallowReadonly | ||
<details> | ||
<summary> | ||
⚠️ <code>shallowReadonly()</code> 会返回一个新的浅拷贝对象,在此之后新加的字段<b>将不会</b>获得只读或响应式状态。 | ||
</summary> | ||
> :bulb: 在 Vue 3 中,`shallowReadonly()` 会返回一个新的的代理对象 | ||
</details> | ||
### 缺失的 API | ||
@@ -396,3 +408,2 @@ | ||
- `readonly` | ||
- `shallowReadonly` | ||
- `defineAsyncComponent` | ||
@@ -403,6 +414,4 @@ - `onRenderTracked` | ||
- `isProxy` | ||
- `isReadonly` | ||
- `isVNode` | ||
### 在 `data()` 中使用组合式 API | ||
@@ -422,3 +431,3 @@ | ||
} | ||
}, | ||
} | ||
} | ||
@@ -425,0 +434,0 @@ ``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234867
4976
431
25
1