diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f48d7c9..6f75dcf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,13 +19,13 @@ jobs: - name: Setup Bun uses: oven-sh/setup-bun@v2 - name: Build Project - run: bun start && bun clean prod + run: bun start - name: Setup Pages uses: actions/configure-pages@v6 - name: Upload artifact uses: actions/upload-pages-artifact@v5 with: - path: 'www' + path: 'site' deploy: needs: build if: github.event_name == 'push' && github.ref == 'refs/heads/main' diff --git a/.gitignore b/.gitignore index 1d2c904..b427a48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ node_modules -package-lock.json bun.lock -dist -*.zip +site diff --git a/cmd/clean b/cmd/clean index 355f84a..d93e1ff 100755 --- a/cmd/clean +++ b/cmd/clean @@ -6,21 +6,8 @@ if [[ ! -f 'cmd/clean' ]] ; then exit 1 fi -# Check to make sure a single argument was provided -if [[ "${#}" -ne 1 ]] ; then - echo "Usage: ${0} " - exit 1 -fi - # Select files to delete -if [[ "${1}" == 'dev' ]] ; then - files=('node_modules' 'dist' 'bun.lock' '*.zip') -elif [[ "${1}" == 'prod' ]] ; then - files=('node_modules' 'src' 'package.json' '*.md' '*.zip' 'release') -else - echo "Unknown argument ${1}." - exit 1 -fi +files=('node_modules' 'bun.lock' 'site') # Delete corresponding files for file in "${files[@]}" ; do diff --git a/cmd/release b/cmd/release deleted file mode 100755 index 9851b3c..0000000 --- a/cmd/release +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -bun start prod -cp dist/main.js ./*.mp3 release -zip -r release.zip release -rm -r release/*.js release/*.mp3 diff --git a/cmd/start b/cmd/start index 1929da7..e9964bc 100755 --- a/cmd/start +++ b/cmd/start @@ -10,5 +10,14 @@ else exit 1 fi +# Create project output directory +name="../../../site/$(basename "${PWD}")" +mkdir -p "${name}" + # Lint and build project -bun x tsc --noEmit && bun x eslint src && bun build "${args[@]}" --outfile=dist/main.js src/index.ts +bun x tsc --noEmit && bun x eslint src && bun build "${args[@]}" --compile --target=browser ./index.html --outfile="${name}/index.html" + +# Package for releasing +if [[ "${2}" == 'zip' ]] ; then + zip -r "${name}/release.zip" "${name}/index.html" +fi diff --git a/package.json b/package.json index 27c925f..e892aea 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "www/**/*" ], "devDependencies": { - "eslint": "10.8.1", + "eslint": "10.9.0", "@eslint/js": "10.0.1", - "typescript-eslint": "8.66.0" + "typescript-eslint": "8.67.0" } } \ No newline at end of file diff --git a/www/games/ballistic/index.html b/www/games/ballistic/index.html index 25be253..1e077a1 100644 --- a/www/games/ballistic/index.html +++ b/www/games/ballistic/index.html @@ -8,7 +8,7 @@ - + diff --git a/www/games/ballistic/package.json b/www/games/ballistic/package.json index 85a2daa..bbd8e39 100644 --- a/www/games/ballistic/package.json +++ b/www/games/ballistic/package.json @@ -4,7 +4,7 @@ "start": "../../../cmd/start" }, "dependencies": { - "graphico": "1.2.1", - "smath": "1.15.1" + "graphico": "1.7.0", + "smath": "3.1.0" } } \ No newline at end of file diff --git a/www/games/ballistic/src/ball.ts b/www/games/ballistic/src/ball.ts index c843a7f..5a39612 100644 --- a/www/games/ballistic/src/ball.ts +++ b/www/games/ballistic/src/ball.ts @@ -1,7 +1,7 @@ import { Drawable } from 'graphico'; import { Rod } from './rod'; import { Hole } from './hole'; -import { clamp, translate } from 'smath'; +import { SMath } from 'smath'; export class Ball implements Drawable { private rolling = false; @@ -141,8 +141,8 @@ export class Ball implements Drawable { public draw(graphics: CanvasRenderingContext2D): void { // Save and manipulate graphics.save(); - const yTranslate: number = translate(clamp(this.fallDuration, 0, this.fallAnimDurationSec), 0, this.fallAnimDurationSec, 0, this.r / 2); - const scaleFactor: number = translate(clamp(this.fallDuration, 0, this.fallAnimDurationSec), 0, this.fallAnimDurationSec, 1, 0); + const yTranslate: number = SMath.translate(SMath.clamp(this.fallDuration, 0, this.fallAnimDurationSec), 0, this.fallAnimDurationSec, 0, this.r / 2); + const scaleFactor: number = SMath.translate(SMath.clamp(this.fallDuration, 0, this.fallAnimDurationSec), 0, this.fallAnimDurationSec, 1, 0); graphics.translate(this.x, this.y + yTranslate); graphics.scale(scaleFactor, scaleFactor); graphics.rotate(this.angle); diff --git a/www/games/ballistic/src/game.ts b/www/games/ballistic/src/game.ts index 937da2c..3a77402 100644 --- a/www/games/ballistic/src/game.ts +++ b/www/games/ballistic/src/game.ts @@ -3,7 +3,7 @@ import { Ball } from './ball'; import { Rod } from './rod'; import { Hole } from './hole'; import { Progress } from './progress'; -import { rint } from 'smath'; +import { SMath } from 'smath'; export type Difficulty = 'Easy' | 'Medium' | 'Hard' | 'X-treme'; @@ -156,8 +156,8 @@ export class Game implements Drawable { this.rod = new Rod(height - vPadding, height - vPadding, width, height, 100, 10); const holeR: number = ballR * holeRFac; this.holes = []; - for (let y = height - vPadding - holeR * 3; y > vPadding; y -= rint(1, holeR)) { - const hole = new Hole(rint(holeR * 3, width - holeR * 3), y, holeR, holePadding); + for (let y = height - vPadding - holeR * 3; y > vPadding; y -= SMath.rint(1, holeR)) { + const hole = new Hole(SMath.rint(holeR * 3, width - holeR * 3), y, holeR, holePadding); let intersects = false; for (const existingHole of this.holes) { if (hole.intersects(existingHole)) { diff --git a/www/games/ballistic/src/rod.ts b/www/games/ballistic/src/rod.ts index 4d2af2d..c0bd424 100644 --- a/www/games/ballistic/src/rod.ts +++ b/www/games/ballistic/src/rod.ts @@ -1,5 +1,5 @@ import { Drawable } from 'graphico'; -import { translate, clamp } from 'smath'; +import { SMath } from 'smath'; type Control = 'Up' | 'Down' | 'None'; @@ -33,7 +33,7 @@ export class Rod implements Drawable { * Get the height of the rod at a certain X-position. */ public getY(x: number): number { - return translate(x, this.lx, this.rx, this.ly, this.ry); + return SMath.translate(x, this.lx, this.rx, this.ly, this.ry); } /** * Move the rod based on user input. @@ -45,13 +45,13 @@ export class Rod implements Drawable { } else if (left === 'Down') { this.ly += speed; } - this.ly = clamp(this.ly, this.width, this.gameHeight - this.width); + this.ly = SMath.clamp(this.ly, this.width, this.gameHeight - this.width); if (right === 'Up') { this.ry -= speed; } else if (right === 'Down') { this.ry += speed; } - this.ry = clamp(this.ry, this.width, this.gameHeight - this.width); + this.ry = SMath.clamp(this.ry, this.width, this.gameHeight - this.width); } /** * Move the rod to a specified position and return `true` when it has reached it. @@ -59,14 +59,14 @@ export class Rod implements Drawable { public reset(dt: number): boolean { const px: number = this.px_per_sec * dt / 1000; if (this.ly > this.startLeft) { - this.ly = clamp(this.ly - px, this.startLeft, this.ly); + this.ly = SMath.clamp(this.ly - px, this.startLeft, this.ly); } else if (this.ly < this.startLeft) { - this.ly = clamp(this.ly + px, this.ly, this.startLeft); + this.ly = SMath.clamp(this.ly + px, this.ly, this.startLeft); } if (this.ry > this.startRight) { - this.ry = clamp(this.ry - px, this.startRight, this.ry); + this.ry = SMath.clamp(this.ry - px, this.startRight, this.ry); } else if (this.ry < this.startRight) { - this.ry = clamp(this.ry + px, this.ry, this.startRight); + this.ry = SMath.clamp(this.ry + px, this.ry, this.startRight); } return this.ly === this.startLeft && this.ry === this.startRight; } diff --git a/www/games/ballistic/src/version.ts b/www/games/ballistic/src/version.ts index dee4d85..6252e59 100644 --- a/www/games/ballistic/src/version.ts +++ b/www/games/ballistic/src/version.ts @@ -1 +1 @@ -export const version = '1.1.1'; +export const version = '1.2.0'; diff --git a/www/games/cave-explorer/index.html b/www/games/cave-explorer/index.html index 1421ad9..6638308 100644 --- a/www/games/cave-explorer/index.html +++ b/www/games/cave-explorer/index.html @@ -5,7 +5,7 @@ Cave Explorer - + diff --git a/www/games/cave-explorer/package.json b/www/games/cave-explorer/package.json index cdb0f2b..6270bd8 100644 --- a/www/games/cave-explorer/package.json +++ b/www/games/cave-explorer/package.json @@ -4,8 +4,8 @@ "start": "../../../cmd/start" }, "dependencies": { - "graphico": "1.2.1", - "smath": "1.15.1", - "viridis": "1.4.2" + "graphico": "1.7.0", + "smath": "3.1.0", + "viridis": "1.7.0" } } \ No newline at end of file diff --git a/www/games/cave-explorer/src/map.ts b/www/games/cave-explorer/src/map.ts index f846700..d32245f 100644 --- a/www/games/cave-explorer/src/map.ts +++ b/www/games/cave-explorer/src/map.ts @@ -1,6 +1,6 @@ import { Drawable } from 'graphico'; import { allDirections, Direction, move, tileSize, Vec2 } from './types'; -import * as SMath from 'smath'; +import { SMath } from 'smath'; export class GameMap implements Drawable { private readonly tiles: TileType[][]; diff --git a/www/games/cave-explorer/src/minimap.ts b/www/games/cave-explorer/src/minimap.ts index 4cc3e09..fd0c6d0 100644 --- a/www/games/cave-explorer/src/minimap.ts +++ b/www/games/cave-explorer/src/minimap.ts @@ -1,4 +1,4 @@ -import * as SMath from 'smath'; +import { SMath } from 'smath'; import { Drawable } from 'graphico'; import { GameMap } from './map'; import { Player } from './player'; diff --git a/www/games/cellsplit/index.html b/www/games/cellsplit/index.html index c6af7c7..5343265 100644 --- a/www/games/cellsplit/index.html +++ b/www/games/cellsplit/index.html @@ -8,7 +8,7 @@ - + diff --git a/www/games/cellsplit/package.json b/www/games/cellsplit/package.json index 7e024ff..3ba0f1e 100644 --- a/www/games/cellsplit/package.json +++ b/www/games/cellsplit/package.json @@ -4,6 +4,6 @@ "start": "../../../cmd/start" }, "dependencies": { - "graphico": "1.2.1" + "graphico": "1.7.0" } } \ No newline at end of file diff --git a/www/games/geomarin/index.html b/www/games/geomarin/index.html index 398030e..5891457 100644 --- a/www/games/geomarin/index.html +++ b/www/games/geomarin/index.html @@ -9,7 +9,7 @@ content="A daily puzzle game dedicated to the unique architecture and natural beauty of Marin county, California."> - + diff --git a/www/games/geomarin/package.json b/www/games/geomarin/package.json index 6176a95..1a4faa6 100644 --- a/www/games/geomarin/package.json +++ b/www/games/geomarin/package.json @@ -4,7 +4,7 @@ "start": "../../../cmd/start" }, "dependencies": { - "graphico": "1.6.0", - "smath": "3.0.0" + "graphico": "1.7.0", + "smath": "3.1.0" } } \ No newline at end of file diff --git a/www/games/geomarin/src/globals.ts b/www/games/geomarin/src/globals.ts index 0e66978..d910f6d 100644 --- a/www/games/geomarin/src/globals.ts +++ b/www/games/geomarin/src/globals.ts @@ -5,7 +5,7 @@ export const global = { /** * Application version number */ - version: '1.1', + version: '1.2', /** * Colors for SVG paths (regions) */ diff --git a/www/games/hexles/CHANGELOG.md b/www/games/hexles/CHANGELOG.md index 0a9880e..4a4e521 100644 --- a/www/games/hexles/CHANGELOG.md +++ b/www/games/hexles/CHANGELOG.md @@ -1,5 +1,10 @@ # Changes +## 1.1.5 + +- Compile into a standalone HTML page +- Update `graphico` (1.7.0) and `smath` (3.1.0) dependencies + ## 1.1.4 - Update `graphico` dependency version (1.2.1) diff --git a/www/games/hexles/index.html b/www/games/hexles/index.html index 196ab89..fee595a 100644 --- a/www/games/hexles/index.html +++ b/www/games/hexles/index.html @@ -9,7 +9,7 @@ - + diff --git a/www/games/hexles/package.json b/www/games/hexles/package.json index e1f4e47..7571c20 100644 --- a/www/games/hexles/package.json +++ b/www/games/hexles/package.json @@ -4,7 +4,7 @@ "start": "../../../cmd/start" }, "dependencies": { - "graphico": "1.2.1", - "smath": "1.15.1" + "graphico": "1.7.0", + "smath": "3.1.0" } } \ No newline at end of file diff --git a/www/games/hexles/src/Game.ts b/www/games/hexles/src/Game.ts index 663600e..662b430 100644 --- a/www/games/hexles/src/Game.ts +++ b/www/games/hexles/src/Game.ts @@ -1,4 +1,4 @@ -import { clamp, selectRandom, selectRandomWeighted } from 'smath'; +import { SMath } from 'smath'; import { Drawable } from 'graphico'; import { Hexagon, Vec2 } from './Geometry'; import { VERSION } from './version'; @@ -37,7 +37,7 @@ class Player implements Drawable { if (unusedColors.length === 0) { throw new Error('All colors are in use.'); } - this.color = selectRandom(unusedColors); + this.color = SMath.selectRandom(unusedColors); } Player.ColorMap[this.color].inUse = true; this.dPad = new DPad(this); @@ -224,7 +224,7 @@ class Board implements Drawable { if (neutralTiles.length === 0) { throw new Error('No neutral tiles left.'); } - const tile: Tile = selectRandom(neutralTiles); + const tile: Tile = SMath.selectRandom(neutralTiles); tile.capture(player); } /** @@ -447,9 +447,9 @@ class Game implements Drawable { this.paused = false; this.board = new Board(boardSize, wallDensity); this.turnText = new Text('', 22, { x: 0.01, y: 0.01 }); - numHumans = clamp(numHumans, 0, Game.MAX_PLAYERS); - numAI = clamp(numAI, 0, Game.MAX_PLAYERS); - numAI = clamp(numAI, Game.MIN_PLAYERS - numHumans, Game.MAX_PLAYERS - numHumans); + numHumans = SMath.clamp(numHumans, 0, Game.MAX_PLAYERS); + numAI = SMath.clamp(numAI, 0, Game.MAX_PLAYERS); + numAI = SMath.clamp(numAI, Game.MIN_PLAYERS - numHumans, Game.MAX_PLAYERS - numHumans); for (let i = 0; i < numHumans; i++) { this.players.push(new Player(favoriteColor, false)); } @@ -535,7 +535,7 @@ class Game implements Drawable { if (this.turnOrder.getCurrentPlayer().isAI) { const bucketNames: Direction[] = ['North', 'NorthEast', 'NorthWest', 'South', 'SouthEast', 'SouthWest'], buckets: number[] = bucketNames.map(name => this.board.captureWeight(this.turnOrder.getCurrentPlayer(), name)), - selectedDirection = bucketNames[selectRandomWeighted(buckets)]; // Note: is `undefined` when there are no legal moves + selectedDirection = bucketNames[SMath.selectRandomWeighted(buckets)]; // Note: is `undefined` when there are no legal moves let startThinkTime: number = this.time + 500; // Wait 0.5 sec before "thinking" const aiTick = setInterval(() => { const elapsedTime: number = this.time - startThinkTime; diff --git a/www/games/hexles/src/version.ts b/www/games/hexles/src/version.ts index 0abf940..60f9312 100644 --- a/www/games/hexles/src/version.ts +++ b/www/games/hexles/src/version.ts @@ -1 +1 @@ -export const VERSION = '1.1.4'; +export const VERSION = '1.1.5'; diff --git a/www/games/orbit-idle/index.html b/www/games/orbit-idle/index.html index 74b9aa8..1354bd9 100644 --- a/www/games/orbit-idle/index.html +++ b/www/games/orbit-idle/index.html @@ -8,13 +8,14 @@ - +

