diff --git a/module/handlebars.mjs b/module/handlebars.mjs index dede71c..f39fb06 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -32,6 +32,7 @@ export const partials = [ export const icons = [ `caret-right.svg`, + `caret-down.svg`, `garbage-bin.svg`, `chat-bubble.svg`, `dice/d4.svg`, diff --git a/module/helpers/index.mjs b/module/helpers/index.mjs index 44fb372..4a62793 100644 --- a/module/helpers/index.mjs +++ b/module/helpers/index.mjs @@ -20,6 +20,7 @@ export default { // Simple helpers "dd-stringify": v => JSON.stringify(v, null, ` `), "dd-empty": v => v.length == 0, + "dd-set-has": (s, k) => s.has(k), // Logic helpers "eq": (a, b) => a == b, diff --git a/module/sheets/GenericActorSheet.mjs b/module/sheets/GenericActorSheet.mjs index 95776c2..8d11ed9 100644 --- a/module/sheets/GenericActorSheet.mjs +++ b/module/sheets/GenericActorSheet.mjs @@ -40,7 +40,7 @@ export class GenericActorSheet extends ActorSheet { if (!this.isEditable) return; console.debug(`.dungeon | Generic sheet adding listeners`); - html.find(`summary`).on(`click`, this._handleSummaryToggle.bind(this)); + html.find(`[data-collapse-id]`).on(`click`, this._handleSummaryToggle.bind(this)); html.find(`[data-roll-formula]`).on(`click`, this._handleRoll.bind(this)); html.find(`[data-embedded-update-on="change"]`) .on(`change`, this.genericEmbeddedUpdate.bind(this)); @@ -102,21 +102,19 @@ export class GenericActorSheet extends ActorSheet { }; async _handleSummaryToggle($e) { - let data = $e.currentTarget.dataset; - let open = $e.currentTarget.parentNode.open; - console.debug(`.dungeon | Collapse ID: ${data.collapseId} (open: ${open})`); + let target = $e.currentTarget; + let parent = target.parentElement; + let data = target.dataset; + console.debug(`.dungeon | Collapse ID: ${data.collapseId}`); - /* - This seeming inversion of logic is due to the fact that this handler - gets called before the element is updated to include/reflect the - change, so if the parentNode doesn't actually have it, then we're - opening it and vice-versa. - */ - if (!open) { + if (!this._expanded.has(data.collapseId)) { this._expanded.add(data.collapseId); } else { this._expanded.delete(data.collapseId); }; + if (parent.nodeName !== "DETAILS") { + this.render(); + } }; async openEmbeddedSheet($event) { diff --git a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss index 822b31f..5723f06 100644 --- a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss @@ -100,6 +100,12 @@ grid-template-columns: 1fr 1fr; gap: 8px; } + + .untyped-list { + display: flex; + gap: 8px; + flex-direction: column; + } } .material { @@ -112,6 +118,8 @@ border-radius: 4px; &__label { + font-family: var(--inventory-item-name-font); + font-size: var(--inventory-item-name-font-size); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; @@ -153,4 +161,29 @@ } } } + + .untyped { + @include material.elevate(1); + padding: 8px; + border-radius: 4px; + color: var(--inventory-material-color); + + &__header { + display: flex; + gap: 8px; + align-items: center; + + button { + color: var(--inventory-material-color); + } + } + &__name { + flex-grow: 1; + font-family: var(--inventory-item-name-font); + font-size: var(--inventory-item-name-font-size); + } + + &__content { + } + } } \ No newline at end of file diff --git a/styles/sheets/actor/char-sheet/v2/themes/dark.scss b/styles/sheets/actor/char-sheet/v2/themes/dark.scss index a71d3ff..4b38e70 100644 --- a/styles/sheets/actor/char-sheet/v2/themes/dark.scss +++ b/styles/sheets/actor/char-sheet/v2/themes/dark.scss @@ -43,7 +43,15 @@ $body-font: sans-serif; --skill-training-select-text-color: #{$on-surface}; --skill-roll-button-text-color: #{$on-surface}; + /* Common Inventory Item Variables */ + --inventory-item-name-font: #{$body-font}; + --inventory-item-name-font-size: 0.875rem; + + /* Material inventory item details */ --inventory-material-color: white; --inventory-material-hover-color: white; --inventory-material-focus-color: white; + + /* Untyped (custom) inventory item details */ + --inventory-untyped-color: white; } diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs index 4c09eb7..7bc7504 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs @@ -1,6 +1,33 @@ -
- {{item.name}} - - X - -
\ No newline at end of file +
+
+ +

+ {{item.name}} +

+
+ (x {{item.system.quantity}}) +
+
+ {{#if (dd-set-has meta.expanded item.uuid)}} +
+
+ Some Description +
+ {{/if}} +