UNPKG

@vuedx/typescript-plugin-vue

Version:
79 lines 3.23 kB
import { AttributeNode, DirectiveNode, ElementNode, InterpolationNode, RootNode, SearchResult } from '@vuedx/template-ast-types'; import { VueSFCDocument } from '@vuedx/vue-virtual-textdocument'; export declare const enum TemplateContextKind { Tag = "tag", Attribute = "attribute", AttributeValue = "attributeValue", PropName = "propName", EventName = "eventName", DirectiveName = "directiveName", DirectiveArg = "directiveArg", DirectiveValue = "directiveValue", DirectiveModifier = "directiveModifier", Interpolation = "interpolation" } interface BaseTemplateContext extends SearchResult { kind: TemplateContextKind; document: VueSFCDocument; block: Exclude<VueSFCDocument['descriptor']['template'], null>; template: RootNode; offsetInDocument: number; offsetInTemplate: number; offsetInGenerated: number; } export interface TagTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.Tag; element: ElementNode; tag: 'open' | 'close'; } export interface AttributeTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.Attribute; element: ElementNode; attribute?: AttributeNode; } export interface AttributeValueTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.AttributeValue; element: ElementNode; attribute: AttributeNode; } export interface PropNameTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.PropName; element: ElementNode; prop: DirectiveNode; } export interface EventNameTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.EventName; element: ElementNode; event: DirectiveNode; } export interface DirectiveNameTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.DirectiveName; element: ElementNode; directive: DirectiveNode; } export interface DirectiveArgTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.DirectiveArg; element: ElementNode; directive: DirectiveNode; } export interface DirectiveValueTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.DirectiveValue; element: ElementNode; directive: DirectiveNode; } export interface DirectiveModifierTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.DirectiveModifier; element: ElementNode; directive: DirectiveNode; } export interface InterpolationTemplateContext extends BaseTemplateContext { kind: TemplateContextKind.Interpolation; interpolation: InterpolationNode; } export declare type TemplateContext = TagTemplateContext | AttributeTemplateContext | AttributeValueTemplateContext | PropNameTemplateContext | EventNameTemplateContext | DirectiveNameTemplateContext | DirectiveArgTemplateContext | DirectiveValueTemplateContext | DirectiveModifierTemplateContext | InterpolationTemplateContext; export declare class TemplateContextService { getContext(document: VueSFCDocument, offsetInDocument: number): TemplateContext | null; getAttributeCompletionOffset(document: VueSFCDocument, element: ElementNode): number | null; } export {}; //# sourceMappingURL=TemplateContextService.d.ts.map