import type { CoreExpression, CoreStatement, Expression, Parameter, Span, Statement, TypeReference } from "@velarscript/compiler/extension"; export interface WebComponentDeclaration { readonly kind: "ExtensionStatement:web:component"; readonly exported: boolean; readonly name: string; readonly parameters: readonly Parameter[]; readonly handleType: TypeReference | null; readonly body: readonly WebComponentItem[]; readonly span: Span; } export type WebComponentItem = CoreStatement | WebStateDeclaration | WebComputedDeclaration | WebResourceDeclaration | WebActionDeclaration | WebWatchDeclaration | WebExposeDeclaration | WebMountedBlock | WebCleanupBlock; export interface WebExposeDeclaration { readonly kind: "ExtensionStatement:web:expose"; readonly value: Expression; readonly span: Span; } export interface WebStateDeclaration { readonly kind: "ExtensionStatement:web:state"; readonly exported: boolean; readonly name: string; readonly type: TypeReference | null; readonly initializer: Expression; readonly span: Span; } /** * D71 rule 182: the reactive half of `const`. `computed name = expression` is * the one spelling for a derived value — read bare like `state`, never * assigned. It shares `WebStateDeclaration`'s shape because it shares its * declaration grammar; only the reactivity it registers differs. */ export interface WebComputedDeclaration { readonly kind: "ExtensionStatement:web:computed"; readonly exported: boolean; readonly name: string; readonly type: TypeReference | null; readonly initializer: Expression; readonly span: Span; } export interface WebResourceDeclaration { readonly kind: "ExtensionStatement:web:resource"; readonly exported: boolean; readonly name: string; readonly type: TypeReference | null; readonly initializer: Expression; readonly span: Span; } export interface WebActionDeclaration { readonly kind: "ExtensionStatement:web:action"; readonly exported: boolean; readonly name: string; readonly parameters: readonly Parameter[]; readonly returnType: TypeReference | null; /** The deletable ` -> T` region; see `FunctionDeclaration.resultAnnotationSpan`. */ readonly resultAnnotationSpan?: Span; readonly signatureSpan: Span; readonly body: readonly Statement[]; readonly span: Span; } export interface WebWatchDeclaration { readonly kind: "ExtensionStatement:web:watch"; readonly expression: Expression; readonly currentName: string | null; readonly previousName: string | null; readonly body: readonly Statement[]; readonly span: Span; } export interface WebMountedBlock { readonly kind: "ExtensionStatement:web:mounted"; readonly body: readonly Statement[]; readonly span: Span; } export interface WebCleanupBlock { readonly kind: "ExtensionStatement:web:cleanup"; readonly body: readonly Statement[]; readonly span: Span; } export type WebUnsafeCssSource = { readonly kind: "external"; readonly path: string; readonly span: Span; } | { readonly kind: "inline"; readonly css: string; readonly span: Span; }; export interface WebUnsafeCssDeclaration { readonly kind: "ExtensionStatement:web:unsafe-css"; readonly source: WebUnsafeCssSource; readonly placement: "before" | "after"; readonly span: Span; } export type WebStatement = WebComponentDeclaration | WebStateDeclaration | WebComputedDeclaration | WebResourceDeclaration | WebActionDeclaration | WebWatchDeclaration | WebUnsafeCssDeclaration; export interface WebUnitLiteralExpression { readonly kind: "ExtensionExpression:web:unit"; readonly value: number; readonly unit: string; readonly raw: string; readonly span: Span; } export interface WebLookHookExpression { readonly kind: "ExtensionExpression:web:look-hook"; readonly name: string; readonly span: Span; } export interface WebLookExpression { readonly kind: "ExtensionExpression:web:look"; readonly entries: readonly WebLookEntry[]; readonly span: Span; } export interface WebKeyframesExpression { readonly kind: "ExtensionExpression:web:keyframes"; readonly stops: readonly WebKeyframeStop[]; readonly span: Span; } export interface WebKeyframeStop { readonly offsets: readonly number[]; readonly entries: readonly WebLookProperty[]; readonly span: Span; } export type WebLookEntry = WebLookProperty | WebLookSpread | WebLookIf | WebLookTarget; export interface WebLookProperty { readonly kind: "LookProperty"; readonly name: string; readonly value: Expression; readonly span: Span; } export interface WebLookSpread { readonly kind: "LookSpread"; readonly value: Expression; readonly span: Span; } export interface WebLookIf { readonly kind: "LookIf"; readonly condition: Expression; readonly thenEntries: readonly WebLookEntry[]; readonly elseEntries: readonly WebLookEntry[]; readonly span: Span; } export interface WebLookTarget { readonly kind: "LookTarget"; readonly name: string; readonly entries: readonly WebLookEntry[]; readonly span: Span; } export interface WebJsxElementExpression { readonly kind: "ExtensionExpression:web:jsx"; readonly tag: string; readonly tagSpan: Span; readonly attributes: readonly WebJsxAttribute[]; readonly children: readonly WebJsxChild[]; readonly span: Span; } export interface WebJsxAttribute { readonly name: string; readonly value: string | Expression | null; readonly span: Span; } export type WebJsxChild = WebJsxText | WebJsxExpressionChild | WebJsxElementExpression; export interface WebJsxText { readonly kind: "JSXText"; readonly value: string; readonly span: Span; } export interface WebJsxExpressionChild { readonly kind: "JSXExpressionChild"; readonly expression: Expression; readonly span: Span; } export type WebExpression = WebUnitLiteralExpression | WebLookHookExpression | WebLookExpression | WebKeyframesExpression | WebJsxElementExpression; export type WebAwareExpression = CoreExpression | WebExpression; export type WebAwareStatement = CoreStatement | WebStatement; export type WebOwnedStatement = WebStatement | WebExposeDeclaration | WebMountedBlock | WebCleanupBlock; /** * D56 rule 129 — the Web extension's half of the statement-construct roster * Core publishes as `CORE_STATEMENT_CONSTRUCTS`, reached through the extension * protocol's `syntax` slot so the tour-coverage gate can require an * extension's constructs without being taught this package's node names. * * `unsafe-css` contributes two keys rather than one because its `source` is a * tagged union this package already owns: the external import and the inline * block are two spellings the AST tells apart on its own. Requiring only the * kind would let D53 rule 117's inline block hide behind the `import css * unsafe` that predates it, which is exactly how the block reached a release * with no example anywhere in `examples/`. */ export type WebStatementConstructKey = Exclude | `ExtensionStatement:web:unsafe-css/${WebUnsafeCssSource["kind"]}`; export declare const WEB_STATEMENT_CONSTRUCTS: Readonly<{ "ExtensionStatement:web:component": string; "ExtensionStatement:web:state": string; "ExtensionStatement:web:computed": string; "ExtensionStatement:web:resource": string; "ExtensionStatement:web:action": string; "ExtensionStatement:web:watch": string; "ExtensionStatement:web:expose": string; "ExtensionStatement:web:mounted": string; "ExtensionStatement:web:cleanup": string; "ExtensionStatement:web:unsafe-css/external": string; "ExtensionStatement:web:unsafe-css/inline": string; }>; /** * The construct key of one parsed node, or null when this extension does not * own it. The gate walks every node in a module and asks each installed * extension, so this has to answer for Core nodes and for another extension's * nodes without knowing them. */ export declare function webStatementConstructKey(node: { readonly kind: string; }): WebStatementConstructKey | null; export declare function isWebStatement(statement: Statement | WebComponentItem): statement is WebOwnedStatement; export declare function isWebExpression(expression: Expression): expression is WebExpression; export declare function isWebComponent(statement: Statement | WebComponentItem): statement is WebComponentDeclaration; export declare function isWebJsx(expression: Expression | WebAwareExpression): expression is WebJsxElementExpression; export declare function isWebLook(expression: Expression | WebAwareExpression): expression is WebLookExpression; /** Web owns the frame semantics of every expression node its parser adds. */ export declare function webExpressionContainsDirectAwait(expression: Expression, contains: (expression: Expression) => boolean): boolean | undefined; /** Web owns whether each statement form executes in this frame or a child. */ export declare function webStatementContainsDirectAwait(statement: Statement, containsExpression: (expression: Expression) => boolean, _containsBlock: (statements: readonly Statement[]) => boolean): boolean | undefined; export declare function isWebKeyframes(expression: Expression | WebAwareExpression): expression is WebKeyframesExpression; export declare function isWebUnit(expression: Expression | WebAwareExpression): expression is WebUnitLiteralExpression; /** * The watch subject as the author spelled it. D90 R15(a) narrowed a subject to * a name or a read path out of one, so the walk is short and the default branch * is what the analyzer has already refused. * * It lives here because two positions need the same rendering and one concept * may not have two definitions: the emitted watch carries the label into the * runtime, where the flush overflow names the observers that ran away, and the * parser puts it in the message that teaches away the retired `writes` clause. */ export declare function webWatchSubjectLabel(expression: Expression): string; //# sourceMappingURL=ast.d.ts.map