import 'reflect-metadata'; import { type Component } from '../component.js'; import { type ComputedOptions } from '../features/support_computed/computed.js'; export type { ComputedOptions }; import type { HasValidate } from '../features/support_validation/types.js'; import type { ConstructableSchema, Infer } from '@vinejs/vine/types'; export { form } from '../features/support_form_objects/form_decorator.js'; export declare function title(value: string): (constructor: typeof Component) => void; export declare function layout(name?: string, props?: Record): (constructor: typeof Component) => void; export declare function lazy(shouldIsolate?: boolean, options?: { bundle?: boolean; }): (constructor: typeof Component) => void; /** * Like `@lazy()`, but the component's placeholder is swapped for the real * render immediately after the initial page load finishes — not when it * scrolls into the viewport. Use `@lazy()` for below-the-fold content, * `@defer()` for above-the-fold content that's just slow to compute. */ export declare function defer(shouldIsolate?: boolean, options?: { bundle?: boolean; }): (constructor: typeof Component) => void; /** * Prevents this component's update requests from bundling with sibling * components updating in the same tick — it always gets its own solo * request. Trades a bit more network overhead for components with slow * actions, independent polling, or listeners that shouldn't be blocked * waiting on someone else's update. */ export declare function isolate(): (constructor: typeof Component) => void; /** * Marks a method as client-only: it never runs on the server. Its source * is shipped to the browser and registered on `$wire.$js`, so * `$wire.methodName()` calls run entirely client-side with `$wire`/`$js` * in scope - no request round-trip. The method body must be * self-contained JS; it can't touch the database, this.someOtherMethod(), * or anything else that only exists on the server. * * @example * ```typescript * class ContactForm extends Component { * @js() * resetForm() { * $wire.name = '' * $wire.email = '' * } * } * ``` */ export declare function js(): (target: Component, propertyKey: string) => void; /** * Marks a server action as a JSON endpoint: its return value resolves * directly on `$wire.methodName()` instead of triggering a re-render, and * it runs outside the request queue (like `@async()`). Use for actions * whose only purpose is fetching/computing data the client wants back, * with no UI update of its own. * * @example * ```typescript * class Search extends Component { * @json() * async search(query: string) { * return Post.query().where('title', 'like', `%${query}%`).limit(10) * } * } * ``` * ```js * let results = await $wire.search('adonis') * ``` */ export declare function json(): (target: Component, propertyKey: string) => void; /** * Persists a property's value in the user's session across requests - * private per-user state, unlike `@url()`'s query-string persistence. * Hydrated from the session on mount if a value is already stored; * written back on every update. * * @param key - Optional custom session key. Defaults to * `${componentName}.${propertyName}`. Supports `{otherProperty}` * placeholders, resolved against the component's own properties. * * @example * ```typescript * class PostFilters extends Component { * @session() * declare sortBy: string * * @session('search-{authorId}') * declare query: string * } * ``` */ export declare function session(key?: string): (target: Component, propertyKey: string) => void; /** * Configures the browser View Transition used for the DOM morph that * follows this action - a `type` (matched against `wire:transition`'s * own `types` on the animated element) or `skip: true` for an instant * update with no animation at all. Only has any visible effect on * elements marked `wire:transition` in the template; see * docs/attribute-transition.md. * * @example * ```typescript * class Wizard extends Component { * @transition({ type: 'forward' }) * next() { * this.step++ * } * * @transition({ skip: true }) * jumpToStep(step: number) { * this.step = step * } * } * ``` */ export declare function transition(options?: { type?: string; skip?: boolean; }): (target: Component, propertyKey: string) => void; export declare function computed(nameOrOptions?: string | ComputedOptions, options?: ComputedOptions): (target: Component, propertyKey: string, _descriptor?: PropertyDescriptor) => void; export declare function on(name?: string): (target: Component, propertyKey: string) => void; export declare function modelable(): (target: Component, propertyKey: string) => void; export declare function locked(): (target: Component, propertyKey: string) => void; export declare function reactive(): (target: Component, propertyKey: string) => void; export declare function url(as?: string | null, options?: { history?: boolean; keep?: boolean; except?: string[]; nullable?: boolean; }): (target: Component, propertyKey: string) => void; export declare function bind(): (target: Component, propertyKey: string, descriptor: PropertyDescriptor) => void; export declare function renderless(): (target: Component, propertyKey: string) => void; /** * Marks an action method as safe to run outside the normal request queue * (parallel, non-blocking). Only use on methods that perform pure side * effects — never on actions that mutate state reflected in the UI, since * async responses can arrive out of order. See docs/attribute-async.md. * * @example * ```typescript * class Post extends Component { * @async() * logView() { * // fire-and-forget, doesn't touch UI-visible state * } * } * ``` */ export declare function async(): (target: Component, propertyKey: string) => void; /** * Validate decorator for properties * * Stores a schema factory function that will be called when building * the validation schema from decorators. * * The schema factory function is called when building the validation schema. * * @param schemaFactory - Function that returns a Vine.js schema for this property * @param options - Optional configuration (onUpdate: whether to validate on property update) * * @example * ```typescript * class MyComponent extends Component { * @validate(() => vine.string().minLength(3)) * declare name: HasValidate * * @validate(() => vine.string().email(), { onUpdate: false }) * declare email: HasValidate * } * ``` */ export declare function validate>(schemaFactory: () => TSchema, options?: { onUpdate?: boolean; }): (target: { [K in TKey]: HasValidate>; }, propertyKey: TKey) => void;