Orbit Idle

+

This game takes a new spin as the 4th game in the Revolution Idle series.

diff --git a/www/games/orbit-idle/package.json b/www/games/orbit-idle/package.json index 7d5f969..aa69ce8 100644 --- a/www/games/orbit-idle/package.json +++ b/www/games/orbit-idle/package.json @@ -1,12 +1,11 @@ { "name": "orbit-idle", "scripts": { - "start": "../../../cmd/start", - "release": "../../../cmd/release" + "start": "../../../cmd/start" }, "dependencies": { - "graphico": "1.6.0", - "smath": "3.0.0", - "viridis": "1.6.1" + "graphico": "1.7.0", + "smath": "3.1.0", + "viridis": "1.7.0" } } \ No newline at end of file diff --git a/www/games/orbit-idle/release/index.css b/www/games/orbit-idle/release/index.css deleted file mode 100644 index 66a7979..0000000 --- a/www/games/orbit-idle/release/index.css +++ /dev/null @@ -1,11 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap'); - -* { - box-sizing: border-box; - border-collapse: collapse; -} - -body { - margin: 0; - padding: 0; -} \ No newline at end of file diff --git a/www/games/orbit-idle/release/index.html b/www/games/orbit-idle/release/index.html deleted file mode 100644 index 1ed1363..0000000 --- a/www/games/orbit-idle/release/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Orbit Idle - - - - - - - - - - - - \ No newline at end of file diff --git a/www/games/orbit-idle/src/data/state.ts b/www/games/orbit-idle/src/data/state.ts index 743b6b4..2bc1c12 100644 --- a/www/games/orbit-idle/src/data/state.ts +++ b/www/games/orbit-idle/src/data/state.ts @@ -12,7 +12,7 @@ import { Tutorial } from '../form-controls/tutorial'; import { Zoom } from '../ui/zoom'; // Global constants -export const version = 'v1.0.1'; +export const version = 'v1.0.2'; // UI elements export const cursor: Cursor = new Cursor(); diff --git a/www/games/orbit-idle/src/index.ts b/www/games/orbit-idle/src/index.ts index 21cf460..94e171f 100644 --- a/www/games/orbit-idle/src/index.ts +++ b/www/games/orbit-idle/src/index.ts @@ -55,7 +55,7 @@ const canv: Canvas = new Canvas({ menu.click(button); if (!audio) { audio = true; - canv.playAudio('./Between_The_Sleepless_Stars.mp3', true, 0.25); + canv.playAudio((document.getElementById('music') as HTMLAudioElement).src, true, 0.25); } }, keydown(key) { diff --git a/www/games/space/index.html b/www/games/space/index.html deleted file mode 100644 index 42c6a56..0000000 --- a/www/games/space/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Space - - - - -

