diff --git a/module.json b/module.json index c26c970..fd4989a 100644 --- a/module.json +++ b/module.json @@ -6,9 +6,6 @@ "name": "Averrin", "url": "https://github.com/averrin", "discord": "Averrin#0374" - }, - { - "name": "Averrin - Averrin#0374" } ], "url": "https://github.com/averrin/director", diff --git a/src/modules/helpers.js b/src/modules/helpers.js index 6a07869..07e078d 100644 --- a/src/modules/helpers.js +++ b/src/modules/helpers.js @@ -41,9 +41,6 @@ export function isLiving(token) { return getProperty(token?.document?.actor.getRollData(), "attributes.hp.max") > 0; } -export let logger = consola.withTag(moduleId); -logger._reporters[0].levelColorMap[3] = infoColor; - export function findItems(token, itemsToFind) { // logger.info(`find items for: ${token.data.name}`, token, itemsToFind); const items = []; @@ -57,15 +54,8 @@ export function findItems(token, itemsToFind) { return items; } -export function rgb2hex({ r, g, b, a = 1 }) { - return { - hex: - "#" + [r, g, b, Math.round(a * 255) | 0].reduce((acc, v) => `${acc}${v.toString(16).padStart(2, "0")}`, ""), - }; -} - export const tools = { - toggle: async (o) => await o.update({ hidden: !o.hidden }), + toggle: async (o) => await o.update({ hidden: !(o.hidden || o.data?.hidden) }), hide: async (o) => await o.update({ hidden: true }), show: async (o) => await o.update({ hidden: false }), kill: async (o) => @@ -185,6 +175,15 @@ export function evalExpression(expr, ...args) { return f(...args) } +export let logger = consola.withTag(moduleId); +logger._reporters[0].levelColorMap[3] = infoColor; +export function rgb2hex({ r, g, b, a = 1 }) { + return { + hex: + "#" + [r, g, b, Math.round(a * 255) | 0].reduce((acc, v) => `${acc}${v.toString(16).padStart(2, "0")}`, ""), + }; +} + export function contrastColor(color) { if (!color || color == "") return "#eeeeeeff"; const pRed = 0.299; diff --git a/src/view/MainApplication.js b/src/view/MainApplication.js index 2cc94a8..73bea53 100644 --- a/src/view/MainApplication.js +++ b/src/view/MainApplication.js @@ -1,5 +1,4 @@ import { SvelteApplication } from "@typhonjs-fvtt/runtime/svelte/application"; -// import { TJSGameSettings } from "@typhonjs-fvtt/runtime/svelte/store"; import { moduleId, SETTINGS } from "../constants.js"; // import { logger } from "../modules/helpers.js"; import { setting } from "../modules/settings.js"; diff --git a/src/view/components/ActionItem.svelte b/src/view/components/ActionItem.svelte index d74110f..f76b435 100644 --- a/src/view/components/ActionItem.svelte +++ b/src/view/components/ActionItem.svelte @@ -30,14 +30,14 @@ export let itemClick; let types = actionTypes; - let spec = actionTypes.find((t) => t.id == item.type.id); + let spec = actionTypes.find((t) => t.id == item?.type?.id); function setType(e) { if (typeof e.detail !== "string" || item?.type?.id == e.detail) return; item.type = { ...actionTypes.find((t) => t.id == e.detail) }; delete item.type.execute; item.args = []; - spec = actionTypes.find((t) => t.id == item.type.id); + spec = actionTypes.find((t) => t.id == item?.type?.id); dispatch("change", item); } @@ -113,7 +113,7 @@ on:change={setType} > - {#if spec.ignoreTarget} + {#if spec?.ignoreTarget} diff --git a/src/view/components/Tags.svelte b/src/view/components/Tags.svelte index 0e24418..a6ccfd3 100644 --- a/src/view/components/Tags.svelte +++ b/src/view/components/Tags.svelte @@ -2,7 +2,6 @@ // This is a modified version of https://github.com/agustinl/svelte-tags-input import { createEventDispatcher, onDestroy } from "svelte"; import { contrastColor } from "../../modules/helpers.js"; - import { XIcon } from "@rgossiaux/svelte-heroicons/solid"; import { tagsStore } from "../../modules/stores.js"; const dispatch = createEventDispatcher(); @@ -49,11 +48,6 @@ onDestroy(unsub); $: tags = tags || []; - $: { - if (typeof tags[0] !== "string" && !(tags[0] instanceof String)) { - tags = tags.map((t) => t.text); - } - } $: addKeys = addKeys || [13]; $: maxTags = maxTags || false; $: onlyUnique = onlyUnique || false; @@ -409,8 +403,10 @@ {tag[autoCompleteKey]} {/if} {#if !disable} - removeTag(i)} /> {/if}