vue-mount-plugin 3.0.0 → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +0,0 @@
1
- var VueDemi=function(e,t,i){if(e.install)return e;if(!t)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if("2.7."===t.version.slice(0,4)){for(var n in t)e[n]=t[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=t,e.Vue2=t,e.version=t.version,e.warn=t.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=function(e,i){var n,o={},r={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(e,t){return o[e]=t,this},directive:function(e,i){return i?(t.directive(e,i),r):t.directive(e)},mount:function(r,s){return n||((n=new t(Object.assign({propsData:i},e,{provide:Object.assign(o,e.provide)}))).$mount(r,s),n)},unmount:function(){n&&(n.$destroy(),n=void 0)}};return r}}else if("2."===t.version.slice(0,2))if(i){for(var n in i)e[n]=i[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=t,e.Vue2=t,e.version=t.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if("3."===t.version.slice(0,2)){for(var n in t)e[n]=t[n];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=t,e.Vue2=void 0,e.version=t.version,e.set=function(e,t,i){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,i),i):(e[t]=i,i)},e.del=function(e,t){Array.isArray(e)?e.splice(t,1):delete e[t]}}else console.error("[vue-demi] Vue version "+t.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(void 0!==VueDemi?VueDemi:{}),this.Vue||("undefined"!=typeof Vue?Vue:void 0),this.VueCompositionAPI||("undefined"!=typeof VueCompositionAPI?VueCompositionAPI:void 0));
2
- /*!
3
- * vue-mount-plugin v3.0.0
4
- * A simple and easy to use vue instance extension plugin that supports vue2.0 and vue3.0
5
- * (c) 2021-2023 saqqdy <saqqdy@qq.com>
6
- * Released under the MIT License.
7
- */
8
- this.VueMount=function(e){"use strict";return class{vNode=null;target;options={};seed=1;constructor(e,t={}){if("undefined"==typeof document)throw new Error("This plugin works in browser");this.options=t,this.target=("string"==typeof t.target?document.querySelector(t.target):t.target)||document.createElement(t.tagName||"div"),this.vNode=this.createVM(e,t)}createVM(t,{props:i,children:n,patchFlag:o,dynamicProps:r,isBlockNode:s,app:u,context:d,parent:a}={}){let c;return e.isVue2?(c=new(e.Vue2.extend(Object.assign({},d||{},t)))({parent:a,propsData:i}),c.id="mount-plugin-"+this.seed++,c):(c=e.createVNode(t,i,n,o,r,s),u?._context&&(c.appContext=u._context),c)}mount(){!this.options.target&&document.body.appendChild(this.target),e.isVue2?this.vNode&&this.vNode.$mount(this.target):e.render(this.vNode,this.target)}unmount(){e.isVue2?(this.vNode.$destroy(),document.body.removeChild(this.vNode.$el)):(e.render(null,this.target),document.body.removeChild(this.target)),this.vNode=null,this.target=null}}}(VueDemi);