UNPKG

svelte-ast-print

Version:

Serialize Svelte AST nodes into stringified syntax. A.k.a parse in reverse.

193 lines 5.07 kB
/** * Printers related to Svelte **attribute**-like related AST nodes only. * @module svelte-ast-print/template/attribute-like */ import type { AST as SV } from "svelte/compiler"; import type { PrintOptions } from "../_internal/option.ts"; import { type Result } from "../_internal/shared.ts"; /** * @see {@link https://svelte.dev/docs/svelte/animate} * * @example with expression * ```svelte * animate:name={expression} * ``` * * @example shorthand - when variable - expression as identifier - name is same * ```svelte * animate:name * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printAnimateDirective(n: SV.AnimateDirective, opts?: Partial<PrintOptions>): Result<SV.AnimateDirective>; /** * @see {@link https://svelte.dev/docs/svelte/bind} * * @example with expression * ```svelte * bind:name={variable} * ``` * * @example shorthand - when variable - expression as identifier - name is same * ```svelte * bind:name * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printBindDirective(n: SV.BindDirective, opts?: Partial<PrintOptions>): Result<SV.BindDirective>; /** * @see {@link https://svelte.dev/docs/svelte/class} * * @example with expression * ```svelte * class:name={expression} * ``` * * @example shorthand - when variable - expression as identifier - name is same * ```svelte * class:name * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printClassDirective(n: SV.ClassDirective, opts?: Partial<PrintOptions>): Result<SV.ClassDirective>; /** * @deprecated Will be removed from Svelte `v6` {@link https://svelte.dev/docs/svelte/legacy-slots#Passing-data-to-slotted-content} * * @example with expression * ```svelte * let:name={expression} * ``` * * @example shorthand - when variable - expression as identifier - name is same * ```svelte * let:name * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printLetDirective(n: SV.LetDirective, opts?: Partial<PrintOptions>): Result<SV.LetDirective>; /** * @deprecated Will be removed from Svelte `v6` {@link https://svelte.dev/docs/svelte/legacy-on} * * @example without modifiers * ```svelte * on:name={expression} * ``` * * @example with modifiers * ```svelte * on:name|modifiers={handler} * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printOnDirective(n: SV.OnDirective, opts?: Partial<PrintOptions>): Result<SV.OnDirective>; /** * @see {@link https://svelte.dev/docs/svelte/style} * * @example with expression tag * ```svelte * style:name={value} * ``` * * @example with text expression * ```svelte * style:name="text" * ``` * * @example without expression * ```svelte * style:name * ``` * * @example with modifiers * ```svelte * style:name|modifiers="text" * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printStyleDirective(n: SV.StyleDirective, opts?: Partial<PrintOptions>): Result<SV.StyleDirective>; /** * @see {@link https://svelte.dev/docs/svelte/transition} * @see {@link https://svelte.dev/docs/svelte/in-and-out} * * @example without expression * ```svelte * transition|in|out:name * ``` * * @example with expression * ```svelte * transition|in|out:name={expression} * ``` * * @example with global modifier and without expression * ```svelte * transition|in|out:name|global * ``` * * @example with global modifier and with expression * ```svelte * transition|in|out:name|global={expression} * ``` * * @example with local modifier and without expression * ```svelte * transition|in|out:name|local * ``` * * @example with local modifier and with expression * ```svelte * transition|in|out:name|local={expression} * ``` * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printTransitionDirective(n: SV.TransitionDirective, opts?: Partial<PrintOptions>): Result<SV.TransitionDirective>; /** * @example with expression * ```svelte * use:name={expression} * ``` * * @example shorthand - when variable - expression as identifier - name is same * ```svelte * use:name * ``` * @see {@link https://svelte.dev/docs/svelte/use} * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printUseDirective(n: SV.UseDirective, opts?: Partial<PrintOptions>): Result<SV.UseDirective>; /** * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printAttributeLike(n: SV.AttributeLike, opts?: Partial<PrintOptions>): Result<SV.AttributeLike>; /** * @see {@link https://svelte.dev/docs/svelte/basic-markup#Element-attributes} * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printAttribute(n: SV.Attribute, opts?: Partial<PrintOptions>): Result<SV.Attribute>; /** * @see {@link https://svelte.dev/docs/svelte/basic-markup#Component-props} * * @since 1.0.0 * @__NO_SIDE_EFFECTS__ */ export declare function printSpreadAttribute(n: SV.SpreadAttribute, opts?: Partial<PrintOptions>): Result<SV.SpreadAttribute>; //# sourceMappingURL=attribute-like.d.ts.map