feat: implement clean Foundry V13 compliant tab system
- Remove custom tab implementation in favor of official ApplicationV2 tabs - Implement ApplicationTab typedef structure for Actor and Item sheets - Add memory-safe event listener management with proper cleanup - Update all sheet templates to use standard Foundry tab structure - Add template safety checks to prevent undefined access errors - Optimize performance with DOM updates instead of full re-renders - Maintain backward CSS compatibility during transition - Add dynamic tab configuration based on item types Key improvements: - ~200 lines of custom tab code removed - Memory leak prevention with proper event cleanup - Performance optimization (no re-render on tab switch) - Standards-compliant with Foundry V13 ApplicationV2 API - Consistent implementation across Actor and Item sheets - Template safety with Handlebars guards - Dynamic icon and localization support All 31 modified files now use the official Foundry VTT v13 tab system.
This commit is contained in:
parent
2c4dbb2620
commit
40e14d1196
31 changed files with 653 additions and 379 deletions
|
@ -4,14 +4,12 @@ SPDX-FileCopyrightText: 2021 Johannes Loher
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab biography" data-group="primary" data-tab="biography">
|
||||
<div class="ds4-biography-tab-content">
|
||||
<!-- beautify ignore:start -->
|
||||
<!-- prettier-ignore-start -->
|
||||
{{!-- remove indentation to avoid annoying Handlebars auto-indent --}}
|
||||
<div class="ds4-biography-tab-content">
|
||||
<!-- beautify ignore:start -->
|
||||
<!-- prettier-ignore-start -->
|
||||
{{!-- remove indentation to avoid annoying Handlebars auto-indent --}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/profile.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/biography.hbs}}
|
||||
<!-- beautify ignore:end -->
|
||||
<!-- prettier-ignore-end -->
|
||||
</div>
|
||||
<!-- beautify ignore:end -->
|
||||
<!-- prettier-ignore-end -->
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ SPDX-FileCopyrightText: 2021 Gesina Schwalbe
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab abilities" data-group="primary" data-tab="abilities">
|
||||
|
||||
{{!-- TALENT --}}
|
||||
<h4 class="ds4-embedded-document-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4>
|
||||
{{#unless (isEmpty itemsByType.talent)}}
|
||||
|
@ -64,4 +64,3 @@ SPDX-License-Identifier: MIT
|
|||
{{/unless}}
|
||||
{{> systems/ds4/templates/sheets/shared/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
|
||||
documentType='item' type='alphabet'}}
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,5 @@ SPDX-FileCopyrightText: 2021 Gesina Schwalbe
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab inventory" data-group="primary" data-tab="inventory">
|
||||
{{> systems/ds4/templates/sheets/actor/components/currency.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/items-overview.hbs}}
|
||||
</div>
|
||||
{{> systems/ds4/templates/sheets/actor/components/currency.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/items-overview.hbs}}
|
||||
|
|
|
@ -5,15 +5,13 @@ SPDX-FileCopyrightText: 2021 Gesina Schwalbe
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab abilities" data-group="primary" data-tab="abilities">
|
||||
{{#unless (isEmpty itemsByType.specialCreatureAbility)}}
|
||||
<ol class="ds4-embedded-document-list ds4-embedded-document-list--special-creature-ability item-list">
|
||||
{{> systems/ds4/templates/sheets/actor/components/item-list-header.hbs type='specialCreatureAbility'}}
|
||||
{{#each itemsByType.specialCreatureAbility as |item id|}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/item-list-entry.hbs item=item}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/unless}}
|
||||
{{> systems/ds4/templates/sheets/shared/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
|
||||
documentType='item' type='specialCreatureAbility'}}
|
||||
</div>
|
||||
{{#unless (isEmpty itemsByType.specialCreatureAbility)}}
|
||||
<ol class="ds4-embedded-document-list ds4-embedded-document-list--special-creature-ability item-list">
|
||||
{{> systems/ds4/templates/sheets/actor/components/item-list-header.hbs type='specialCreatureAbility'}}
|
||||
{{#each itemsByType.specialCreatureAbility as |item id|}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/item-list-entry.hbs item=item}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/unless}}
|
||||
{{> systems/ds4/templates/sheets/shared/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
|
||||
documentType='item' type='specialCreatureAbility'}}
|
||||
|
|
|
@ -5,6 +5,4 @@ SPDX-FileCopyrightText: 2021 Gesina Schwalbe
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab inventory" data-group="primary" data-tab="inventory">
|
||||
{{> systems/ds4/templates/sheets/actor/components/items-overview.hbs}}
|
||||
</div>
|
||||
{{> systems/ds4/templates/sheets/actor/components/items-overview.hbs}}
|
||||
|
|
|
@ -4,6 +4,4 @@ SPDX-FileCopyrightText: 2021 Johannes Loher
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab description" data-group="primary" data-tab="description">
|
||||
{{> systems/ds4/templates/sheets/actor/components/description.hbs}}
|
||||
</div>
|
||||
{{> systems/ds4/templates/sheets/actor/components/description.hbs}}
|
||||
|
|
|
@ -5,15 +5,13 @@ SPDX-FileCopyrightText: 2021 Gesina Schwalbe
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab effects" data-group="primary" data-tab="effects">
|
||||
{{#unless (isEmpty enrichedEffects)}}
|
||||
<ol class="ds4-embedded-document-list ds4-embedded-document-list--effect effect-list">
|
||||
{{> systems/ds4/templates/sheets/actor/components/effect-list-header.hbs}}
|
||||
{{#each enrichedEffects as |effectData id| }}
|
||||
{{> systems/ds4/templates/sheets/actor/components/effect-list-entry.hbs effectData=effectData}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/unless}}
|
||||
{{> systems/ds4/templates/sheets/shared/components/add-button.hbs title='DS4.UserInteractionAddEffectTitle'
|
||||
documentType='effect'}}
|
||||
</div>
|
||||
{{#unless (isEmpty enrichedEffects)}}
|
||||
<ol class="ds4-embedded-document-list ds4-embedded-document-list--effect effect-list">
|
||||
{{> systems/ds4/templates/sheets/actor/components/effect-list-header.hbs}}
|
||||
{{#each enrichedEffects as |effectData id| }}
|
||||
{{> systems/ds4/templates/sheets/actor/components/effect-list-entry.hbs effectData=effectData}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/unless}}
|
||||
{{> systems/ds4/templates/sheets/shared/components/add-button.hbs title='DS4.UserInteractionAddEffectTitle'
|
||||
documentType='effect'}}
|
||||
|
|
|
@ -42,7 +42,7 @@ titleKey=titleKey}}
|
|||
|
||||
{{!-- ======================================================================== --}}
|
||||
|
||||
<div class="ds4-sheet-tab tab spells" data-group="primary" data-tab="spells">
|
||||
|
||||
{{#unless (isEmpty itemsByType.spell)}}
|
||||
<ol class="ds4-embedded-document-list ds4-embedded-document-list--spell item-list">
|
||||
{{#> systems/ds4/templates/sheets/actor/components/item-list-header.hbs isEquipable=true hideDescription=true
|
||||
|
@ -79,6 +79,7 @@ titleKey=titleKey}}
|
|||
'')}}{{item.system.spellModifier.numerical}}{{else}}{{item.system.spellModifier.complex}}{{/if}}
|
||||
</div>
|
||||
|
||||
|
||||
{{!-- max. distance --}}
|
||||
{{> distanceUnit titleKey='DS4.SpellDistance' unitDatum=item.system.maxDistance
|
||||
config=@root/config}}
|
||||
|
@ -96,4 +97,3 @@ titleKey=titleKey}}
|
|||
{{/unless}}
|
||||
{{> systems/ds4/templates/sheets/shared/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
|
||||
documentType='item' type='spell'}}
|
||||
</div>
|
||||
|
|
|
@ -4,8 +4,6 @@ SPDX-FileCopyrightText: 2021 Johannes Loher
|
|||
SPDX-License-Identifier: MIT
|
||||
--}}
|
||||
|
||||
<div class="ds4-sheet-tab tab values" data-group="primary" data-tab="values">
|
||||
{{> systems/ds4/templates/sheets/actor/components/core-values.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/combat-values.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/checks.hbs}}
|
||||
</div>
|
||||
{{> systems/ds4/templates/sheets/actor/components/core-values.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/combat-values.hbs}}
|
||||
{{> systems/ds4/templates/sheets/actor/components/checks.hbs}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue