day-card 0.2.0: pick the card's background, and the margin around it
The card was always a receipt on a wide teal ground. A Background button
in the toolbar now opens a menu of 19 backdrops, all drawn on the canvas
the card is saved from:
- teal (as before), and 14 patterns: gingham, graph paper, kraft,
cyanotype, night dots, deckchair stripes, olive linen, seigaiha waves,
xuan paper, zigzag, terracotta, lilac lines, green velvet, apricot
polka;
- four landscape photos (alpine dawn, misty shore, dunes, forest lake),
1000x1500 JPEGs made for this plugin;
- a picture of the reader's own: pick it, drop it on the page or paste
it.
A slider sets the margin around the paper (24 to 160, 76 by default, in
place of the old fixed 207 a side and 4:3 height). A photo also has blur
and dim. The paper's shadow follows the ground.
The choice is kept in the plugin's options (magpie.options): saved a
moment after a slider settles, since magpie takes one write a second.
The reader's own picture is shrunk to a JPEG of at most ~44KB, within
the 64KB magpie keeps for a plugin's options.
The photos are JPEG data in page/bg/<id>.js, loaded when picked, not
image files: the frame's origin is opaque, so a picture loaded by URL
would taint the canvas, and Copy image and Save PNG would fail.
Thumbnails are in bg/thumbs.js, loaded when the menu first opens.
Run: bun test packages/day-card on the Linux test box (magpie-desktop,
via wsl-run; mote refused SSH at the time): 14 pass, 2 of them new
(names in every language and the photos' data; a saved choice made
sound). A Playwright harness served the page with magpie's plugin-page
CSP (sandbox allow-scripts, img-src own data:, connect-src 'none') and
a fake bridge, in Chromium and WebKit: each of the 19 backdrops drew
and saved a PNG through magpie.image (so the canvas was not tainted),
the menu picked dunes and saved {bg: dunes, pad: 120}, the blur and dim
sliders showed only for a photo, and a 2400px JPEG of one's own was
stored as 36-43KB data and drawn. No page errors in either engine. The
first run showed the menu's sliders over the card while closed
(display: flex beat [hidden]); fixed and run again.
Not tried: the real magpie app (WKWebView, WebKitGTK, WebView2), its
real options store, and the native file picker inside the frame.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# @magpie-community/page-day-card
|
||||
|
||||
A page in [magpie](https://usemagpie.ai)'s window that prints a day of your AI usage as a receipt, a "Daily AI statement" on paper over a teal ground. It has the day's API-equivalent cost, your streak, requests, errors and the day against your average day before it, then each agent and its models with their logos and costs, and the day's tokens: input, output and the cache hit rate. **Copy image** puts the card on the clipboard; **Save PNG** saves it in Downloads.
|
||||
A page in [magpie](https://usemagpie.ai)'s window that prints a day of your AI usage as a receipt, a "Daily AI statement" on paper over a backdrop of your choice. It has the day's API-equivalent cost, your streak, requests, errors and the day against your average day before it, then each agent and its models with their logos and costs, and the day's tokens: input, output and the cache hit rate. **Background** picks what the paper lies on: teal, fifteen patterns (gingham, graph paper, kraft, cyanotype, seigaiha waves, xuan paper and more), four landscape photos, or a picture of your own (pick one, drop it on the page or paste it). A slider sets the margin around the paper; a photo also has blur and dim. The choice is kept in the plugin's options. **Copy image** puts the card on the clipboard; **Save PNG** saves it in Downloads.
|
||||
|
||||
Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @magpie-community/page-day-card`. It then has a tab, **Day card** (titled in the window's language: 每日用量卡, 1日の使用量カード, Tageskarte), under Plugins in the sidebar, in the app and in `magpie web`. Pick an earlier day with the arrows or the date's menu.
|
||||
|
||||
@@ -17,6 +17,8 @@ Like every plugin page, it runs in a sandboxed frame with no network (`connect-s
|
||||
- `page/index.html`, `page/style.css`: the page.
|
||||
- `page/view.js`: what the card says, in English, 简体中文, 繁體中文, 日本語 and Deutsch, with no DOM. The test loads it.
|
||||
- `page/app.js`: reads through the bridge, draws the card, copies and saves it, and refreshes today's every minute.
|
||||
- `page/backgrounds.js`: the backdrops, drawn on the canvas, and what a saved choice may be.
|
||||
- `page/bg/`: the four photos and their thumbnails, as JPEG data in scripts the page loads when it needs them. A picture the frame loads from a URL would taint the canvas, and the card could no longer be copied or saved.
|
||||
- `page/fonts.js`: the receipt's face, a subset of [JetBrains Mono](https://www.jetbrains.com/lp/mono/) 2.304 as woff2 data (`page/fonts.LICENSE.txt`, SIL OFL 1.1). The frame can't fetch a font file, so the page loads these bytes with `FontFace`.
|
||||
|
||||
## Test
|
||||
@@ -25,4 +27,4 @@ Like every plugin page, it runs in a sandboxed frame with no network (`connect-s
|
||||
bun test packages/day-card
|
||||
```
|
||||
|
||||
中文:在 magpie 窗口里加一个「每日用量卡」页面,把某一天的用量打印成一张小票(Daily AI Statement):当天按 API 价计的费用、连续使用天数、请求数、错误数、与此前日均的倍数,每个 Agent 及其模型(带图标和费用),以及输入、输出 token 和缓存命中率。可以「复制图片」到剪贴板,或「保存 PNG」到下载文件夹。只读取声明过的 `usage:day`,运行在无网络的沙盒 frame 里。
|
||||
中文:在 magpie 窗口里加一个「每日用量卡」页面,把某一天的用量打印成一张小票(Daily AI Statement):当天按 API 价计的费用、连续使用天数、请求数、错误数、与此前日均的倍数,每个 Agent 及其模型(带图标和费用),以及输入、输出 token 和缓存命中率。「背景」可以换成 15 种图案、4 张风景照片或自己的图片(选择、拖入或粘贴),边距可调,照片还可调模糊和压暗。可以「复制图片」到剪贴板,或「保存 PNG」到下载文件夹。只读取声明过的 `usage:day`,运行在无网络的沙盒 frame 里。
|
||||
|
||||
@@ -213,3 +213,37 @@ test("the receipt's face comes with the page, as data the frame can load", () =>
|
||||
expect(html.indexOf('src="fonts.js"')).toBeLessThan(html.indexOf('src="app.js"'))
|
||||
expect(read("fonts.LICENSE.txt")).toContain("SIL OPEN FONT LICENSE")
|
||||
})
|
||||
|
||||
// backgrounds.js, as the page loads it
|
||||
const bgScope = {}
|
||||
new Function("globalThis", read("backgrounds.js"))(bgScope)
|
||||
const B = bgScope.DayBackgrounds
|
||||
|
||||
test("every backdrop has a name in every language, and its picture comes with the page", () => {
|
||||
const ids = [...B.list.map((b) => b.id), "custom"]
|
||||
expect(new Set(ids).size).toBe(ids.length)
|
||||
for (const [lang, t] of Object.entries(V.TEXT)) for (const id of ids) expect([lang, id, typeof t[`bg-${id}`]]).toEqual([lang, id, "string"])
|
||||
const thumbs = {}
|
||||
new Function("globalThis", read("bg/thumbs.js"))(thumbs)
|
||||
for (const b of B.list.filter((b) => b.photo)) {
|
||||
// data:, so the canvas a photo is drawn on can still be copied and saved
|
||||
const photos = {}
|
||||
new Function("globalThis", read(`bg/${b.id}.js`))(photos)
|
||||
expect(photos.DayPhotos[b.id]).toMatch(/^data:image\/jpeg;base64,\/9j\//)
|
||||
expect(thumbs.DayThumbs[b.id]).toMatch(/^data:image\/jpeg;base64,\/9j\//)
|
||||
}
|
||||
const html = read("index.html")
|
||||
expect(html.indexOf('src="backgrounds.js"')).toBeLessThan(html.indexOf('src="app.js"'))
|
||||
})
|
||||
|
||||
test("a saved backdrop is made sound before it is drawn", () => {
|
||||
expect(B.norm(null)).toEqual({ bg: "teal", pad: 76, blur: 0, dim: 0, image: "" })
|
||||
expect(B.norm({ bg: "seigaiha", pad: 500, blur: -3, dim: "40" })).toEqual({ bg: "seigaiha", pad: 160, blur: 0, dim: 40, image: "" })
|
||||
expect(B.norm({ bg: "nope", pad: "x" })).toMatchObject({ bg: "teal", pad: 76 })
|
||||
// a custom backdrop needs its picture, and only a picture as data:
|
||||
expect(B.norm({ bg: "custom" }).bg).toBe("teal")
|
||||
expect(B.norm({ bg: "custom", image: "https://example.com/a.jpg" })).toMatchObject({ bg: "teal", image: "" })
|
||||
expect(B.norm({ bg: "custom", image: "data:image/jpeg;base64,AAAA", pad: 24 })).toEqual({ bg: "custom", pad: 24, blur: 0, dim: 0, image: "data:image/jpeg;base64,AAAA" })
|
||||
expect(B.meta("custom").photo).toBe(true)
|
||||
expect(B.meta("nope").id).toBe("teal")
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/page-day-card",
|
||||
"version": "0.1.2",
|
||||
"version": "0.2.0",
|
||||
"description": "A page in magpie's window that draws a day of your AI usage as a card: tokens, cost, each agent and its models, your streak and your average day. Copy it as a picture or save it as a PNG",
|
||||
"files": ["page", "README.md"],
|
||||
"keywords": ["magpie", "magpie-page", "usage", "tokens", "cost", "card"],
|
||||
|
||||
+254
-24
@@ -3,11 +3,12 @@
|
||||
// PNG to magpie.image to copy or save.
|
||||
(async () => {
|
||||
const V = globalThis.DayView;
|
||||
const B = globalThis.DayBackgrounds;
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const theme = await magpie.ready;
|
||||
let lang = theme.lang;
|
||||
const zone = (() => { try { return Intl.DateTimeFormat().resolvedOptions().timeZone || ""; } catch { return ""; } })();
|
||||
const state = { date: "", day: null, icons: new Map(), loading: 0 };
|
||||
const state = { date: "", day: null, icons: new Map(), loading: 0, drawn: 0, bg: B.norm(null) };
|
||||
|
||||
// ---- words ----
|
||||
function words() {
|
||||
@@ -117,10 +118,7 @@
|
||||
|
||||
// ---- the receipt ----
|
||||
const PW = 440; // the paper
|
||||
const PAD = 30; // the paper's margin
|
||||
const SIDE = 207; // the backdrop either side, and above and below
|
||||
const TOP = 48;
|
||||
const BOTTOM = 52;
|
||||
const PAD = 30; // the paper's margin; the backdrop's is the reader's (state.bg.pad)
|
||||
const TOOTH = 5; // the torn edge's teeth
|
||||
|
||||
const f = (w, px) => `${w} ${px}px ${MONO}`;
|
||||
@@ -321,18 +319,24 @@
|
||||
async function draw() {
|
||||
const day = state.day;
|
||||
if (!day) return;
|
||||
const n = ++state.drawn;
|
||||
const bg = state.bg;
|
||||
await fonts;
|
||||
const c = V.card(day, lang);
|
||||
const icons = new Map();
|
||||
await Promise.all([...new Set(c.agents.flatMap((a) => [a.icon, ...a.models.map((m) => m.icon)]))].map(async (n) => icons.set(n, await picture(n))));
|
||||
if (state.day !== day) return;
|
||||
const [img] = await Promise.all([
|
||||
backdrop(bg),
|
||||
...[...new Set(c.agents.flatMap((a) => [a.icon, ...a.models.map((m) => m.icon)]))].map(async (n) => icons.set(n, await picture(n))),
|
||||
]);
|
||||
if (state.day !== day || n !== state.drawn) return;
|
||||
const scale = Math.max(2, Math.min(3, Math.ceil(window.devicePixelRatio || 1)));
|
||||
|
||||
// measure, then draw
|
||||
const ph = slip(document.createElement("canvas").getContext("2d"), c, new Map(), 1) + TOOTH;
|
||||
const W = PW + SIDE * 2;
|
||||
const H = Math.max(TOP + ph + BOTTOM, Math.round(W * 4 / 3));
|
||||
const top = Math.round((H - ph) / 2.15);
|
||||
const side = bg.pad;
|
||||
const W = PW + side * 2;
|
||||
const H = ph + side * 2;
|
||||
const top = side;
|
||||
const cv = $("card");
|
||||
cv.width = W * scale;
|
||||
cv.height = H * scale;
|
||||
@@ -340,21 +344,12 @@
|
||||
const ctx = cv.getContext("2d");
|
||||
ctx.setTransform(scale, 0, 0, scale, 0, 0);
|
||||
|
||||
// the backdrop: teal at the top left to mint at the bottom right
|
||||
const g = ctx.createLinearGradient(0, 0, W * 0.35, H);
|
||||
g.addColorStop(0, "#1dd8d1");
|
||||
g.addColorStop(1, "#92ecc6");
|
||||
ctx.fillStyle = g;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
const g2 = ctx.createLinearGradient(0, 0, W, 0);
|
||||
g2.addColorStop(0, "rgba(255, 255, 255, 0)");
|
||||
g2.addColorStop(1, "rgba(255, 255, 255, .14)");
|
||||
ctx.fillStyle = g2;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
// the backdrop the reader picked
|
||||
B.paint(ctx, W, H, scale, bg, img);
|
||||
|
||||
// the paper, torn along its foot, and its shadow
|
||||
ctx.save();
|
||||
ctx.translate(SIDE, top);
|
||||
ctx.translate(side, top);
|
||||
const paper = new Path2D();
|
||||
paper.moveTo(0, 0);
|
||||
paper.lineTo(PW, 0);
|
||||
@@ -366,7 +361,7 @@
|
||||
paper.lineTo(i * tw, ph - TOOTH);
|
||||
}
|
||||
paper.closePath();
|
||||
ctx.shadowColor = "rgba(0, 60, 55, .28)";
|
||||
ctx.shadowColor = B.meta(bg.bg).shadow;
|
||||
ctx.shadowBlur = 36;
|
||||
ctx.shadowOffsetY = 12;
|
||||
ctx.fillStyle = PAPER;
|
||||
@@ -453,6 +448,235 @@
|
||||
$("next").addEventListener("click", () => state.date && state.day && state.date < state.day.today && load(V.shift(state.date, 1)));
|
||||
$("today").addEventListener("click", () => load(""));
|
||||
|
||||
// ---- the backdrop: a pattern, a photo from bg/, or the reader's picture ----
|
||||
const images = new Map();
|
||||
function image(src) {
|
||||
if (!images.has(src)) {
|
||||
images.set(src, new Promise((ok) => {
|
||||
const img = new Image();
|
||||
img.onload = () => ok(img);
|
||||
img.onerror = () => ok(null);
|
||||
img.src = src;
|
||||
}));
|
||||
}
|
||||
return images.get(src);
|
||||
}
|
||||
// a script of the page's own (bg/<id>.js, bg/thumbs.js): the photos come
|
||||
// as data: so the canvas they're drawn on can still be saved
|
||||
const scripts = new Map();
|
||||
function script(file) {
|
||||
if (!scripts.has(file)) {
|
||||
scripts.set(file, new Promise((ok) => {
|
||||
const s = document.createElement("script");
|
||||
s.src = file;
|
||||
s.onload = () => ok(true);
|
||||
s.onerror = () => { scripts.delete(file); ok(false); };
|
||||
document.head.append(s);
|
||||
}));
|
||||
}
|
||||
return scripts.get(file);
|
||||
}
|
||||
async function photoSrc(id) {
|
||||
if (!globalThis.DayPhotos?.[id]) await script(`bg/${id}.js`);
|
||||
return globalThis.DayPhotos?.[id] || "";
|
||||
}
|
||||
// the picture under bg, loaded; null for a pattern
|
||||
async function backdrop(bg) {
|
||||
if (!B.meta(bg.bg).photo) return null;
|
||||
const src = bg.bg === "custom" ? bg.image : await photoSrc(bg.bg);
|
||||
return src ? image(src) : null;
|
||||
}
|
||||
|
||||
// the reader's pick, kept in the plugin's options; magpie takes a write a
|
||||
// second at most, so a slider's run is saved once it settles
|
||||
let saveTimer = 0;
|
||||
function keep() {
|
||||
clearTimeout(saveTimer);
|
||||
saveTimer = setTimeout(async () => {
|
||||
try {
|
||||
await magpie.options.set({ ...state.bg });
|
||||
} catch (e) {
|
||||
if (/429|too many/i.test(String(e?.message || e))) keep();
|
||||
else status(`${V.text(lang).keepFailed}: ${e?.message || e}`, true);
|
||||
}
|
||||
}, 1100);
|
||||
}
|
||||
function pick(o) {
|
||||
state.bg = B.norm({ ...state.bg, ...o });
|
||||
paintPicker();
|
||||
keep();
|
||||
draw();
|
||||
}
|
||||
|
||||
const pop = $("bg-pop");
|
||||
const grid = $("bg-grid");
|
||||
function swatch(id) {
|
||||
const b = document.createElement("button");
|
||||
b.type = "button";
|
||||
b.className = "sw";
|
||||
b.dataset.bg = id;
|
||||
b.setAttribute("role", "radio");
|
||||
return b;
|
||||
}
|
||||
// a pattern's swatch, drawn by the code that draws the card
|
||||
function patternCanvas(id, size) {
|
||||
const cv = document.createElement("canvas");
|
||||
const s = Math.max(1, Math.min(3, Math.ceil(window.devicePixelRatio || 1)));
|
||||
cv.width = cv.height = size * s;
|
||||
const ctx = cv.getContext("2d");
|
||||
ctx.setTransform(s, 0, 0, s, 0, 0);
|
||||
B.paint(ctx, size, size, s, { ...state.bg, bg: id }, null);
|
||||
return cv;
|
||||
}
|
||||
async function buildGrid() {
|
||||
await script("bg/thumbs.js");
|
||||
const t = V.text(lang);
|
||||
const list = B.list.map((m) => {
|
||||
const b = swatch(m.id);
|
||||
if (m.photo) {
|
||||
const img = document.createElement("img");
|
||||
img.alt = "";
|
||||
img.src = globalThis.DayThumbs?.[m.id] || "";
|
||||
b.append(img);
|
||||
} else {
|
||||
b.append(patternCanvas(m.id, 60));
|
||||
}
|
||||
return b;
|
||||
});
|
||||
if (state.bg.image) {
|
||||
const b = swatch("custom");
|
||||
const img = document.createElement("img");
|
||||
img.alt = "";
|
||||
img.src = state.bg.image;
|
||||
b.append(img);
|
||||
list.push(b);
|
||||
}
|
||||
const add = document.createElement("button");
|
||||
add.type = "button";
|
||||
add.className = "sw add";
|
||||
add.id = "bg-add";
|
||||
add.innerHTML = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3v10M3 8h10"/></svg>';
|
||||
add.setAttribute("aria-label", t.upload);
|
||||
add.title = t.upload;
|
||||
list.push(add);
|
||||
grid.replaceChildren(...list);
|
||||
paintPicker();
|
||||
}
|
||||
function paintPicker() {
|
||||
const t = V.text(lang);
|
||||
const bg = state.bg;
|
||||
grid.querySelectorAll(".sw[data-bg]").forEach((b) => {
|
||||
const name = t[`bg-${b.dataset.bg}`];
|
||||
b.setAttribute("aria-label", name);
|
||||
b.title = name;
|
||||
b.setAttribute("aria-checked", String(b.dataset.bg === bg.bg));
|
||||
});
|
||||
$("pad").value = bg.pad;
|
||||
$("blur").value = bg.blur;
|
||||
$("dim").value = bg.dim;
|
||||
pop.classList.toggle("photo", B.meta(bg.bg).photo);
|
||||
paintChip();
|
||||
}
|
||||
async function paintChip() {
|
||||
const cv = $("bg-chip");
|
||||
const s = Math.max(1, Math.min(3, Math.ceil(window.devicePixelRatio || 1)));
|
||||
cv.width = cv.height = 14 * s;
|
||||
const ctx = cv.getContext("2d");
|
||||
ctx.setTransform(s, 0, 0, s, 0, 0);
|
||||
const bg = state.bg;
|
||||
const img = await backdrop(bg);
|
||||
if (bg !== state.bg) return;
|
||||
B.paint(ctx, 14, 14, s, bg, img);
|
||||
}
|
||||
|
||||
function openPop() {
|
||||
if (!grid.childElementCount) buildGrid();
|
||||
pop.hidden = false;
|
||||
pop.classList.remove("closing");
|
||||
pop.classList.add("opening");
|
||||
$("bg").setAttribute("aria-expanded", "true");
|
||||
requestAnimationFrame(() => pop.classList.remove("opening"));
|
||||
}
|
||||
function closePop() {
|
||||
if (pop.hidden) return;
|
||||
$("bg").setAttribute("aria-expanded", "false");
|
||||
pop.classList.add("closing");
|
||||
setTimeout(() => { if (pop.classList.contains("closing")) { pop.hidden = true; pop.classList.remove("closing"); } }, 120);
|
||||
}
|
||||
$("bg").addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
if (pop.hidden || pop.classList.contains("closing")) openPop(); else closePop();
|
||||
});
|
||||
grid.addEventListener("click", (e) => {
|
||||
const b = e.target.closest(".sw");
|
||||
if (!b) return;
|
||||
if (b.id === "bg-add") $("file").click();
|
||||
else pick({ bg: b.dataset.bg });
|
||||
});
|
||||
for (const id of ["pad", "blur", "dim"]) $(id).addEventListener("input", (e) => pick({ [id]: e.target.value }));
|
||||
document.addEventListener("click", (e) => { if (!e.target.closest(".bgpick")) closePop(); });
|
||||
document.addEventListener("keydown", (e) => { if (e.key === "Escape") closePop(); });
|
||||
|
||||
// the reader's own picture, made small enough for the options magpie
|
||||
// keeps (64KB a plugin): a JPEG of at most ~44KB as data:
|
||||
const readFile = (file) => new Promise((ok, no) => {
|
||||
const r = new FileReader();
|
||||
r.onload = () => ok(String(r.result));
|
||||
r.onerror = () => no(r.error);
|
||||
r.readAsDataURL(file);
|
||||
});
|
||||
async function usePicture(file) {
|
||||
if (!file || !/^image\//.test(file.type)) return;
|
||||
try {
|
||||
const img = await image(await readFile(file));
|
||||
if (!img) throw new Error(file.name || "?");
|
||||
const iw = img.naturalWidth, ih = img.naturalHeight;
|
||||
let out = "";
|
||||
for (const edge of [960, 800, 640, 520, 400]) {
|
||||
const k = Math.min(1, edge / Math.max(iw, ih));
|
||||
const cv = document.createElement("canvas");
|
||||
cv.width = Math.max(1, Math.round(iw * k));
|
||||
cv.height = Math.max(1, Math.round(ih * k));
|
||||
const ctx = cv.getContext("2d");
|
||||
ctx.imageSmoothingQuality = "high";
|
||||
ctx.drawImage(img, 0, 0, cv.width, cv.height);
|
||||
for (const q of [0.82, 0.72, 0.62]) {
|
||||
out = cv.toDataURL("image/jpeg", q);
|
||||
if (out.length <= 44000) break;
|
||||
}
|
||||
if (out.length <= 44000) break;
|
||||
}
|
||||
if (out.length > 44000) throw new Error(file.name || "?");
|
||||
pick({ bg: "custom", image: out });
|
||||
buildGrid();
|
||||
} catch (e) {
|
||||
status(`${V.text(lang).imageFailed}: ${e?.message || e}`, true);
|
||||
}
|
||||
}
|
||||
$("file").addEventListener("change", (e) => {
|
||||
usePicture(e.target.files?.[0]);
|
||||
e.target.value = "";
|
||||
});
|
||||
// a picture dropped on the page or pasted works as well as the picker
|
||||
const main = document.querySelector("main");
|
||||
document.addEventListener("dragover", (e) => {
|
||||
if (![...(e.dataTransfer?.items || [])].some((i) => i.kind === "file")) return;
|
||||
e.preventDefault();
|
||||
main.classList.add("drop");
|
||||
});
|
||||
document.addEventListener("dragleave", (e) => { if (!e.relatedTarget) main.classList.remove("drop"); });
|
||||
document.addEventListener("drop", (e) => {
|
||||
main.classList.remove("drop");
|
||||
const f = [...(e.dataTransfer?.files || [])].find((f) => /^image\//.test(f.type));
|
||||
if (!f) return;
|
||||
e.preventDefault();
|
||||
usePicture(f);
|
||||
});
|
||||
document.addEventListener("paste", (e) => {
|
||||
const f = [...(e.clipboardData?.files || [])].find((f) => /^image\//.test(f.type));
|
||||
if (f) usePicture(f);
|
||||
});
|
||||
|
||||
// ---- sharing ----
|
||||
const png = () => new Promise((ok, no) => $("card").toBlob((b) => (b ? ok(b) : no(new Error("no picture"))), "image/png"));
|
||||
$("copy").addEventListener("click", async () => {
|
||||
@@ -481,10 +705,16 @@
|
||||
}
|
||||
});
|
||||
|
||||
magpie.onTheme((t) => { lang = t.lang; words(); paintBar(); draw(); });
|
||||
magpie.onTheme((t) => { lang = t.lang; words(); paintBar(); if (grid.childElementCount) paintPicker(); draw(); });
|
||||
// today's numbers keep coming while the page is open
|
||||
setInterval(() => { if (state.day && state.date === state.day.today && document.visibilityState !== "hidden") load(state.date); }, 60_000);
|
||||
words();
|
||||
paintBar();
|
||||
try {
|
||||
state.bg = B.norm(await magpie.options.get());
|
||||
} catch {
|
||||
// the default backdrop, until the reader picks one
|
||||
}
|
||||
paintPicker();
|
||||
await load("");
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
// The card's backdrops: patterns drawn on the canvas, photos from bg/, or a
|
||||
// picture of the reader's own. A classic script: it sets
|
||||
// globalThis.DayBackgrounds. What a setting may be (norm) needs no DOM, so a
|
||||
// test can check it; paint draws on a canvas.
|
||||
(() => {
|
||||
// shadow: the paper's shadow on that ground
|
||||
const LIST = [
|
||||
{ id: "teal", shadow: "rgba(0, 60, 55, .28)" },
|
||||
{ id: "gingham", shadow: "rgba(90, 30, 20, .22)" },
|
||||
{ id: "grid", shadow: "rgba(30, 50, 90, .2)" },
|
||||
{ id: "kraft", shadow: "rgba(60, 36, 12, .38)" },
|
||||
{ id: "cyan", shadow: "rgba(0, 8, 30, .5)" },
|
||||
{ id: "dots", shadow: "rgba(0, 0, 0, .6)" },
|
||||
{ id: "deck", shadow: "rgba(10, 40, 32, .32)" },
|
||||
{ id: "linen", shadow: "rgba(20, 26, 10, .45)" },
|
||||
{ id: "seigaiha", shadow: "rgba(0, 16, 30, .5)" },
|
||||
{ id: "xuan", shadow: "rgba(80, 64, 40, .22)" },
|
||||
{ id: "zigzag", shadow: "rgba(70, 50, 20, .3)" },
|
||||
{ id: "terracotta", shadow: "rgba(60, 16, 4, .4)" },
|
||||
{ id: "lilac", shadow: "rgba(50, 36, 90, .25)" },
|
||||
{ id: "velvet", shadow: "rgba(0, 0, 0, .55)" },
|
||||
{ id: "polka", shadow: "rgba(120, 50, 20, .22)" },
|
||||
{ id: "alpine", photo: true, shadow: "rgba(0, 10, 30, .45)" },
|
||||
{ id: "sea", photo: true, shadow: "rgba(20, 30, 50, .35)" },
|
||||
{ id: "dunes", photo: true, shadow: "rgba(70, 30, 0, .4)" },
|
||||
{ id: "lake", photo: true, shadow: "rgba(0, 20, 12, .5)" },
|
||||
];
|
||||
const BY = new Map(LIST.map((b) => [b.id, b]));
|
||||
const CUSTOM = { id: "custom", photo: true, shadow: "rgba(0, 0, 0, .45)" };
|
||||
|
||||
const PAD = { min: 24, max: 160, step: 4, def: 76 };
|
||||
const BLUR = { min: 0, max: 20, def: 0 };
|
||||
const DIM = { min: 0, max: 60, def: 0 };
|
||||
const num = (v, r) => {
|
||||
const n = Math.round(Number(v));
|
||||
return Number.isFinite(n) ? Math.min(r.max, Math.max(r.min, n)) : r.def;
|
||||
};
|
||||
|
||||
// the reader's saved options, made sound: an unknown backdrop is teal, a
|
||||
// custom one with no picture is teal, numbers are held to their range
|
||||
function norm(o) {
|
||||
o = o && typeof o === "object" ? o : {};
|
||||
const image = typeof o.image === "string" && /^data:image\/(jpeg|png|webp);base64,/.test(o.image) ? o.image : "";
|
||||
let bg = typeof o.bg === "string" ? o.bg : "teal";
|
||||
if (bg === "custom" ? !image : !BY.has(bg)) bg = "teal";
|
||||
return { bg, pad: num(o.pad, PAD), blur: num(o.blur, BLUR), dim: num(o.dim, DIM), image };
|
||||
}
|
||||
const meta = (id) => (id === "custom" ? CUSTOM : BY.get(id) || BY.get("teal"));
|
||||
|
||||
// ---- patterns: a tile drawn once at the canvas's scale, then repeated ----
|
||||
function tile(scale, w, h, draw) {
|
||||
const c = typeof OffscreenCanvas === "function" ? new OffscreenCanvas(Math.ceil(w * scale), Math.ceil(h * scale)) : Object.assign(document.createElement("canvas"), { width: Math.ceil(w * scale), height: Math.ceil(h * scale) });
|
||||
const t = c.getContext("2d");
|
||||
t.scale(c.width / w, c.height / h);
|
||||
draw(t, w, h);
|
||||
return c;
|
||||
}
|
||||
// fill the card with a tile, rotated by deg if asked
|
||||
function layer(ctx, W, H, scale, w, h, draw, deg) {
|
||||
const p = ctx.createPattern(tile(scale, w, h, draw), "repeat");
|
||||
const m = new DOMMatrix().rotateSelf(deg || 0).scaleSelf(w / Math.ceil(w * scale), h / Math.ceil(h * scale));
|
||||
p.setTransform(m);
|
||||
ctx.fillStyle = p;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
}
|
||||
const dot = (t, x, y, r) => { t.beginPath(); t.arc(x, y, r, 0, Math.PI * 2); t.fill(); };
|
||||
const ground = (ctx, W, H, c) => { ctx.fillStyle = c; ctx.fillRect(0, 0, W, H); };
|
||||
|
||||
const PATTERNS = {
|
||||
teal(ctx, W, H) {
|
||||
const g = ctx.createLinearGradient(0, 0, W * 0.35, H);
|
||||
g.addColorStop(0, "#1dd8d1");
|
||||
g.addColorStop(1, "#92ecc6");
|
||||
ground(ctx, W, H, g);
|
||||
const g2 = ctx.createLinearGradient(0, 0, W, 0);
|
||||
g2.addColorStop(0, "rgba(255, 255, 255, 0)");
|
||||
g2.addColorStop(1, "rgba(255, 255, 255, .14)");
|
||||
ground(ctx, W, H, g2);
|
||||
},
|
||||
gingham(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#fbf6ef");
|
||||
layer(ctx, W, H, s, 36, 36, (t) => {
|
||||
t.fillStyle = "rgba(214, 72, 56, .42)";
|
||||
t.fillRect(0, 0, 36, 18);
|
||||
t.fillRect(0, 0, 18, 36);
|
||||
});
|
||||
},
|
||||
grid(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#f3f0e6");
|
||||
layer(ctx, W, H, s, 22, 22, (t) => {
|
||||
t.fillStyle = "rgba(60, 110, 180, .2)";
|
||||
t.fillRect(0, 0, 22, 1);
|
||||
t.fillRect(0, 1, 1, 21);
|
||||
});
|
||||
},
|
||||
kraft(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#c4a274");
|
||||
// fibre specks, scattered by a fixed seed so every card is the same
|
||||
let seed = 7;
|
||||
const rnd = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
|
||||
layer(ctx, W, H, s, 96, 96, (t) => {
|
||||
for (let i = 0; i < 260; i++) {
|
||||
t.fillStyle = i % 3 ? "rgba(80, 52, 24, .22)" : "rgba(255, 255, 255, .16)";
|
||||
dot(t, rnd() * 96, rnd() * 96, 0.5 + rnd() * 0.8);
|
||||
}
|
||||
});
|
||||
},
|
||||
cyan(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#1b3a7a");
|
||||
layer(ctx, W, H, s, 9, 9, (t) => { t.fillStyle = "rgba(255, 255, 255, .12)"; dot(t, 4.5, 4.5, 1.3); });
|
||||
},
|
||||
dots(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#151515");
|
||||
layer(ctx, W, H, s, 12, 12, (t) => { t.fillStyle = "#3d3d3d"; dot(t, 6, 6, 1.5); });
|
||||
},
|
||||
deck(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#f2ead8");
|
||||
layer(ctx, W, H, s, 56, 8, (t) => { t.fillStyle = "#2f5d50"; t.fillRect(28, 0, 28, 8); });
|
||||
},
|
||||
linen(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#6f7a52");
|
||||
layer(ctx, W, H, s, 12, 12, (t) => {
|
||||
t.fillStyle = "rgba(255, 255, 255, .06)";
|
||||
for (let y = 0; y < 12; y += 3) t.fillRect(0, y, 12, 1);
|
||||
t.fillStyle = "rgba(0, 0, 0, .08)";
|
||||
for (let x = 0; x < 12; x += 4) t.fillRect(x, 0, 1, 12);
|
||||
});
|
||||
},
|
||||
seigaiha(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#24506a");
|
||||
// overlapping waves, each row over the one above it
|
||||
layer(ctx, W, H, s, 24, 12, (t) => {
|
||||
t.strokeStyle = "rgba(240, 232, 214, .4)";
|
||||
t.lineWidth = 0.9;
|
||||
for (let row = -2; row <= 4; row++) {
|
||||
const y = row * 6;
|
||||
for (const x of row % 2 ? [-12, 12, 36] : [0, 24]) {
|
||||
t.fillStyle = "#24506a";
|
||||
dot(t, x, y, 11.5);
|
||||
for (const r of [11, 7.5, 4]) { t.beginPath(); t.arc(x, y, r, Math.PI, 0); t.stroke(); }
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
xuan(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#efe9db");
|
||||
layer(ctx, W, H, s, 6, 6, (t) => { t.fillStyle = "rgba(120, 98, 66, .06)"; t.fillRect(0, 0, 6, 1); }, 115);
|
||||
let seed = 11;
|
||||
const rnd = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
|
||||
layer(ctx, W, H, s, 80, 80, (t) => {
|
||||
t.fillStyle = "rgba(120, 98, 66, .16)";
|
||||
for (let i = 0; i < 70; i++) dot(t, rnd() * 80, rnd() * 80, 0.4 + rnd() * 0.7);
|
||||
});
|
||||
},
|
||||
zigzag(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#d6c4a2");
|
||||
layer(ctx, W, H, s, 32, 16, (t) => {
|
||||
t.fillStyle = "#ebdfc8";
|
||||
t.beginPath();
|
||||
t.moveTo(0, 8); t.lineTo(16, 0); t.lineTo(32, 8); t.lineTo(32, 16); t.lineTo(16, 8); t.lineTo(0, 16);
|
||||
t.closePath();
|
||||
t.fill();
|
||||
});
|
||||
},
|
||||
terracotta(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#bf6748");
|
||||
layer(ctx, W, H, s, 10, 10, (t) => { t.fillStyle = "rgba(255, 236, 214, .22)"; dot(t, 5, 5, 1.1); });
|
||||
},
|
||||
lilac(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#d9d3e6");
|
||||
layer(ctx, W, H, s, 10, 10, (t) => { t.fillStyle = "rgba(78, 60, 120, .14)"; t.fillRect(0, 0, 10, 1); }, 45);
|
||||
},
|
||||
velvet(ctx, W, H) {
|
||||
ground(ctx, W, H, "#17322a");
|
||||
const r = Math.max(W, H) * 0.9;
|
||||
const g = ctx.createRadialGradient(W * 0.3, H * 0.15, 0, W * 0.3, H * 0.15, r);
|
||||
g.addColorStop(0, "rgba(80, 140, 110, .45)");
|
||||
g.addColorStop(0.7, "rgba(80, 140, 110, 0)");
|
||||
ground(ctx, W, H, g);
|
||||
},
|
||||
polka(ctx, W, H, s) {
|
||||
ground(ctx, W, H, "#f4e4cf");
|
||||
layer(ctx, W, H, s, 22, 22, (t) => {
|
||||
t.fillStyle = "#e0795a";
|
||||
for (const [x, y] of [[0, 0], [22, 0], [0, 22], [22, 22], [11, 11]]) dot(t, x, y, 3);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
// a picture covering the card, softened by blur and darkened by dim
|
||||
function photo(ctx, W, H, scale, img, blur, dim) {
|
||||
const iw = img.naturalWidth || img.width, ih = img.naturalHeight || img.height;
|
||||
const k = Math.max(W / iw, H / ih);
|
||||
const dw = iw * k, dh = ih * k;
|
||||
if (blur > 0) {
|
||||
// blur by drawing small and scaling back up: canvas filters are not in
|
||||
// every webview
|
||||
const f = 1 / (1 + blur * 0.55);
|
||||
const w = Math.max(2, Math.round(W * scale * f)), h = Math.max(2, Math.round(H * scale * f));
|
||||
const small = tile(1, w, h, (t) => {
|
||||
t.imageSmoothingQuality = "high";
|
||||
t.drawImage(img, (W - dw) / 2 * scale * f, (H - dh) / 2 * scale * f, dw * scale * f, dh * scale * f);
|
||||
});
|
||||
ctx.save();
|
||||
ctx.imageSmoothingQuality = "high";
|
||||
// a little past the edges, so the blur has no light rim
|
||||
const m = blur * 1.5;
|
||||
ctx.drawImage(small, -m, -m, W + m * 2, H + m * 2);
|
||||
ctx.restore();
|
||||
} else {
|
||||
ctx.drawImage(img, (W - dw) / 2, (H - dh) / 2, dw, dh);
|
||||
}
|
||||
if (dim > 0) ground(ctx, W, H, `rgba(0, 0, 0, ${dim / 100})`);
|
||||
}
|
||||
|
||||
// Draw the backdrop for settings o on ctx (already at scale), W by H.
|
||||
// img: the photo's or the reader's picture, loaded; teal stands in for
|
||||
// one that isn't there.
|
||||
function paint(ctx, W, H, scale, o, img) {
|
||||
ctx.save();
|
||||
const m = meta(o.bg);
|
||||
if (m.photo && img) photo(ctx, W, H, scale, img, o.blur, o.dim);
|
||||
else (PATTERNS[o.bg] || PATTERNS.teal)(ctx, W, H, scale);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
globalThis.DayBackgrounds = { list: LIST, meta, norm, paint, PAD, BLUR, DIM };
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
|
||||
// the photos' thumbnails, for the background menu; bg/<id>.js has each photo
|
||||
globalThis.DayThumbs = globalThis.DayThumbs || {};
|
||||
globalThis.DayThumbs["alpine"] = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHCAkIBgoJCAkMCwoMDxoRDw4ODx8WGBMaJSEnJiQhJCMpLjsyKSw4LCMkM0Y0OD0/QkNCKDFITUhATTtBQj//2wBDAQsMDA8NDx4RER4/KiQqPz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/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HzZIFbJemI+QnjmhRI7kKST6VXCkYB3/AJopv8xHNFpnK5PBoN7ddezjHvQBYjY9q98ZuM/rRNFm207hht6VZLZZcA7Z2oeO4KHL5PtWiXL48owc52qnQmXpBAJRqlQdRmDHXxj0qUXojgUFS3m1L3wNIHvTeztTP0S50DXJ4gOw32HvxQFlHGbeQyyYcf8ASUHv3J/Kuq6Fbg9KVZOJMkrpxjP8/esxqRX4dtVXp6SFfNIc59R7elP0jUDisbWBYII4k+lFCg0YoXG7YNVuRg7KNqDubSKdSPpJ7imTxZGcZqotGYbA0Mc1LbTWTjza1O+f7VeELcAgrgHg04uYVAKSpkdwaT3ET27EwZZfTuKM5gG8tBbtqj8uOCNjS6aTxQNYGobahsT96ZzXDgZdSVPrQslssp1R5AxVZoSKASyBTIFXksewok9JlKeJBKkqngDYn8qqUCR74GKJsbe4uWISJcMR5uMUTAv4dcIdUlu+kc7ZrY+AieT6h608PRLk4aO5Ytx5icUwtPhqBfPOzTt6HZf0qNcXNQIkh041sRwozUrt0sY4k0xxqoHZRipRri+e9DiWVZVMWrKkNIzDIz6CujtU8GCOJDkIoXJpP0i3eztnEqAOzevamSTY5NVIZRvJnBNENKqDfmlPzZAIFVMxYc0XTy3vFDYO4plFcxnZcZrkkkINFxXBB3JqLKbdXTUquoGTyRSR0Od6YrcCRQrNkVZ4lbcCheyo24cbisGs9OdJ5pz4Ax6VhIoG1EwoXp0ZbL7+1NrZ0hAGkYHpWTYBzVZTkbUPRh88BkZwPapH1N0fy7ilIqwBztQ10MfUY5B5gPyqVz5DKM1KYugmO1ZNUqVphZeKup3qVKKKjUac1GNSpUV5G7BuaZLK3hjepUoRV5XPJrCR2PepUqKHZjnmvNRqVKrKZO9bx/RnvUqUElPlqVKlQf/Z";
|
||||
@@ -8,6 +8,7 @@
|
||||
<script src="_magpie/bridge.js"></script>
|
||||
<script src="fonts.js"></script>
|
||||
<script src="view.js"></script>
|
||||
<script src="backgrounds.js"></script>
|
||||
<script src="app.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -22,6 +23,16 @@
|
||||
<button type="button" id="today" data-t="today">Today</button>
|
||||
</div>
|
||||
<div class="share">
|
||||
<div class="bgpick">
|
||||
<button type="button" id="bg" aria-haspopup="dialog" aria-expanded="false"><canvas id="bg-chip" aria-hidden="true"></canvas><span data-t="background">Background</span></button>
|
||||
<div id="bg-pop" role="dialog" data-t-label="background" hidden>
|
||||
<div id="bg-grid" role="radiogroup" data-t-label="background"></div>
|
||||
<label class="slider"><span data-t="padding">Padding</span><input type="range" id="pad" min="24" max="160" step="4"></label>
|
||||
<label class="slider photo-only"><span data-t="blur">Blur</span><input type="range" id="blur" min="0" max="20" step="1"></label>
|
||||
<label class="slider photo-only"><span data-t="dim">Dim</span><input type="range" id="dim" min="0" max="60" step="1"></label>
|
||||
<input type="file" id="file" accept="image/png,image/jpeg,image/webp" hidden>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" id="copy" data-t="copy" disabled>Copy image</button>
|
||||
<button type="button" id="save" data-t="save" disabled>Save PNG</button>
|
||||
</div>
|
||||
|
||||
@@ -31,3 +31,24 @@ svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width:
|
||||
main { max-width: 760px; margin: 0 auto; }
|
||||
canvas { display: block; width: 100%; height: auto; border-radius: 10px; }
|
||||
@media (prefers-reduced-motion: reduce) { #menu.closing, #menu.opening { transform: none; } button:active:not(:disabled) { transform: none; } }
|
||||
|
||||
/* the background menu */
|
||||
.bgpick { position: relative; }
|
||||
#bg { display: inline-flex; align-items: center; gap: 6px; }
|
||||
#bg-chip { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
|
||||
#bg-pop { position: absolute; z-index: 2; top: calc(100% + 4px); right: 0; width: 292px; padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); transform-origin: top right; transition: opacity .18s cubic-bezier(.23, 1, .32, 1), transform .18s cubic-bezier(.23, 1, .32, 1); }
|
||||
#bg-pop[hidden] { display: none; }
|
||||
#bg-pop.closing, #bg-pop.opening { opacity: 0; transform: scale(.96); }
|
||||
#bg-pop.closing { transition-duration: .12s; }
|
||||
#bg-grid { display: grid; grid-template-columns: repeat(4, 60px); gap: 8px; justify-content: space-between; }
|
||||
.sw { position: relative; width: 60px; height: 60px; padding: 0; border-radius: 9px; overflow: hidden; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
|
||||
.sw canvas, .sw img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; pointer-events: none; }
|
||||
.sw[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }
|
||||
.sw.add { display: grid; place-items: center; color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line); border: 1px dashed var(--line); }
|
||||
.sw.add svg { width: 18px; height: 18px; }
|
||||
@media (hover: hover) and (pointer: fine) { .sw:hover:not([aria-checked="true"]) { box-shadow: inset 0 0 0 1px var(--muted); } }
|
||||
.slider { display: grid; grid-template-columns: 5.5em 1fr; align-items: center; gap: 10px; padding: 0 2px; color: var(--muted); }
|
||||
.slider input { width: 100%; margin: 0; accent-color: var(--fg); }
|
||||
#bg-pop:not(.photo) .photo-only { display: none; }
|
||||
main.drop canvas { outline: 2px dashed var(--muted); outline-offset: 4px; }
|
||||
@media (prefers-reduced-motion: reduce) { #bg-pop.closing, #bg-pop.opening { transform: none; } }
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
noAgent: "NO AGENT NAMED",
|
||||
today: "Today", prev: "Previous day", next: "Next day", copy: "Copy image", copied: "Copied", save: "Save PNG", saved: "Saved to",
|
||||
failed: "Couldn't read usage", shareFailed: "Couldn't share the picture", update: "This card needs a newer magpie. Update magpie, then open it again.",
|
||||
background: "Background", padding: "Padding", blur: "Blur", dim: "Dim", upload: "Add your own picture", imageFailed: "Couldn't use that picture", keepFailed: "Couldn't keep the background",
|
||||
"bg-teal": "Teal", "bg-gingham": "Gingham", "bg-grid": "Graph paper", "bg-kraft": "Kraft paper", "bg-cyan": "Cyanotype", "bg-dots": "Night dots", "bg-deck": "Deckchair stripes", "bg-linen": "Olive linen", "bg-seigaiha": "Seigaiha waves", "bg-xuan": "Xuan paper", "bg-zigzag": "Zigzag", "bg-terracotta": "Terracotta", "bg-lilac": "Lilac lines", "bg-velvet": "Green velvet", "bg-polka": "Apricot polka", "bg-alpine": "Alpine dawn", "bg-sea": "Misty shore", "bg-dunes": "Dunes", "bg-lake": "Forest lake", "bg-custom": "Your picture",
|
||||
},
|
||||
zh: {
|
||||
title: "每日 AI 账单", tagline: "经 magpie 路由",
|
||||
@@ -31,6 +33,8 @@
|
||||
noAgent: "未标明 AGENT",
|
||||
today: "今天", prev: "前一天", next: "后一天", copy: "复制图片", copied: "已复制", save: "保存 PNG", saved: "已保存到",
|
||||
failed: "读取用量失败", shareFailed: "分享图片失败", update: "这个卡片需要更新版本的 magpie。请更新 magpie 后再打开。",
|
||||
background: "背景", padding: "边距", blur: "模糊", dim: "压暗", upload: "用自己的图片", imageFailed: "这张图片用不了", keepFailed: "背景没能保存",
|
||||
"bg-teal": "青绿", "bg-gingham": "野餐格", "bg-grid": "方格纸", "bg-kraft": "牛皮纸", "bg-cyan": "蓝晒", "bg-dots": "夜色网点", "bg-deck": "躺椅条纹", "bg-linen": "橄榄亚麻", "bg-seigaiha": "青海波", "bg-xuan": "宣纸", "bg-zigzag": "人字纹", "bg-terracotta": "赤陶", "bg-lilac": "雾紫细线", "bg-velvet": "墨绿丝绒", "bg-polka": "杏色波点", "bg-alpine": "雪山晨光", "bg-sea": "雾中海岸", "bg-dunes": "沙丘", "bg-lake": "林间湖", "bg-custom": "自己的图片",
|
||||
},
|
||||
"zh-TW": {
|
||||
title: "每日 AI 帳單", tagline: "經 magpie 路由",
|
||||
@@ -44,6 +48,8 @@
|
||||
noAgent: "未標明 AGENT",
|
||||
today: "今天", prev: "前一天", next: "後一天", copy: "複製圖片", copied: "已複製", save: "儲存 PNG", saved: "已儲存到",
|
||||
failed: "讀取用量失敗", shareFailed: "分享圖片失敗", update: "這張卡片需要更新版本的 magpie。請更新 magpie 後再開啟。",
|
||||
background: "背景", padding: "邊距", blur: "模糊", dim: "壓暗", upload: "用自己的圖片", imageFailed: "這張圖片用不了", keepFailed: "背景沒能儲存",
|
||||
"bg-teal": "青綠", "bg-gingham": "野餐格", "bg-grid": "方格紙", "bg-kraft": "牛皮紙", "bg-cyan": "藍曬", "bg-dots": "夜色網點", "bg-deck": "躺椅條紋", "bg-linen": "橄欖亞麻", "bg-seigaiha": "青海波", "bg-xuan": "宣紙", "bg-zigzag": "人字紋", "bg-terracotta": "赤陶", "bg-lilac": "霧紫細線", "bg-velvet": "墨綠絲絨", "bg-polka": "杏色波點", "bg-alpine": "雪山晨光", "bg-sea": "霧中海岸", "bg-dunes": "沙丘", "bg-lake": "林間湖", "bg-custom": "自己的圖片",
|
||||
},
|
||||
ja: {
|
||||
title: "1日の AI 明細", tagline: "magpie 経由",
|
||||
@@ -57,6 +63,8 @@
|
||||
noAgent: "エージェント名なし",
|
||||
today: "今日", prev: "前の日", next: "次の日", copy: "画像をコピー", copied: "コピーしました", save: "PNG を保存", saved: "保存先",
|
||||
failed: "使用量を読み込めませんでした", shareFailed: "画像を共有できませんでした", update: "このカードには新しい magpie が必要です。magpie を更新してから開き直してください。",
|
||||
background: "背景", padding: "余白", blur: "ぼかし", dim: "暗さ", upload: "自分の画像を使う", imageFailed: "この画像は使えません", keepFailed: "背景を保存できませんでした",
|
||||
"bg-teal": "ティール", "bg-gingham": "ギンガム", "bg-grid": "方眼紙", "bg-kraft": "クラフト紙", "bg-cyan": "青写真", "bg-dots": "夜のドット", "bg-deck": "デッキチェア", "bg-linen": "オリーブリネン", "bg-seigaiha": "青海波", "bg-xuan": "宣紙", "bg-zigzag": "ジグザグ", "bg-terracotta": "テラコッタ", "bg-lilac": "ライラック", "bg-velvet": "深緑ベルベット", "bg-polka": "アプリコット水玉", "bg-alpine": "雪山の朝", "bg-sea": "霧の海辺", "bg-dunes": "砂丘", "bg-lake": "森の湖", "bg-custom": "自分の画像",
|
||||
},
|
||||
de: {
|
||||
title: "TÄGLICHE KI-ABRECHNUNG", tagline: "Geroutet über magpie.",
|
||||
@@ -70,6 +78,8 @@
|
||||
noAgent: "OHNE AGENT",
|
||||
today: "Heute", prev: "Vorheriger Tag", next: "Nächster Tag", copy: "Bild kopieren", copied: "Kopiert", save: "PNG sichern", saved: "Gesichert in",
|
||||
failed: "Nutzung nicht lesbar", shareFailed: "Bild nicht teilbar", update: "Diese Karte braucht ein neueres magpie. Aktualisiere magpie und öffne sie dann erneut.",
|
||||
background: "Hintergrund", padding: "Rand", blur: "Weichzeichnen", dim: "Abdunkeln", upload: "Eigenes Bild wählen", imageFailed: "Dieses Bild geht nicht", keepFailed: "Hintergrund nicht gesichert",
|
||||
"bg-teal": "Türkis", "bg-gingham": "Vichy-Karo", "bg-grid": "Millimeterpapier", "bg-kraft": "Packpapier", "bg-cyan": "Cyanotypie", "bg-dots": "Nachtpunkte", "bg-deck": "Liegestuhlstreifen", "bg-linen": "Olivleinen", "bg-seigaiha": "Seigaiha", "bg-xuan": "Xuan-Papier", "bg-zigzag": "Zickzack", "bg-terracotta": "Terrakotta", "bg-lilac": "Fliederlinien", "bg-velvet": "Grüner Samt", "bg-polka": "Aprikosenpunkte", "bg-alpine": "Alpenmorgen", "bg-sea": "Nebelküste", "bg-dunes": "Dünen", "bg-lake": "Waldsee", "bg-custom": "Eigenes Bild",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user