@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250710065228 → 13.346.0-beta.20250710155653

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@league-of-foundry-developers/foundry-vtt-types",
4
- "version": "13.346.0-beta.20250710065228",
4
+ "version": "13.346.0-beta.20250710155653",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -1,4 +1,4 @@
1
- import type { AnyObject } from "../../../utils/index.d.mts";
1
+ import type { AnyObject, InexactPartial } from "../../../utils/index.d.mts";
2
2
  import type { FormInputConfig, NumberInputConfig, SelectInputConfig } from "#client/applications/forms/fields.d.mts";
3
3
 
4
4
  /**
@@ -51,8 +51,14 @@ export function loadTemplates(paths: string[] | Record<string, string>): Promise
51
51
  // TODO(LukeAbby): Create a registry for templates or some abstraction to make this type safe.
52
52
  export function renderTemplate(path: string, data: AnyObject): Promise<string>;
53
53
 
54
+ /**
55
+ * Initialize Handlebars extensions and helpers.
56
+ */
57
+ export function initialize(): void;
58
+
54
59
  /**
55
60
  * For checkboxes, if the value of the checkbox is true, add the "checked" property, otherwise add nothing.
61
+ * @param value - A value with a truthiness indicative of whether the checkbox is checked
56
62
  *
57
63
  * @example
58
64
  * ```hbs
@@ -64,6 +70,7 @@ export function checked(value: unknown): string;
64
70
 
65
71
  /**
66
72
  * For use in form inputs. If the supplied value is truthy, add the "disabled" property, otherwise add nothing.
73
+ * @param value - A value with a truthiness indicative of whether the input is disabled
67
74
  *
68
75
  * @example
69
76
  * ```hbs
@@ -97,7 +104,9 @@ export function editor(content: string, options: TextEditorOptions): Handlebars.
97
104
 
98
105
  /**
99
106
  * A ternary expression that allows inserting A or B depending on the value of C.
100
- * @param options - Helper options
107
+ * @param criteria - The test criteria
108
+ * @param ifTrue - The string to output if true
109
+ * @param ifFalse - The string to output if false
101
110
  * @returns The ternary result
102
111
  *
103
112
  * @example Ternary if-then template usage
@@ -105,10 +114,11 @@ export function editor(content: string, options: TextEditorOptions): Handlebars.
105
114
  * {{ifThen true "It is true" "It is false"}}
106
115
  * ```
107
116
  */
108
- export function ifThen(options: IfThenOptions): string;
117
+ export function ifThen(criteria: boolean, ifTrue: string, ifFalse: string): string;
109
118
 
110
119
  /**
111
120
  * Translate a provided string key by using the loaded dictionary of localization strings.
121
+ * @param value - value The path to a localized string
112
122
  *
113
123
  * @example Translate a provided localization string, optionally including formatting parameters
114
124
  * ```handlebars
@@ -145,6 +155,11 @@ export function numberFormat(value: string | number, options: NumberFormatOption
145
155
  */
146
156
  export function numberInput(value: string, options: NumberInputOptions): Handlebars.SafeString;
147
157
 
158
+ /**
159
+ * Create an object from a sequence of `key=value` pairs.
160
+ */
161
+ export function object(options: Handlebars.HelperOptions): Record<string, unknown>;
162
+
148
163
  /**
149
164
  * A helper to create a set of radio checkbox input elements in a named set.
150
165
  * The provided keys are the possible radio values while the provided values are human readable labels.
@@ -295,7 +310,10 @@ export function select(selected: string, options: SelectOptions): string;
295
310
  */
296
311
  export function rangePicker(options: RangePickerOptions): Handlebars.SafeString;
297
312
 
