PageSourceSearch

https://mojehospodarstvi.cz/app/dependencies/vue2-teleport/teleport.min.js

js mojehospodarstvi.cz collected 2026-10-02 01:01:29 UTC 9,578 bytes, 1 lines download raw bytes

1var Teleport=function(e){"use strict";var n={name:"teleport",props:{to:{type:String,required:!0},where:{type:String,default:"after"},disabled:Boolean},data:function(){return{nodes:[],waiting:!1,observer:null,parent:null}},watch:{to:"maybeMove",where:"maybeMove",disabled:function(e){var n=this;e?(this.disable(),this.$nextTick(function(){n.teardownObserver()})):(this.bootObserver(),this.move())}},mounted:function(){this.nodes=Array.from(this.$el.childNodes),this.disabled||this.bootObserver(),this.maybeMove()},beforeDestroy:function(){this.nodes=this.getComponentChildrenNode(),this.disable(),this.teardownObserver()},computed:{classes:function(){return this.disabled?["teleporter"]:["teleporter","hidden"]}},methods:{maybeMove:function(){this.disabled||this.move()},move:function(){if(this.waiting=!1,this.parent=document.querySelector(this.to),!this.parent)return this.disable(),void(this.waiting=!0);"before"===this.where?this.parent.prepend(this.getFragment()):this.parent.appendChild(this.getFragment())},disable:function(){this.$el.appendChild(this.getFragment()),this.parent=null},getFragment:function(){var e=document.createDocumentFragment();return this.nodes.forEach(function(n){return e.appendChild(n)}),e},onMutations:function(e){for(var n=this,t=!1,i=0;i<e.length;i++){var s=e[i],r=Array.from(s.addedNodes).filter(function(e){return!n.nodes.includes(e)});Array.from(s.removedNodes).includes(this.parent)?(this.disable(),this.waiting=!this.disabled):this.waiting&&r.length>0&&(t=!0)}t&&this.move()},bootObserver:function(){var e=this;this.observer||(this.observer=new MutationObserver(function(n){return e.onMutations(n)}),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1}),this.childObserver||(this.childObserver=new MutationObserver(function(n){n.find(function(n){return n.target===e.$el})&&(e.nodes.forEach(function(e){return e.parentNode&&e.parentNode.removeChild(e)}),e.nodes=e.getComponentChildrenNode(),e.maybeMove())}),this.childObserver.observe(this.$el,{childList:!0,subtree:!1,attributes:!1,characterData:!1})))},teardownObserver:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.childObserver&&(this.childObserver.disconnect(),this.childObserver=null)},getComponentChildrenNode:function(){return this.$vnode.componentOptions.children.map(function(e){return e.elm}).filter(function(e){return e})}}};function t(e,n,t,i,s,r,o,a,d,l){"boolean"!=typeof o&&(d=a,a=o,o=!1);var h,u="function"==typeof t?t.options:t;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,s&&(u.functional=!0)),i&&(u._scopeId=i),r?(h=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,d(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},u._ssrRegister=h):n&&(h=o?function(e){n.call(this,l(e,this.$root.$options.shadowRoot))}:function(e){n.call(this,a(e))}),h)if(u.functional){var c=u.render;u.render=function(e,n){return h.call(n),c(e,n)}}else{var v=u.beforeCreate;u.beforeCreate=v?[].concat(v,h):[h]}return t}var i,s="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function r(e){return function(e,n){return function(e,n){var t=s?n.media||"default":e,r=o[t]||(o[t]={ids:new Set,styles:[]});if(!r.ids.has(e)){r.ids.add(e);var a=n.source;if(n.map&&(a+="\n/*# sourceURL="+n.map.sources[0]+" */",a+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n.map))))+" */"),r.element||(r.element=document.createElement("style"),r.element.type="text/css",n.media&&r.element.setAttribute("media",n.media),void 0===i&&(i=document.head||document.getElementsByTagName("head")[0]),i.appendChild(r.element)),"styleSheet"in r.element)r.styles.push(a),r.element.styleSheet.cssText=r.styles.filter(Boolean).join("\n");else{var d=r.ids.size-1,l=document.createTextNode(a),h=r.element.childNodes;h[d]&&r.element.removeChild(h[d]),h.length?r.element.insertBefore(l,h[d]):r.element.appendChild(l)}}}(e,n)}}var o={},a=n,d=function(){var e=this,n=e.$createElement;return(e._self._c||n)("div",{class:e.classes},[e._t("default")],2)};d._withStripped=!0;
1var l=t({render:d,staticRenderFns:[]},function(e){e&&e("data-v-50f4b45b_0",{source:".hidden[data-v-50f4b45b] {\n  visibility: hidden;\n  display: none;\n}\n\n/*# sourceMappingURL=Teleport.vue.map */",map:{version:3,sources:["/home/shodan/Projects/vue2-teleport/src/Teleport.vue","Teleport.vue"],names:[],mappings:"AA2LA;EACA,kBAAA;EACA,aAAA;AC1LA;;AAEA,uCAAuC",file:"Teleport.vue",sourcesContent:["<template>\n  <div :class=\"classes\">\n    <slot/>\n  </div>\n</template>\n\n<script>\nexport default {\n  name: 'teleport',\n  props: {\n    to: {\n      type: String,\n      required: true,\n    },\n    where: {\n      type: String,\n      default: 'after',\n    },\n    disabled: Boolean,\n  },\n  data() {\n    return {\n      nodes: [],\n      waiting: false,\n      observer: null,\n      parent: null,\n    };\n  },\n  watch: {\n    to: 'maybeMove',\n    where: 'maybeMove',\n    disabled(value) {\n      if (value) {\n        this.disable();\n        // Ensure all event done.\n        this.$nextTick(() => {\n          this.teardownObserver();\n        });\n      } else {\n        this.bootObserver();\n        this.move();\n      }\n    },\n  },\n  mounted() {\n    // Store a reference to the nodes\n    this.nodes = Array.from(this.$el.childNodes);\n\n    if (!this.disabled) {\n      this.bootObserver();\n    }\n\n    // Move slot content to target\n    this.maybeMove();\n  },\n  beforeDestroy() {\n    // Fix nodes reference\n    this.nodes = this.getComponentChildrenNode();\n\n    // Move back\n    this.disable();\n\n    // Stop observing\n    this.teardownObserver();\n  },\n  computed: {\n    classes() {\n      if (this.disabled) {\n        return ['teleporter'];\n      }\n\n      return ['teleporter', 'hidden'];\n    },\n  },\n  methods: {\n    maybeMove() {\n      if (!this.disabled) {\n        this.move();\n      }\n    },\n    move() {\n      this.waiting = false;\n\n      this.parent = document.querySelector(this.to);\n\n      if (!this.parent) {\n        this.disable();\n\n        this.waiting = true;\n\n        return;\n      }\n\n      if (this.where === 'before') {\n        this.parent.prepend(this.getFragment());\n      } else {\n        this.parent.appendChild(this.getFragment());\n      }\n    },\n    disable() {\n      this.$el.appendChild(this.getFragment());\n      this.parent = null;\n    },\n    // Using a fragment is faster because it'll trigger only a single reflow\n    // See https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment\n    getFragment() {\n      const fragment = document.createDocumentFragment();\n\n      this.nodes.forEach(node => fragment.appendChild(node));\n\n      return fragment;\n    },\n    onMutations(mutations) {\n      // Makes sure the move operation is only done once\n      let shouldMove = false;\n\n      for (let i = 0; i < mutations.length; i++) {\n        const mutation = mutations[i];\n        const filteredAddedNodes = Array.from(mutation.addedNodes).filter(node => !this.nodes.includes(node));\n\n        if (Array.from(mutation.removedNodes).includes(this.parent)) {\n          this.disable();\n          this.waiting = !this.disabled;\n        } else if (this.waiting && filteredAddedNodes.length > 0) {\n          shouldMove = true;\n        }\n      }\n\n      if (shouldMove) {\n        this.move();\n      }\n    },\n    bootObserver() {\n      if (this.observer) {\n        return;\n      }\n\n      this.observer = new MutationObserver(mutations => this.onMutations(mutations));\n\n      this.observer.observe(document.body, {\n        childList: true,\n        subtree: true,\n        attributes: false,\n        characterData: false,\n      });\n\n      if (this.childObserver) {\n        return;\n      }\n      // watch childNodes change\n      this.childObserver = new MutationObserver(mutations => {\n        const childChangeRecord = mutations.find(i => i.target === this.$el);\n        if (childChangeRecord) {\n          // Remove old nodes before update position.\n          this.nodes.forEach((node) => node.parentNode && node.parentNode.removeChild(node));\n          this.nodes = this.getComponentChildrenNode();\n          this.maybeMove();\n        }\n      });\n\n      this.childObserver.observe(this.$el, {\n        childList: true,\n        subtree: false,\n        attributes: false,\n        characterData: false,\n      });\n    },\n    teardownObserver() {\n      if (this.observer) {\n        this.observer.disconnect();\n        this.observer = null;\n      }\n      if (this.childObserver) {\n        this.childObserver.disconnect();\n        this.childObserver = null;\n      }\n    },\n    getComponentChildrenNode() {\n      return this.$vnode.componentOptions.children\n        .map((i) => i.elm)\n        .filter((i) => i);\n    },\n  },\n};\n<\/script>\n\n<style scoped lang=\"scss\">\n.hidden {\n  visibility: hidden;\n  display: none;\n}\n</style>\n",".hidden {\n  visibility: hidden;\n  display: none;\n}\n\n/*# sourceMappingURL=Teleport.vue.map */"]},media:void 0})},a,"data-v-50f4b45b",!1,void 0,!1,r,void 0,void 0);function h(e){h.installed||(h.installed=!0,e.component("Teleport",l))}var u={install:h},c=null;return"undefined"!=typeof window?c=window.Vue:"undefined"!=typeof global&&(c=global.Vue),c&&c.use(u),e.default=l,e.install=h,e}({});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.