-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update TokenConfig and DefaultTokenConfig #2326
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,5 @@ | ||||||||||||||||||||
import type { ConfiguredDocumentClassForName } from "../../../../types/helperTypes"; | ||||||||||||||||||||
import type { TokenData } from "../../../common/data/module.mjs"; | ||||||||||||||||||||
|
||||||||||||||||||||
declare global { | ||||||||||||||||||||
/** | ||||||||||||||||||||
|
@@ -7,18 +8,21 @@ declare global { | |||||||||||||||||||
* be changed in v10. | ||||||||||||||||||||
* @typeParam Options - The type of the options object | ||||||||||||||||||||
*/ | ||||||||||||||||||||
class TokenConfig<Options extends FormApplicationOptions = FormApplicationOptions> extends FormApplication< | ||||||||||||||||||||
Options, | ||||||||||||||||||||
InstanceType<ConfiguredDocumentClassForName<"Token">> | InstanceType<ConfiguredDocumentClassForName<"Actor">> | ||||||||||||||||||||
> { | ||||||||||||||||||||
class TokenConfig<Options extends DocumentSheetOptions = DocumentSheetOptions> extends DocumentSheet<Options> { | ||||||||||||||||||||
constructor( | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doc comments for the parameters should be copied over from the sources. |
||||||||||||||||||||
object: | ||||||||||||||||||||
| InstanceType<ConfiguredDocumentClassForName<"Token">> | ||||||||||||||||||||
| InstanceType<ConfiguredDocumentClassForName<"Actor">>, | ||||||||||||||||||||
options?: Partial<Options> | ||||||||||||||||||||
); | ||||||||||||||||||||
|
||||||||||||||||||||
/** The placed Token object in the Scene */ | ||||||||||||||||||||
token: InstanceType<ConfiguredDocumentClassForName<"Token">> | PrototypeTokenDocument; | ||||||||||||||||||||
/** A reference to the Actor which the token depicts */ | ||||||||||||||||||||
actor: InstanceType<ConfiguredDocumentClassForName<"Actor">>; | ||||||||||||||||||||
/** Preserve a copy of the original document before any changes are made. */ | ||||||||||||||||||||
// TODO: unsure about this type. | ||||||||||||||||||||
original: TokenData["_source"]; | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* @defaultValue | ||||||||||||||||||||
|
@@ -36,25 +40,22 @@ declare global { | |||||||||||||||||||
* }) | ||||||||||||||||||||
* ``` | ||||||||||||||||||||
*/ | ||||||||||||||||||||
static override get defaultOptions(): FormApplicationOptions; | ||||||||||||||||||||
|
||||||||||||||||||||
override get id(): string; | ||||||||||||||||||||
static override get defaultOptions(): DocumentSheetOptions; | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also update the documented default return value. |
||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* A convenience accessor to test whether we are configuring the prototype Token for an Actor. | ||||||||||||||||||||
*/ | ||||||||||||||||||||
get isPrototype(): boolean; | ||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* Convenience access to the Actor document that this Token represents | ||||||||||||||||||||
*/ | ||||||||||||||||||||
get actor(): InstanceType<ConfiguredDocumentClassForName<"Actor">>; | ||||||||||||||||||||
override get id(): string; | ||||||||||||||||||||
|
||||||||||||||||||||
override get title(): string; | ||||||||||||||||||||
|
||||||||||||||||||||
override getData(options?: Partial<Options>): MaybePromise<object>; | ||||||||||||||||||||
override render(force?: boolean, options?: Application.RenderOptions<Options>): this; | ||||||||||||||||||||
|
||||||||||||||||||||
protected override _canUserView(user: User): boolean; | ||||||||||||||||||||
|
||||||||||||||||||||
override render(force?: boolean, options?: Application.RenderOptions<Options>): Promise<this>; | ||||||||||||||||||||
override getData(options?: Partial<Options>): MaybePromise<object>; | ||||||||||||||||||||
|
||||||||||||||||||||
protected override _renderInner(args: object): Promise<JQuery>; | ||||||||||||||||||||
|
||||||||||||||||||||
|
@@ -64,15 +65,25 @@ declare global { | |||||||||||||||||||
*/ | ||||||||||||||||||||
protected _getAlternateTokenImages(): Promise<Record<string, string>>; | ||||||||||||||||||||
|
||||||||||||||||||||
protected override _getHeaderButtons(): Application.HeaderButton[]; | ||||||||||||||||||||
override activateListeners(html: JQuery): void; | ||||||||||||||||||||
|
||||||||||||||||||||
override close(options?: FormApplication.CloseOptions | undefined): Promise<void>; | ||||||||||||||||||||
|
||||||||||||||||||||
protected override _getSubmitData(updateData?: object | null | undefined): Record<string, unknown>; | ||||||||||||||||||||
|
||||||||||||||||||||
protected override _onChangeInput(event: JQuery.ChangeEvent<any, any, any, any>): Promise<void>; | ||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* Shim for {@link DocumentSheet#_onConfigureSheet} that will be replaced in v10 when this class subclasses it. | ||||||||||||||||||||
* @internal | ||||||||||||||||||||
* Mimic changes to the Token document as if they were true document updates. | ||||||||||||||||||||
* @param change - Data which simulates a document update | ||||||||||||||||||||
* @param reset - To know if this preview change is a reset. Defaults to false. | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
*/ | ||||||||||||||||||||
protected _onConfigureSheet(event: JQuery.ClickEvent): void; | ||||||||||||||||||||
protected _previewChanges(change: Parameters<foundry.documents.BaseToken["_onUpdate"]>[0], reset?: boolean): void; | ||||||||||||||||||||
|
||||||||||||||||||||
override activateListeners(html: JQuery): void; | ||||||||||||||||||||
/** | ||||||||||||||||||||
* Reset the temporary preview of the Token when the form is submitted or closed. | ||||||||||||||||||||
*/ | ||||||||||||||||||||
protected _resetPreview(): void; | ||||||||||||||||||||
|
||||||||||||||||||||
protected override _updateObject(event: Event, formData: TokenConfig.FormData): Promise<unknown>; | ||||||||||||||||||||
|
||||||||||||||||||||
|
@@ -87,7 +98,16 @@ declare global { | |||||||||||||||||||
* Handle changing the attribute bar in the drop-down selector to update the default current and max value | ||||||||||||||||||||
* @internal | ||||||||||||||||||||
*/ | ||||||||||||||||||||
protected _onBarChange(ev: JQuery.ChangeEvent): void; | ||||||||||||||||||||
protected _onBarChange(event: JQuery.ChangeEvent): void; | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This now has parameter documentation, which should be added. |
||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* Handle click events on a token configuration sheet action button | ||||||||||||||||||||
* @param event - The originating click event */ | ||||||||||||||||||||
protected _onClickActionButton(event: JQuery.ClickEvent): void; | ||||||||||||||||||||
Comment on lines
+105
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* Disable the user's ability to edit the token image field if wildcard images are enabled and that user does not have | ||||||||||||||||||||
* file browser permissions. */ | ||||||||||||||||||||
private _disableEditImage(): void; | ||||||||||||||||||||
Comment on lines
+107
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
namespace TokenConfig { | ||||||||||||||||||||
|
@@ -132,9 +152,7 @@ declare global { | |||||||||||||||||||
/** | ||||||||||||||||||||
* A sheet that alters the values of the default Token configuration used when new Token documents are created. | ||||||||||||||||||||
*/ | ||||||||||||||||||||
class DefaultTokenConfig< | ||||||||||||||||||||
Options extends FormApplicationOptions = FormApplicationOptions | ||||||||||||||||||||
> extends TokenConfig<Options> { | ||||||||||||||||||||
class DefaultTokenConfig<Options extends DocumentSheetOptions> extends TokenConfig<Options> { | ||||||||||||||||||||
constructor(object: unknown, options?: Partial<Options> | undefined); | ||||||||||||||||||||
|
||||||||||||||||||||
data: foundry.data.TokenData; | ||||||||||||||||||||
|
@@ -158,7 +176,7 @@ declare global { | |||||||||||||||||||
* }) | ||||||||||||||||||||
* ``` | ||||||||||||||||||||
*/ | ||||||||||||||||||||
static override get defaultOptions(): FormApplicationOptions; | ||||||||||||||||||||
static override get defaultOptions(): DocumentSheetOptions; | ||||||||||||||||||||
|
||||||||||||||||||||
override get id(): string; | ||||||||||||||||||||
|
||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A piece of this comment was removed in V10. It should also be removed here.