298
- interface ColorPickerOptions extends Partial<Handlebars.HelperOptions> {
313
+ /**
314
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
315
+ */
316
+ export interface ColorPickerOptions extends InexactPartial<Handlebars.HelperOptions> {
299
317
  hash: {
300
318
  /**
301
319
  * The name of the field to create
@@ -314,7 +332,10 @@ interface ColorPickerOptions extends Partial<Handlebars.HelperOptions> {
314
332
  };
315
333
  }
316
334
 
317
- interface TextEditorOptions extends Partial<Handlebars.HelperOptions> {
335
+ /**
336
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
337
+ */
338
+ export interface TextEditorOptions extends InexactPartial<Handlebars.HelperOptions> {
318
339
  hash: {
319
340
  /**
320
341
  * The named target data element
@@ -351,12 +372,15 @@ interface TextEditorOptions extends Partial<Handlebars.HelperOptions> {
351
372
  };
352
373
  }
353
374
 
354
- interface FilePickerOptions extends Partial<Handlebars.HelperOptions> {
375
+ /**
376
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
377
+ */
378
+ export interface FilePickerOptions extends InexactPartial<Handlebars.HelperOptions> {
355
379
  hash: {
356
380
  /**
357
381
  * The type of FilePicker instance to display
358
382
  */
359
- type?: foundry.applications.apps.FilePicker.Type;
383
+ type?: foundry.applications.apps.FilePicker.Type | undefined;
360
384
 
361
385
  /**
362
386
  * The field name in the target data
@@ -365,30 +389,18 @@ interface FilePickerOptions extends Partial<Handlebars.HelperOptions> {
365
389
  };
366
390
  }
367
391
 
368
- interface IfThenOptions extends Partial<Handlebars.HelperOptions> {
369
- hash: {
370
- /**
371
- * The test criteria
372
- */
373
- criteria: boolean;
374
-
375
- /**
376
- * The string to output if true
377
- */
378
- ifTrue: string;
379
-
380
- /**
381
- * The string to output if false
382
- */
383
- ifFalse: string;
384
- };
385
- }
386
-
387
- interface LocalizeOptions extends Partial<Handlebars.HelperOptions> {
392
+ /**
393
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
394
+ */
395
+ export interface LocalizeOptions extends InexactPartial<Handlebars.HelperOptions> {
396
+ /** Interpolation data passed to Localization#format */
388
397
  hash: Record<string, unknown>;
389
398
  }
390
399
 
391
- interface NumberFormatOptions extends Partial<Handlebars.HelperOptions> {
400
+ /**
401
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
402
+ */
403
+ export interface NumberFormatOptions extends InexactPartial<Handlebars.HelperOptions> {
392
404
  hash: {
393
405
  /**
394
406
  * The number of decimal places to include in the resulting string
@@ -404,7 +416,10 @@ interface NumberFormatOptions extends Partial<Handlebars.HelperOptions> {
404
416
  };
405
417
  }
406
418
 
407
- interface NumberInputOptions extends Partial<Handlebars.HelperOptions> {
419
+ /**
420
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
421
+ */
422
+ export interface NumberInputOptions extends InexactPartial<Handlebars.HelperOptions> {
408
423
  hash: FormInputConfig<number> &
409
424
  NumberInputConfig & {
410
425
  /**
@@ -414,7 +429,10 @@ interface NumberInputOptions extends Partial<Handlebars.HelperOptions> {
414
429
  };
415
430
  }
416
431
 
417
- interface RadioBoxesOptions extends Partial<Handlebars.HelperOptions> {
432
+ /**
433
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
434
+ */
435
+ export interface RadioBoxesOptions extends InexactPartial<Handlebars.HelperOptions> {
418
436
  hash: {
419
437
  /**
420
438
  * Which key is currently checked?
@@ -430,37 +448,48 @@ interface RadioBoxesOptions extends Partial<Handlebars.HelperOptions> {
430
448
  };
431
449
  }
432
450
 
433
- interface RangePickerOptions extends Partial<Handlebars.HelperOptions> {
434
- /**
435
- * The name of the field to create
436
- * @defaultValue `"range"`
437
- */
438
- name?: string;
439
-
440
- /**
441
- * The current range value
442
- */
443
- value?: number;
444
-
445
- /**
446
- * The minimum allowed value
447
- */
448
- min?: number;
449
-
450
- /**
451
- * The maximum allowed value
452
- */
453
- max?: number;
454
-
455
- /**
456
- * The allowed step size
457
- */
458
- step?: number;
451
+ /**
452
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
453
+ */
454
+ export interface RangePickerOptions extends InexactPartial<Handlebars.HelperOptions> {
455
+ hash?: {
456
+ /**
457
+ * The name of the field to create
458
+ * @defaultValue `"range"`
459
+ */
460
+ name?: string | undefined;
461
+
462
+ /**
463
+ * The current range value
464
+ */
465
+ value?: number | undefined;
466
+
467
+ /**
468
+ * The minimum allowed value
469
+ */
470
+ min?: number | undefined;
471
+
472
+ /**
473
+ * The maximum allowed value
474
+ */
475
+ max?: number | undefined;
476
+
477
+ /**
478
+ * The allowed step size
479
+ */
480
+ step?: number | undefined;
481
+ };
459
482
  }
460
483
 
461
- interface SelectOptions extends Handlebars.HelperOptions {}
484
+ /**
485
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
486
+ */
487
+ export interface SelectOptions extends InexactPartial<Handlebars.HelperOptions> {}
462
488
 
463
- interface SelectOptionsOptions extends Partial<Handlebars.HelperOptions> {
489
+ /**
490
+ * Despite extending Handlebars.HelperOptions, the function does not use the non-hash options
491
+ */
492
+ export interface SelectOptionsOptions extends InexactPartial<Handlebars.HelperOptions> {
464
493
  hash: SelectInputConfig & {
465
494
  /**
466
495
  * The currently selected value or values