import type { QuerableProps } from "../queries/types.js"; import type { State } from "../state/state.js"; import { ConditionsContextBase } from "./types.js"; /** * Getters and methods which change subject */ declare class ConditionSubjects, S extends State = Context["state"]> { /** * Sets new subject. This can be anything. * @yields completely new subject, provided in the argument * @example * ```ts * test().set([1, 2, 3]).as("choices") * ``` */ set(newSubject: unknown): this; /** * Looks for a child entity by their `props`, starting from current subject. * * @yields an entity, found by `QuerableProps` query * @example * ```ts * test().query({ name: "deck" }).not.empty() * ``` */ query(props: QuerableProps): this; /** * Allows you to change subject to one of the initial subjects. * * @example * ```ts * test().subject.entity.its("name").equals("mainDeck") * ``` */ get subject(): Record; /** * Alias to `test().subject` */ get $(): Record; /** * Changes subject to a prop of its current subject. * @yields subject prop's value to be asserted. Will remember the reference to the object, so you can chain key checks * @example * ```ts * test().entity * .its("propA").equals("foo") * .and.its("propB").above(5) * * test().its("customMap").its("propA").equals(true) * ``` */ its(propName: string): this; /** * @yields parent of current subject */ get parent(): this; /** * @yields children of current subject (an array) */ get children(): this; /** * @yields a child at a specific index (of array or Parent) * @param index */ nthChild(index: number): this; /** * @yields first element in collection */ get bottom(): this; /** * @yields last element in collection */ get top(): this; /** * @yields {number} `length` property of a collection (or string) */ get itsLength(): this; /** * @yields all selected children */ get selectedChildren(): this; /** * @yields all NOT selected children */ get unselectedChildren(): this; /** * @yields {number} children count if `subject` is a `Parent` */ get childrenCount(): this; /** * @yields {number} number of selected children if subject is parent */ get selectedChildrenCount(): this; /** * @yields {number} number of selected children if subject is parent */ get unselectedChildrenCount(): this; /** * @yields {number} value of `idx` of the entity */ get idx(): this; /** * @yields {number} value of `selectionIndex` of the entity */ get selectionIndex(): this; /** * **REQUIRES** `"player"` initial subject * * Changes subject to owner of current entity * @yields `player` */ get owner(): this; /** * **REQUIRES** `"player"` initial subject * * Changes subject to entity of current dragging happening. * @yields `entity` */ get playersDraggedEntity(): this; /** * Bring back previously remembered subject by its alias * @param alias * * @example * ```ts * test().query({ name: "deck" }).as("deck") * // ... * test().get("deck").children.not.empty() * ``` */ get(alias: string): this; /** * Remembers subject found by queryProps with a given alias. * Won't start looking for (querying) new subject if given * alias is already populated with something (for performance!). * * @example * ```ts * test().remember("deck", { name: "deck" }) * ``` */ remember(alias: string, props: QuerableProps): void; /** * Remembers current subject with a given alias * @example * ```ts * test().as({ name: "deck" }).as("deck") * ``` */ as(alias: string): void; } export { ConditionSubjects };