@vttforge/core 0.11.2 → 0.11.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @vttforge/core
2
2
 
3
+ ## 0.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9b8ca8c: Export the option and config interfaces that public functions already took: `MockDocumentOptions` and `MockFoundryOptions` from `@vttforge/testing`, `ActorConfig` and `ItemConfig` from `@vttforge/core`. They were reachable through the functions but could not be named.
8
+ - 9b8ca8c: Plain punctuation in error messages, prompts and doc comments: em dashes replaced with sentence breaks, colons or parentheses. The generated API reference reads these comments, so they are public text.
9
+ - e0941e2: `@vttforge/types` now holds the Foundry surface the base factories stand on: `ApplicationV2Members`, `DocumentSheetV2Members` and `VttforgeClass`. `@vttforge/core` depends on it and re-exports the same names, so nothing changes for a system that imports from core.
10
+ - Updated dependencies [e0941e2]
11
+ - @vttforge/types@0.2.0
12
+
3
13
  ## 0.11.2
4
14
 
5
15
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 1,
3
3
  "package": "@vttforge/core",
4
- "packageVersion": "0.11.2",
4
+ "packageVersion": "0.11.3",
5
5
  "entries": [
6
6
  {
7
7
  "code": "VTTF-0001",
package/dist/index.d.mts CHANGED
@@ -1,107 +1,4 @@
1
- //#region src/foundry-base.d.ts
2
- /**
3
- * How a base factory reports what it returns.
4
- *
5
- * These factories mix VTTForge behaviour into a Foundry class resolved at
6
- * runtime, so the result has two halves: what we add, and what Foundry brings.
7
- *
8
- * ## What the index signature cost
9
- *
10
- * The first version returned `any` for the whole thing. The second kept our
11
- * half typed and let Foundry's through `[member: string]: any`. Both were
12
- * measured against two real consumers, and the index signature turned out to
13
- * be the worse of the two failures rather than a middle ground:
14
- *
15
- * ```ts
16
- * const viewer = new PdfViewer();
17
- * viewer.goToPage(3); // no such method — accepted
18
- * viewer.tpyoDeVerdade(); // not even a real name — accepted
19
- * ```
20
- *
21
- * A module shipped a release calling `url` and `goToPage` on a viewer that
22
- * had neither, and nothing reported it. An index signature makes every
23
- * property access legal, so a typo in the consumer's own subclass reads as
24
- * valid code.
25
- *
26
- * And it did not even buy the thing it looked like it bought:
27
- *
28
- * ```
29
- * error TS4113: This member cannot have an 'override' modifier because it is
30
- * not declared in the base class.
31
- * ```
32
- *
33
- * An index signature is not a declaration, so `override` on a Foundry member
34
- * was rejected anyway. It permitted what should have failed and forbade what
35
- * should have worked.
36
- *
37
- * ## What replaced it
38
- *
39
- * The Foundry members these factories actually stand on are written down
40
- * below. Removing the index signature and running both consumers produced
41
- * thirty-three errors naming eight distinct members — a set small enough to
42
- * declare, which is what settled the design. It is not the whole ApplicationV2
43
- * surface and does not claim to be; `@vttforge/types` is where that lands.
44
- *
45
- * Reaching a member that is not here is a cast, and a cast is a sentence you
46
- * write on purpose. That is the difference from an index signature, which
47
- * writes it for you on every line.
48
- */
49
- /**
50
- * The ApplicationV2 surface these bases rely on.
51
- *
52
- * Deliberately small. Every member here is one a real consumer used, not one
53
- * that exists in Foundry — the point is to describe what the factories stand
54
- * on, not to restate Foundry's API.
55
- */
56
- interface ApplicationV2Members {
57
- /** The window's root element once rendered. `undefined` before that. */
58
- readonly element: HTMLElement | undefined;
59
- /** The window title, from `options.window.title`. */
60
- readonly title: string;
61
- /** Whether the window is currently rendered. */
62
- readonly rendered: boolean;
63
- /** Render the application. Resolves when the render completes. */
64
- render(options?: unknown, _options?: unknown): Promise<unknown>;
65
- /** Close the window. */
66
- close(options?: unknown): Promise<unknown>;
67
- /** Build the render context. */
68
- _prepareContext(options: unknown): Promise<Record<string, unknown>>;
69
- /** Runs after every render. */
70
- _onRender(context: unknown, options: unknown): void;
71
- /** Runs after the first render only. */
72
- _onFirstRender(context: unknown, options: unknown): void;
73
- /** The resolved options this instance was constructed with. */
74
- readonly options: Record<string, unknown>;
75
- }
76
- /**
77
- * What a document sheet adds on top of an application.
78
- */
79
- interface DocumentSheetV2Members extends ApplicationV2Members {
80
- /**
81
- * The document this sheet is for.
82
- *
83
- * Typed loosely on purpose: which document, and what its `system` holds,
84
- * is the consumer's to know. Narrow it with a getter on your subclass.
85
- */
86
- readonly document: unknown;
87
- /** Whether the current user may edit this document. */
88
- readonly isEditable: boolean;
89
- }
90
- /**
91
- * A class this SDK built on top of a Foundry one.
92
- *
93
- * `Added` is what the factory contributes; `Foundry` is the part of Foundry's
94
- * own surface the factory stands on. Anything outside both is a cast — see
95
- * the note at the top of this file for why that is the point.
96
- *
97
- * `Foundry` defaults to nothing rather than to the application surface. A
98
- * `TypeDataModel` is not an application, and defaulting the other way handed
99
- * data models a `render` and a `close` they do not have.
100
- */
101
- type VttforgeClass<Added, Statics = unknown, Foundry = unknown> = Statics & {
102
- new (...args: any[]): Added & Foundry;
103
- };
104
- //#endregion
1
+ import { ApplicationV2Members, DocumentSheetV2Members, VttforgeClass } from "@vttforge/types";
105
2
  //#region src/base-actor-sheet.d.ts
106
3
  /**
107
4
  * Declarative DragDrop entry consumed by `_onRender`. Mirrors the
@@ -122,7 +19,7 @@ interface DragDropConfig {
122
19
  * The statics a VTTForge sheet base carries.
123
20
  *
124
21
  * The factory used to return a bare constructor, so a subclass writing
125
- * `super.DEFAULT_OPTIONS` the pattern the docs show and every sheet needs
22
+ * `super.DEFAULT_OPTIONS` (the pattern the docs show and every sheet needs)
126
23
  * failed to compile. TypeScript cannot see a static through an untyped
127
24
  * constructor. The example system never caught it because it is JavaScript.
128
25
  *
@@ -141,7 +38,7 @@ interface SheetBaseStatics {
141
38
  * What the sheet factories add on top of Foundry's own sheet.
142
39
  *
143
40
  * Only the members a subclass actually reaches for. The rest of the Foundry
144
- * surface stays reachable and untyped until `@vttforge/types` describes it
41
+ * surface stays reachable and untyped until `@vttforge/types` describes it;
145
42
  * see `DocumentSheetV2Members`.
146
43
  */
147
44
  interface SheetBaseMembers {
@@ -162,7 +59,7 @@ interface SheetBaseMembers {
162
59
  * Foundry's own drop entry points, implemented here to resolve the payload
163
60
  * and hand it to the `onDropX` hook above.
164
61
  *
165
- * Declared because the base really does define them an earlier version
62
+ * Declared because the base really does define them. An earlier version
166
63
  * left them off, and nothing said so while an index signature was making
167
64
  * every member name legal. Override `onDropItem` rather than this.
168
65
  */
@@ -247,7 +144,7 @@ interface BaseDocumentSheetMembers {
247
144
  /**
248
145
  * Put the rendered content in the window.
249
146
  *
250
- * The whole-content swap. Override for a sheet that updates in place
147
+ * The whole-content swap. Override for a sheet that updates in place:
251
148
  * a viewer that keeps its scroll position across a page turn, say.
252
149
  */
253
150
  _replaceHTML(result: HTMLElement, content: HTMLElement): void;
@@ -302,7 +199,7 @@ declare function BaseItemSheet(): SheetBaseCtor;
302
199
  * v0.1 `InferSchema<T>` surface.
303
200
  *
304
201
  * Mirrors the shape documented at https://foundryvtt.com/api/v13/ for each
305
- * `foundry.data.fields.*` class. Properties are structural they exist purely
202
+ * `foundry.data.fields.*` class. Properties are structural: they exist purely
306
203
  * so the conditional types in `./infer-schema.ts` can extract semantics like
307
204
  * `nullable: true` without us pulling in `fvtt-types` (deferred to
308
205
  * `@vttforge/types` v1.0).
@@ -352,7 +249,7 @@ interface ArrayFieldOptions extends DataFieldOptions {
352
249
  }
353
250
  type SchemaFieldOptions = DataFieldOptions;
354
251
  /**
355
- * `SetField` takes the same options as `ArrayField` it is a subclass whose
252
+ * `SetField` takes the same options as `ArrayField`. It is a subclass whose
356
253
  * only difference is what `initialize` hands back.
357
254
  */
358
255
  type SetFieldOptions = ArrayFieldOptions;
@@ -360,7 +257,7 @@ interface ForeignDocumentFieldOptions extends DataFieldOptions {
360
257
  /**
361
258
  * Keep the stored id instead of resolving the document.
362
259
  *
363
- * With this off, the field initializes to a getter reading the property
260
+ * With this off, the field initializes to a getter: reading the property
364
261
  * gives you a function, and calling it looks the document up. That is why
365
262
  * the two cases infer to different types.
366
263
  */
@@ -376,7 +273,7 @@ type TypedSchemaFieldOptions = DataFieldOptions;
376
273
  //#region src/data/fields.d.ts
377
274
  declare const BRAND: unique symbol;
378
275
  /**
379
- * Anything that satisfies the `FieldInstance` shape used as the inner-field
276
+ * Anything that satisfies the `FieldInstance` shape. Used as the inner-field
380
277
  * constraint on `ArrayField` and as the value type of `SchemaField`'s child
381
278
  * map. Keeps the conditional types in `./infer-schema.ts` straightforward.
382
279
  */
@@ -417,7 +314,7 @@ interface ArrayFieldInstance<Inner extends FieldInstance = FieldInstance, O exte
417
314
  * A `SetField` holds a `Set`, not an array.
418
315
  *
419
316
  * It extends `ArrayField` and validates the same way, but `initialize`
420
- * wraps the result in `new Set(...)` so a schema that declares one and
317
+ * wraps the result in `new Set(...)`, so a schema that declares one and
421
318
  * types it as an array gets `.push` and index access from the compiler on a
422
319
  * value that has neither.
423
320
  */
@@ -432,7 +329,7 @@ interface SetFieldInstance<Inner extends FieldInstance = FieldInstance, O extend
432
329
  * What you read back depends on `idOnly`. With it, the id string. Without
433
330
  * it, the document itself: the field resolves to a getter, so reading the
434
331
  * property looks the document up in its collection and hands back the
435
- * instance or `null` when it is gone or lives in a compendium.
332
+ * instance, or `null` when it is gone or lives in a compendium.
436
333
  *
437
334
  * The field is nullable by default, so both shapes admit `null`.
438
335
  */
@@ -445,7 +342,7 @@ interface ForeignDocumentFieldInstance<Doc extends DocumentClass = DocumentClass
445
342
  * A nested data model.
446
343
  *
447
344
  * It is a `SchemaField` built from the model class's own `defineSchema()`, so
448
- * the value is an instance of that model not a plain object. Reading it
345
+ * the value is an instance of that model, not a plain object. Reading it
449
346
  * gives you the model's derived data and methods too.
450
347
  */
451
348
  interface EmbeddedDataFieldInstance<Model extends DataModelClass = DataModelClass, O extends EmbeddedDataFieldOptions = EmbeddedDataFieldOptions> extends FieldInstance {
@@ -468,8 +365,8 @@ interface EmbeddedDocumentFieldInstance<Doc extends DataModelClass = DataModelCl
468
365
  * One of several shapes, told apart by a `type` property.
469
366
  *
470
367
  * Each entry becomes its own SchemaField. When an entry does not declare a
471
- * `type` field, the field adds one a required string whose value must equal
472
- * that entry's key which is what makes the result a discriminated union you
368
+ * `type` field, the field adds one (a required string whose value must equal
369
+ * that entry's key), which is what makes the result a discriminated union you
473
370
  * can narrow on.
474
371
  */
475
372
  interface TypedSchemaFieldInstance<T extends Record<string, Record<string, FieldInstance>> = Record<string, Record<string, FieldInstance>>, O extends TypedSchemaFieldOptions = TypedSchemaFieldOptions> extends FieldInstance {
@@ -507,7 +404,7 @@ interface SetFieldCtor {
507
404
  new <Inner extends FieldInstance, O extends SetFieldOptions = SetFieldOptions>(element: Inner, options?: O): SetFieldInstance<Inner, O>;
508
405
  }
509
406
  /**
510
- * Any document class what `ForeignDocumentField` takes as its first
407
+ * Any document class: what `ForeignDocumentField` takes as its first
511
408
  * argument. Declared structurally so the inference surface stays free of a
512
409
  * dependency on a Foundry type package.
513
410
  */
@@ -515,7 +412,7 @@ type DocumentClass = abstract new (...args: never[]) => object;
515
412
  interface ForeignDocumentFieldCtor {
516
413
  new <Doc extends DocumentClass, O extends ForeignDocumentFieldOptions = ForeignDocumentFieldOptions>(model: Doc, options?: O): ForeignDocumentFieldInstance<Doc, O>;
517
414
  }
518
- /** Any DataModel subclass what the embedded fields take as their type. */
415
+ /** Any DataModel subclass: what the embedded fields take as their type. */
519
416
  type DataModelClass = abstract new (...args: never[]) => object;
520
417
  interface EmbeddedDataFieldCtor {
521
418
  new <Model extends DataModelClass, O extends EmbeddedDataFieldOptions = EmbeddedDataFieldOptions>(model: Model, options?: O): EmbeddedDataFieldInstance<Model, O>;
@@ -531,7 +428,7 @@ interface SchemaFieldCtor {
531
428
  }
532
429
  /**
533
430
  * Typed bag returned by `fields()`. Each property is the corresponding
534
- * `foundry.data.fields.*` class the runtime value is Foundry's own
431
+ * `foundry.data.fields.*` class. The runtime value is Foundry's own
535
432
  * constructor; the type is our overlay.
536
433
  */
537
434
  interface FieldsApi {
@@ -554,7 +451,7 @@ interface FieldsApi {
554
451
  *
555
452
  * Call this inside `defineSchema()` (or any code that runs after Foundry's
556
453
  * `init` hook). Calling at module scope will throw when imported from Node
557
- * tests the global only exists inside the Foundry runtime.
454
+ * tests; the global only exists inside the Foundry runtime.
558
455
  *
559
456
  * @throws `VttfError` with code `VTTF-0002` when `foundry.data.fields` is
560
457
  * missing.
@@ -565,8 +462,8 @@ declare function fields(): FieldsApi;
565
462
  /**
566
463
  * The shape a `ColorField` hands back.
567
464
  *
568
- * Foundry initializes the field into one of its own `Color` instances a
569
- * boxed 24-bit integer with derived accessors rather than the CSS string it
465
+ * Foundry initializes the field into one of its own `Color` instances (a
466
+ * boxed 24-bit integer with derived accessors) rather than the CSS string it
570
467
  * stores. Described structurally here rather than imported, because the
571
468
  * inference surface deliberately does not depend on the Foundry type package.
572
469
  *
@@ -601,13 +498,13 @@ interface Color {
601
498
  /**
602
499
  * Flatten an intersection / mapped type into a plain object literal so IDE
603
500
  * hovers stay readable (Matt Pocock's `Prettify`). Use on every public
604
- * conditional-type surface PRD §7 TS-hygiene rule.
501
+ * conditional-type surface, for IDE performance.
605
502
  */
606
503
  type Prettify<T> = { [K in keyof T]: T[K]; } & {};
607
504
  /**
608
505
  * Whether a field's options gave an explicit `initial`.
609
506
  *
610
- * Presence of the key is the question, not its value `{ initial: undefined }`
507
+ * Presence of the key is the question, not its value: `{ initial: undefined }`
611
508
  * is not an initial.
612
509
  */
613
510
  type HasInitial<O> = O extends {
@@ -682,7 +579,7 @@ type ContainerDefaults = {
682
579
  nullable: false;
683
580
  populated: true;
684
581
  };
685
- /** Required but nullable an id that points at nothing is `null`. */
582
+ /** Required but nullable: an id that points at nothing is `null`. */
686
583
  type ReferenceDefaults = {
687
584
  required: true;
688
585
  nullable: true;
@@ -692,7 +589,7 @@ type ReferenceDefaults = {
692
589
  * What a `ColorField` holds once the model is initialized.
693
590
  *
694
591
  * Not a string. The field casts its stored value to a CSS string, but
695
- * `initialize` hands back a `Color` instance so `system.tint` is an object
592
+ * `initialize` hands back a `Color` instance, so `system.tint` is an object
696
593
  * with `.css`, `.rgb`, `.hex` and friends, and typing it as `string` makes
697
594
  * every property access on it a lie the compiler accepts.
698
595
  *
@@ -704,7 +601,7 @@ type ColorFieldValue<O> = Presence<O, Color, NullStartDefaults>;
704
601
  * What a `ForeignDocumentField` holds once the model is initialized.
705
602
  *
706
603
  * With `idOnly`, the stored id string. Without it the field resolves to a
707
- * getter, and the data model installs it as one so reading the property
604
+ * getter, and the data model installs it as one, so reading the property
708
605
  * gives the document instance, not the function that fetched it. It yields
709
606
  * `null` when the id points at nothing, or when the parent lives in a
710
607
  * compendium.
@@ -728,8 +625,8 @@ type ForeignDocumentValue<Doc extends DocumentClass, O> = Presence<O, O extends
728
625
  * What a `TypedSchemaField` holds: one shape per entry, each carrying the
729
626
  * key it was filed under as its `type`.
730
627
  *
731
- * The field supplies that `type` when an entry does not declare one a
732
- * required string validated to equal the key so narrowing on `type` picks
628
+ * The field supplies that `type` when an entry does not declare one (a
629
+ * required string validated to equal the key), so narrowing on `type` picks
733
630
  * exactly one branch.
734
631
  */
735
632
  type TypedSchemaValue<T extends Record<string, Record<string, FieldInstance>>> = { [K in keyof T]: Prettify<InferSchema<T[K]> & {
@@ -737,7 +634,7 @@ type TypedSchemaValue<T extends Record<string, Record<string, FieldInstance>>> =
737
634
  }>; }[keyof T];
738
635
  /**
739
636
  * Map a single field instance to its runtime TypeScript type. `never` for
740
- * shapes we don't recognise — the v1.0 `@vttforge/types` package will widen
637
+ * shapes we don't recognise; `@vttforge/types` will widen
741
638
  * this matrix to the remaining Foundry fields.
742
639
  */
743
640
  type InferField<F> = F extends NumberFieldInstance<infer O> ? Presence<O, number, NumberDefaults> : F extends StringFieldInstance<infer O> ? Presence<O, string, StringDefaults> : F extends BooleanFieldInstance<infer O> ? Presence<O, boolean, BooleanDefaults> : F extends HTMLFieldInstance<infer O> ? Presence<O, string, HTMLDefaults> : F extends ColorFieldInstance<infer O> ? ColorFieldValue<O> : F extends FilePathFieldInstance<infer O> ? Presence<O, string, NullStartDefaults> : F extends ForeignDocumentFieldInstance<infer Doc, infer O> ? ForeignDocumentValue<Doc, O> : F extends ArrayFieldInstance<infer Inner, infer O> ? Presence<O, InferField<Inner>[], ContainerDefaults> : F extends SetFieldInstance<infer Inner, infer O> ? Presence<O, Set<InferField<Inner>>, ContainerDefaults> : F extends SchemaFieldInstance<infer S, infer O> ? Presence<O, InferSchema<S>, ContainerDefaults> : F extends EmbeddedDocumentFieldInstance<infer Doc, infer O> ? Presence<O, InstanceType<Doc>, ReferenceDefaults> : F extends EmbeddedDataFieldInstance<infer Model, infer O> ? Presence<O, InstanceType<Model>, ContainerDefaults> : F extends TypedSchemaFieldInstance<infer T, infer O> ? Presence<O, TypedSchemaValue<T>, ContainerDefaults> : never;
@@ -777,7 +674,7 @@ interface TypeDataModelHooks {
777
674
  /**
778
675
  * What an instance looks like when the schema is known.
779
676
  *
780
- * The schema's fields ARE the instance properties inside
677
+ * The schema's fields ARE the instance properties: inside
781
678
  * `prepareDerivedData()` you read `this.level`, not `this.system.level`, and
782
679
  * `actor.system` is this instance.
783
680
  *
@@ -791,7 +688,7 @@ interface TypeDataModelHooks {
791
688
  type TypedTypeDataModel<S extends Record<string, FieldInstance>> = InferSchema<S> & TypeDataModelHooks & {
792
689
  /**
793
690
  * Phantom property carrying the schema's inferred shape. Never assigned,
794
- * never present at runtime it exists so the type has a name:
691
+ * never present at runtime; it exists so the type has a name:
795
692
  *
796
693
  * ```ts
797
694
  * type CharacterSystem = CharacterData['$inferData'];
@@ -841,10 +738,10 @@ declare function BaseTypeDataModel<S extends Record<string, FieldInstance>>(defi
841
738
  //#endregion
842
739
  //#region src/errors/registry.d.ts
843
740
  /**
844
- * VTTF-NNNN error registry append-only, stable across majors.
741
+ * VTTF-NNNN error registry: append-only, stable across majors.
845
742
  *
846
743
  * Every error VTTForge throws has a numeric code (`VTTF-NNNN`) and a PascalCase
847
- * `name` for stack-trace readability. Codes are URLs `https://vttforge.dev/errors/VTTF-0001`
744
+ * `name` for stack-trace readability. Codes are URLs: `https://vttforge.dev/errors/VTTF-0001`
848
745
  * eventually links to a docs page generated from this registry.
849
746
  *
850
747
  * Never renumber an entry. To deprecate, mark with `deprecated: true` and add a
@@ -859,7 +756,7 @@ interface VttfErrorEntry {
859
756
  readonly replacedBy?: VttfErrorCode;
860
757
  }
861
758
  /**
862
- * Look up a registered entry by code. Throws if the code is unknown the
759
+ * Look up a registered entry by code. Throws if the code is unknown; the
863
760
  * registry is the source of truth, so missing codes mean a typo.
864
761
  */
865
762
  declare function getErrorEntry(code: VttfErrorCode): VttfErrorEntry;
@@ -870,10 +767,10 @@ declare function getErrorEntry(code: VttfErrorCode): VttfErrorEntry;
870
767
  declare function listErrorEntries(): readonly VttfErrorEntry[];
871
768
  declare function docsUrlFor(code: VttfErrorCode): string;
872
769
  /**
873
- * VttfError every error VTTForge throws extends this.
770
+ * VttfError: every error VTTForge throws extends this.
874
771
  *
875
772
  * - `code` is the registry key (string-narrowed).
876
- * - `name` is the PascalCase name from the registry shows up in stack traces.
773
+ * - `name` is the PascalCase name from the registry; it shows up in stack traces.
877
774
  * - `docsUrl` points at the docs page.
878
775
  * - `cause` uses the native ES2022 mechanism. Multiple causes => pass an
879
776
  * `AggregateError` as the cause.
@@ -893,7 +790,7 @@ interface ErrorManifest {
893
790
  }
894
791
  /**
895
792
  * Snapshot the current registry as a manifest object. Recomputed on every
896
- * call cheap (the registry is a frozen literal). For the JSON projection
793
+ * call, cheap because the registry is a frozen literal. For the JSON projection
897
794
  * shipped with the package, see `dist/errors-manifest.json`.
898
795
  */
899
796
  declare function getErrorManifest(): ErrorManifest;
@@ -902,7 +799,7 @@ declare function getErrorManifest(): ErrorManifest;
902
799
  /**
903
800
  * Minimal type-only contracts for the Foundry v13+ globals VTTForge core touches.
904
801
  *
905
- * Intentionally narrow full Foundry typing lives in `@vttforge/types` (v1.0)
802
+ * Intentionally narrow. The Foundry members the bases stand on are in `@vttforge/types`;
906
803
  * built on top of `fvtt-types`. We mirror just the surface we use so the core
907
804
  * package compiles without pulling in fvtt-types' git-SHA dependency.
908
805
  *
@@ -975,7 +872,7 @@ interface FoundryConfig {
975
872
  interface Migration {
976
873
  /** Semver version this migration brings the world to. */
977
874
  readonly version: string;
978
- /** Optional human-readable description logged when the migration runs and shown in error messages. */
875
+ /** Optional human-readable description, logged when the migration runs and shown in error messages. */
979
876
  readonly description?: string;
980
877
  /** The migration body. May be sync or async. Should be idempotent (safe to re-run after partial failure). */
981
878
  readonly fn: () => void | Promise<void>;
@@ -986,14 +883,14 @@ interface MigrationLogger {
986
883
  error(message: string): void;
987
884
  }
988
885
  interface MigrationRunnerOptions {
989
- /** System id used as the `game.settings` namespace. */
886
+ /** System id, used as the `game.settings` namespace. */
990
887
  readonly systemId: string;
991
888
  /** Migrations in ascending version order. Empty array is allowed (`run()` is a no-op then). */
992
889
  readonly migrations: ReadonlyArray<Migration>;
993
890
  /** Settings key under `systemId`. Defaults to `'schemaVersion'`. */
994
891
  readonly settingKey?: string;
995
892
  /**
996
- * Compatibility floor worlds with a stored schemaVersion strictly older than this
893
+ * Compatibility floor: worlds with a stored schemaVersion strictly older than this
997
894
  * throw `VttfError VTTF-0005` instead of running migrations. Mirrors the
998
895
  * `flags.<systemId>.compatibleMigrationVersion` declaration in `system.json`.
999
896
  */
@@ -1030,7 +927,7 @@ interface MigrationRunner {
1030
927
  * wrapping the original error if any migration throws; throws
1031
928
  * `VttfError VTTF-0005` if the stored version is older than `compatibleVersion`.
1032
929
  *
1033
- * Call from your `ready` hook, gated by `game.user.isGM` this method does
930
+ * Call from your `ready` hook, gated by `game.user.isGM`; this method does
1034
931
  * NOT enforce GM-only itself so consumers can compose differently if needed.
1035
932
  */
1036
933
  run(): Promise<ReadonlyArray<string>>;
@@ -1068,8 +965,8 @@ declare function createMigrationRunner(options: MigrationRunnerOptions): Migrati
1068
965
  /**
1069
966
  * Text enricher registration.
1070
967
  *
1071
- * An enricher turns a pattern in any rich text field chat, journals, item
1072
- * descriptions into markup. `@PDF[handbook|page=12]{Player's Handbook}`
968
+ * An enricher turns a pattern in any rich text field (chat, journals, item
969
+ * descriptions) into markup. `@PDF[handbook|page=12]{Player's Handbook}`
1073
970
  * becomes a link that opens the book at that page.
1074
971
  *
1075
972
  * `CONFIG.TextEditor.enrichers` is a plain array, so registering by hand is one
@@ -1081,7 +978,7 @@ declare function createMigrationRunner(options: MigrationRunnerOptions): Migrati
1081
978
  * nothing to fire the callback from. The enricher still produces markup, so
1082
979
  * the text looks right and only the behaviour is missing.
1083
980
  * - **A duplicate `id` silently loses.** The wrapper stores the id as an
1084
- * attribute and looks the enricher back up with `find` first match wins.
981
+ * attribute and looks the enricher back up with `find`; first match wins.
1085
982
  * Two packages using `link` means the first one's `onRender` runs against the
1086
983
  * second one's markup. Only reproducible with both installed.
1087
984
  * - **A pattern without the `g` flag throws.** Enrichment runs the pattern
@@ -1105,13 +1002,13 @@ interface EnricherRegistration {
1105
1002
  */
1106
1003
  readonly id: string;
1107
1004
  /**
1108
- * The pattern to match. Must carry the `g` flag enrichment runs it through
1005
+ * The pattern to match. Must carry the `g` flag: enrichment runs it through
1109
1006
  * `matchAll`, which refuses a non-global regex.
1110
1007
  */
1111
1008
  readonly pattern: RegExp;
1112
1009
  /**
1113
1010
  * Build the replacement for one match. Return `null` to leave the text
1114
- * alone the usual answer when the thing referenced does not exist or the
1011
+ * alone, the usual answer when the thing referenced does not exist or the
1115
1012
  * reader is not allowed to see it.
1116
1013
  */
1117
1014
  readonly enricher: (match: RegExpMatchArray, options?: unknown) => Promise<HTMLElement | null> | HTMLElement | null;
@@ -1146,7 +1043,7 @@ declare function registerEnrichers(packageId: string, enrichers: readonly Enrich
1146
1043
  * same sheet registers as `mo` in one build and `vo` in the next. The saved
1147
1044
  * key then names a sheet that no longer exists, Foundry falls back to the
1148
1045
  * default, and the reader's chosen sheet is gone with nothing in the console.
1149
- * It hits released upgrades, not just a dev loop pick the sheet in 1.0, ship
1046
+ * It hits released upgrades, not just a dev loop: pick the sheet in 1.0, ship
1150
1047
  * 1.1, and the choice is lost.
1151
1048
  *
1152
1049
  * So the caller names the sheet and VTTForge fixes the class name to that
@@ -1176,7 +1073,7 @@ interface SheetRegistration {
1176
1073
  * Document sub-types the sheet applies to. Omit to offer it for every type.
1177
1074
  *
1178
1075
  * A module registering a sheet for its own sub-type must pass the prefixed
1179
- * key `moduleSubType(id, 'pdf')`, not `'pdf'`.
1076
+ * key: `moduleSubType(id, 'pdf')`, not `'pdf'`.
1180
1077
  */
1181
1078
  readonly types?: readonly string[];
1182
1079
  /** Localization key for the name shown in the sheet picker. */
@@ -1198,7 +1095,7 @@ declare function registerSheets(packageId: string, sheets: readonly SheetRegistr
1198
1095
  //#endregion
1199
1096
  //#region src/register-module.d.ts
1200
1097
  interface ModuleRegistration {
1201
- /** Module id must match the folder name and `module.json` `id`. */
1098
+ /** Module id: must match the folder name and `module.json` `id`. */
1202
1099
  readonly id: string;
1203
1100
  /**
1204
1101
  * Actor sub-types this module contributes, keyed by the bare type name.
@@ -1232,7 +1129,7 @@ interface ModuleRegistration {
1232
1129
  * with it. See `registerEnrichers`.
1233
1130
  */
1234
1131
  readonly enrichers?: readonly EnricherRegistration[];
1235
- /** Runs before any CONFIG mutation the usual home for the module API. */
1132
+ /** Runs before any CONFIG mutation: the usual home for the module API. */
1236
1133
  readonly onBeforeInit?: () => void;
1237
1134
  /** Runs after the mutations above, inside the same `init` hook. */
1238
1135
  readonly onAfterInit?: () => void;
@@ -1246,7 +1143,7 @@ interface ModuleRegistration {
1246
1143
  /**
1247
1144
  * The key Foundry files a module's document sub-type under.
1248
1145
  *
1249
- * Use it wherever you name the type outside `registerModule` registering the
1146
+ * Use it wherever you name the type outside `registerModule`: registering the
1250
1147
  * sheet, checking `actor.type`, writing `documentTypes` in the manifest. The
1251
1148
  * prefix is easy to get wrong by hand and fails silently when you do.
1252
1149
  *
@@ -1259,7 +1156,7 @@ declare function moduleSubType(moduleId: string, type: string): string;
1259
1156
  /**
1260
1157
  * Register a Foundry module with VTTForge.
1261
1158
  *
1262
- * Calling twice with the same `id` throws VTTF-0001 almost always a
1159
+ * Calling twice with the same `id` throws VTTF-0001, almost always a
1263
1160
  * hot-reload artefact or a duplicate import. The CONFIG mutations are deferred
1264
1161
  * until Foundry's `init` hook fires.
1265
1162
  */
@@ -1267,7 +1164,7 @@ declare function registerModule(config: ModuleRegistration): ModuleRegistration;
1267
1164
  //#endregion
1268
1165
  //#region src/register-system.d.ts
1269
1166
  interface SystemRegistration {
1270
- /** System id must match the folder name and `system.json` `id`. */
1167
+ /** System id: must match the folder name and `system.json` `id`. */
1271
1168
  readonly id: string;
1272
1169
  /** Map of `documentTypes.Actor` key → TypeDataModel class. */
1273
1170
  readonly actorDataModels?: Readonly<Record<string, unknown>>;
@@ -1277,12 +1174,12 @@ interface SystemRegistration {
1277
1174
  readonly actorDocumentClass?: unknown;
1278
1175
  /** Replacement for `CONFIG.Item.documentClass`. */
1279
1176
  readonly itemDocumentClass?: unknown;
1280
- /** Global initiative formula assigned to `CONFIG.Combat.initiative`. */
1177
+ /** Global initiative formula: assigned to `CONFIG.Combat.initiative`. */
1281
1178
  readonly combat?: CombatConfig;
1282
1179
  /** Disables legacy Active Effect transferral. Defaults to true. */
1283
1180
  readonly activeEffect?: ActiveEffectConfig;
1284
1181
  /**
1285
- * Replaces `CONFIG.statusEffects` (systems own this array modules push).
1182
+ * Replaces `CONFIG.statusEffects` (systems own this array; modules push).
1286
1183
  * If omitted, the existing array is kept untouched.
1287
1184
  */
1288
1185
  readonly statusEffects?: readonly unknown[];
@@ -1305,23 +1202,23 @@ interface SystemRegistration {
1305
1202
  readonly enrichers?: readonly EnricherRegistration[];
1306
1203
  /**
1307
1204
  * Optional pre-init hook for work that has to run before any of the CONFIG
1308
- * mutations (rare usually used to assign `globalThis.<systemId>` API).
1205
+ * mutations (rare; usually used to assign `globalThis.<systemId>` API).
1309
1206
  */
1310
1207
  readonly onBeforeInit?: () => void;
1311
1208
  /** Optional post-init hook for work that depends on the mutations above. */
1312
1209
  readonly onAfterInit?: () => void;
1313
1210
  /**
1314
- * Optional `ready` hook fires once after Foundry has finished bootstrap.
1211
+ * Optional `ready` hook. Fires once after Foundry has finished bootstrap.
1315
1212
  * The natural home for migration runners (`createMigrationRunner().run()`).
1316
1213
  *
1317
1214
  * **Not GM-gated.** Guard inside your callback (`if (!game.user.isGM) return;`)
1318
- * when the work is GM-only migrations always are.
1215
+ * when the work is GM-only, and migrations always are.
1319
1216
  */
1320
1217
  readonly onReady?: () => void | Promise<void>;
1321
1218
  }
1322
1219
  /**
1323
1220
  * Register a Foundry system with VTTForge. Idempotency: the same `id` calling
1324
- * twice throws VTTF-0001 almost always a hot-reload or duplicate import bug.
1221
+ * twice throws VTTF-0001, almost always a hot-reload or duplicate import bug.
1325
1222
  *
1326
1223
  * Returns the registration object so consumers can inspect what was applied
1327
1224
  * (useful in tests). The actual CONFIG mutations are deferred until Foundry's
@@ -1342,26 +1239,26 @@ declare class SystemConfig {
1342
1239
  //#endregion
1343
1240
  //#region src/index.d.ts
1344
1241
  /**
1345
- * @vttforge/core runtime utilities for FoundryVTT v13+ systems and modules.
1242
+ * @vttforge/core: runtime utilities for FoundryVTT v13+ systems and modules.
1346
1243
  *
1347
1244
  * v0.1 surface:
1348
1245
  *
1349
- * - registerSystem() one-call init, replaces Hooks.once("init")
1350
- * - registerModule() the same for modules, with namespaced sub-types
1351
- * - SystemConfig typed wrapper around game.settings
1352
- * - BaseTypeDataModel() TypeDataModel with safe migrateData default
1353
- * - BaseActorSheet() ActorSheetV2 + HandlebarsApplicationMixin
1354
- * - BaseItemSheet() ItemSheetV2 + HandlebarsApplicationMixin
1355
- * - fields() typed bag of foundry.data.fields constructors
1356
- * - InferSchema<T> — derive `system` shape from defineSchema()
1357
- * - createMigrationRunner() declarative schema migrations (register + run)
1358
- * - VttfError + error registry VTTF-NNNN codes with docs URLs
1246
+ * - registerSystem(): one-call init, replaces Hooks.once("init")
1247
+ * - registerModule(): the same for modules, with namespaced sub-types
1248
+ * - SystemConfig: typed wrapper around game.settings
1249
+ * - BaseTypeDataModel(): TypeDataModel with safe migrateData default
1250
+ * - BaseActorSheet(): ActorSheetV2 + HandlebarsApplicationMixin
1251
+ * - BaseItemSheet(): ItemSheetV2 + HandlebarsApplicationMixin
1252
+ * - fields(): typed bag of foundry.data.fields constructors
1253
+ * - InferSchema<T>: derive `system` shape from defineSchema()
1254
+ * - createMigrationRunner(): declarative schema migrations (register + run)
1255
+ * - VttfError + error registry: VTTF-NNNN codes with docs URLs
1359
1256
  *
1360
1257
  * Foundry classes are resolved from `globalThis.foundry` lazily so the package
1361
- * imports cleanly in Node/tests; concrete Foundry typing arrives with
1362
- * `@vttforge/types` in v1.0.
1258
+ * imports cleanly in Node/tests. The Foundry members the bases stand on are
1259
+ * declared in `@vttforge/types` and re-exported here.
1363
1260
  */
1364
1261
  declare const VTTFORGE_CORE_VERSION: string;
1365
1262
  //#endregion
1366
- export { type ActiveEffectConfig, type ApplicationV2Members, type ArrayFieldCtor, type ArrayFieldInstance, type ArrayFieldOptions, BaseActorSheet, BaseApplication, type BaseApplicationMembers, BaseDocumentSheet, type BaseDocumentSheetMembers, BaseItemSheet, BaseTypeDataModel, type BooleanFieldCtor, type BooleanFieldInstance, type BooleanFieldOptions, type ColorFieldCtor, type ColorFieldInstance, type ColorFieldOptions, type CombatConfig, type DataFieldOptions, type DataModelClass, type DocumentClass, type DocumentSheetKind, type DocumentSheetV2Members, type DragDropConfig, ERROR_MANIFEST_VERSION, type EmbeddedDataFieldCtor, type EmbeddedDataFieldInstance, type EmbeddedDataFieldOptions, type EmbeddedDocumentFieldCtor, type EmbeddedDocumentFieldInstance, type EmbeddedDocumentFieldOptions, type EnricherRegistration, type ErrorManifest, type FieldInstance, type FieldsApi, type FilePathFieldCtor, type FilePathFieldInstance, type FilePathFieldOptions, type ForeignDocumentFieldCtor, type ForeignDocumentFieldInstance, type ForeignDocumentFieldOptions, type FoundryConfig, type GameApi, type GameSettingsApi, type HTMLFieldCtor, type HTMLFieldInstance, type HTMLFieldOptions, type HookCallback, type HooksApi, type InferField, type InferSchema, type Migration, type MigrationLogger, type MigrationRunner, type MigrationRunnerOptions, type ModuleRegistration, type NumberFieldCtor, type NumberFieldInstance, type NumberFieldOptions, type Prettify, type SchemaFieldCtor, type SchemaFieldInstance, type SchemaFieldOptions, type SetFieldCtor, type SetFieldInstance, type SetFieldOptions, type SettingConfig, type SettingScope, type SheetBaseCtor, type SheetBaseMembers, type SheetBaseStatics, type SheetDocumentKind, type SheetRegistration, type StringFieldCtor, type StringFieldInstance, type StringFieldOptions, SystemConfig, type SystemRegistration, type TypeDataModelHooks, type TypedSchemaFieldCtor, type TypedSchemaFieldInstance, type TypedSchemaFieldOptions, type TypedTypeDataModel, type TypedTypeDataModelCtor, VTTFORGE_CORE_VERSION, VTTFORGE_SHEET_CLASS, VttfError, type VttfErrorCode, type VttfErrorEntry, type VttforgeClass, createMigrationRunner, docsUrlFor, fields, getErrorEntry, getErrorManifest, listErrorEntries, moduleSubType, registerEnrichers, registerModule, registerSheets, registerSystem };
1263
+ export { type ActiveEffectConfig, type ActorConfig, type ApplicationV2Members, type ArrayFieldCtor, type ArrayFieldInstance, type ArrayFieldOptions, BaseActorSheet, BaseApplication, type BaseApplicationMembers, BaseDocumentSheet, type BaseDocumentSheetMembers, BaseItemSheet, BaseTypeDataModel, type BooleanFieldCtor, type BooleanFieldInstance, type BooleanFieldOptions, type ColorFieldCtor, type ColorFieldInstance, type ColorFieldOptions, type CombatConfig, type ConfigCollection, type DataFieldOptions, type DataModelClass, type DocumentClass, type DocumentSheetKind, type DocumentSheetV2Members, type DragDropConfig, ERROR_MANIFEST_VERSION, type EmbeddedDataFieldCtor, type EmbeddedDataFieldInstance, type EmbeddedDataFieldOptions, type EmbeddedDocumentFieldCtor, type EmbeddedDocumentFieldInstance, type EmbeddedDocumentFieldOptions, type EnricherRegistration, type ErrorManifest, type FieldInstance, type FieldsApi, type FilePathFieldCtor, type FilePathFieldInstance, type FilePathFieldOptions, type ForeignDocumentFieldCtor, type ForeignDocumentFieldInstance, type ForeignDocumentFieldOptions, type FoundryConfig, type GameApi, type GameSettingsApi, type HTMLFieldCtor, type HTMLFieldInstance, type HTMLFieldOptions, type HookCallback, type HooksApi, type InferField, type InferSchema, type ItemConfig, type Migration, type MigrationLogger, type MigrationRunner, type MigrationRunnerOptions, type ModuleRegistration, type NumberFieldCtor, type NumberFieldInstance, type NumberFieldOptions, type Prettify, type SchemaFieldCtor, type SchemaFieldInstance, type SchemaFieldOptions, type SetFieldCtor, type SetFieldInstance, type SetFieldOptions, type SettingConfig, type SettingScope, type SheetBaseCtor, type SheetBaseMembers, type SheetBaseStatics, type SheetDocumentKind, type SheetRegistration, type StringFieldCtor, type StringFieldInstance, type StringFieldOptions, SystemConfig, type SystemRegistration, type TypeDataModelHooks, type TypedSchemaFieldCtor, type TypedSchemaFieldInstance, type TypedSchemaFieldOptions, type TypedTypeDataModel, type TypedTypeDataModelCtor, VTTFORGE_CORE_VERSION, VTTFORGE_SHEET_CLASS, VttfError, type VttfErrorCode, type VttfErrorEntry, type VttforgeClass, createMigrationRunner, docsUrlFor, fields, getErrorEntry, getErrorManifest, listErrorEntries, moduleSubType, registerEnrichers, registerModule, registerSheets, registerSystem };
1367
1264
  //# sourceMappingURL=index.d.mts.map