diff --git a/scss/components/shared/_form_group.scss b/scss/components/shared/_form_group.scss index 2a3032b3..9f163ea9 100644 --- a/scss/components/shared/_form_group.scss +++ b/scss/components/shared/_form_group.scss @@ -4,12 +4,13 @@ * SPDX-License-Identifier: MIT */ -.ds4-form-group { +.ds4-form-group, +.ds4-item-sheet .form-group { clear: both; display: flex; flex-direction: row; flex-wrap: wrap; - margin: 3px 0; + margin: 8px 0; align-items: center; &--start { @@ -24,4 +25,78 @@ flex: 2; line-height: var(--input-height); } + + // Add spacing between form groups + & + & { + margin-top: 12px; + } + + // Style for slim form groups (input + select combinations) + &.slim { + margin: 6px 0; + + .form-fields { + display: flex; + align-items: center; + gap: 4px; + + input { + flex: 1; + min-width: 60px; + } + + select { + flex: 0 0 auto; + min-width: 120px; + width: auto !important; + } + + label { + flex: 0 0 auto; + margin-right: 8px; + font-weight: bold; + } + } + } +} + +// Style standard Foundry form-fields containers +.ds4-item-sheet .form-fields { + display: flex; + align-items: center; + gap: 6px; + flex: 1; + + input, select, textarea { + background: rgba(255, 255, 255, 0.05); + border: 1px solid var(--color-border); + border-radius: 3px; + padding: 4px 8px; + color: var(--color-text-primary); + + &:focus { + border-color: var(--color-text-accent); + box-shadow: 0 0 3px var(--color-text-accent); + } + } + + select { + background: rgba(255, 255, 255, 0.05); + appearance: none; + background-image: url("data:image/svg+xml;charset=US-ASCII,"); + background-repeat: no-repeat; + background-position: right 8px center; + background-size: 8px; + padding-right: 24px; + width: auto !important; + } +} + +// Improve label styling +.ds4-item-sheet .form-group > label { + flex: 0 0 160px; + font-weight: bold; + color: var(--color-form-label); + line-height: var(--input-height); + margin-right: 12px; } diff --git a/scss/global/_fonts.scss b/scss/global/_fonts.scss index d5e7adb4..574bc4cb 100644 --- a/scss/global/_fonts.scss +++ b/scss/global/_fonts.scss @@ -59,13 +59,11 @@ --ds4-font-heading: "Wood Stamp", sans-serif; } -// Apply Wood Stamp font only to DS4 sheet-specific elements -.ds4-actor-sheet h1, +// Apply Wood Stamp font only to DS4 sheet-specific elements (excluding window titles) .ds4-actor-sheet h2, .ds4-actor-sheet h4, .ds4-actor-sheet h5, .ds4-actor-sheet h6, -.ds4-item-sheet h1, .ds4-item-sheet h2, .ds4-item-sheet h4, .ds4-item-sheet h5, @@ -76,3 +74,11 @@ text-transform: uppercase; font-weight: 100 !important; } + +// Keep window titles readable with standard font +.ds4-actor-sheet .window-title, +.ds4-item-sheet .window-title { + font-family: var(--font-sans) !important; + text-transform: none !important; + font-weight: normal !important; +} diff --git a/src/apps/item-sheet.js b/src/apps/item-sheet.js index 5d1c36e6..76efdabb 100644 --- a/src/apps/item-sheet.js +++ b/src/apps/item-sheet.js @@ -260,7 +260,9 @@ export class DS4ItemSheet extends foundry.applications.api.HandlebarsApplication */ _initializeTabHandlers() { const tabNavigation = this.element.querySelector('.tabs[data-group="primary"]'); - if (!tabNavigation) return; + if (!tabNavigation) { + return; + } // Remove existing event listeners to prevent memory leaks this._removeTabHandlers(); @@ -272,7 +274,9 @@ export class DS4ItemSheet extends foundry.applications.api.HandlebarsApplication this._tabClickHandler = (event) => { event.preventDefault(); const item = event.target.closest('.item[data-tab]'); - if (!item) return; + if (!item) { + return; + } const tabId = item.dataset.tab; const groupId = item.dataset.group; @@ -285,6 +289,15 @@ export class DS4ItemSheet extends foundry.applications.api.HandlebarsApplication tabNavigation.addEventListener('click', this._tabClickHandler); } + /** + * Override form submission to prevent re-rendering + */ + async _processSubmitData(event, form, submitData, options = {}) { + // Always prevent re-rendering on form updates + options.render = false; + return super._processSubmitData(event, form, submitData, options); + } + /** * Remove tab event handlers to prevent memory leaks */ diff --git a/templates/sheets/item/components/properties/spell.hbs b/templates/sheets/item/components/properties/spell.hbs index 2d1069b8..524d1147 100644 --- a/templates/sheets/item/components/properties/spell.hbs +++ b/templates/sheets/item/components/properties/spell.hbs @@ -88,10 +88,8 @@ SPDX-License-Identifier: MIT