StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
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
29 KiB
1 line
29 KiB
4 years ago
|
{"version":3,"file":"portal-vue.esm.js","sources":["../src/utils/index.ts","../src/components/wormhole.ts","../src/components/portal.tsx","../src/components/portal-target.tsx","../src/components/mounting-portal.tsx","../src/index.ts"],"sourcesContent":["import { VNode } from 'vue'\nimport { Transport } from '../types'\n\nexport const inBrowser = typeof window !== 'undefined'\n\nexport function freeze<R>(item: R[]): ReadonlyArray<R> {\n if (Array.isArray(item) || typeof item === 'object') {\n return Object.freeze(item)\n }\n return item\n}\n\nexport function combinePassengers(\n transports: Transport[],\n slotProps = {}\n): Array<VNode> {\n return transports.reduce(\n (passengers, transport) => {\n const temp = transport.passengers[0]\n const newPassengers =\n typeof temp === 'function'\n ? (temp(slotProps) as VNode[])\n : (transport.passengers as VNode[])\n return passengers.concat(newPassengers)\n },\n [] as Array<VNode>\n )\n}\n\nexport function stableSort<T>(array: T[], compareFn: Function) {\n return array\n .map((v: T, idx: number) => {\n return [idx, v] as [number, T]\n })\n .sort(function(a, b) {\n return compareFn(a[1], b[1]) || a[0] - b[0]\n })\n .map(c => c[1])\n}\n\nexport function pick<T extends object, K extends keyof T>(\n obj: T,\n keys: K[]\n): Pick<T, K> {\n return keys.reduce(\n (acc, key) => {\n if (obj.hasOwnProperty(key)) {\n acc[key] = obj[key]\n }\n return acc\n },\n {} as Pick<T, K>\n )\n}\n","import Vue from 'vue'\nimport { freeze, inBrowser, stableSort } from '../utils'\nimport {\n Transports,\n Transport,\n TransportInput,\n TransportVector,\n VMRegister,\n} from '../types'\n\nconst transports: Transports = {}\nconst targets: VMRegister = {}\nconst sources: VMRegister = {}\n\nexport const Wormhole = Vue.extend({\n data: () => ({\n transports,\n targets,\n sources,\n trackInstances: inBrowser,\n }),\n methods: {\n open(transport: TransportInput) {\n if (!inBrowser) return\n const { to, from, passengers, order = Infinity } = transport\n if (!to || !from || !passengers) return\n\n const newTransport = {\n to,\n from,\n passengers: freeze<object>(passengers),\n order,\n } as Transport\n const keys = Object.keys(this.transports)\n\n if (keys.indexOf(to) === -1) {\n Vue.set(this.transports, to, [])\n }\n\n const currentIndex = this.$_getTransportIndex(newTransport)\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(newTransport)\n } else {\n newTransports[currentIndex] = newTransport\n }\n\n this.transports[to] = stableSort<Transport>(\n newTransports,\n (a: Transport, b: Transport) => a.order - b.order\n )\n },\n\n close(transport: TransportVector, force = false) {\n const { to, from } = transport\n if (!to || (!from && force === false)) 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 registerTarget(target: string, vm: Vue, force?: boolean): void {\n if (!inBrowser) return\n if (this.trackInstances && !force && this.targets[target]) {\n console.warn(`[portal-vue]: Target ${target} already exists`)\n }\n this.$set(this.targets, target, Object.freeze([vm]))\n },\n unregisterTarget(target: string) {\n this.$delete(this.targets, target)\n }
|