Skip to content

Commit

Permalink
Merge branch 'release/v1.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mattd committed Jul 15, 2022
2 parents d397e70 + 3b29431 commit 6e4927c
Show file tree
Hide file tree
Showing 22 changed files with 3,756 additions and 3,927 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// System Files
.DS_Store

// Artifacts
build.zip
node_modules

// Development
.screenrc
6 changes: 3 additions & 3 deletions module/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"author": "troygoode, Argonius-Angelus, mattd",
"url": "https://github.com/mattd/foundryvtt-progress-clocks",
"manifest": "https://raw.githubusercontent.com/mattd/foundryvtt-progress-clocks/main/module/module.json",
"download": "https://github.com/mattd/foundryvtt-progress-clocks/releases/download/v1.4.1/build.zip",
"version": "1.4.1",
"download": "https://github.com/mattd/foundryvtt-progress-clocks/releases/download/v1.4.2/build.zip",
"version": "1.4.2",
"minimumCoreVersion": "0.7.0",
"compatibleCoreVersion": "9",
"esmodules": ["scripts/init.js"],
"esmodules": ["scripts/init.mjs"],
"styles": ["styles/clocks.css"]
}
166 changes: 0 additions & 166 deletions module/scripts/clock.js

This file was deleted.

87 changes: 87 additions & 0 deletions module/scripts/clock.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
const nextIndexInArray = (arr, el) => {
const idx = arr.indexOf(el);
return (idx < 0 || idx >= arr.length) ? 0 : idx + 1;
}

export class Clock {
static sizes = [
2, 3, 4, 5, 6, 8, 10, 12
];

static image = {
width: 350,
height: 350
};

static themePath = 'modules/progress-clocks/themes';

static themes = {
gms_red: `${Clock.themePath}/gms_red`,
gms_red_grey: `${Clock.themePath}/gms_red_grey`,
wallflower_green: `${Clock.themePath}/wallflower_green`,
wallflower_green_grey: `${Clock.themePath}/wallflower_green_grey`
};

constructor ({ size, progress, theme } = {}) {
const isSupportedSize = size && Clock.sizes.indexOf(parseInt(size)) >= 0;

this.size = isSupportedSize ? parseInt(size) : Clock.sizes[0];

if (!progress || progress < 0) {
this.progress = 0;
} else if (progress > size) {
this.progress = this.size;
} else {
this.progress = progress;
}

this.theme = theme || 'wallflower_green';
}

get flags () {
return {
clocks: {
size: this.size,
progress: this.progress,
theme: this.theme
}
};
}

cycleSize () {
return new Clock({
size: Clock.sizes[nextIndexInArray(Clock.sizes, this.size)],
progress: this.progress,
theme: this.theme
});
}

increment () {
const old = this;
return new Clock({
size: old.size,
progress: old.progress + 1,
theme: old.theme
});
}

decrement () {
const old = this;
return new Clock({
size: old.size,
progress: old.progress - 1,
theme: old.theme
});
}

isEqual (clock) {
return clock
&& clock.size === this.size
&& clock.progress === this.progress
&& clock.theme === this.theme;
}

toString () {
return `${this.progress}/${this.size}${this.theme}`;
}
}
34 changes: 0 additions & 34 deletions module/scripts/init.js

This file was deleted.

5 changes: 5 additions & 0 deletions module/scripts/init.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ClockSheet } from "./sheet.mjs";

Hooks.once("init", () => {
ClockSheet.register();
});
Loading

0 comments on commit 6e4927c

Please sign in to comment.