Skip to content

Commit

Permalink
0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
averrin committed Aug 10, 2022
1 parent 54849fc commit feff1c5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 25 deletions.
3 changes: 0 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"name": "Averrin",
"url": "https://github.com/averrin",
"discord": "Averrin#0374"
},
{
"name": "Averrin - Averrin#0374"
}
],
"url": "https://github.com/averrin/director",
Expand Down
21 changes: 10 additions & 11 deletions src/modules/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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) =>
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/view/MainApplication.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
6 changes: 3 additions & 3 deletions src/view/components/ActionItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -113,7 +113,7 @@
on:change={setType}
>
<svelte:fragment slot="right">
{#if spec.ignoreTarget}
{#if spec?.ignoreTarget}
<span style:color="#232323" title="targets are ignored" class="ui-h-12 ui-w-16">
<iconify-icon style:font-size="2rem" icon="tabler:target-off" style:color="#444444" />
</span>
Expand Down
10 changes: 3 additions & 7 deletions src/view/components/Tags.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -409,8 +403,10 @@
{tag[autoCompleteKey]}
{/if}
{#if !disable}
<XIcon
<iconify-icon
class="ui-h-4 ui-w-4 ui-mx-1 ui-mt-1 ui-cursor-pointer svelte-tags-input-tag-remove"
icon="gridicons:cross"
style:color={contrastColor(colors[tag])}
on:click={() => removeTag(i)}
/>
{/if}
Expand Down

0 comments on commit feff1c5

Please sign in to comment.