diff --git a/dist/extension.zip b/dist/extension.zip index 9db8461..8cd4185 100644 Binary files a/dist/extension.zip and b/dist/extension.zip differ diff --git a/dist/extension/birb.js b/dist/extension/birb.js index 2eb3f95..4606bee 100644 --- a/dist/extension/birb.js +++ b/dist/extension/birb.js @@ -1869,7 +1869,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2026.1.10", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.10"); }, false), + new MenuItem("2026.1.18", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.18"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/extension/manifest.json b/dist/extension/manifest.json index 7a73455..5a87d8c 100644 --- a/dist/extension/manifest.json +++ b/dist/extension/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Pocket Bird", "description": "It's a pet bird in your browser, what more could you want?", - "version": "2026.1.10", + "version": "2026.1.18", "homepage_url": "https://idreesinc.com", "icons": { "48": "images/icons/transparent/48x48x1.png", diff --git a/dist/obsidian/main.js b/dist/obsidian/main.js index 09fa2bf..ac99d5c 100644 --- a/dist/obsidian/main.js +++ b/dist/obsidian/main.js @@ -1,7 +1,7 @@ const { Plugin, Notice } = require('obsidian'); module.exports = class PocketBird extends Plugin { onload() { - console.log("Loading Pocket Bird version 2026.1.10..."); + console.log("Loading Pocket Bird version 2026.1.18..."); const OBSIDIAN_PLUGIN = this; (function () { 'use strict'; @@ -1912,7 +1912,7 @@ module.exports = class PocketBird extends Plugin { insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2026.1.10", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.10"); }, false), + new MenuItem("2026.1.18", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.18"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/obsidian/manifest.json b/dist/obsidian/manifest.json index 0152ace..de3d1eb 100644 --- a/dist/obsidian/manifest.json +++ b/dist/obsidian/manifest.json @@ -1,7 +1,7 @@ { "id": "pocket-bird", "name": "Pocket Bird", - "version": "2026.1.10", + "version": "2026.1.18", "minAppVersion": "0.15.0", "description": "Add a pet bird to fly around your notes and keep you company!", "author": "Idrees Hassan", diff --git a/dist/userscript/birb.user.js b/dist/userscript/birb.user.js index 5d1d897..7db413a 100644 --- a/dist/userscript/birb.user.js +++ b/dist/userscript/birb.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Pocket Bird // @namespace https://idreesinc.com -// @version 2026.1.10 +// @version 2026.1.18 // @description It's a pet bird in your browser, what more could you want? // @author Idrees // @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/userscript/birb.user.js @@ -1874,7 +1874,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2026.1.10", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.10"); }, false), + new MenuItem("2026.1.18", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.18"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/web/birb.embed.js b/dist/web/birb.embed.js index 10ac911..48fb44a 100644 --- a/dist/web/birb.embed.js +++ b/dist/web/birb.embed.js @@ -1854,7 +1854,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2026.1.10", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.10"); }, false), + new MenuItem("2026.1.18", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.18"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/web/birb.js b/dist/web/birb.js index 10ac911..48fb44a 100644 --- a/dist/web/birb.js +++ b/dist/web/birb.js @@ -1854,7 +1854,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2026.1.10", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.10"); }, false), + new MenuItem("2026.1.18", () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.18"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/src/Frame.js b/src/Frame.js deleted file mode 100644 index f8c6ece..0000000 --- a/src/Frame.js +++ /dev/null @@ -1,76 +0,0 @@ -import { Directions } from './shared.js'; -import { Sprite, BirdType } from './sprites.js'; -import Layer from './layer.js'; - -class Frame { - - /** @type {{ [tag: string]: string[][] }} */ - #pixelsByTag = {}; - - /** - * @param {Layer[]} layers - */ - constructor(layers) { - /** @type {Set} */ - let tags = new Set(); - for (let layer of layers) { - tags.add(layer.tag); - } - tags.add("default"); - for (let tag of tags) { - let maxHeight = layers.reduce((max, layer) => Math.max(max, layer.pixels.length), 0); - if (layers[0].tag !== "default") { - throw new Error("First layer must have the 'default' tag"); - } - this.pixels = layers[0].pixels.map(row => row.slice()); - // Pad from top with transparent pixels - while (this.pixels.length < maxHeight) { - this.pixels.unshift(new Array(this.pixels[0].length).fill(Sprite.TRANSPARENT)); - } - // Combine layers - for (let i = 1; i < layers.length; i++) { - if (layers[i].tag === "default" || layers[i].tag === tag) { - let layerPixels = layers[i].pixels; - let topMargin = maxHeight - layerPixels.length; - for (let y = 0; y < layerPixels.length; y++) { - for (let x = 0; x < layerPixels[y].length; x++) { - this.pixels[y + topMargin][x] = layerPixels[y][x] !== Sprite.TRANSPARENT ? layerPixels[y][x] : this.pixels[y + topMargin][x]; - } - } - } - } - this.#pixelsByTag[tag] = this.pixels.map(row => row.slice()); - } - } - - /** - * @param {string} [tag] - * @returns {string[][]} - */ - getPixels(tag = "default") { - return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"]; - } - - /** - * @param {CanvasRenderingContext2D} ctx - * @param {BirdType} [species] - * @param {number} direction - * @param {number} canvasPixelSize - */ - draw(ctx, direction, canvasPixelSize, species) { - // Clear the canvas before drawing the new frame - ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); - - const pixels = this.getPixels(species?.tags[0]); - for (let y = 0; y < pixels.length; y++) { - const row = pixels[y]; - for (let x = 0; x < pixels[y].length; x++) { - const cell = direction === Directions.LEFT ? row[x] : row[pixels[y].length - x - 1]; - ctx.fillStyle = species?.colors[cell] ?? cell; - ctx.fillRect(x * canvasPixelSize, y * canvasPixelSize, canvasPixelSize, canvasPixelSize); - }; - }; - } -} - -export default Frame; \ No newline at end of file diff --git a/src/Layer.js b/src/Layer.js deleted file mode 100644 index cd33990..0000000 --- a/src/Layer.js +++ /dev/null @@ -1,12 +0,0 @@ -class Layer { - /** - * @param {string[][]} pixels - * @param {string} [tag] - */ - constructor(pixels, tag = "default") { - this.pixels = pixels; - this.tag = tag; - } -} - -export default Layer; \ No newline at end of file diff --git a/src/anim.js b/src/animation/anim.js similarity index 100% rename from src/anim.js rename to src/animation/anim.js diff --git a/src/frame.js b/src/animation/frame.js similarity index 98% rename from src/frame.js rename to src/animation/frame.js index f8c6ece..757619b 100644 --- a/src/frame.js +++ b/src/animation/frame.js @@ -1,4 +1,4 @@ -import { Directions } from './shared.js'; +import { Directions } from '../shared.js'; import { Sprite, BirdType } from './sprites.js'; import Layer from './layer.js'; diff --git a/src/layer.js b/src/animation/layer.js similarity index 100% rename from src/layer.js rename to src/animation/layer.js diff --git a/src/sprites.js b/src/animation/sprites.js similarity index 100% rename from src/sprites.js rename to src/animation/sprites.js diff --git a/src/application.js b/src/application.js index 396e7fb..6c710d7 100644 --- a/src/application.js +++ b/src/application.js @@ -1,6 +1,6 @@ -import Frame from './frame.js'; -import Layer from './layer.js'; -import Anim from './anim.js'; +import Frame from './animation/frame.js'; +import Layer from './animation/layer.js'; +import Anim from './animation/anim.js'; import { Birb, Animations } from './birb.js'; import { Birdsong } from './sound.js'; import { Context, ObsidianContext } from './context.js'; @@ -26,7 +26,7 @@ import { Sprite, SPRITE_SHEET_COLOR_MAP, SPECIES -} from './sprites.js'; +} from './animation/sprites.js'; import { StickyNote, createNewStickyNote, diff --git a/src/birb.js b/src/birb.js index a2baeb6..a7f6843 100644 --- a/src/birb.js +++ b/src/birb.js @@ -1,8 +1,8 @@ import { Directions, getLayer, getWindowHeight, getFixedWindowHeight } from './shared.js'; -import Layer from './layer.js'; -import Frame from './frame.js'; -import Anim from './anim.js'; -import { BirdType } from './sprites.js'; +import Layer from './animation/layer.js'; +import Frame from './animation/frame.js'; +import Anim from './animation/anim.js'; +import { BirdType } from './animation/sprites.js'; /** * @typedef {keyof typeof Animations} AnimationType