y-design-ssr
Version:
SSR component library of YUI with Vue3
14 lines (13 loc) • 533 B
TypeScript
import { InjectionKey, ComponentInternalInstance, Ref } from 'vue';
export type RelationParent<T> = T & {
children: ComponentInternalInstance[];
addChild: (child: ComponentInternalInstance) => void;
removeChild: (child: ComponentInternalInstance) => void;
};
export interface UseRelationProvider<T> {
index: Ref<number>;
parent: (RelationParent<T> & {
[key: string]: unknown;
}) | null;
}
export declare const useRelation: <T>(key: string | InjectionKey<RelationParent<T>>) => UseRelationProvider<T>;