diff --git a/module/settings.js b/module/settings.js
index 797c523..6cc7e53 100644
--- a/module/settings.js
+++ b/module/settings.js
@@ -3,17 +3,43 @@ import DG from "./config.js";
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
+/**
+ * Base class for all setting forms.
+ *
+ * Note: This class is abstract and should not be instantiated directly.
+ *
+ * @extends {ApplicationV2}
+ */
const SettingForm = class extends HandlebarsApplicationMixin(ApplicationV2) {
- static _namespace;
+ /** @type {"automation"|"handler"|null} */
+ static _namespace = null;
+ /**
+ * The namespace for the settings defined by this class. This is necessary
+ * to register the settings with the game.
+ *
+ * @returns {string}
+ */
static get namespace() {
return this._namespace;
}
+ /**
+ * A getter that returns an object with all the settings defined by the subclass.
+ * Used to register settings with the game.
+ *
+ * @abstract
+ * @returns {object} An object with all the settings defined by the subclass
+ * @throws Will throw an error if this method is not defined by a subclass.
+ */
static get settings() {
throw new Error("This static getter must be defined by a subclass");
}
+ /**
+ * Registers the settings for each defined SettingForm subclass.
+ * @returns {void}
+ */
static register() {
const { settings } = this;
for (const [settingID, setting] of Object.entries(settings)) {
@@ -63,6 +89,7 @@ const SettingForm = class extends HandlebarsApplicationMixin(ApplicationV2) {
});
}
+ /** @override */
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
@@ -84,8 +111,10 @@ const SettingForm = class extends HandlebarsApplicationMixin(ApplicationV2) {
label: settingConfig.name,
};
+ // Use Foundry's built-in /