Space

- - - \ No newline at end of file diff --git a/www/games/space/package.json b/www/games/space/package.json deleted file mode 100644 index 9fb6d1d..0000000 --- a/www/games/space/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "space", - "scripts": { - "start": "../../../cmd/start" - }, - "dependencies": { - "graphico": "1.0.0", - "smath": "1.13.2", - "viridis": "1.4.1" - } -} \ No newline at end of file diff --git a/www/games/space/src/Star.ts b/www/games/space/src/Star.ts deleted file mode 100644 index 8e6ce99..0000000 --- a/www/games/space/src/Star.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Drawable } from 'graphico'; -import { Color, Gradient } from 'viridis'; -import * as SMath from 'smath'; -import { game } from './game'; - -export class Star implements Drawable { - private static readonly temp_gradient: Gradient = new Gradient([ - Color.rgb(255, 100, 100), // 2,500 [K] - Color.rgb(255, 255, 150), // 5,000 [K] - Color.rgb(255, 255, 255), // 7,500 [K] - Color.rgb(150, 150, 255), // 10,000 [K] - ]); - private readonly color: Color; - constructor(private x: number, private y: number, private readonly r: number, private readonly distance: number, temp: number) { - this.color = Star.temp_gradient.getColor(temp, 2500, 10000); - } - public static rand(): Star { - return new Star(SMath.runif(0, game.width), SMath.runif(0, game.height), SMath.runif(1, 3), SMath.rint(10, 100), SMath.rnorm(6000, 2000)); - } - public move(dx: number, dy: number, dt: number): void { - this.x -= dx * dt / this.distance; - this.y -= dy * dt / this.distance; - this.x = (game.width + this.x) % game.width; - this.y = (game.height + this.y) % game.height; - } - public draw(graphics: CanvasRenderingContext2D): void { - const grad = graphics.createRadialGradient(this.x, this.y, 0, this.x, this.y, 4 * this.r); - grad.addColorStop(0, this.color.toString()); - grad.addColorStop(1, Color.rgb(0, 0, 0, 0).toString()); - graphics.fillStyle = grad; - graphics.beginPath(); - graphics.arc(this.x, this.y, 20 * this.r, 0, 2 * Math.PI); - graphics.fill(); - graphics.fillStyle = this.color.toString(); - graphics.beginPath(); - graphics.arc(this.x, this.y, this.r, 0, 2 * Math.PI); - graphics.fill(); - } -} \ No newline at end of file diff --git a/www/games/space/src/game.ts b/www/games/space/src/game.ts deleted file mode 100644 index 00bf32e..0000000 --- a/www/games/space/src/game.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Canvas } from 'graphico'; -import { Star } from './Star'; - -export const stars: Star[] = []; - -export const game: Canvas = new Canvas({ - background: 'black', - border: 'black', - borderBlur: 'gray', - width: 1280, - height: 720, - loop(dt) { - game.clear(); - const left: boolean = game.isKeyDown('arrowleft'); - const right: boolean = game.isKeyDown('arrowright'); - const up: boolean = game.isKeyDown('arrowup'); - const down: boolean = game.isKeyDown('arrowdown'); - for (const star of stars) { - star.move((left ? -1 : 0) + (right ? 1 : 0), (up ? -1 : 0) + (down ? 1 : 0), dt); - game.draw(star); - } - }, -}); diff --git a/www/games/space/src/index.ts b/www/games/space/src/index.ts deleted file mode 100644 index 2932a87..0000000 --- a/www/games/space/src/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { stars } from './game'; -import { Star } from './Star'; - -for (let i = 0; i < 1000; i++) { - stars.push(Star.rand()); -} diff --git a/www/tools/assets/script.js b/www/tools/assets/script.js deleted file mode 100644 index e22e00c..0000000 --- a/www/tools/assets/script.js +++ /dev/null @@ -1,44 +0,0 @@ -console.log('Loaded!'); - -const allTools = document.getElementById('tools'); -let hue = 0; - -function addGroup(heading = '') { - const head = document.createElement('h3'); - head.setAttribute('title', `Below is a group of tools relating to: ${heading}`) - head.textContent = heading; - allTools.appendChild(head); -} - -function addTool(path = '', name = '', desc = '') { - hue += 10; - const anchor = document.createElement('a'); - anchor.setAttribute('href', path); - anchor.setAttribute('title', `${name}: ${desc}`); - anchor.className = 'tool'; - allTools.appendChild(anchor); - const container = document.createElement('div'); - container.style.background = `hsl(${hue},100%,75%)`; - container.className = 'tool'; - anchor.appendChild(container); - const title = document.createElement('strong'); - title.textContent = name; - const descr = document.createElement('i'); - descr.textContent = ` - ${desc}`; - container.append(title, descr); -} - -addGroup('Finance'); -addTool('tvm', 'Time Value of Money', 'Calculate the time value of money using various equations.'); -addTool('interest', 'Interest Calculator', 'A collection of formulas that calculate parameters for an environment with an interest rate.'); - -addGroup('Science'); -addTool('https://psychart.nicfv.com/', 'Psychart', 'Plot thermodynamic conditions of air on a psychrometric chart, optionally displaying comfort zones.'); -addTool('dimensional', 'Unit Converter', 'Convert anything to anything! Build complex units and analyze dimensions.'); -addTool('dimensional-playground', 'Dimensional Playground', 'Presents a live editor with the `dimensional` package ready to use.'); -addTool('data-url', 'File To Data URL', 'Encode any file as a data URL that can be directly embedded into a source code file.'); - -addGroup('Gaming'); -addTool('wordle', 'Wordle Helper', 'Filters the wordle dictionary based on your previous guesses to help you make an informed next guess.'); -addTool('hearts', 'Hearts Helper', 'Help counts cards specifically for the game, Hearts.'); -addTool('pokemon-go', 'Pokemon Go Catch Rate', 'A catch rate calculator for the mobile game, Pokemon Go.'); diff --git a/www/tools/assets/style.css b/www/tools/assets/style.css deleted file mode 100644 index 770b1c1..0000000 --- a/www/tools/assets/style.css +++ /dev/null @@ -1,52 +0,0 @@ -* { - outline: none; - box-sizing: border-box; -} - -html, -body { - height: 100%; - margin: 0; - padding: 0; -} - -body { - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; - font-family: sans-serif; -} - -main { - padding: 1rem; - max-width: 40rem; -} - -footer { - width: 100%; - background: lightgray; - border-top: 1px solid gray; - padding: 0.5rem; -} - -a, -a:link, -a:visited { - color: navy; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -a:active { - color: red; -} - -div.tool { - margin: 0.5rem 0; - padding: 0.5rem; - border-radius: 0.5rem; -} \ No newline at end of file diff --git a/www/tools/data-url/index.html b/www/tools/data-url/index.html index 7769ecc..47f5194 100644 --- a/www/tools/data-url/index.html +++ b/www/tools/data-url/index.html @@ -7,13 +7,13 @@ - + - Convert File to Data URL + Convert File to Data URL diff --git a/www/tools/dimensional-playground/index.html b/www/tools/dimensional-playground/index.html index 0dc0292..fd8d65d 100644 --- a/www/tools/dimensional-playground/index.html +++ b/www/tools/dimensional-playground/index.html @@ -9,13 +9,13 @@ - +

- Dimensional Analysis Playground — + Dimensional Analysis Playground — Documentation

diff --git a/www/tools/dimensional-playground/package.json b/www/tools/dimensional-playground/package.json index 1f952c3..c520232 100644 --- a/www/tools/dimensional-playground/package.json +++ b/www/tools/dimensional-playground/package.json @@ -4,8 +4,8 @@ "start": "../../../cmd/start" }, "dependencies": { - "@codemirror/lang-javascript": "6.2.4", + "@codemirror/lang-javascript": "6.2.5", "codemirror": "6.0.2", - "dimensional": "1.3.2" + "dimensional": "1.5.0" } } \ No newline at end of file diff --git a/www/tools/dimensional/index.html b/www/tools/dimensional/index.html index 23d2bb5..db002d5 100644 --- a/www/tools/dimensional/index.html +++ b/www/tools/dimensional/index.html @@ -9,7 +9,7 @@ - + diff --git a/www/tools/dimensional/package.json b/www/tools/dimensional/package.json index e4007eb..a059a8b 100644 --- a/www/tools/dimensional/package.json +++ b/www/tools/dimensional/package.json @@ -4,7 +4,6 @@ "start": "../../../cmd/start" }, "dependencies": { - "dimensional": "1.3.2", - "smath": "1.13.3" + "dimensional": "1.5.0" } } \ No newline at end of file diff --git a/www/tools/hearts/index.html b/www/tools/hearts/index.html index 9ccf5aa..b5ba4df 100644 --- a/www/tools/hearts/index.html +++ b/www/tools/hearts/index.html @@ -8,7 +8,7 @@ - + diff --git a/www/tools/index.html b/www/tools/index.html deleted file mode 100644 index a39f8e3..0000000 --- a/www/tools/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Tools - - - - - - - - - -
-

