Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/foundry/client/applications/forms/fields.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,21 @@ export interface FormGroupConfig extends NullishProps<_FormGroupConfig> {
}

interface _FormInputConfig<FormInputValue = unknown> {
/**
* The name of the form element
*/
name: string;

/**
* The current value of the form element
*/
value: FormInputValue;

/**
* An id to assign to the element
*/
id: string;

/**
* Is the field required?
* @defaultValue `false`
Expand Down Expand Up @@ -106,11 +116,22 @@ interface _FormInputConfig<FormInputValue = unknown> {
*/
dataset: Record<string, string>;

/**
* Aria attributes to assign to the input
* @remarks Omit the `aria-`-prefix
*/
aria: Record<string, string>;

/**
* A placeholder value, if supported by the element type
*/
placeholder: string;

/**
* Space-delimited class names to apply to the input.
*/
classes: string;

input: CustomFormInput;
}

Expand Down
12 changes: 11 additions & 1 deletion src/foundry/client/applications/sheets/token/mixin.d.mts
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
import type HandlebarsApplicationMixin from "#client/applications/api/handlebars-application.mjs";
import type { PrototypeToken } from "#common/data/data.mjs";
import type { FixedInstanceType, Mixin } from "#utils";
import type ApplicationV2 from "../../api/application.d.mts";

/**
* @remarks This does NOT exist at runtime. This is only here to be used as a type when relevant as well as to avoid
* issues with anonymous mixin classes.
* @remarks TODO: Stub
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare class TokenApplication {
/** @privateRemarks All mixin classses should accept anything for its constructor. */
constructor(...args: any[]);

/**
* The TokenDocument or PrototypeToken
*/
get token(): TokenDocument.Implementation | PrototypeToken;
}

/**
* A mixin for UI shared between TokenDocument and PrototypeToken sheets
*/
declare function TokenApplicationMixin<BaseClass extends TokenApplicationMixin.BaseClass>(
BaseApplication: BaseClass,
): Mixin<typeof TokenApplication, BaseClass>;
): TokenApplicationMixin.Mix<BaseClass>;

declare namespace TokenApplicationMixin {
type AnyMixedConstructor = ReturnType<typeof TokenApplicationMixin<BaseClass>>;
interface AnyMixed extends FixedInstanceType<AnyMixedConstructor> {}

type BaseClass = ApplicationV2.Internal.Constructor;
type Mix<BaseClass extends TokenApplicationMixin.BaseClass> = HandlebarsApplicationMixin.Mix<
Mixin<typeof TokenApplication, BaseClass>
>;

type Token = TokenDocument.Implementation | PrototypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ declare class PrototypeTokenConfig<
> extends TokenApplicationMixin(ApplicationV2)<RenderContext, Configuration, RenderOptions> {
// Fake override.
static override DEFAULT_OPTIONS: PrototypeTokenConfig.DefaultOptions;

override get token(): TokenDocument.Implementation | PrototypeToken;
}

declare namespace PrototypeTokenConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { PrototypeToken } from "#common/data/data.mjs";
import type { Identity } from "#utils";
import type DocumentSheetV2 from "../../api/document-sheet.d.mts";
import type TokenApplicationMixin from "./mixin.d.mts";
Expand All @@ -23,7 +24,9 @@ declare class TokenConfig<
RenderContext,
Configuration,
RenderOptions
> {}
> {
override get token(): TokenDocument.Implementation | PrototypeToken;
}

declare namespace TokenConfig {
interface Any extends AnyTokenConfig {}
Expand Down
9 changes: 7 additions & 2 deletions src/foundry/client/canvas/placeables/placeable-object.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -466,16 +466,21 @@ declare abstract class PlaceableObject<
* @param event - The triggering canvas interaction event
* @param options - Options which customize event handling
* @remarks {@link Wall._onHoverIn | `Wall#_onHoverIn`} can return `false`, otherwise this is always `void`
* @remarks This method barely does anything with the given event and can thus also just be given a {@link MouseEvent}.
*/
// options: not null (destructured)
protected _onHoverIn(event: Canvas.Event.Pointer, options?: PlaceableObject.HoverInOptions): false | void;
protected _onHoverIn(
event: Canvas.Event.Pointer | MouseEvent,
options?: PlaceableObject.HoverInOptions,
): false | void;

/**
* Actions that should be taken for this Placeable Object when a mouseout event occurs
* @see `MouseInteractionManager##handlePointerOut`
* @param event - The triggering canvas interaction event
* @remarks The event is not used in the method.
*/
protected _onHoverOut(event: Canvas.Event.Pointer): void;
protected _onHoverOut(event?: Canvas.Event.Pointer): void;

/**
* Should the placeable propagate left click downstream?
Expand Down
7 changes: 5 additions & 2 deletions src/foundry/client/canvas/placeables/token.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,12 @@ declare class Token extends PlaceableObject<TokenDocument.Implementation> {
protected override _canDrag(user: User.Implementation, event?: Canvas.Event.Pointer): boolean;

// options: not null (destructured)
protected override _onHoverIn(event: Canvas.Event.Pointer, options?: PlaceableObject.HoverInOptions): void;
protected override _onHoverIn(
event: Canvas.Event.Pointer | MouseEvent,
options?: PlaceableObject.HoverInOptions,
): void;

protected override _onHoverOut(event: Canvas.Event.Pointer): void;
protected override _onHoverOut(event?: Canvas.Event.Pointer): void;

protected override _onClickLeft(event: Canvas.Event.Pointer): void;

Expand Down
2 changes: 1 addition & 1 deletion src/foundry/common/documents/actor-delta.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ declare abstract class BaseActorDelta<
* @param changes - Candidate source changes. (default: `{}`)
* @param options - Options which determine how the new data is merged. (default: `{}`)
*/
protected _prepareDeltaUpdate(changes: ActorDelta.UpdateData, options: DataModel.UpdateOptions): void;
protected _prepareDeltaUpdate(changes?: ActorDelta.UpdateData, options?: DataModel.UpdateOptions): void;

/** @remarks passes to {@linkcode _prepareDeltaUpdate} prior to calling super */
override updateSource(changes?: ActorDelta.UpdateData, options?: DataModel.UpdateOptions): ActorDelta.UpdateData;
Expand Down
2 changes: 1 addition & 1 deletion src/foundry/common/documents/scene.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ declare abstract class BaseScene extends Document<"Scene", BaseScene.Schema, any

protected override _initialize(options?: Document.InitializeOptions): void;

override updateSource(changes: Scene.UpdateData, options: DataModel.UpdateOptions): Scene.UpdateData;
override updateSource(changes?: Scene.UpdateData, options?: DataModel.UpdateOptions): Scene.UpdateData;

/**
* @remarks
Expand Down