From 0de9457026f43b94de8b4fbd42656bcb4010acdc Mon Sep 17 00:00:00 2001 From: Kevin Garner Date: Sun, 24 Nov 2024 00:51:06 -0600 Subject: [PATCH 1/3] Fixed ID selector for input focus restore to use the longhand syntax for ID selection to fix breakage that was occurring with hyphenated input iDs. Coalesced an undefined field to an empty string. --- src/mixins/SvelteApplicationMixin.ts | 2 +- src/sheets/item/parts/FieldUses.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mixins/SvelteApplicationMixin.ts b/src/mixins/SvelteApplicationMixin.ts index f2d7ae2d9..a4b9a22cf 100644 --- a/src/mixins/SvelteApplicationMixin.ts +++ b/src/mixins/SvelteApplicationMixin.ts @@ -457,7 +457,7 @@ export function SvelteApplicationMixin< this.#focusedInputSelector = focusedElement?.name ? `${focusedElement.tagName}[name="${focusedElement.name}"]` : focusedElement?.id - ? `#${focusedElement.id}` + ? `[id="${focusedElement.id}"]` : undefined; } diff --git a/src/sheets/item/parts/FieldUses.svelte b/src/sheets/item/parts/FieldUses.svelte index fa55778eb..f14580306 100644 --- a/src/sheets/item/parts/FieldUses.svelte +++ b/src/sheets/item/parts/FieldUses.svelte @@ -181,7 +181,7 @@ ev.currentTarget.value, )} disabled={!$context.editable} - value={recovery.data.formula} + value={recovery.data.formula ?? ''} /> {/if} From 44ad0d6e4f853acb0cdd2cb2b502be75e7131a61 Mon Sep 17 00:00:00 2001 From: Kevin Garner Date: Sun, 24 Nov 2024 01:52:13 -0600 Subject: [PATCH 2/3] Fixed bug where Additional Spells custom section behaviors were not working properly. Added Activity Uses for Additional Spells that have activity uses. --- src/components/spellbook/SpellbookList.svelte | 5 +++++ src/features/sections/SheetSections.ts | 8 +++++++- src/types/types.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/spellbook/SpellbookList.svelte b/src/components/spellbook/SpellbookList.svelte index 23f6d2e75..9e64d6c80 100644 --- a/src/components/spellbook/SpellbookList.svelte +++ b/src/components/spellbook/SpellbookList.svelte @@ -34,6 +34,7 @@ import ClassicControls from 'src/sheets/shared/ClassicControls.svelte'; import ConcentrationOverlayIcon from './ConcentrationOverlayIcon.svelte'; import DeleteOrOpenActivity from '../item-list/controls/DeleteOrOpenActivity.svelte'; + import ActivityUses from '../item-list/ActivityUses.svelte'; let context = getContext>( CONSTANTS.SVELTE_CONTEXT.CONTEXT, @@ -206,6 +207,10 @@ + {:else if (spell.system.linkedActivity?.uses?.max ?? 0) > 0} + + + {/if} {#if allowFavorites && $settingStore.showIconsNextToTheItemName && 'favoriteId' in ctx && !!ctx.favoriteId} diff --git a/src/features/sections/SheetSections.ts b/src/features/sections/SheetSections.ts index f8cff4163..e8052be2a 100644 --- a/src/features/sections/SheetSections.ts +++ b/src/features/sections/SheetSections.ts @@ -135,7 +135,13 @@ export class SheetSections { const spellbookMap = spellbook.reduce>( (prev, curr) => { - const key = curr.prop ?? ''; + let key = curr.prop ?? ''; + + // Handle "Additional Spells" section + if (curr.order === 'item') { + key = 'dnd5e-cast-activity-additional-spells'; + } + curr.key = key; // Tidy passes the dataset directly to the item creation code, rather than planting it on the HTML. diff --git a/src/types/types.ts b/src/types/types.ts index 81f14bfb5..b0d738a23 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -184,7 +184,7 @@ export type SimpleEditableColumn = { }; export type SpellbookSection = { - order?: number; + order?: number | string; usesSlots: boolean; canCreate: boolean; canPrepare: boolean; From f5bbc6cc91223dbacb0fb4d74121dbe9125781df Mon Sep 17 00:00:00 2001 From: Kevin Garner Date: Sun, 24 Nov 2024 01:56:30 -0600 Subject: [PATCH 3/3] Removed ability to try to add spells to the Addl Spells section. --- src/features/sections/SheetSections.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/features/sections/SheetSections.ts b/src/features/sections/SheetSections.ts index e8052be2a..27c2491be 100644 --- a/src/features/sections/SheetSections.ts +++ b/src/features/sections/SheetSections.ts @@ -140,6 +140,7 @@ export class SheetSections { // Handle "Additional Spells" section if (curr.order === 'item') { key = 'dnd5e-cast-activity-additional-spells'; + curr.canCreate = false; } curr.key = key;