mirror of https://github.com/vuejs/core.git
wip: refactor
This commit is contained in:
parent
fd6f163246
commit
4de819c267
|
@ -60,7 +60,7 @@ import {
|
||||||
import { hmrReload, hmrRerender } from './hmr'
|
import { hmrReload, hmrRerender } from './hmr'
|
||||||
import { isHydrating, locateHydrationNode } from './dom/hydration'
|
import { isHydrating, locateHydrationNode } from './dom/hydration'
|
||||||
import { insertionAnchor, insertionParent } from './insertionState'
|
import { insertionAnchor, insertionParent } from './insertionState'
|
||||||
import type { VaporTeleportImpl } from './components/Teleport'
|
import { isVaporTeleport } from './components/Teleport'
|
||||||
|
|
||||||
export { currentInstance } from '@vue/runtime-dom'
|
export { currentInstance } from '@vue/runtime-dom'
|
||||||
|
|
||||||
|
@ -93,8 +93,6 @@ export interface ObjectVaporComponent
|
||||||
|
|
||||||
name?: string
|
name?: string
|
||||||
vapor?: boolean
|
vapor?: boolean
|
||||||
|
|
||||||
__isTeleport?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SharedInternalOptions {
|
interface SharedInternalOptions {
|
||||||
|
@ -161,11 +159,8 @@ export function createComponent(
|
||||||
}
|
}
|
||||||
|
|
||||||
// teleport
|
// teleport
|
||||||
if (component.__isTeleport) {
|
if (isVaporTeleport(component)) {
|
||||||
const frag = (component as typeof VaporTeleportImpl).process(
|
const frag = component.process(rawProps!, rawSlots!)
|
||||||
rawProps!,
|
|
||||||
rawSlots!,
|
|
||||||
)
|
|
||||||
if (!isHydrating && _insertionParent) {
|
if (!isHydrating && _insertionParent) {
|
||||||
insert(frag, _insertionParent, _insertionAnchor)
|
insert(frag, _insertionParent, _insertionAnchor)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -85,7 +85,7 @@ export const VaporTeleportImpl = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
class TeleportFragment extends VaporFragment {
|
export class TeleportFragment extends VaporFragment {
|
||||||
anchor: Node
|
anchor: Node
|
||||||
|
|
||||||
private targetStart?: Node
|
private targetStart?: Node
|
||||||
|
@ -242,6 +242,12 @@ export const VaporTeleport = VaporTeleportImpl as unknown as {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isVaporTeleport(
|
||||||
|
value: unknown,
|
||||||
|
): value is typeof VaporTeleportImpl {
|
||||||
|
return value === VaporTeleportImpl
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dev only
|
* dev only
|
||||||
* during root component HMR reload, since the old component will be unmounted
|
* during root component HMR reload, since the old component will be unmounted
|
||||||
|
|
Loading…
Reference in New Issue