You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
2.8 KiB
1 line
2.8 KiB
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport '../browser.mjs';\nimport { isClient } from '@vueuse/core';\nconst globalNodes = [];\nlet target = !isClient ? void 0 : document.body;\nfunction createGlobalNode(id) {\n const el = document.createElement(\"div\");\n if (id !== void 0) {\n el.setAttribute(\"id\", id);\n }\n if (target) {\n target.appendChild(el);\n globalNodes.push(el);\n }\n return el;\n}\nfunction removeGlobalNode(el) {\n globalNodes.splice(globalNodes.indexOf(el), 1);\n el.remove();\n}\nfunction changeGlobalNodesTarget(el) {\n if (el === target) return;\n target = el;\n globalNodes.forEach(el2 => {\n if (target && !el2.contains(target)) {\n target.appendChild(el2);\n }\n });\n}\nexport { changeGlobalNodesTarget, createGlobalNode, removeGlobalNode };","map":{"version":3,"names":["globalNodes","target","isClient","document","body","createGlobalNode","id","el","createElement","setAttribute","appendChild","push","removeGlobalNode","splice","indexOf","remove","changeGlobalNodesTarget","forEach","el2","contains"],"sources":["../../../../../packages/utils/vue/global-node.ts"],"sourcesContent":["import { isClient } from '../browser'\n\nconst globalNodes: HTMLElement[] = []\nlet target: HTMLElement | undefined = !isClient ? undefined : document.body\n\nexport function createGlobalNode(id?: string) {\n const el = document.createElement('div')\n if (id !== undefined) {\n el.setAttribute('id', id)\n }\n\n if (target) {\n target.appendChild(el)\n globalNodes.push(el)\n }\n\n return el\n}\n\nexport function removeGlobalNode(el: HTMLElement) {\n globalNodes.splice(globalNodes.indexOf(el), 1)\n el.remove()\n}\n\nexport function changeGlobalNodesTarget(el: HTMLElement) {\n if (el === target) return\n\n target = el\n globalNodes.forEach((el) => {\n if (target && !el.contains(target)) {\n target.appendChild(el)\n }\n })\n}\n"],"mappings":";;;AACA,MAAMA,WAAW,GAAG,EAAE;AACtB,IAAIC,MAAM,GAAG,CAACC,QAAQ,GAAG,KAAK,CAAC,GAAGC,QAAQ,CAACC,IAAI;AACxC,SAASC,gBAAgBA,CAACC,EAAE,EAAE;EACnC,MAAMC,EAAE,GAAGJ,QAAQ,CAACK,aAAa,CAAC,KAAK,CAAC;EACxC,IAAIF,EAAE,KAAK,KAAK,CAAC,EAAE;IACjBC,EAAE,CAACE,YAAY,CAAC,IAAI,EAAEH,EAAE,CAAC;EAC7B;EACE,IAAIL,MAAM,EAAE;IACVA,MAAM,CAACS,WAAW,CAACH,EAAE,CAAC;IACtBP,WAAW,CAACW,IAAI,CAACJ,EAAE,CAAC;EACxB;EACE,OAAOA,EAAE;AACX;AACO,SAASK,gBAAgBA,CAACL,EAAE,EAAE;EACnCP,WAAW,CAACa,MAAM,CAACb,WAAW,CAACc,OAAO,CAACP,EAAE,CAAC,EAAE,CAAC,CAAC;EAC9CA,EAAE,CAACQ,MAAM,EAAE;AACb;AACO,SAASC,uBAAuBA,CAACT,EAAE,EAAE;EAC1C,IAAIA,EAAE,KAAKN,MAAM,EACf;EACFA,MAAM,GAAGM,EAAE;EACXP,WAAW,CAACiB,OAAO,CAAEC,GAAG,IAAK;IAC3B,IAAIjB,MAAM,IAAI,CAACiB,GAAG,CAACC,QAAQ,CAAClB,MAAM,CAAC,EAAE;MACnCA,MAAM,CAACS,WAAW,CAACQ,GAAG,CAAC;IAC7B;EACA,CAAG,CAAC;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |