From cf3318a916d6499e0a5ce6da346dd763ff8b2eb6 Mon Sep 17 00:00:00 2001 From: Thorsten Date: Wed, 26 Dec 2018 15:57:28 +0100 Subject: [PATCH] beta.1 - forgot to build, Jesus! --- dist/portal-vue.js | 9 ++------- dist/portal-vue.js.map | 2 +- dist/portal-vue.min.js | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dist/portal-vue.js b/dist/portal-vue.js index 2cd7212..66be986 100644 --- a/dist/portal-vue.js +++ b/dist/portal-vue.js @@ -1,6 +1,6 @@ /* portal-vue - Version: 1.5.0 + Version: 1.5.1-beta.1 Licence: MIT (c) Thorsten Lünborg */ @@ -435,16 +435,11 @@ var PortalTarget = { ); } - // Solves a bug where Vue would sometimes duplicate elements upon changing multiple or disabled - var wrapperKey = this.ownTransports.length; - return noWrapper ? children[0] : h( Tag, babelHelperVueJsxMergeProps([{ 'class': 'vue-portal-target ' + this.transportedClasses.join(' ') - }, this.attributes, { - key: wrapperKey - }]), + }, this.attributes]), [children] ); } diff --git a/dist/portal-vue.js.map b/dist/portal-vue.js.map index 9692d9b..955980d 100644 --- a/dist/portal-vue.js.map +++ b/dist/portal-vue.js.map @@ -1 +1 @@ -{"version":3,"file":"portal-vue.js","sources":["../src/utils.js","../src/components/wormhole.js","../node_modules/babel-helper-vue-jsx-merge-props/index.js","../src/components/portal-target.js","../src/components/portal.js","../src/index.js"],"sourcesContent":["export function extractAttributes(el) {\n const map = el.hasAttributes() ? el.attributes : []\n const attrs = {}\n for (let i = 0; i < map.length; i++) {\n const attr = map[i]\n if (attr.value) {\n attrs[attr.name] = attr.value === '' ? true : attr.value\n }\n }\n let klass, style\n if (attrs.class) {\n klass = attrs.class\n delete attrs.class\n }\n if (attrs.style) {\n style = attrs.style\n delete attrs.style\n }\n const data = {\n attrs,\n class: klass,\n style,\n }\n return data\n}\n\nexport function freeze(item) {\n if (Array.isArray(item) || typeof item === 'object') {\n return Object.freeze(item)\n }\n return item\n}\n\nexport function combinePassengers(transports, slotProps = {}) {\n return transports.reduce((passengers, transport) => {\n let newPassengers = transport.passengers[0]\n newPassengers =\n typeof newPassengers === 'function'\n ? newPassengers(slotProps)\n : transport.passengers\n return passengers.concat(newPassengers)\n }, [])\n}\n\nexport function stableSort(array, compareFn) {\n return array\n .map((v, idx) => [idx, v])\n .sort(function (a,b) { return this(a[1], b[1]) || a[0] - b[0] }.bind(compareFn))\n .map(c => c[1])\n}\n","import Vue from 'vue'\nimport { combinePassengers, freeze, stableSort } from '../utils'\nconst transports = {}\n\nexport { transports }\n\nexport const Wormhole = Vue.extend({\n data: () => ({ transports }),\n methods: {\n open(transport) {\n const { to, from, passengers } = transport\n if (!to || !from || !passengers) return\n\n transport.passengers = freeze(passengers)\n const keys = Object.keys(this.transports)\n if (keys.indexOf(to) === -1) {\n Vue.set(this.transports, to, [])\n }\n\n const currentIndex = this.getTransportIndex(transport)\n // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays\n const newTransports = this.transports[to].slice(0)\n if (currentIndex === -1) {\n newTransports.push(transport)\n } else {\n newTransports[currentIndex] = transport\n }\n this.transports[to] = stableSort(newTransports, function(a, b) {\n return a.order - b.order\n })\n },\n\n close(transport, force = false) {\n const { to, from } = transport\n if (!to || !from) return\n if (!this.transports[to]) {\n return\n }\n\n if (force) {\n this.transports[to] = []\n } else {\n const index = this.getTransportIndex(transport)\n if (index >= 0) {\n // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays\n const newTransports = this.transports[to].slice(0)\n newTransports.splice(index, 1)\n this.transports[to] = newTransports\n }\n }\n },\n\n hasTarget(to) {\n return this.transports.hasOwnProperty(to)\n },\n\n hasContentFor(to) {\n if (!this.transports[to]) {\n return false\n }\n return this.getContentFor(to).length > 0\n },\n\n getSourceFor(to) {\n return this.transports[to] && this.transports[to][0].from\n },\n\n getContentFor(to) {\n const transports = this.transports[to]\n if (!transports) {\n return undefined\n }\n return combinePassengers(transports)\n },\n\n getTransportIndex({ to, from }) {\n for (const i in this.transports[to]) {\n if (this.transports[to][i].from === from) {\n return i\n }\n }\n return -1\n },\n },\n})\n\nconst wormhole = new Wormhole(transports)\nexport default wormhole\n","var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/\n\nmodule.exports = function mergeJSXProps (objs) {\n return objs.reduce(function (a, b) {\n var aa, bb, key, nestedKey, temp\n for (key in b) {\n aa = a[key]\n bb = b[key]\n if (aa && nestRE.test(key)) {\n // normalize class\n if (key === 'class') {\n if (typeof aa === 'string') {\n temp = aa\n a[key] = aa = {}\n aa[temp] = true\n }\n if (typeof bb === 'string') {\n temp = bb\n b[key] = bb = {}\n bb[temp] = true\n }\n }\n if (key === 'on' || key === 'nativeOn' || key === 'hook') {\n // merge functions\n for (nestedKey in bb) {\n aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey])\n }\n } else if (Array.isArray(aa)) {\n a[key] = aa.concat(bb)\n } else if (Array.isArray(bb)) {\n a[key] = [aa].concat(bb)\n } else {\n for (nestedKey in bb) {\n aa[nestedKey] = bb[nestedKey]\n }\n }\n } else {\n a[key] = b[key]\n }\n }\n return a\n }, {})\n}\n\nfunction mergeFn (a, b) {\n return function () {\n a && a.apply(this, arguments)\n b && b.apply(this, arguments)\n }\n}\n","// import { transports } from './wormhole'\nimport { combinePassengers } from '../utils'\nimport wormhole from './wormhole'\n\nexport default {\n abstract: false,\n name: 'portalTarget',\n props: {\n attributes: { type: Object, default: () => ({}) },\n multiple: { type: Boolean, default: false },\n name: { type: String, required: true },\n slim: { type: Boolean, default: false },\n slotProps: { type: Object, default: () => ({}) },\n tag: { type: String, default: 'div' },\n transition: { type: [Boolean, String, Object], default: false },\n transitionEvents: { type: Object, default: () => ({}) },\n },\n data() {\n return {\n transports: wormhole.transports,\n firstRender: true,\n }\n },\n created() {\n if (!this.transports[this.name]) {\n this.$set(this.transports, this.name, [])\n }\n },\n mounted() {\n this.unwatch = this.$watch('ownTransports', this.emitChange)\n this.$nextTick(() => {\n if (this.transition) {\n // only when we have a transition, because it causes a re-render\n this.firstRender = false\n }\n })\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n updated() {\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n beforeDestroy() {\n this.unwatch()\n },\n\n computed: {\n ownTransports() {\n const transports = this.transports[this.name] || []\n if (this.multiple) {\n return transports\n }\n return transports.length === 0 ? [] : [transports[transports.length - 1]]\n },\n passengers() {\n return combinePassengers(this.ownTransports, this.slotProps)\n },\n hasAttributes() {\n return Object.keys(this.attributes).length > 0\n },\n withTransition() {\n return !!this.transition\n },\n transitionData() {\n const t = this.transition\n const data = {}\n\n // During first render, we render a dumb transition without any classes, events and a fake name\n // We have to do this to emulate the normal behaviour of transitions without `appear`\n // because in Portals, transitions can behave as if appear was defined under certain conditions.\n if (\n this.firstRender &&\n (typeof this.transition === 'object' && !this.transition.appear)\n ) {\n data.props = { name: '__notranstition__portal-vue__' }\n return data\n }\n\n if (typeof t === 'string') {\n data.props = { name: t }\n } else if (typeof t === 'object') {\n data.props = t\n }\n if (this.renderSlim) {\n data.props.tag = this.tag\n }\n data.on = this.transitionEvents\n\n return data\n },\n transportedClasses() {\n return this.ownTransports\n .map(transport => transport.class)\n .reduce((array, subarray) => array.concat(subarray), [])\n //.filter((string, index, array) => array.indexOf(string) === index)\n },\n },\n\n methods: {\n emitChange(newTransports, oldTransports) {\n if (this.multiple) {\n this.$emit('change', [...newTransports], [...oldTransports])\n } else {\n const newTransport =\n newTransports.length === 0 ? undefined : newTransports[0]\n const oldTransport =\n oldTransports.length === 0 ? undefined : oldTransports[0]\n this.$emit('change', { ...newTransport }, { ...oldTransport })\n }\n },\n // can't be a computed prop because it has to \"react\" to $slot changes.\n children() {\n return this.passengers.length !== 0\n ? this.passengers\n : this.$slots.default || []\n },\n noWrapper() {\n const noWrapper = !this.hasAttributes && this.slim\n if (noWrapper && this.children().length > 1) {\n console.warn(\n '[portal-vue]: PortalTarget with `slim` option received more than one child element.'\n )\n }\n return noWrapper\n },\n },\n render(h) {\n this.$options.abstract = true\n const noWrapper = this.noWrapper()\n const children = this.children()\n const TransitionType = noWrapper ? 'transition' : 'transition-group'\n const Tag = this.tag\n\n if (this.withTransition) {\n return (\n \n {children}\n \n )\n }\n\n // Solves a bug where Vue would sometimes duplicate elements upon changing multiple or disabled\n const wrapperKey = this.ownTransports.length\n\n return noWrapper ? (\n children[0]\n ) : (\n \n {children}\n \n )\n },\n}\n","import Vue from 'vue'\nimport wormhole from './wormhole'\nimport Target from './portal-target'\nimport { extractAttributes } from '../utils'\n\nconst inBrowser = typeof window !== 'undefined'\n\nlet pid = 1\n\nexport default {\n abstract: false,\n name: 'portal',\n props: {\n /* global HTMLElement */\n disabled: { type: Boolean, default: false },\n name: { type: String, default: () => String(pid++) },\n order: { type: Number, default: 0 },\n slim: { type: Boolean, default: false },\n slotProps: { type: Object, default: () => ({}) },\n tag: { type: [String], default: 'DIV' },\n targetEl: { type: inBrowser ? [String, HTMLElement] : String },\n targetClass: { type: String },\n to: {\n type: String,\n default: () => String(Math.round(Math.random() * 10000000)),\n },\n },\n\n mounted() {\n if (this.targetEl) {\n this.mountToTarget()\n }\n if (!this.disabled) {\n this.sendUpdate()\n }\n // Reset hack to make child components skip the portal when defining their $parent\n // was set to true during render when we render something locally.\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n\n updated() {\n if (this.disabled) {\n this.clear()\n } else {\n this.sendUpdate()\n }\n // Reset hack to make child components skip the portal when defining their $parent\n // was set to true during render when we render something locally.\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n\n beforeDestroy() {\n this.clear()\n if (this.mountedComp) {\n this.mountedComp.$destroy()\n }\n },\n watch: {\n to(newValue, oldValue) {\n oldValue && oldValue !== newValue && this.clear(oldValue)\n this.sendUpdate()\n },\n targetEl(newValue, oldValue) {\n if (newValue) {\n this.mountToTarget()\n }\n },\n },\n\n methods: {\n normalizedSlots() {\n return this.$scopedSlots.default\n ? [this.$scopedSlots.default]\n : this.$slots.default\n },\n sendUpdate() {\n const slotContent = this.normalizedSlots()\n\n if (slotContent) {\n wormhole.open({\n from: this.name,\n to: this.to,\n passengers: [...slotContent],\n class: this.targetClass && this.targetClass.split(' '),\n order: this.order,\n })\n } else {\n this.clear()\n }\n },\n\n clear(target) {\n wormhole.close({\n from: this.name,\n to: target || this.to,\n })\n },\n\n mountToTarget() {\n let el\n const target = this.targetEl\n\n if (typeof target === 'string') {\n el = document.querySelector(target)\n } else if (target instanceof HTMLElement) {\n el = target\n } else {\n console.warn(\n '[vue-portal]: value of targetEl must be of type String or HTMLElement'\n )\n return\n }\n\n if (el) {\n const newTarget = new Vue({\n ...Target,\n parent: this,\n propsData: {\n name: this.to,\n tag: el.tagName,\n attributes: extractAttributes(el),\n },\n })\n newTarget.$mount(el)\n this.mountedComp = newTarget\n } else {\n console.warn(\n '[vue-portal]: The specified targetEl ' + target + ' was not found'\n )\n }\n },\n normalizeChildren(children) {\n return typeof children === 'function'\n ? children(this.slotProps)\n : children\n },\n },\n\n render(h) {\n const children = this.$slots.default || this.$scopedSlots.default || []\n const Tag = this.tag\n if (children.length && this.disabled) {\n // hack to make child components skip the portal when defining their $parent\n this.$options.abstract = true\n return children.length <= 1 && this.slim ? (\n children[0]\n ) : (\n {this.normalizeChildren(children)}\n )\n } else {\n return (\n \n )\n // h(this.tag, { class: { 'v-portal': true }, style: { display: 'none' }, key: 'v-portal-placeholder' })\n }\n },\n}\n","import Portal from './components/portal.js'\nimport PortalTarget from './components/portal-target.js'\nimport Wormhole from './components/wormhole.js'\n\nfunction install(Vue, opts = {}) {\n Vue.component(opts.portalName || 'Portal', Portal)\n Vue.component(opts.portalTargetName || 'PortalTarget', PortalTarget)\n}\nif (typeof window !== 'undefined' && window.Vue) {\n window.Vue.use({ install: install })\n}\n\nexport default {\n install,\n Portal,\n PortalTarget,\n Wormhole,\n}\n"],"names":["extractAttributes","el","map","hasAttributes","attributes","attrs","i","length","attr","value","name","klass","style","class","data","freeze","item","Array","isArray","Object","combinePassengers","transports","slotProps","reduce","passengers","transport","newPassengers","concat","stableSort","array","compareFn","v","idx","sort","a","b","bind","c","Wormhole","Vue","extend","to","from","keys","indexOf","set","currentIndex","getTransportIndex","newTransports","slice","push","order","force","index","splice","hasOwnProperty","getContentFor","undefined","wormhole","type","default","Boolean","String","required","$set","unwatch","$watch","emitChange","$nextTick","transition","firstRender","$options","abstract","multiple","ownTransports","t","babelHelpers.typeof","appear","props","renderSlim","tag","on","transitionEvents","subarray","oldTransports","$emit","newTransport","oldTransport","$slots","noWrapper","slim","children","warn","h","TransitionType","Tag","withTransition","transitionData","wrapperKey","transportedClasses","join","inBrowser","window","pid","Number","HTMLElement","Math","round","random","targetEl","mountToTarget","disabled","sendUpdate","clear","mountedComp","$destroy","newValue","oldValue","$scopedSlots","slotContent","normalizedSlots","open","targetClass","split","target","close","document","querySelector","newTarget","Target","tagName","$mount","normalizeChildren","install","opts","component","portalName","Portal","portalTargetName","PortalTarget","use"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,iBAAT,CAA2BC,EAA3B,EAA+B;MAC9BC,MAAMD,GAAGE,aAAH,KAAqBF,GAAGG,UAAxB,GAAqC,EAAjD;MACMC,QAAQ,EAAd;OACK,IAAIC,IAAI,CAAb,EAAgBA,IAAIJ,IAAIK,MAAxB,EAAgCD,GAAhC,EAAqC;QAC7BE,OAAON,IAAII,CAAJ,CAAb;QACIE,KAAKC,KAAT,EAAgB;YACRD,KAAKE,IAAX,IAAmBF,KAAKC,KAAL,KAAe,EAAf,GAAoB,IAApB,GAA2BD,KAAKC,KAAnD;;;MAGAE,cAAJ;MAAWC,cAAX;MACIP,MAAMQ,KAAV,EAAiB;YACPR,MAAMQ,KAAd;WACOR,MAAMQ,KAAb;;MAEER,MAAMO,KAAV,EAAiB;YACPP,MAAMO,KAAd;WACOP,MAAMO,KAAb;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/components/wormhole.js","../node_modules/babel-helper-vue-jsx-merge-props/index.js","../src/components/portal-target.js","../src/components/portal.js","../src/index.js"],"sourcesContent":["export function extractAttributes(el) {\n const map = el.hasAttributes() ? el.attributes : []\n const attrs = {}\n for (let i = 0; i < map.length; i++) {\n const attr = map[i]\n if (attr.value) {\n attrs[attr.name] = attr.value === '' ? true : attr.value\n }\n }\n let klass, style\n if (attrs.class) {\n klass = attrs.class\n delete attrs.class\n }\n if (attrs.style) {\n style = attrs.style\n delete attrs.style\n }\n const data = {\n attrs,\n class: klass,\n style,\n }\n return data\n}\n\nexport function freeze(item) {\n if (Array.isArray(item) || typeof item === 'object') {\n return Object.freeze(item)\n }\n return item\n}\n\nexport function combinePassengers(transports, slotProps = {}) {\n return transports.reduce((passengers, transport) => {\n let newPassengers = transport.passengers[0]\n newPassengers =\n typeof newPassengers === 'function'\n ? newPassengers(slotProps)\n : transport.passengers\n return passengers.concat(newPassengers)\n }, [])\n}\n\nexport function stableSort(array, compareFn) {\n return array\n .map((v, idx) => [idx, v])\n .sort(function (a,b) { return this(a[1], b[1]) || a[0] - b[0] }.bind(compareFn))\n .map(c => c[1])\n}\n","import Vue from 'vue'\nimport { combinePassengers, freeze, stableSort } from '../utils'\nconst transports = {}\n\nexport { transports }\n\nexport const Wormhole = Vue.extend({\n data: () => ({ transports }),\n methods: {\n open(transport) {\n const { to, from, passengers } = transport\n if (!to || !from || !passengers) return\n\n transport.passengers = freeze(passengers)\n const keys = Object.keys(this.transports)\n if (keys.indexOf(to) === -1) {\n Vue.set(this.transports, to, [])\n }\n\n const currentIndex = this.getTransportIndex(transport)\n // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays\n const newTransports = this.transports[to].slice(0)\n if (currentIndex === -1) {\n newTransports.push(transport)\n } else {\n newTransports[currentIndex] = transport\n }\n this.transports[to] = stableSort(newTransports, function(a, b) {\n return a.order - b.order\n })\n },\n\n close(transport, force = false) {\n const { to, from } = transport\n if (!to || !from) return\n if (!this.transports[to]) {\n return\n }\n\n if (force) {\n this.transports[to] = []\n } else {\n const index = this.getTransportIndex(transport)\n if (index >= 0) {\n // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays\n const newTransports = this.transports[to].slice(0)\n newTransports.splice(index, 1)\n this.transports[to] = newTransports\n }\n }\n },\n\n hasTarget(to) {\n return this.transports.hasOwnProperty(to)\n },\n\n hasContentFor(to) {\n if (!this.transports[to]) {\n return false\n }\n return this.getContentFor(to).length > 0\n },\n\n getSourceFor(to) {\n return this.transports[to] && this.transports[to][0].from\n },\n\n getContentFor(to) {\n const transports = this.transports[to]\n if (!transports) {\n return undefined\n }\n return combinePassengers(transports)\n },\n\n getTransportIndex({ to, from }) {\n for (const i in this.transports[to]) {\n if (this.transports[to][i].from === from) {\n return i\n }\n }\n return -1\n },\n },\n})\n\nconst wormhole = new Wormhole(transports)\nexport default wormhole\n","var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/\n\nmodule.exports = function mergeJSXProps (objs) {\n return objs.reduce(function (a, b) {\n var aa, bb, key, nestedKey, temp\n for (key in b) {\n aa = a[key]\n bb = b[key]\n if (aa && nestRE.test(key)) {\n // normalize class\n if (key === 'class') {\n if (typeof aa === 'string') {\n temp = aa\n a[key] = aa = {}\n aa[temp] = true\n }\n if (typeof bb === 'string') {\n temp = bb\n b[key] = bb = {}\n bb[temp] = true\n }\n }\n if (key === 'on' || key === 'nativeOn' || key === 'hook') {\n // merge functions\n for (nestedKey in bb) {\n aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey])\n }\n } else if (Array.isArray(aa)) {\n a[key] = aa.concat(bb)\n } else if (Array.isArray(bb)) {\n a[key] = [aa].concat(bb)\n } else {\n for (nestedKey in bb) {\n aa[nestedKey] = bb[nestedKey]\n }\n }\n } else {\n a[key] = b[key]\n }\n }\n return a\n }, {})\n}\n\nfunction mergeFn (a, b) {\n return function () {\n a && a.apply(this, arguments)\n b && b.apply(this, arguments)\n }\n}\n","// import { transports } from './wormhole'\nimport { combinePassengers } from '../utils'\nimport wormhole from './wormhole'\n\nexport default {\n abstract: false,\n name: 'portalTarget',\n props: {\n attributes: { type: Object, default: () => ({}) },\n multiple: { type: Boolean, default: false },\n name: { type: String, required: true },\n slim: { type: Boolean, default: false },\n slotProps: { type: Object, default: () => ({}) },\n tag: { type: String, default: 'div' },\n transition: { type: [Boolean, String, Object], default: false },\n transitionEvents: { type: Object, default: () => ({}) },\n },\n data() {\n return {\n transports: wormhole.transports,\n firstRender: true,\n }\n },\n created() {\n if (!this.transports[this.name]) {\n this.$set(this.transports, this.name, [])\n }\n },\n mounted() {\n this.unwatch = this.$watch('ownTransports', this.emitChange)\n this.$nextTick(() => {\n if (this.transition) {\n // only when we have a transition, because it causes a re-render\n this.firstRender = false\n }\n })\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n updated() {\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n beforeDestroy() {\n this.unwatch()\n },\n\n computed: {\n ownTransports() {\n const transports = this.transports[this.name] || []\n if (this.multiple) {\n return transports\n }\n return transports.length === 0 ? [] : [transports[transports.length - 1]]\n },\n passengers() {\n return combinePassengers(this.ownTransports, this.slotProps)\n },\n hasAttributes() {\n return Object.keys(this.attributes).length > 0\n },\n withTransition() {\n return !!this.transition\n },\n transitionData() {\n const t = this.transition\n const data = {}\n\n // During first render, we render a dumb transition without any classes, events and a fake name\n // We have to do this to emulate the normal behaviour of transitions without `appear`\n // because in Portals, transitions can behave as if appear was defined under certain conditions.\n if (\n this.firstRender &&\n (typeof this.transition === 'object' && !this.transition.appear)\n ) {\n data.props = { name: '__notranstition__portal-vue__' }\n return data\n }\n\n if (typeof t === 'string') {\n data.props = { name: t }\n } else if (typeof t === 'object') {\n data.props = t\n }\n if (this.renderSlim) {\n data.props.tag = this.tag\n }\n data.on = this.transitionEvents\n\n return data\n },\n transportedClasses() {\n return this.ownTransports\n .map(transport => transport.class)\n .reduce((array, subarray) => array.concat(subarray), [])\n //.filter((string, index, array) => array.indexOf(string) === index)\n },\n },\n\n methods: {\n emitChange(newTransports, oldTransports) {\n if (this.multiple) {\n this.$emit('change', [...newTransports], [...oldTransports])\n } else {\n const newTransport =\n newTransports.length === 0 ? undefined : newTransports[0]\n const oldTransport =\n oldTransports.length === 0 ? undefined : oldTransports[0]\n this.$emit('change', { ...newTransport }, { ...oldTransport })\n }\n },\n // can't be a computed prop because it has to \"react\" to $slot changes.\n children() {\n return this.passengers.length !== 0\n ? this.passengers\n : this.$slots.default || []\n },\n noWrapper() {\n const noWrapper = !this.hasAttributes && this.slim\n if (noWrapper && this.children().length > 1) {\n console.warn(\n '[portal-vue]: PortalTarget with `slim` option received more than one child element.'\n )\n }\n return noWrapper\n },\n },\n render(h) {\n this.$options.abstract = true\n const noWrapper = this.noWrapper()\n const children = this.children()\n const TransitionType = noWrapper ? 'transition' : 'transition-group'\n const Tag = this.tag\n\n if (this.withTransition) {\n return (\n \n {children}\n \n )\n }\n\n return noWrapper ? (\n children[0]\n ) : (\n \n {children}\n \n )\n },\n}\n","import Vue from 'vue'\nimport wormhole from './wormhole'\nimport Target from './portal-target'\nimport { extractAttributes } from '../utils'\n\nconst inBrowser = typeof window !== 'undefined'\n\nlet pid = 1\n\nexport default {\n abstract: false,\n name: 'portal',\n props: {\n /* global HTMLElement */\n disabled: { type: Boolean, default: false },\n name: { type: String, default: () => String(pid++) },\n order: { type: Number, default: 0 },\n slim: { type: Boolean, default: false },\n slotProps: { type: Object, default: () => ({}) },\n tag: { type: [String], default: 'DIV' },\n targetEl: { type: inBrowser ? [String, HTMLElement] : String },\n targetClass: { type: String },\n to: {\n type: String,\n default: () => String(Math.round(Math.random() * 10000000)),\n },\n },\n\n mounted() {\n if (this.targetEl) {\n this.mountToTarget()\n }\n if (!this.disabled) {\n this.sendUpdate()\n }\n // Reset hack to make child components skip the portal when defining their $parent\n // was set to true during render when we render something locally.\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n\n updated() {\n if (this.disabled) {\n this.clear()\n } else {\n this.sendUpdate()\n }\n // Reset hack to make child components skip the portal when defining their $parent\n // was set to true during render when we render something locally.\n if (this.$options.abstract) {\n this.$options.abstract = false\n }\n },\n\n beforeDestroy() {\n this.clear()\n if (this.mountedComp) {\n this.mountedComp.$destroy()\n }\n },\n watch: {\n to(newValue, oldValue) {\n oldValue && oldValue !== newValue && this.clear(oldValue)\n this.sendUpdate()\n },\n targetEl(newValue, oldValue) {\n if (newValue) {\n this.mountToTarget()\n }\n },\n },\n\n methods: {\n normalizedSlots() {\n return this.$scopedSlots.default\n ? [this.$scopedSlots.default]\n : this.$slots.default\n },\n sendUpdate() {\n const slotContent = this.normalizedSlots()\n\n if (slotContent) {\n wormhole.open({\n from: this.name,\n to: this.to,\n passengers: [...slotContent],\n class: this.targetClass && this.targetClass.split(' '),\n order: this.order,\n })\n } else {\n this.clear()\n }\n },\n\n clear(target) {\n wormhole.close({\n from: this.name,\n to: target || this.to,\n })\n },\n\n mountToTarget() {\n let el\n const target = this.targetEl\n\n if (typeof target === 'string') {\n el = document.querySelector(target)\n } else if (target instanceof HTMLElement) {\n el = target\n } else {\n console.warn(\n '[vue-portal]: value of targetEl must be of type String or HTMLElement'\n )\n return\n }\n\n if (el) {\n const newTarget = new Vue({\n ...Target,\n parent: this,\n propsData: {\n name: this.to,\n tag: el.tagName,\n attributes: extractAttributes(el),\n },\n })\n newTarget.$mount(el)\n this.mountedComp = newTarget\n } else {\n console.warn(\n '[vue-portal]: The specified targetEl ' + target + ' was not found'\n )\n }\n },\n normalizeChildren(children) {\n return typeof children === 'function'\n ? children(this.slotProps)\n : children\n },\n },\n\n render(h) {\n const children = this.$slots.default || this.$scopedSlots.default || []\n const Tag = this.tag\n if (children.length && this.disabled) {\n // hack to make child components skip the portal when defining their $parent\n this.$options.abstract = true\n return children.length <= 1 && this.slim ? (\n children[0]\n ) : (\n {this.normalizeChildren(children)}\n )\n } else {\n return (\n \n )\n // h(this.tag, { class: { 'v-portal': true }, style: { display: 'none' }, key: 'v-portal-placeholder' })\n }\n },\n}\n","import Portal from './components/portal.js'\nimport PortalTarget from './components/portal-target.js'\nimport Wormhole from './components/wormhole.js'\n\nfunction install(Vue, opts = {}) {\n Vue.component(opts.portalName || 'Portal', Portal)\n Vue.component(opts.portalTargetName || 'PortalTarget', PortalTarget)\n}\nif (typeof window !== 'undefined' && window.Vue) {\n window.Vue.use({ install: install })\n}\n\nexport default {\n install,\n Portal,\n PortalTarget,\n Wormhole,\n}\n"],"names":["extractAttributes","el","map","hasAttributes","attributes","attrs","i","length","attr","value","name","klass","style","class","data","freeze","item","Array","isArray","Object","combinePassengers","transports","slotProps","reduce","passengers","transport","newPassengers","concat","stableSort","array","compareFn","v","idx","sort","a","b","bind","c","Wormhole","Vue","extend","to","from","keys","indexOf","set","currentIndex","getTransportIndex","newTransports","slice","push","order","force","index","splice","hasOwnProperty","getContentFor","undefined","wormhole","type","default","Boolean","String","required","$set","unwatch","$watch","emitChange","$nextTick","transition","firstRender","$options","abstract","multiple","ownTransports","t","babelHelpers.typeof","appear","props","renderSlim","tag","on","transitionEvents","subarray","oldTransports","$emit","newTransport","oldTransport","$slots","noWrapper","slim","children","warn","h","TransitionType","Tag","withTransition","transitionData","transportedClasses","join","inBrowser","window","pid","Number","HTMLElement","Math","round","random","targetEl","mountToTarget","disabled","sendUpdate","clear","mountedComp","$destroy","newValue","oldValue","$scopedSlots","slotContent","normalizedSlots","open","targetClass","split","target","close","document","querySelector","newTarget","Target","tagName","$mount","normalizeChildren","install","opts","component","portalName","Portal","portalTargetName","PortalTarget","use"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,iBAAT,CAA2BC,EAA3B,EAA+B;MAC9BC,MAAMD,GAAGE,aAAH,KAAqBF,GAAGG,UAAxB,GAAqC,EAAjD;MACMC,QAAQ,EAAd;OACK,IAAIC,IAAI,CAAb,EA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AA3C;SACIF,SAAJ,CAAcD,KAAKI,gBAAL,IAAyB,cAAvC,EAAuDC,YAAvD;;AAEF,IAAI,OAAOrC,MAAP,KAAkB,WAAlB,IAAiCA,OAAO9D,GAA5C,EAAiD;SACxCA,GAAP,CAAWoG,GAAX,CAAe,EAAEP,SAASA,OAAX,EAAf;;;AAGF,YAAe;kBAAA;gBAAA;4BAAA;;CAAf;;;;;;;;"} \ No newline at end of file diff --git a/dist/portal-vue.min.js b/dist/portal-vue.min.js index ddbfb39..d5cfa52 100644 --- a/dist/portal-vue.min.js +++ b/dist/portal-vue.min.js @@ -1 +1 @@ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("vue")):"function"==typeof define&&define.amd?define(["vue"],n):t.PortalVue=n(t.Vue)}(this,function(t){"use strict";function n(t){for(var n=t.hasAttributes()?t.attributes:[],e={},r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return t.reduce(function(t,e){var r=e.passengers[0];return r="function"==typeof r?r(n):e.passengers,t.concat(r)},[])}function s(t,n){return t.map(function(t,n){return[n,t]}).sort(function(t,n){return this(t[1],n[1])||t[0]-n[0]}.bind(n)).map(function(t){return t[1]})}function o(t,n){return function(){t&&t.apply(this,arguments),n&&n.apply(this,arguments)}}function i(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.component(n.portalName||"Portal",v),t.component(n.portalTargetName||"PortalTarget",g)}t=t&&t.hasOwnProperty("default")?t.default:t;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=Object.assign||function(t){for(var n=1;n1&&void 0!==arguments[1]&&arguments[1],e=t.to,r=t.from;if(e&&r&&this.transports[e])if(n)this.transports[e]=[];else{var s=this.getTransportIndex(t);if(s>=0){var o=this.transports[e].slice(0);o.splice(s,1),this.transports[e]=o}}},hasTarget:function(t){return this.transports.hasOwnProperty(t)},hasContentFor:function(t){return!!this.transports[t]&&this.getContentFor(t).length>0},getSourceFor:function(t){return this.transports[t]&&this.transports[t][0].from},getContentFor:function(t){var n=this.transports[t];if(n)return r(n)},getTransportIndex:function(t){var n=t.to,e=t.from;for(var r in this.transports[n])if(this.transports[n][r].from===e)return r;return-1}}}),c=new p(h),f=/^(attrs|props|on|nativeOn|class|style|hook)$/,d=function(t){return t.reduce(function(t,n){var e,r,s,i,a;for(s in n)if(e=t[s],r=n[s],e&&f.test(s))if("class"===s&&("string"==typeof e&&(a=e,t[s]=e={},e[a]=!0),"string"==typeof r&&(a=r,n[s]=r={},r[a]=!0)),"on"===s||"nativeOn"===s||"hook"===s)for(i in r)e[i]=o(e[i],r[i]);else if(Array.isArray(e))t[s]=e.concat(r);else if(Array.isArray(r))t[s]=[e].concat(r);else for(i in r)e[i]=r[i];else t[s]=n[s];return t},{})},g={abstract:!1,name:"portalTarget",props:{attributes:{type:Object,default:function(){return{}}},multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[Boolean,String,Object],default:!1},transitionEvents:{type:Object,default:function(){return{}}}},data:function(){return{transports:c.transports,firstRender:!0}},created:function(){this.transports[this.name]||this.$set(this.transports,this.name,[])},mounted:function(){var t=this;this.unwatch=this.$watch("ownTransports",this.emitChange),this.$nextTick(function(){t.transition&&(t.firstRender=!1)}),this.$options.abstract&&(this.$options.abstract=!1)},updated:function(){this.$options.abstract&&(this.$options.abstract=!1)},beforeDestroy:function(){this.unwatch()},computed:{ownTransports:function(){var t=this.transports[this.name]||[];return this.multiple?t:0===t.length?[]:[t[t.length-1]]},passengers:function(){return r(this.ownTransports,this.slotProps)},hasAttributes:function(){return Object.keys(this.attributes).length>0},withTransition:function(){return!!this.transition},transitionData:function(){var t=this.transition,n={};return this.firstRender&&"object"===a(this.transition)&&!this.transition.appear?(n.props={name:"__notranstition__portal-vue__"},n):("string"==typeof t?n.props={name:t}:"object"===(void 0===t?"undefined":a(t))&&(n.props=t),this.renderSlim&&(n.props.tag=this.tag),n.on=this.transitionEvents,n)},transportedClasses:function(){return this.ownTransports.map(function(t){return t.class}).reduce(function(t,n){return t.concat(n)},[])}},methods:{emitChange:function(t,n){if(this.multiple)this.$emit("change",[].concat(l(t)),[].concat(l(n)));else{var e=0===t.length?void 0:t[0],r=0===n.length?void 0:n[0];this.$emit("change",u({},e),u({},r))}},children:function(){return 0!==this.passengers.length?this.passengers:this.$slots.default||[]},noWrapper:function(){var t=!this.hasAttributes&&this.slim;return t&&this.children().length>1&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),t}},render:function(t){this.$options.abstract=!0;var n=this.noWrapper(),e=this.children(),r=n?"transition":"transition-group",s=this.tag;if(this.withTransition)return t(r,d([this.transitionData,{class:"vue-portal-target"}]),[e]);var o=this.ownTransports.length;return n?e[0]:t(s,d([{class:"vue-portal-target "+this.transportedClasses.join(" ")},this.attributes,{key:o}]),[e])}},m="undefined"!=typeof window,y=1,v={abstract:!1,name:"portal",props:{disabled:{type:Boolean,default:!1},name:{type:String,default:function(){return String(y++)}},order:{type:Number,default:0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:[String],default:"DIV"},targetEl:{type:m?[String,HTMLElement]:String},targetClass:{type:String},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},mounted:function(){this.targetEl&&this.mountToTarget(),this.disabled||this.sendUpdate(),this.$options.abstract&&(this.$options.abstract=!1)},updated:function(){this.disabled?this.clear():this.sendUpdate(),this.$options.abstract&&(this.$options.abstract=!1)},beforeDestroy:function(){this.clear(),this.mountedComp&&this.mountedComp.$destroy()},watch:{to:function(t,n){n&&n!==t&&this.clear(n),this.sendUpdate()},targetEl:function(t,n){t&&this.mountToTarget()}},methods:{normalizedSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},sendUpdate:function(){var t=this.normalizedSlots();t?c.open({from:this.name,to:this.to,passengers:[].concat(l(t)),class:this.targetClass&&this.targetClass.split(" "),order:this.order}):this.clear()},clear:function(t){c.close({from:this.name,to:t||this.to})},mountToTarget:function(){var e=void 0,r=this.targetEl;if("string"==typeof r)e=document.querySelector(r);else{if(!(r instanceof HTMLElement))return void console.warn("[vue-portal]: value of targetEl must be of type String or HTMLElement");e=r}if(e){var s=new t(u({},g,{parent:this,propsData:{name:this.to,tag:e.tagName,attributes:n(e)}}));s.$mount(e),this.mountedComp=s}else console.warn("[vue-portal]: The specified targetEl "+r+" was not found")},normalizeChildren:function(t){return"function"==typeof t?t(this.slotProps):t}},render:function(t){var n=this.$slots.default||this.$scopedSlots.default||[],e=this.tag;return n.length&&this.disabled?(this.$options.abstract=!0,n.length<=1&&this.slim?n[0]:t(e,[this.normalizeChildren(n)])):t(e,{class:"v-portal",style:"display: none",key:"v-portal-placeholder"})}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use({install:i}),{install:i,Portal:v,PortalTarget:g,Wormhole:c}}); +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("vue")):"function"==typeof define&&define.amd?define(["vue"],n):t.PortalVue=n(t.Vue)}(this,function(t){"use strict";function n(t){for(var n=t.hasAttributes()?t.attributes:[],e={},r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return t.reduce(function(t,e){var r=e.passengers[0];return r="function"==typeof r?r(n):e.passengers,t.concat(r)},[])}function s(t,n){return t.map(function(t,n){return[n,t]}).sort(function(t,n){return this(t[1],n[1])||t[0]-n[0]}.bind(n)).map(function(t){return t[1]})}function o(t,n){return function(){t&&t.apply(this,arguments),n&&n.apply(this,arguments)}}function i(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.component(n.portalName||"Portal",v),t.component(n.portalTargetName||"PortalTarget",m)}t=t&&t.hasOwnProperty("default")?t.default:t;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=Object.assign||function(t){for(var n=1;n1&&void 0!==arguments[1]&&arguments[1],e=t.to,r=t.from;if(e&&r&&this.transports[e])if(n)this.transports[e]=[];else{var s=this.getTransportIndex(t);if(s>=0){var o=this.transports[e].slice(0);o.splice(s,1),this.transports[e]=o}}},hasTarget:function(t){return this.transports.hasOwnProperty(t)},hasContentFor:function(t){return!!this.transports[t]&&this.getContentFor(t).length>0},getSourceFor:function(t){return this.transports[t]&&this.transports[t][0].from},getContentFor:function(t){var n=this.transports[t];if(n)return r(n)},getTransportIndex:function(t){var n=t.to,e=t.from;for(var r in this.transports[n])if(this.transports[n][r].from===e)return r;return-1}}}),h=new c(p),f=/^(attrs|props|on|nativeOn|class|style|hook)$/,d=function(t){return t.reduce(function(t,n){var e,r,s,i,a;for(s in n)if(e=t[s],r=n[s],e&&f.test(s))if("class"===s&&("string"==typeof e&&(a=e,t[s]=e={},e[a]=!0),"string"==typeof r&&(a=r,n[s]=r={},r[a]=!0)),"on"===s||"nativeOn"===s||"hook"===s)for(i in r)e[i]=o(e[i],r[i]);else if(Array.isArray(e))t[s]=e.concat(r);else if(Array.isArray(r))t[s]=[e].concat(r);else for(i in r)e[i]=r[i];else t[s]=n[s];return t},{})},m={abstract:!1,name:"portalTarget",props:{attributes:{type:Object,default:function(){return{}}},multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[Boolean,String,Object],default:!1},transitionEvents:{type:Object,default:function(){return{}}}},data:function(){return{transports:h.transports,firstRender:!0}},created:function(){this.transports[this.name]||this.$set(this.transports,this.name,[])},mounted:function(){var t=this;this.unwatch=this.$watch("ownTransports",this.emitChange),this.$nextTick(function(){t.transition&&(t.firstRender=!1)}),this.$options.abstract&&(this.$options.abstract=!1)},updated:function(){this.$options.abstract&&(this.$options.abstract=!1)},beforeDestroy:function(){this.unwatch()},computed:{ownTransports:function(){var t=this.transports[this.name]||[];return this.multiple?t:0===t.length?[]:[t[t.length-1]]},passengers:function(){return r(this.ownTransports,this.slotProps)},hasAttributes:function(){return Object.keys(this.attributes).length>0},withTransition:function(){return!!this.transition},transitionData:function(){var t=this.transition,n={};return this.firstRender&&"object"===a(this.transition)&&!this.transition.appear?(n.props={name:"__notranstition__portal-vue__"},n):("string"==typeof t?n.props={name:t}:"object"===(void 0===t?"undefined":a(t))&&(n.props=t),this.renderSlim&&(n.props.tag=this.tag),n.on=this.transitionEvents,n)},transportedClasses:function(){return this.ownTransports.map(function(t){return t.class}).reduce(function(t,n){return t.concat(n)},[])}},methods:{emitChange:function(t,n){if(this.multiple)this.$emit("change",[].concat(l(t)),[].concat(l(n)));else{var e=0===t.length?void 0:t[0],r=0===n.length?void 0:n[0];this.$emit("change",u({},e),u({},r))}},children:function(){return 0!==this.passengers.length?this.passengers:this.$slots.default||[]},noWrapper:function(){var t=!this.hasAttributes&&this.slim;return t&&this.children().length>1&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),t}},render:function(t){this.$options.abstract=!0;var n=this.noWrapper(),e=this.children(),r=n?"transition":"transition-group",s=this.tag;return this.withTransition?t(r,d([this.transitionData,{class:"vue-portal-target"}]),[e]):n?e[0]:t(s,d([{class:"vue-portal-target "+this.transportedClasses.join(" ")},this.attributes]),[e])}},g="undefined"!=typeof window,y=1,v={abstract:!1,name:"portal",props:{disabled:{type:Boolean,default:!1},name:{type:String,default:function(){return String(y++)}},order:{type:Number,default:0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:[String],default:"DIV"},targetEl:{type:g?[String,HTMLElement]:String},targetClass:{type:String},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},mounted:function(){this.targetEl&&this.mountToTarget(),this.disabled||this.sendUpdate(),this.$options.abstract&&(this.$options.abstract=!1)},updated:function(){this.disabled?this.clear():this.sendUpdate(),this.$options.abstract&&(this.$options.abstract=!1)},beforeDestroy:function(){this.clear(),this.mountedComp&&this.mountedComp.$destroy()},watch:{to:function(t,n){n&&n!==t&&this.clear(n),this.sendUpdate()},targetEl:function(t,n){t&&this.mountToTarget()}},methods:{normalizedSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},sendUpdate:function(){var t=this.normalizedSlots();t?h.open({from:this.name,to:this.to,passengers:[].concat(l(t)),class:this.targetClass&&this.targetClass.split(" "),order:this.order}):this.clear()},clear:function(t){h.close({from:this.name,to:t||this.to})},mountToTarget:function(){var e=void 0,r=this.targetEl;if("string"==typeof r)e=document.querySelector(r);else{if(!(r instanceof HTMLElement))return void console.warn("[vue-portal]: value of targetEl must be of type String or HTMLElement");e=r}if(e){var s=new t(u({},m,{parent:this,propsData:{name:this.to,tag:e.tagName,attributes:n(e)}}));s.$mount(e),this.mountedComp=s}else console.warn("[vue-portal]: The specified targetEl "+r+" was not found")},normalizeChildren:function(t){return"function"==typeof t?t(this.slotProps):t}},render:function(t){var n=this.$slots.default||this.$scopedSlots.default||[],e=this.tag;return n.length&&this.disabled?(this.$options.abstract=!0,n.length<=1&&this.slim?n[0]:t(e,[this.normalizeChildren(n)])):t(e,{class:"v-portal",style:"display: none",key:"v-portal-placeholder"})}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use({install:i}),{install:i,Portal:v,PortalTarget:m,Wormhole:h}}); diff --git a/package.json b/package.json index 922a883..c1da4a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "portal-vue", - "version": "1.5.1-beta.0", + "version": "1.5.1-beta.1", "description": "A Vue component to render elements outside of a component's template, elsewhere in the DOM", "main": "dist/portal-vue.js", "files": [