Tools

-

A collection of software tools created by Nicolas Ventura.

-
-
- - - - \ No newline at end of file diff --git a/www/tools/interest/index.html b/www/tools/interest/index.html index 796c808..af401b5 100644 --- a/www/tools/interest/index.html +++ b/www/tools/interest/index.html @@ -8,7 +8,7 @@ - + diff --git a/www/tools/interest/package.json b/www/tools/interest/package.json index 3528c81..7958d69 100644 --- a/www/tools/interest/package.json +++ b/www/tools/interest/package.json @@ -4,6 +4,6 @@ "start": "../../../cmd/start" }, "dependencies": { - "smath": "1.13.3" + "smath": "3.1.0" } } \ No newline at end of file diff --git a/www/tools/interest/src/input.ts b/www/tools/interest/src/input.ts index 56f296c..f3b88b5 100644 --- a/www/tools/interest/src/input.ts +++ b/www/tools/interest/src/input.ts @@ -1,4 +1,4 @@ -import * as SMath from 'smath'; +import { SMath } from 'smath'; /** * Represents a structure for numeric bounds. diff --git a/www/tools/pokemon-go/index.html b/www/tools/pokemon-go/index.html index 5e35c82..887094b 100644 --- a/www/tools/pokemon-go/index.html +++ b/www/tools/pokemon-go/index.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@
- Pokemon Go Catch Rate Calculatorv2.3 + Pokemon Go Catch Rate Calculatorv2.4 Likelihood to catch: %
diff --git a/www/tools/pokemon-go/package.json b/www/tools/pokemon-go/package.json index f11bf06..3a7fb7e 100644 --- a/www/tools/pokemon-go/package.json +++ b/www/tools/pokemon-go/package.json @@ -4,7 +4,7 @@ "start": "../../../cmd/start" }, "dependencies": { - "smath": "1.13.3", - "viridis": "1.4.2" + "smath": "3.1.0", + "viridis": "1.7.0" } } \ No newline at end of file diff --git a/www/tools/pokemon-go/src/index.ts b/www/tools/pokemon-go/src/index.ts index 4485fe5..1de27b1 100644 --- a/www/tools/pokemon-go/src/index.ts +++ b/www/tools/pokemon-go/src/index.ts @@ -1,4 +1,4 @@ -import { clamp, round2 } from 'smath'; +import { SMath } from 'smath'; import { Range } from './range'; import { Ring } from './ring'; @@ -37,7 +37,7 @@ function calculate(): void { /** * Curveball modifier */ - const curveMod: number = clamp(curve.getValue(), 1, 1.7); + const curveMod: number = SMath.clamp(curve.getValue(), 1, 1.7); /** * Total bonus modifier not accounted for by `prob0` */ @@ -47,6 +47,6 @@ function calculate(): void { */ const prob1: number = 1 - (1 - prob0) ** modifier; // Display the final probability - output.textContent = round2(prob1 * 100, 0.1).toString(); + output.textContent = SMath.round2(prob1 * 100, 0.1).toString(); } calculate(); diff --git a/www/tools/pokemon-go/src/range.ts b/www/tools/pokemon-go/src/range.ts index e85a72d..380f338 100644 --- a/www/tools/pokemon-go/src/range.ts +++ b/www/tools/pokemon-go/src/range.ts @@ -1,4 +1,4 @@ -import * as SMath from 'smath'; +import { SMath } from 'smath'; /** * Represents a structure for numeric bounds. diff --git a/www/tools/pokemon-go/src/ring.ts b/www/tools/pokemon-go/src/ring.ts index b4b07a1..23684f5 100644 --- a/www/tools/pokemon-go/src/ring.ts +++ b/www/tools/pokemon-go/src/ring.ts @@ -1,4 +1,4 @@ -import { expand } from 'smath'; +import { SMath } from 'smath'; import { Color, Gradient } from 'viridis'; /** @@ -42,7 +42,7 @@ export class Ring { * Set the size of the inner ring, using a value [0-1] */ public setSize(normalized: number): void { - this.ring.setAttribute('r', `${expand(normalized, this.strokeWidth / 2, this.size / 2 - this.strokeWidth)}`); + this.ring.setAttribute('r', `${SMath.expand(normalized, this.strokeWidth / 2, this.size / 2 - this.strokeWidth)}`); } /** * Set the color of the inner ring, using a value [0-1] diff --git a/www/tools/tvm/index.html b/www/tools/tvm/index.html index 86dcac7..740cb8c 100644 --- a/www/tools/tvm/index.html +++ b/www/tools/tvm/index.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@

Time Value of Money

- v1.3 + v1.4