Skip to content
Draft
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
2e3a7b0
Removed unnecessary warning log.
kgar Sep 11, 2025
08b978d
Fixed error with pinned filters.
kgar Sep 11, 2025
0e1994a
Created generic InlineQuantityTracker for use beyond just items.
kgar Sep 11, 2025
7326159
Updated TidyItemTableRow to tolerate when item expansion / item data …
kgar Sep 12, 2025
ee09a8e
Added SheetExpandedItemsCacheable handling to Container sheet.
kgar Sep 12, 2025
76b2f81
Implemented member quantity update handling.
kgar Sep 12, 2025
85989ec
Updated inline tracker css to target more generalized tracker classes…
kgar Sep 12, 2025
32ddc8e
Wired up quantity tracker for encounter member quantity column.
kgar Sep 12, 2025
00e61d0
Ensured a happy path member quantity update is a non-nullish value.
kgar Sep 12, 2025
feee0b8
Set up min handling for inline quantity tracker.
kgar Sep 12, 2025
75fd1b4
Converted inline item quantity tracker to reuse the generic inline tr…
kgar Sep 12, 2025
01ee092
Added drift correction to generic quantity tracker.
kgar Sep 12, 2025
d531028
Added Combat tab for Encounters.
kgar Sep 12, 2025
5975f51
Corrected loc key.
kgar Sep 12, 2025
a5c2392
- [x] Encounter subtitle
kgar Sep 13, 2025
8fc7f34
Stubbed encounter skills and encounter members tab sidebar.
kgar Sep 13, 2025
e12e15e
Scaffolded member traits prep. Pulled back group trait prep to the mu…
kgar Sep 13, 2025
e9c613d
Added member emphasis to Encounter Sheet.
kgar Sep 13, 2025
8d5b232
Renamed class groups-tab-content to group-tab-content.
kgar Sep 13, 2025
48e20a9
Stubbed the create button for encounter members table. Put in combat …
kgar Sep 14, 2025
47c872c
Marked off done work
kgar Sep 14, 2025
be2793f
Implemented compendium browser member adding.
kgar Sep 14, 2025
f100231
Added HP rollFormula button to group member HP column that will show …
kgar Sep 14, 2025
7df4ab7
- [x] Members context menu for Encounter sheet
kgar Sep 14, 2025
7a5683a
kgar Sep 14, 2025
76be42c
- [X] Make Formula column a lower-priority, always-shown column
kgar Sep 14, 2025
2731bd4
kgar Sep 14, 2025
46ed79e
Styling for the Encounter sheet header, columns, subtitle, and XP bar
jeffwain Sep 15, 2025
f791856
Tried to scaffold out combat tab, more cleanup and style updates.
jeffwain Sep 15, 2025
bd61116
Merge pull request #1384 from jeffwain/close-encounters-of-the-5e-kind
kgar Sep 15, 2025
17f831d
Localized combat buttons.
kgar Sep 15, 2025
c85ce37
Lots of small tweaks and fixes for the Encounter sheet to fix up styl…
jeffwain Sep 17, 2025
4544a19
Merge pull request #1386 from jeffwain/feel-the-rush-2
kgar Sep 17, 2025
ecf062b
kgar Sep 18, 2025
a31600d
Leveraged inset style for brevity
kgar Sep 19, 2025
9c0637e
Traded toSorted for sort where able
kgar Sep 19, 2025
062d6b9
Replaced weird findIndex usage with regular find usage.
kgar Sep 19, 2025
0bef25f
Replaced toSorted wtih in-place sort where able.
kgar Sep 19, 2025
8558fdb
Hid difficulty badge and pill when difficulty is not known (e.g., no …
kgar Sep 19, 2025
4e16d88
Updated difficulty to be hidden when difficulty cannot be calculated.
kgar Sep 19, 2025
e41e4e4
Planning
kgar Sep 19, 2025
1506ca7
Added getRollModeState to FoundryAdapter.
kgar Sep 19, 2025
dc38ae5
Added flag for encounter initiative.
kgar Sep 19, 2025
700a187
Implemented encounter initiative handling.
kgar Sep 19, 2025
c17cc34
Wired up XP bar in Encounter sheet.
kgar Sep 20, 2025
5d68aa6
Set up Encounter placeholders
kgar Sep 20, 2025
b1a62b2
Added combatants context, which is an array of either members or plac…
kgar Sep 20, 2025
9f49c20
Added name field to placeholder type.
kgar Sep 20, 2025
d72f96b
Began work on delineating placeholder and member rows on the Combat tab.
kgar Sep 20, 2025
c4f8e9d
Column display fixes for Combat tab
jeffwain Sep 21, 2025
0676e8e
Massaging column widths
jeffwain Sep 21, 2025
835c8a6
Began implementing managing placeholders.
kgar Sep 21, 2025
c26341f
Merge branch 'ui-overhaul-i-feel-the-rush' of github.com:kgar/foundry…
kgar Sep 21, 2025
d0cafb6
Made plans
kgar Sep 21, 2025
8daddfd
Updated all Combat tab columns to anticipate possibly being given a p…
kgar Sep 21, 2025
8d320ba
Implemented placeholder name and note editing.
kgar Sep 21, 2025
cb5c4d3
Suppresed initiative roll button on placeholders.
kgar Sep 21, 2025
f10c09c
Wired up adding single placeholder.
kgar Sep 21, 2025
f2e6caa
Clarified Add Combat Placeholder row action.
kgar Sep 21, 2025
62603e2
Implemented Combat Visibility and Combat Inclusion.
kgar Sep 21, 2025
317957f
Made plans
kgar Sep 21, 2025
8ee04f0
Encounter work:
kgar Sep 21, 2025
4430287
Making plans.
kgar Sep 21, 2025
fb994a1
- [x] Encounter sheet: Set up tab selection
kgar Sep 21, 2025
ff9d7e3
kgar Sep 21, 2025
438bc1f
Reorganized a number of classes for consistency across sheets. Reorga…
jeffwain Sep 21, 2025
b67167e
Merge branch 'ui-overhaul-i-feel-the-rush' of https://github.com/kgar…
jeffwain Sep 21, 2025
546df0a
Fixed errors.
kgar Sep 21, 2025
02d1b35
Merge branch 'ui-overhaul-i-feel-the-rush' of github.com:kgar/foundry…
kgar Sep 21, 2025
2a27d76
Rearranged character subtitles to show additional classses by default.
jeffwain Sep 21, 2025
a3048e2
Added adapter for managing combatant settings.
kgar Sep 21, 2025
7c1c1b0
- [x] Refactor: Consolidate all combat options to a single model and …
kgar Sep 21, 2025
824cb9a
Fixed inappropriate identifier management in row action components.
kgar Sep 21, 2025
8b961ba
Merge branch 'ui-overhaul-i-feel-the-rush' of https://github.com/kgar…
jeffwain Sep 22, 2025
0da078b
Tweaks to actor sheets table styles
jeffwain Sep 22, 2025
3ed6291
Fixed issues with using CombatantSettings.
kgar Sep 23, 2025
4284c78
Added optional partial data and combatant settings that one can submi…
kgar Sep 23, 2025
fca8fba
Corrected localization on encounter delete button.
kgar Sep 23, 2025
be7adc4
Added context menu for combat placeholders.
kgar Sep 23, 2025
66bf3d7
Fixed individual roll initiative button.
kgar Sep 23, 2025
9034434
Moved "Restore Transformation" header control to header.
kgar Sep 23, 2025
5e29869
Encounter sheet styling for combat tab. Added sidebar buttons for pre…
jeffwain Sep 23, 2025
c730338
Misc css fixes. NPC sidebar class name change, biography layout final…
jeffwain Sep 23, 2025
5b9f1e1
Moved prototype token / token settings to the header.
kgar Sep 23, 2025
4da29c2
Merge branch 'ui-overhaul-i-feel-the-rush' of github.com:kgar/foundry…
kgar Sep 23, 2025
50c09b0
Styling updates for tab item counts and encounter inventory quantity …
jeffwain Sep 23, 2025
677b499
Merge branch 'ui-overhaul-i-feel-the-rush' of https://github.com/kgar…
jeffwain Sep 23, 2025
68c9c67
Fix for crazy long tooltips
jeffwain Sep 23, 2025
3a1da95
Resolved dep warnings for ImagePopout.
kgar Sep 23, 2025
ed4622e
Removed rogue divider dot.
kgar Sep 23, 2025
5f741a7
kgar Sep 23, 2025
3286223
Updated enc sidebar to appropriate icons
kgar Sep 23, 2025
baf6194
Added loc keys for difficulty target and primary party.
kgar Sep 23, 2025
106e1fd
Added encounter difficulty target group ID flag for game.user.
kgar Sep 23, 2025
f33357d
Adjusted styles for meter labels to maintain a normal line height for…
kgar Sep 23, 2025
855dc1e
Removed max value on XP budget bar. It confuses more than helps.
kgar Sep 23, 2025
a5e4651
Difficulty is guaranteed, label is not. Updated accordingly.
kgar Sep 23, 2025
a654b54
Fixed a bug where configured selected world tab IDs were not being co…
kgar Sep 23, 2025
6c4f1ed
Unleashed Encounter Sheet
kgar Sep 23, 2025
a5afe45
Added placeholder text keys for placeholder inputs.
kgar Sep 23, 2025
fbf6664
Wired up placeholders for placeholder inputs.
kgar Sep 23, 2025
5fa7a9b
Checked the Encounter sheet box. Scaffolded the readme section.
kgar Sep 23, 2025
c02f6b2
kgar Sep 23, 2025
d069847
Moved primary party to top of selector, updated header to better hand…
jeffwain Sep 24, 2025
c21c6c4
Fixed up Quadrone dialogs to use consistent layout, classes, and styles.
jeffwain Sep 24, 2025
0232080
Fix for difficulty target overflowing text
jeffwain Sep 24, 2025
4d36037
Added encounter to actorHeaderBackgroundSupportedActorTypes in Theme …
kgar Sep 24, 2025
114268c
Guarded against undefined creature types.
kgar Sep 24, 2025
aabecec
Cleaned up unused code.
kgar Sep 24, 2025
a52ae1b
Fixed member delete functionality on Combat tab.
kgar Sep 24, 2025
c3e2b05
Reverted a style change to the encounter sheet header
jeffwain Sep 24, 2025
20c1873
Fixed light mode header issue, more tweaks to banner image
jeffwain Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/images/badge_encounter_difficulty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

"TIDY5E.JournalTabName": "Journal",
"TIDY5E.StatblockTabName": "Statblock",
"TIDY5E.CombatTabName": "Combat",

"TIDY5E.Actions": {
"TabName": "Actions",
Expand Down Expand Up @@ -895,5 +896,15 @@
"TIDY5E.UseSpecificDefaultValue.Label": "Use Default ({value})",
"TIDY5E.Notifications.FirstTimeWelcome1": "Welcome to Tidy 5e Sheets! To get started, you'll need to change {sheetLinkStart}a sheet{sheetLinkEnd} (or {allSheetsLinkStart}all your sheets{allSheetsLinkEnd}!) to use the Tidy version. Learn more about this module and what it can do on the {wikiLinkStart}official wiki{wikiLinkEnd}.",
"TIDY5E.AggregateSkill.HighMeasure": "High",
"TIDY5E.AggregateSkill.LowMeasure": "Low"
"TIDY5E.AggregateSkill.LowMeasure": "Low",
"TIDY5E.Difficulty": "Difficulty",
"TIDY5E.Encounter": {
"Combat.IncludeInCombat.Tooltip": "Include in combat activities",
"Combat.ExcludeFromCombat.Tooltip": "Exclude from combat activities",
"AddMember.Label": "Add Member",
"AddToCombatTracker.Label": "Add to Active Encounter",
"AddPlaceholder.Label": "Add a Placeholder",
"AddAllPlaceholders.Label": "Add All as Placeholders",
"PrerollInitiative": "Preroll Initiative"
}
}
8 changes: 4 additions & 4 deletions src/components/table-quadrone/TidyItemTableRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
properties: [],
};

