mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Offer 38 highlight colors and keep a retired color's saved choice
AI Assisted
This commit is contained in:
1 parent
c602dfed57
commit
e67aaabdce
5 files changed
+126
-70
No files matched your search
@@ -87,7 +87,7 @@ import {
|
||||
nextOpenAfter,
|
||||
} from "../src/web-console/public/answers.js";
|
||||
import { chatView } from "../src/web-console/public/chat.js";
|
||||
import { ACCENTS, DEFAULT_ACCENT } from "../src/web-console/public/palette.js";
|
||||
import { ACCENTS, DEFAULT_ACCENT, RETIRED_ACCENTS, accentId } from "../src/web-console/public/palette.js";
|
||||
import {
|
||||
needsRoleNudge,
|
||||
normalizeRole,
|
||||
@@ -665,7 +665,8 @@ const contrast = (a, b) => {
|
||||
|
||||
test("every highlight color is readable in both themes", () => {
|
||||
const panel = { light: "#ffffff", dark: "#201d1a" };
|
||||
assert.ok(Object.keys(ACCENTS).length >= 32);
|
||||
// Nineteen a row in the wide Preferences dialog, two rows at most.
|
||||
assert.ok(Object.keys(ACCENTS).length >= 32 && Object.keys(ACCENTS).length <= 38);
|
||||
assert.ok(ACCENTS[DEFAULT_ACCENT], "the default must be in the list");
|
||||
const names = new Set();
|
||||
for (const [id, a] of Object.entries(ACCENTS)) {
|
||||
@@ -681,11 +682,22 @@ test("every highlight color is readable in both themes", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("a retired highlight color keeps its closest twin, an unknown one the default", () => {
|
||||
for (const [old, now] of Object.entries(RETIRED_ACCENTS)) {
|
||||
assert.ok(!ACCENTS[old], `${old} is retired, so it is not offered`);
|
||||
assert.ok(ACCENTS[now], `${old} maps to ${now}, which must exist`);
|
||||
assert.equal(accentId(old), now);
|
||||
}
|
||||
assert.equal(accentId("violet"), "violet");
|
||||
assert.equal(accentId("nope"), DEFAULT_ACCENT);
|
||||
assert.equal(accentId(undefined), DEFAULT_ACCENT);
|
||||
});
|
||||
|
||||
/* ------------------------------------------------- the spec-aware dashboard */
|
||||
|
||||
// The console scans the repo itself, so the states the picker shows have to
|
||||
// be read off real folder shapes — a fixture per stage, then the matrix that
|
||||
// turns a stage into lit or greyed cards.
|
||||
// turns a stage into lit or grayed cards.
|
||||
function fakeSpec(root, name, files) {
|
||||
const dir = path.join(root, "specs", name);
|
||||
for (const [rel, text] of Object.entries(files)) {
|
||||
@@ -847,7 +859,7 @@ test("a delete is a session action naming the folder, and its reply says it is f
|
||||
assert.equal(deleteSummary({ ...spec, detail: "" }).stage, SPEC_STATE_LABELS.building);
|
||||
});
|
||||
|
||||
test("a fixed bug says so once: on its chip, in the delete dialog and on its greyed cards", () => {
|
||||
test("a fixed bug says so once: on its chip, in the delete dialog and on its grayed cards", () => {
|
||||
const fixed = { dir: "specs/old-bug", name: "old-bug", state: "fixed", detail: "bug fixed", files: 1, touched: 1 };
|
||||
assert.equal(deleteSummary(fixed).stage, "Bug fixed");
|
||||
const building = { dir: "specs/lunch-vote", name: "lunch-vote", state: "building", detail: "1 of 2 tasks done" };
|
||||
@@ -984,7 +996,7 @@ test("the Git card stays clickable outside a repository and says what happens",
|
||||
assert.equal(cardPresentation(entry, withSpec, withSpec.specs[0], menu).detail, "Two changes ready");
|
||||
});
|
||||
|
||||
test("the Git card is never greyed", () => {
|
||||
test("the Git card is never grayed", () => {
|
||||
const entry = SKILL_CATALOG.find((e) => e.skill === "plan2code-git");
|
||||
const clean = cardAvailability(entry, { hasAgents: true, isGit: true, pending: 0 }, null);
|
||||
assert.equal(clean.on, true);
|
||||
@@ -1191,7 +1203,7 @@ test("the dashboard matrix lights only the cards a spec state allows", () => {
|
||||
assert.ok(!cardAvailability(entry("plan2code-quick-task"), scan, sel("fixed")).next);
|
||||
assert.equal(launchTarget(entry("plan2code-quick-task"), sel("fixed")), null);
|
||||
|
||||
// A greyed card always says why, and a selected spec's next step is marked.
|
||||
// A grayed card always says why, and a selected spec's next step is marked.
|
||||
assert.ok(cardAvailability(entry("plan2code-3-implement"), scan, sel("exploring")).reason);
|
||||
assert.equal(cardAvailability(entry("plan2code-3-implement"), scan, sel("documented")).next, true);
|
||||
assert.ok(!cardAvailability(entry("plan2code-1-plan"), scan, sel("documented")).next);
|
||||
@@ -2168,18 +2180,6 @@ test("subagents: helperRows turns a reported strength and effort into one line,
|
||||
}
|
||||
});
|
||||
|
||||
test("page: the Subagents button sits right after Write a brief, and its dialog is in the page with no inline styles or scripts", () => {
|
||||
const html = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "index.html"), "utf8");
|
||||
const row = html.match(/<div class="row-left">([\s\S]*?)<\/div>\s*<div class="views-group">/);
|
||||
assert.ok(row, "index.html has the second row's left cluster");
|
||||
const ids = [...row[1].matchAll(/<button[^>]*\bid="([^"]+)"/g)].map((m) => m[1]);
|
||||
assert.equal(ids[ids.indexOf("btn-brief") + 1], "btn-subagents", "the Subagents button follows Write a brief");
|
||||
assert.match(row[1], /<button[^>]*id="btn-subagents"[^>]*\bhidden\b/, "the button starts hidden");
|
||||
for (const part of ["sa-hub", "sa-node", "sa-link"]) assert.ok(row[1].includes(`class="${part}"`), `the icon has ${part}`);
|
||||
const dialog = html.match(/<dialog class="modal looks subagents" id="subagents-modal" aria-labelledby="subagents-title">([\s\S]*?)<\/dialog>/);
|
||||
assert.ok(dialog, "index.html has the Subagents dialog");
|
||||
for (const id of ["subagents-instruction", "subagents-default", "subagents-max", "subagents-checkin", "subagents-research", "subagents-status", "subagents-cancel", "subagents-save"]) {
|
||||
assert.ok(dialog[1].includes(`id="${id}"`), `the dialog carries #${id}`);
|
||||
test("subagents: helperRows gives each reported strength and effort a badge ranked 1-3, and the session's own model rank 0", () => {
|
||||
const badges = (extra) => helperRows([{ id: "h1", title: "One", ask: "a", state: "running", ...extra }]).rows[0].badges;
|
||||
assert.deepEqual(badges({ strength: "standard", effort: "high" }), [
|
||||
@@ -2194,6 +2194,18 @@ test("subagents: helperRows gives each reported strength and effort a badge rank
|
||||
]);
|
||||
});
|
||||
|
||||
test("page: the Subagents button sits right after Write a brief, and its dialog is in the page with no inline styles or scripts", () => {
|
||||
const html = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "index.html"), "utf8");
|
||||
const row = html.match(/<div class="row-left">([\s\S]*?)<\/div>\s*<div class="views-group">/);
|
||||
assert.ok(row, "index.html has the second row's left cluster");
|
||||
const ids = [...row[1].matchAll(/<button[^>]*\bid="([^"]+)"/g)].map((m) => m[1]);
|
||||
assert.equal(ids[ids.indexOf("btn-brief") + 1], "btn-subagents", "the Subagents button follows Write a brief");
|
||||
assert.match(row[1], /<button[^>]*id="btn-subagents"[^>]*\bhidden\b/, "the button starts hidden");
|
||||
for (const part of ["sa-hub", "sa-node", "sa-link"]) assert.ok(row[1].includes(`class="${part}"`), `the icon has ${part}`);
|
||||
const dialog = html.match(/<dialog class="modal looks subagents" id="subagents-modal" aria-labelledby="subagents-title">([\s\S]*?)<\/dialog>/);
|
||||
assert.ok(dialog, "index.html has the Subagents dialog");
|
||||
for (const id of ["subagents-instruction", "subagents-default", "subagents-max", "subagents-checkin", "subagents-research", "subagents-status", "subagents-cancel", "subagents-save"]) {
|
||||
assert.ok(dialog[1].includes(`id="${id}"`), `the dialog carries #${id}`);
|
||||
}
|
||||
assert.doesNotMatch(dialog[1], /\sstyle=/);
|
||||
assert.doesNotMatch(dialog[1], /<script/i);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// `looks` is a live binding: every file reads the current object, and only
|
||||
// this file replaces it.
|
||||
|
||||
import { DEFAULT_ACCENT, soundPrefs, DEFAULT_CARD_WIDTH, ACCENTS, cardWidth, soundKey } from "./palette.js";
|
||||
import { DEFAULT_ACCENT, soundPrefs, DEFAULT_CARD_WIDTH, ACCENTS, accentId, cardWidth, soundKey } from "./palette.js";
|
||||
import { normalizeRole, ROLE_NOT_SET } from "./starters.js";
|
||||
import { bootData, hooks } from "./state.js";
|
||||
import { el } from "./render.js";
|
||||
@@ -40,7 +40,7 @@ export let looksReady = false;
|
||||
|
||||
export function adoptLooks(saved) {
|
||||
looks = { ...DEFAULT_LOOKS, ...saved };
|
||||
if (!ACCENTS[looks.accent]) looks.accent = DEFAULT_LOOKS.accent;
|
||||
looks.accent = accentId(looks.accent);
|
||||
if (!["system", "light", "dark"].includes(looks.theme)) looks.theme = DEFAULT_LOOKS.theme;
|
||||
if (typeof looks.sound !== "boolean") looks.sound = DEFAULT_LOOKS.sound;
|
||||
Object.assign(looks, soundPrefs(looks));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// The highlight colors, as data. Kept out of app.js for one reason: app.js
|
||||
// cannot be imported outside a browser, and thirty-two colors each with four
|
||||
// cannot be imported outside a browser, and thirty-eight colors each with four
|
||||
// shades in two themes is far too many to trust to eyeballing. The test suite
|
||||
// imports this and checks every one.
|
||||
//
|
||||
@@ -19,12 +19,20 @@
|
||||
// also badge text on the soft tint). Everything after the first five was
|
||||
// found by stepping lightness until both held, not picked by eye.
|
||||
//
|
||||
// Order is the order of the picker: round the wheel, then the greys. Sixteen
|
||||
// a row, so the warm half and the greens sit on the first, the blues, purples,
|
||||
// pinks and greys on the second.
|
||||
// Order is the order of the picker: round the wheel, then the grays and Mono
|
||||
// (near-black in light, near-white in dark). Nineteen a row, so the reds,
|
||||
// browns, yellows and greens sit on the first, the blues, purples, pinks and
|
||||
// grays on the second. The pale ones (Peach, Cream, Mint, Aqua, Lavender,
|
||||
// Pink) are pastels only in dark mode: in light mode a fill has to carry a
|
||||
// white label, so they come out as deeper shades of the same hue.
|
||||
|
||||
export const ACCENTS = {
|
||||
// name fill soft ink line
|
||||
maroon: {
|
||||
name: "Maroon",
|
||||
light: ["#7c1d2d", "#fbeef1", "#ffffff", "#cea1a9"],
|
||||
dark: ["#da818f", "#321b1f", "#140b0c", "#76424b"],
|
||||
},
|
||||
crimson: {
|
||||
name: "Crimson",
|
||||
light: ["#cd1d41", "#fbe9ed", "#ffffff", "#dcaab4"],
|
||||
@@ -40,40 +48,45 @@ export const ACCENTS = {
|
||||
light: ["#c83510", "#fbede9", "#ffffff", "#dcaca0"],
|
||||
dark: ["#ef5b37", "#321f1b", "#140d0b", "#6f4237"],
|
||||
},
|
||||
rust: {
|
||||
name: "Rust",
|
||||
light: ["#ae4f2b", "#fbeee7", "#ffffff", "#dd9b7e"],
|
||||
dark: ["#e8825a", "#34211a", "#1a120e", "#8a4f36"],
|
||||
peach: {
|
||||
name: "Peach",
|
||||
light: ["#b44c2d", "#fbf2ef", "#ffffff", "#cdaca2"],
|
||||
dark: ["#f9a48b", "#32201b", "#140d0b", "#764e42"],
|
||||
},
|
||||
tangerine: {
|
||||
name: "Tangerine",
|
||||
light: ["#b15209", "#fbf1e9", "#ffffff", "#d9af8f"],
|
||||
dark: ["#f2700d", "#32251b", "#140f0b", "#664830"],
|
||||
},
|
||||
copper: {
|
||||
name: "Copper",
|
||||
light: ["#a2592f", "#f9f0eb", "#ffffff", "#cdb2a2"],
|
||||
dark: ["#cb7a4b", "#32231b", "#140e0b", "#5f493d"],
|
||||
rust: {
|
||||
name: "Rust",
|
||||
light: ["#ae4f2b", "#fbeee7", "#ffffff", "#dd9b7e"],
|
||||
dark: ["#e8825a", "#34211a", "#1a120e", "#8a4f36"],
|
||||
},
|
||||
brown: {
|
||||
name: "Brown",
|
||||
light: ["#6f472a", "#f9f4f0", "#ffffff", "#c8b5a8"],
|
||||
dark: ["#c59877", "#32241b", "#140f0b", "#765842"],
|
||||
},
|
||||
clay: {
|
||||
name: "Clay",
|
||||
light: ["#8d644c", "#f5f2f0", "#ffffff", "#bfafa6"],
|
||||
dark: ["#ba957f", "#2b2521", "#17100c", "#62544b"],
|
||||
},
|
||||
marigold: {
|
||||
name: "Marigold",
|
||||
light: ["#9a6406", "#fbf5e9", "#ffffff", "#d3b279"],
|
||||
dark: ["#f59f0a", "#32291b", "#14110b", "#5e4c2c"],
|
||||
},
|
||||
gold: {
|
||||
name: "Gold",
|
||||
light: ["#896b09", "#fbf7e9", "#ffffff", "#ccb66d"],
|
||||
dark: ["#f0bb0f", "#322c1b", "#14120b", "#584d2a"],
|
||||
},
|
||||
mustard: {
|
||||
name: "Mustard",
|
||||
light: ["#806f1b", "#fbf8ea", "#ffffff", "#c3b881"],
|
||||
dark: ["#d2b72d", "#322e1b", "#14120b", "#544e31"],
|
||||
cream: {
|
||||
name: "Cream",
|
||||
light: ["#776740", "#f8f6f2", "#ffffff", "#c0b9aa"],
|
||||
dark: ["#f1e1bc", "#322b1b", "#14110b", "#766642"],
|
||||
},
|
||||
lemon: {
|
||||
name: "Lemon",
|
||||
light: ["#7e7607", "#fcfbee", "#ffffff", "#c5bf67"],
|
||||
dark: ["#f0e442", "#32301b", "#14130b", "#767242"],
|
||||
},
|
||||
olive: {
|
||||
name: "Olive",
|
||||
@@ -90,21 +103,31 @@ export const ACCENTS = {
|
||||
light: ["#577740", "#f2f6ee", "#ffffff", "#acbca1"],
|
||||
dark: ["#79a659", "#24321b", "#0f140b", "#475140"],
|
||||
},
|
||||
forest: {
|
||||
name: "Forest",
|
||||
light: ["#216337", "#f0faf3", "#ffffff", "#9cc4a9"],
|
||||
dark: ["#6bbd86", "#1b3222", "#0b140e", "#427653"],
|
||||
},
|
||||
emerald: {
|
||||
name: "Emerald",
|
||||
light: ["#207e47", "#ebfaf1", "#ffffff", "#8ac4a2"],
|
||||
dark: ["#33cc73", "#1b3224", "#0b140f", "#345542"],
|
||||
},
|
||||
jade: {
|
||||
name: "Jade",
|
||||
light: ["#297c61", "#ecf9f4", "#ffffff", "#92c1b1"],
|
||||
dark: ["#40bf95", "#1b322a", "#0b1411", "#38544b"],
|
||||
mint: {
|
||||
name: "Mint",
|
||||
light: ["#25805a", "#effaf6", "#ffffff", "#97c4b1"],
|
||||
dark: ["#8be4bf", "#1b3228", "#0b1410", "#427660"],
|
||||
},
|
||||
teal: {
|
||||
name: "Teal",
|
||||
light: ["#0f766e", "#e2f1ef", "#ffffff", "#6fb3aa"],
|
||||
dark: ["#5ecfc0", "#14302c", "#0b1a18", "#3a7d74"],
|
||||
},
|
||||
aqua: {
|
||||
name: "Aqua",
|
||||
light: ["#177e82", "#eefbfc", "#ffffff", "#8dc6c8"],
|
||||
dark: ["#84e8eb", "#1b3132", "#0b1414", "#427476"],
|
||||
},
|
||||
cyan: {
|
||||
name: "Cyan",
|
||||
light: ["#0f798a", "#ebf7f9", "#ffffff", "#75bec9"],
|
||||
@@ -120,31 +143,31 @@ export const ACCENTS = {
|
||||
light: ["#206cc3", "#ecf2f9", "#ffffff", "#9ab4d3"],
|
||||
dark: ["#619fe5", "#1a2533", "#0c1117", "#3d5978"],
|
||||
},
|
||||
navy: {
|
||||
name: "Navy",
|
||||
light: ["#24396b", "#eef0f7", "#ffffff", "#a7b3cd"],
|
||||
dark: ["#819ad5", "#1e232f", "#0c1017", "#4a5775"],
|
||||
},
|
||||
cobalt: {
|
||||
name: "Cobalt",
|
||||
light: ["#405ce7", "#ebeef9", "#ffffff", "#a8b0dc"],
|
||||
dark: ["#7b8fef", "#191d34", "#0c0e17", "#465392"],
|
||||
},
|
||||
navy: {
|
||||
name: "Navy",
|
||||
light: ["#24396b", "#eef0f7", "#ffffff", "#a7b3cd"],
|
||||
dark: ["#819ad5", "#1e232f", "#0c1017", "#4a5775"],
|
||||
},
|
||||
indigo: {
|
||||
name: "Indigo",
|
||||
light: ["#4f46e5", "#ecebfb", "#ffffff", "#9b95ef"],
|
||||
dark: ["#a5a0ff", "#1e1d3a", "#121129", "#5f5ba8"],
|
||||
},
|
||||
lavender: {
|
||||
name: "Lavender",
|
||||
light: ["#6f61b8", "#f2f1f9", "#ffffff", "#afaac5"],
|
||||
dark: ["#b9acf6", "#1f1b32", "#0c0b14", "#4d4479"],
|
||||
},
|
||||
violet: {
|
||||
name: "Violet",
|
||||
light: ["#7f4dd5", "#f1edf8", "#ffffff", "#bbabd6"],
|
||||
dark: ["#a785e2", "#231c31", "#100c17", "#624c87"],
|
||||
},
|
||||
lilac: {
|
||||
name: "Lilac",
|
||||
light: ["#8b51b8", "#f3eff6", "#ffffff", "#beaccb"],
|
||||
dark: ["#b189cf", "#271f2d", "#130c17", "#634f73"],
|
||||
},
|
||||
orchid: {
|
||||
name: "Orchid",
|
||||
light: ["#a141b9", "#f5eef7", "#ffffff", "#c5a8cc"],
|
||||
@@ -165,6 +188,16 @@ export const ACCENTS = {
|
||||
light: ["#c42e6a", "#f8edf1", "#ffffff", "#d3a6b8"],
|
||||
dark: ["#df77a0", "#311c24", "#170c11", "#7c465b"],
|
||||
},
|
||||
pink: {
|
||||
name: "Pink",
|
||||
light: ["#b23875", "#faeff5", "#ffffff", "#caa5b8"],
|
||||
dark: ["#f7a1cc", "#321b26", "#140b0f", "#76425c"],
|
||||
},
|
||||
mauve: {
|
||||
name: "Mauve",
|
||||
light: ["#816281", "#f4f1f4", "#ffffff", "#bbafbb"],
|
||||
dark: ["#ae93ae", "#292329", "#170c17", "#5f545f"],
|
||||
},
|
||||
steel: {
|
||||
name: "Steel",
|
||||
light: ["#50737c", "#f0f3f4", "#ffffff", "#a5b5b8"],
|
||||
@@ -175,20 +208,30 @@ export const ACCENTS = {
|
||||
light: ["#5b6e88", "#f0f2f4", "#ffffff", "#acb3bc"],
|
||||
dark: ["#8e9eb4", "#23262a", "#0c1117", "#515861"],
|
||||
},
|
||||
mauve: {
|
||||
name: "Mauve",
|
||||
light: ["#816281", "#f4f1f4", "#ffffff", "#bbafbb"],
|
||||
dark: ["#ae93ae", "#292329", "#170c17", "#5f545f"],
|
||||
},
|
||||
graphite: {
|
||||
name: "Graphite",
|
||||
light: ["#4a4640", "#eeedea", "#ffffff", "#a8a196"],
|
||||
dark: ["#cfc7bb", "#2b2a28", "#161513", "#7a7369"],
|
||||
},
|
||||
mono: {
|
||||
name: "Mono",
|
||||
light: ["#1f1f1f", "#efefef", "#ffffff", "#a3a3a3"],
|
||||
dark: ["#ececec", "#2a2a2a", "#141414", "#6e6e6e"],
|
||||
},
|
||||
};
|
||||
|
||||
export const DEFAULT_ACCENT = "ocean";
|
||||
|
||||
// Colors that were merged into a near twin when the picker grew to Paint's
|
||||
// range. A looks.json saved with one keeps the closest color, not the default.
|
||||
export const RETIRED_ACCENTS = { copper: "rust", marigold: "gold", mustard: "lemon", jade: "emerald", lilac: "violet" };
|
||||
|
||||
export function accentId(value) {
|
||||
const id = String(value);
|
||||
if (Object.hasOwn(ACCENTS, id)) return id;
|
||||
return Object.hasOwn(RETIRED_ACCENTS, id) ? RETIRED_ACCENTS[id] : DEFAULT_ACCENT;
|
||||
}
|
||||
|
||||
// The card-width presets. Here for the same reason the accents are: the page
|
||||
// validates a saved `looks.width` with cardWidth(), and the server uses it to
|
||||
// paint the first-load `data-width` attribute before app.js runs. One list,
|
||||
|
||||
@@ -40,12 +40,13 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
|
||||
/* ------------------------------------------------------------ swatches */
|
||||
|
||||
/* Thirty-two of them: a fixed sixteen-column grid so they sit in two even
|
||||
rows in the wide dialog, and four even rows of eight on a narrow window,
|
||||
rather than leaving a straggler alone on the last line. */
|
||||
.swatches { display: grid; grid-template-columns: repeat(16, minmax(0, 34px)); gap: 8px; }
|
||||
/* Thirty-eight of them: a fixed nineteen-column grid so they sit in two even
|
||||
rows in the wide dialog (19 x 34px plus gaps fits its 828px body), and rows
|
||||
of ten on a narrow window. Thirty-eight is the cap: one more would leave a
|
||||
straggler on a third row in the wide dialog. */
|
||||
.swatches { display: grid; grid-template-columns: repeat(19, minmax(0, 34px)); gap: 8px; }
|
||||
@media (max-width: 720px) {
|
||||
.swatches { grid-template-columns: repeat(8, minmax(0, 34px)); }
|
||||
.swatches { grid-template-columns: repeat(10, minmax(0, 34px)); }
|
||||
}
|
||||
|
||||
.swatch {
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
import { DOC_TYPES, MAX_ATTACHMENTS, MAX_DOC_BYTES, docExt, workflowLabel, workflowTitle } from "./public/answers.js";
|
||||
import { CHAT_LIMIT, CHAT_MAX_CHARS } from "./public/chat.js";
|
||||
import { cleanSetting, offered } from "./public/subagents.js";
|
||||
import { ACCENTS, DEFAULT_ACCENT, DEFAULT_CARD_WIDTH, cardWidth } from "./public/palette.js";
|
||||
import { DEFAULT_ACCENT, DEFAULT_CARD_WIDTH, accentId, cardWidth } from "./public/palette.js";
|
||||
import { SERVABLE, TYPES, asset } from "./static.mjs";
|
||||
import { handoffsDir, isHandoffId } from "./handoffs.mjs";
|
||||
import { linkToOpen, openLink } from "./open-link.mjs";
|
||||
@@ -265,8 +265,8 @@ function renderIndex(ctx) {
|
||||
};
|
||||
let htmlAttrs = "";
|
||||
if (looks && (looks.theme === "light" || looks.theme === "dark")) htmlAttrs += ` data-theme="${looks.theme}"`;
|
||||
if (looks && looks.accent !== DEFAULT_ACCENT && Object.hasOwn(ACCENTS, String(looks.accent))) {
|
||||
htmlAttrs += ` data-looks-accent="${looks.accent}"`;
|
||||
if (looks && accentId(looks.accent) !== DEFAULT_ACCENT) {
|
||||
htmlAttrs += ` data-looks-accent="${accentId(looks.accent)}"`;
|
||||
}
|
||||
// The same first-paint reasoning as the accent: a Wide user never sees the
|
||||
// column jump from the default width. The value is one of the fixed preset
|
||||
@@ -302,7 +302,7 @@ function renderIndex(ctx) {
|
||||
|
||||
/* ------------------------------------------------------ read-only routes */
|
||||
|
||||
// The spec's overview.md, read-only. A dashboard honours ?spec= only for a
|
||||
// The spec's overview.md, read-only. A dashboard honors ?spec= only for a
|
||||
// spec its own scan found; every other workflow reads its own specDir.
|
||||
// readOverview() keeps the read inside the project root.
|
||||
function overview(req, res, ctx, url) {
|
||||
@@ -1453,7 +1453,7 @@ function authed(req, ctx) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS-rebinding defence, and the highest-value check in this file.
|
||||
* The DNS-rebinding defense, and the highest-value check in this file.
|
||||
*
|
||||
* Without it, any page the user visits can resolve its own hostname to
|
||||
* 127.0.0.1 and then talk to this server as same-origin. That is not
|
||||
|
||||
Reference in new issue
Block a user