Compare commits

..

4 commits

Author SHA1 Message Date
Carlos Fernandez
37b088fe7d Apply low performance styling to all daggerheart sheets 2026-03-13 20:00:05 -04:00
WBHarry
7c0ab25e10 Fixed contextmenu 2026-03-14 00:10:48 +01:00
Carlos Fernandez
1160f51347 Fix hasDamage checks on non-attack actions 2026-03-13 18:47:55 -04:00
Carlos Fernandez
92bcaf4962 Fix clean type in v14 2026-03-13 18:09:19 -04:00
5 changed files with 7 additions and 51 deletions

View file

@ -52,46 +52,6 @@
* @extends {foundry.applications.ux.ContextMenu}
*/
export default class DHContextMenu extends foundry.applications.ux.ContextMenu {
/**
* @param {HTMLElement|jQuery} container - The HTML element that contains the context menu targets.
* @param {string} selector - A CSS selector which activates the context menu.
* @param {ContextMenuEntry[]} menuItems - An Array of entries to display in the menu
* @param {ContextMenuOptions} [options] - Additional options to configure the context menu.
*/
constructor(container, selector, menuItems, options) {
super(container, selector, menuItems, options);
/** @deprecated since v13 until v15 */
this.#jQuery = options.jQuery;
}
/**
* Whether to pass jQuery objects or HTMLElement instances to callback.
* @type {boolean}
*/
#jQuery;
/**@inheritdoc */
activateListeners(menu) {
menu.addEventListener('click', this.#onClickItem.bind(this));
}
/**
* Handle click events on context menu items.
* @param {PointerEvent} event The click event
*/
#onClickItem(event) {
event.preventDefault();
event.stopPropagation();
const element = event.target.closest('.context-item');
if (!element) return;
const item = this.menuItems.find(i => i.element === element);
item?.onClick(event, this.#jQuery ? $(this.target) : this.target);
this.close();
}
/* -------------------------------------------- */
/**
* Trigger a context menu event in response to a normal click on a additional options button.
* @param {PointerEvent} event

View file

@ -354,11 +354,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
}
get hasDamage() {
return !foundry.utils.isEmpty(this.damage.parts) && this.type !== 'healing';
return !foundry.utils.isEmpty(this.damage?.parts) && this.type !== 'healing';
}
get hasHealing() {
return !foundry.utils.isEmpty(this.damage.parts) && this.type === 'healing';
return !foundry.utils.isEmpty(this.damage?.parts) && this.type === 'healing';
}
get hasSave() {

View file

@ -87,10 +87,10 @@ export class ActionField extends foundry.data.fields.ObjectField {
/* -------------------------------------------- */
/** @override */
_cleanType(value, options) {
_cleanType(value, options, _state) {
if (!(typeof value === 'object')) value = {};
const cls = this.getModel(value);
if (cls) return cls.cleanData(value, options);
if (cls) return cls.cleanData(value, options, _state);
return value;
}

View file

@ -52,8 +52,8 @@ class ResourcesField extends fields.TypedObjectField {
return key in CONFIG.DH.RESOURCE[this.actorType].all;
}
_cleanType(value, options) {
value = super._cleanType(value, options);
_cleanType(value, options, _state) {
value = super._cleanType(value, options, _state);
// If not partial, ensure all data exists
if (!options.partial) {

View file

@ -14,11 +14,7 @@ body.game:is(.performance-low, .noblur) {
.themed.theme-dark .application.daggerheart.sheet.dh-style,
.themed.theme-dark.application.daggerheart.sheet.dh-style,
&.theme-dark .application.daggerheart {
&.adversary,
&.character,
&.item {
background: @dark-blue;
}
background: @dark-blue;
}
}