const expandedItemData = getContext<ExpandedItemData>(
const expandedItemData = getContext<ExpandedItemData | undefined>(
CONSTANTS.SVELTE_CONTEXT.EXPANDED_ITEM_DATA,
);

const expandedItems = getContext<ExpandedItemIdToLocationsMap>(
const expandedItems = getContext<ExpandedItemIdToLocationsMap | undefined>(
CONSTANTS.SVELTE_CONTEXT.EXPANDED_ITEMS,
);

const onItemToggled = getContext<OnItemToggledFn>(
const onItemToggled = getContext<OnItemToggledFn | undefined>(
CONSTANTS.SVELTE_CONTEXT.ON_ITEM_TOGGLED,
);

Expand Down Expand Up @@ -114,7 +114,7 @@

$effect(() => {
const isExpandedAtThisLocation = expandedItems?.get(item.id)?.has(location);
const data = expandedItemData.get(item.id);
const data = expandedItemData?.get(item.id);

if (isExpandedAtThisLocation && data) {
untrack(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script lang="ts">
import { TidyFlags } from 'src/api';
import { FoundryAdapter } from 'src/foundry/foundry-adapter';

interface Props {
doc: any;
disabled?: boolean;
addPlaceholderFn?: Function;
tooltip?: string;
}

let {
doc,
disabled,
addPlaceholderFn = () => alert('TODO: Add a placeholder to the combat tracker.'),
tooltip = FoundryAdapter.localize('TIDY5E.Encounter.AddPlaceholder.Label'),
}: Props = $props();
</script>

<a
class="tidy-table-button {disabled ?? 'disabled'}"
aria-label={tooltip}
data-tooltip
onclick={() => !disabled && addPlaceholderFn()}
>
<i class="fa-solid fa-circle-dashed"></i>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script lang="ts">
import { TidyFlags } from 'src/api';
import { FoundryAdapter } from 'src/foundry/foundry-adapter';

interface Props {
doc: any;
}

let { doc }: Props = $props();

const localize = FoundryAdapter.localize;

let include = true; // undefined defaults to true
</script>

<a
class="tidy-table-button tidy-table-toggle"
aria-label={FoundryAdapter.localize(
include
? 'TIDY5E.Encounter.Combat.IncludeInCombat.Tooltip'
: 'TIDY5E.Encounter.Combat.ExcludeFromCombat.Tooltip',
)}
data-tooltip
onclick={() => alert('TODO: Adjust included/excluded members as a flag on the encounter sheet.')}
>
{#if include}
<i class="fa-solid fa-toggle-large-on enabled"></i>
{:else}
<i class="fa-solid fa-toggle-off"></i>
{/if}
</a>
62 changes: 23 additions & 39 deletions src/components/trackers/InlineItemQuantityTracker.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type { Item5e } from 'src/types/item.types';
import TextInput from '../inputs/TextInput.svelte';
import { FoundryAdapter } from 'src/foundry/foundry-adapter';
import { isNil } from 'src/utils/data';
import InlineQuantityTracker from './InlineQuantityTracker.svelte';
import { processInputChangeDeltaFromValues } from 'src/utils/form';

interface Props {
item: Item5e;
Expand All @@ -12,43 +12,27 @@

let { item, field = 'system.quantity', disabled = false }: Props = $props();

let quantity = $derived(FoundryAdapter.getProperty<number>(item, field));
let quantity = $derived(
FoundryAdapter.getProperty<number>(item, field)?.toString() ?? '',
);

async function increment() {
if (!isNil(quantity)) {
await item.update({
[field]: quantity + 1,
});
}
}

async function decrement() {
if (!isNil(quantity)) {
await item.update({
[field]: quantity - 1,
});
}
}
let localize = FoundryAdapter.localize;
</script>

<article class="tidy-inline-item-quantity-tracker" class:disabled>
<a class="command decrementer" onclick={() => !disabled && decrement()}>
<i class="fa-solid fa-minus"></i>
</a>
<span class="item-quantity-tracker-input-wrapper uninput">
<TextInput
class="item-quantity-tracker-input"
document={item}
{field}
value={quantity}
{disabled}
allowDeltaChanges={true}
selectOnFocus={true}
></TextInput>
</span>
<a class="command incrementer" onclick={() => !disabled && increment()}>
<i class="fa-solid fa-plus"></i>
</a>
</article>

<!-- TODO: Make a generic counter that can be injected onto the sheet for things like `So Inspired!` 🔥 -->
<InlineQuantityTracker
aria-label={localize('DND5E.Quantity')}
data-tooltip="DND5E.Quantity"
min="0"
{disabled}
onchange={async (ev) => {
const input = ev.currentTarget;
await item.update({
[field]: processInputChangeDeltaFromValues(
ev.currentTarget.value,
quantity,
),
});
input.value = quantity;
}}
value={quantity}
/>
48 changes: 48 additions & 0 deletions src/components/trackers/InlineQuantityTracker.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script lang="ts">
import type { HTMLInputAttributes } from 'svelte/elements';
import { processInputChangeDeltaFromValues } from 'src/utils/form';
import { InputAttachments } from 'src/attachments/input-attachments.svelte';

let attributes: HTMLInputAttributes = $props();

let input: HTMLInputElement;

let min = $derived(attributes.min ? +attributes.min : -Infinity);

function adjust(delta: string) {
const newValue = processInputChangeDeltaFromValues(delta, input.value);

if (newValue !== undefined) {
input.value = newValue.toString();
const changeEvent = new Event('change', { bubbles: true });
input.dispatchEvent(changeEvent);
}
}
</script>

<article
class={['tidy-inline-quantity-tracker', { disabled: attributes.disabled }]}
>
<a
class="command decrementer"
onclick={() =>
attributes.value - 1 >= min && !attributes.disabled && adjust('-1')}
>
<i class="fa-solid fa-minus"></i>
</a>
<span class="quantity-tracker-input-wrapper">
<input
bind:this={input}
type="text"
class="quantity-tracker-input"
{@attach InputAttachments.selectOnFocus}
{...attributes}
/>
</span>
<a
class="command incrementer"
onclick={() => !attributes.disabled && adjust('+1')}
>
<i class="fa-solid fa-plus"></i>
</a>
</article>
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const CONSTANTS = {
TAB_OPTION_CLASS: 'tab-option',
TAB_ACTOR_ACTIONS: 'actions',
TAB_ACTOR_BIOGRAPHY: 'biography',
TAB_ACTOR_COMBAT: 'combat',
TAB_ACTOR_INVENTORY: 'inventory',
TAB_ACTOR_SPECIAL_TRAITS: 'special-traits',
TAB_ACTOR_SPELLBOOK: 'spellbook',
Expand Down
47 changes: 47 additions & 0 deletions src/context-menu/tidy5e-encounter-context-menu-quadrone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { Actor5e } from 'src/types/types';
import type { ContextMenuEntry } from 'src/foundry/foundry.types';
import { FoundryAdapter } from 'src/foundry/foundry-adapter';
import { Tidy5eNpcSheetQuadrone } from 'src/sheets/quadrone/Tidy5eNpcSheetQuadrone.svelte';

/**
* Prepare an array of context menu options which are available for a member of a encounter.
* @param encounter The encounter for which the context menu is activated.
* @param actor The actor for whom the context menu is activate.
* @returns Context menu options.
*/
export function getEncounterMemberContextOptionsQuadrone(
encounter: Actor5e,
memberPromise: Promise<Actor5e>
): ContextMenuEntry[] {
let options: ContextMenuEntry[] = [
{
name: 'DND5E.Group.Action.View',
icon: `<i class="fas fa-eye fa-fw"></i>`,
callback: async () => (await memberPromise)?.sheet.render(true),
condition: () =>
encounter.isOwner && !FoundryAdapter.isLockedInCompendium(encounter),
},
{
name: 'DND5E.HPFormulaRollMessage',
icon: `<i class="fas fa-dice-d6 fa-fw"></i>`,
callback: async () => {
await new Tidy5eNpcSheetQuadrone({
document: await memberPromise,
}).rollFormula();
encounter.sheet.render();
},
condition: () =>
encounter.isOwner && !FoundryAdapter.isLockedInCompendium(encounter),
},
{
name: 'DND5E.Group.Action.Remove',
icon: `<i class="fas fa-trash fa-fw"></i>`,
callback: async () =>
await encounter.system.removeMember(await memberPromise),
condition: () =>
encounter.isOwner && !FoundryAdapter.isLockedInCompendium(encounter),
},
];

return options;
}
11 changes: 7 additions & 4 deletions src/context-menu/tidy5e-encounter-context.menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { ContextMenuEntry } from 'src/foundry/foundry.types';
import type { Encounter5eMember } from 'src/types/group.types';
import { TidyHooks } from 'src/foundry/TidyHooks';
import { FoundryAdapter } from 'src/foundry/foundry-adapter';
import { getEncounterMemberContextOptionsQuadrone } from './tidy5e-encounter-context-menu-quadrone';

export function configureEncounterContextMenu(element: HTMLElement, app: any) {
const memberId = element.getAttribute('data-member-uuid');
Expand All @@ -14,10 +15,12 @@ export function configureEncounterContextMenu(element: HTMLElement, app: any) {

if (!memberPromise) return;

ui.context.menuItems = getEncounterMemberContextOptions(
app.document,
memberPromise
);
const isQuadroneSheet = element.closest('.quadrone');

ui.context.menuItems = isQuadroneSheet
? getEncounterMemberContextOptionsQuadrone(app.document, memberPromise)
: getEncounterMemberContextOptions(app.document, memberPromise);

TidyHooks.tidy5eSheetsGetEncounterMemberContextOptions(
app.document,
memberPromise,
Expand Down
Loading