chore: BlockFn

This commit is contained in:
Evan You 2024-12-07 22:05:11 +08:00
parent aa96762ad4
commit 407b9abc0b
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import { EffectScope } from '@vue/reactivity'
export type Block = Node | Fragment | VaporComponentInstance | Block[]
export type BlockRenderFn = (...args: any[]) => Block
export type BlockFn = (...args: any[]) => Block
export class Fragment {
nodes: Block
@ -30,7 +30,7 @@ export class DynamicFragment extends Fragment {
document.createTextNode('')
}
update(render?: BlockRenderFn, key: any = render): void {
update(render?: BlockFn, key: any = render): void {
if (key === this.key) return
this.key = key

View File

@ -1,5 +1,5 @@
import { EMPTY_OBJ, NO, hasOwn, isArray, isFunction } from '@vue/shared'
import { type Block, type BlockRenderFn, DynamicFragment } from './block'
import { type Block, type BlockFn, DynamicFragment } from './block'
import type { RawProps } from './componentProps'
import { currentInstance } from '@vue/runtime-core'
import type { VaporComponentInstance } from './component'
@ -11,7 +11,7 @@ export type RawSlots = Record<string, Slot> & {
export type StaticSlots = Record<string, Slot>
export type Slot = BlockRenderFn
export type Slot = BlockFn
export type DynamicSlot = { name: string; fn: Slot }
export type DynamicSlotFn = () => DynamicSlot | DynamicSlot[]