ds4/templates/sheets/actor/creature-sheet.hbs
Alexander Minges 40e14d1196
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.
2025-07-29 19:03:58 +02:00

57 lines
2.3 KiB
Handlebars

{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Oliver Rümpelein
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
<form class="{{cssClass}} ds4-sheet-form" autocomplete="off">
{{!-- Header --}}
{{#> systems/ds4/templates/sheets/actor/components/actor-header.hbs}}
{{> systems/ds4/templates/sheets/actor/components/creature-properties.hbs}}
{{/systems/ds4/templates/sheets/actor/components/actor-header.hbs}}
{{!-- Sheet Tab Navigation --}}
<nav class="tabs" data-group="primary">
{{#each tabs}}
<a class="item {{cssClass}}" data-tab="{{id}}" data-group="{{group}}">
{{#if icon}}<i class="{{icon}}"></i>{{/if}}
{{label}}
</a>
{{/each}}
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- Values Tab --}}
<div class="tab {{#if tabs.values}}{{tabs.values.cssClass}}{{/if}}" data-tab="values" data-group="primary">
{{> systems/ds4/templates/sheets/actor/tabs/values.hbs}}
</div>
{{!-- Inventory Tab --}}
<div class="tab {{#if tabs.inventory}}{{tabs.inventory.cssClass}}{{/if}}" data-tab="inventory" data-group="primary">
{{> systems/ds4/templates/sheets/actor/tabs/creature-inventory.hbs}}
</div>
{{!-- Spells Tab --}}
<div class="tab {{#if tabs.spells}}{{tabs.spells.cssClass}}{{/if}}" data-tab="spells" data-group="primary">
{{> systems/ds4/templates/sheets/actor/tabs/spells.hbs}}
</div>
{{!-- Abilities Tab --}}
<div class="tab {{#if tabs.abilities}}{{tabs.abilities.cssClass}}{{/if}}" data-tab="abilities" data-group="primary">
{{> systems/ds4/templates/sheets/actor/tabs/creature-abilities.hbs}}
</div>
{{!-- Effects Tab --}}
<div class="tab {{#if tabs.effects}}{{tabs.effects.cssClass}}{{/if}}" data-tab="effects" data-group="primary">
{{> systems/ds4/templates/sheets/actor/tabs/effects.hbs}}
</div>
{{!-- Description Tab --}}
<div class="tab {{#if tabs.description}}{{tabs.description.cssClass}}{{/if}}" data-tab="description" data-group="primary">
{{> systems/ds4/templates/sheets/actor/tabs/description.hbs}}
</div>
</section>
</form>