import { ScriptExpression, Reference } from "../script/ast"; import { Sheet, MixinRule, StyleExpression } from "../css/ast"; import { BasicRaws, StringRange } from "../base/ast"; import { DependencyGraph } from "../core/graph"; import { StringLiteral } from "../core/ast"; export declare enum NodeKind { Fragment = "Fragment", Text = "Text", Annotation = "Annotation", Comment = "Comment", Element = "Element", StyleElement = "StyleElement", Slot = "Slot" } export declare type BaseNode = { id: string; nodeKind: TKind; }; export declare type Text = StringLiteral & BaseNode; export declare type Annotation = { properties: AnnotationProperty[]; range: StringRange; } & BaseNode; export declare type Comment = { raws: BasicRaws; value: string; annotation: Annotation; range: StringRange; } & BaseNode; export declare enum AnnotationPropertyKind { Text = "Text", Declaration = "Declaration" } declare type BaseAnnotationProperty = { kind: TKind; }; export declare type TextAnnotation = { value: string; raws: BasicRaws; } & BaseAnnotationProperty; export declare type DeclarationAnnotation = { name: string; value: ScriptExpression; raws: BasicRaws; } & BaseAnnotationProperty; export declare type AnnotationProperty = TextAnnotation | DeclarationAnnotation; export declare type ElementRaws = { before: string; }; export declare type Element = { id: string; range: StringRange; raws: ElementRaws; openTagRange: StringRange; tagNameRange: StringRange; tagName: string; attributes: Attribute[]; value: string; children: Node[]; } & BaseNode; export declare type StyleElement = { sheet: Sheet; range: StringRange; raws: BasicRaws; } & BaseNode; export declare enum AttributeKind { ShorthandAttribute = "ShorthandAttribute", KeyValueAttribute = "KeyValueAttribute", SpreadAttribute = "SpreadAttribute", PropertyBoundAttribute = "PropertyBoundAttribute" } declare type BaseAttribute = { attrKind: TKind; }; declare type ShorthandAttribute = { id: string; reference: ScriptExpression; range: StringRange; } & BaseAttribute; declare type SpreadAttribute = { id: string; script: ScriptExpression; range: StringRange; } & BaseAttribute; declare type KeyValueAttribute = { id: string; name: string; value?: AttributeValue; range: StringRange; } & BaseAttribute; export declare type PropertyBoundAttribute = { id: string; name: string; bindingName: string; value: AttributeValue; range: StringRange; } & BaseAttribute; export declare type Attribute = ShorthandAttribute | SpreadAttribute | KeyValueAttribute | PropertyBoundAttribute; export declare enum AttributeValueKind { DyanmicString = "DyanmicString", String = "String", Slot = "Slot" } export declare type BaseAttributeValue = { id: string; attrValueKind: TKind; }; export declare type StringAttributeValue = StringLiteral & BaseAttributeValue; export declare enum DynamicStringAttributeValuePartKind { Literal = "Literal", ClassNamePierce = "ClassNamePierce", Slot = "Slot" } declare type BaseDynamicStringAttributeValuePart = { id: string; partKind: TPartKind; }; declare type DynamicStringLiteralPart = { range: StringRange; value: string; } & BaseDynamicStringAttributeValuePart; declare type DynamicStringClassNamePiercePart = { range: StringRange; className: string; } & BaseDynamicStringAttributeValuePart; declare type DynamicStringSlotPart = ScriptExpression & BaseDynamicStringAttributeValuePart; export declare type DynamicStringAttributeValuePart = DynamicStringLiteralPart | DynamicStringClassNamePiercePart | DynamicStringSlotPart; export declare type DynamicStringAttributeValue = { values: DynamicStringAttributeValuePart[]; range: StringRange; } & BaseAttributeValue; export declare type SlotAttributeValue = { script: ScriptExpression; range: StringRange; } & BaseAttributeValue; export declare type AttributeValue = StringAttributeValue | SlotAttributeValue | DynamicStringAttributeValue; export declare type Fragment = { value: string; children: Node[]; range: StringRange; } & BaseNode; export declare type Slot = { script: ScriptExpression; range: StringRange; raws: BasicRaws; } & BaseNode; export declare type Node = Text | Element | StyleElement | Fragment | Slot | Annotation | Comment; export declare type Expression = Node | Attribute | AttributeValue | StyleExpression | ScriptExpression | DynamicStringAttributeValuePart | StringLiteral; export declare enum RootExpressionKind { String = "String", Node = "Node", Attribute = "Attribute", CSS = "CSS", Script = "Script" } declare type BaseRootExpression = { pcObjectKind: TKind; }; export declare type RootString = StringLiteral & BaseRootExpression; export declare type RootNode = Node & BaseRootExpression; export declare type RootAttribute = Node & BaseRootExpression; export declare type RootCSS = StyleExpression & BaseRootExpression; export declare type RootScript = ScriptExpression & BaseRootExpression; export declare type RootExpression = RootString | RootNode | RootCSS | RootScript | RootAttribute; export declare const getImports: (ast: Node) => Element[]; export declare const getRelativeFilePath: (fs: any) => (fromFilePath: string, importFilePath: string) => string; export declare const getImportIds: (ast: Node) => string[]; export declare const getImportById: (id: string, ast: Node) => Element | null; export declare const getImportBySrc: (src: string, ast: Node) => Element | null; export declare const getChildren: (ast: Node) => Node[]; export declare const getStyleScopeId: (filePath: string) => any; export declare const getChildrenByTagName: (tagName: string, parent: Node) => Element[]; export declare const findByNamespace: (namespace: string, current: Node | ScriptExpression, allChildrenByNamespace?: Element[]) => Element[]; export declare const getMetaValue: (name: string, root: Node) => string; export declare const getAttribute: (name: string, element: Element) => KeyValueAttribute; export declare const getAttributeValue: (name: string, element: Element) => AttributeValue; export declare const getAttributeStringValue: (name: string, element: Element) => string; export declare const getStyleElements: (ast: Node) => StyleElement[]; export declare const isVisibleElement: (ast: Element) => boolean; export declare const isVisibleNode: (node: Node) => boolean; export declare const getVisibleChildNodes: (ast: Node) => Node[]; export declare const isComponent: (node: Node) => node is Element; export declare const isImport: (node: Node) => node is Element; export declare const getParts: (ast: Node) => Element[]; export declare const getPartIds: (ast: Node) => string[]; export declare const getDefaultPart: (ast: Node) => Element; export declare const getLogicElement: (ast: Node) => Element | null; export declare const hasAttribute: (name: string, element: Element) => boolean; export declare const getParentNode: (node: Node, root: Node) => Element | Fragment; export declare const getPCNodeAnnotations: (node: Node, root: Node) => Comment; export declare const getNodeById: (nodeId: string, root: Node) => Node; export declare const isComponentInstance: (node: Expression, root: Node) => node is Element; export declare const getDocumentComponents: (root: Node) => Element[]; export declare const getComponentMap: (root: Node) => Record; export declare const getInstanceComponentInfo: (instance: Element, uri: string, graph: DependencyGraph) => [string, Element]; export declare const getMixins: (ast: Node) => Record; export declare const getASTParentChildMap: (ast: Expression) => Record; export declare const getASTParent: (ast: Expression, root: Expression) => Expression; export declare const getASTAncestors: (ast: Expression, root: Expression) => Expression[]; export declare const isNode: (ast: Expression) => ast is Node; export declare const isAttribute: (ast: Expression) => ast is Attribute; export declare const isAttributeValue: (ast: Expression) => ast is AttributeValue; export declare const isScriptExpression: (ast: Expression) => ast is ScriptExpression; export declare const isDynamicStringAttributeValuePart: (ast: Expression) => ast is DynamicStringAttributeValuePart; export declare const traverseExpression: (ast: Expression, owner: Expression, each: (node: Expression, parent: Expression) => void | boolean) => any; export declare const getNestedReferences: (node: Node, _statements?: [Reference, string][]) => [Reference, string][]; export {};