@jonandev/longbeard 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +5 -5
- package/CHANGELOG.md +35 -0
- package/README.md +3 -4
- package/beard.json +6 -17
- package/bin/long-beard.js +2 -2
- package/package.json +1 -1
- package/skills/design/SKILL.md +7 -11
- package/skills/design-brief/SKILL.md +5 -35
- package/skills/design-check/SKILL.md +5 -7
- package/skills/design-check/references/design-rules.md +26 -4
- package/skills/design-check/scripts/rules.mjs +143 -9
- package/skills/design-content/SKILL.md +3 -8
- package/skills/design-direction/SKILL.md +58 -53
- package/skills/design-direction/references/design-floor.md +118 -0
- package/skills/design-direction/references/graphic.md +5 -6
- package/skills/design-direction/references/library.md +7 -7
- package/skills/design-direction/references/screen-template.html +7 -164
- package/skills/design-direction/references/screen.js +163 -0
- package/skills/design-direction/references/subject.md +3 -3
- package/skills/design-direction/references/variants.js +43 -0
- package/skills/design-direction/scripts/canvas.mjs +12 -9
- package/skills/design-direction/scripts/colours.mjs +247 -0
- package/skills/design-direction/scripts/moodboard.mjs +1 -1
- package/skills/design-direction/scripts/rules.mjs +747 -0
- package/skills/design-direction/scripts/sheet.mjs +3 -1
- package/skills/design-figma/SKILL.md +4 -6
- package/skills/design-identity/SKILL.md +12 -14
- package/skills/design-identity/references/design-floor.md +118 -0
- package/skills/design-identity/scripts/colours.mjs +35 -1
- package/skills/design-identity/scripts/sheet.mjs +3 -1
- package/skills/design-moodboard/SKILL.md +11 -11
- package/skills/design-moodboard/references/graphic.md +1 -1
- package/skills/design-moodboard/references/sources.md +1 -1
- package/skills/design-moodboard/scripts/group.mjs +1 -1
- package/skills/design-moodboard/scripts/moodboard.mjs +1 -1
- package/skills/design-prototype/SKILL.md +51 -49
- package/skills/design-prototype/references/design-floor.md +118 -0
- package/skills/design-prototype/references/design-md-template.md +4 -2
- package/skills/design-prototype/references/graphic.md +6 -5
- package/skills/design-prototype/references/variants.js +43 -0
- package/skills/design-prototype/scripts/links.mjs +5 -4
- package/skills/design-prototype/scripts/rules.mjs +143 -9
- package/skills/design-prototype/scripts/sheet.mjs +3 -1
- package/skills/design-wordmark/SKILL.md +9 -8
- package/skills/design-wordmark/scripts/sheet.mjs +3 -1
- package/skills/framework-skills/SKILL.md +3 -5
- package/skills/idea/SKILL.md +7 -9
- package/skills/design-direction/references/design-rules.md +0 -204
- package/skills/design-direction/references/full-build.md +0 -20
- package/skills/design-direction/references/grid.md +0 -97
- package/skills/design-direction/scripts/layout-diff.mjs +0 -118
- package/skills/design-families/SKILL.md +0 -139
- package/skills/design-families/scripts/contact-sheet.mjs +0 -259
- package/skills/design-families/scripts/families.mjs +0 -607
- package/skills/design-families/scripts/measure.mjs +0 -1728
- package/skills/design-families/scripts/moodboard.mjs +0 -609
- package/skills/design-families/scripts/tag.mjs +0 -289
- package/skills/design-prototype/references/design-rules.md +0 -204
- package/skills/design-prototype/references/five-second.md +0 -46
|
@@ -1,609 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// A moodboard of the references, built to be marked: every card with a shot
|
|
3
|
-
// or recorded frames, grouped by its topic (the family it looks like, or the
|
|
4
|
-
// one piece it is for), with Lead, Like and No, a note per tile, a "leave out"
|
|
5
|
-
// per tile, and a copy-out for the chat. The
|
|
6
|
-
// layout is this file. It shows what we saw. It does not paint a brand.
|
|
7
|
-
//
|
|
8
|
-
// A card's fields in board.md: link, shot, frames (a folder that
|
|
9
|
-
// capture.mjs --frames wrote, played on hover), topic (or part), pattern (or move), measured
|
|
10
|
-
// (its traits from measure.mjs, shown small under the pattern), why, like (the
|
|
11
|
-
// person's own words from the picker: what they like in it, and why; shown on
|
|
12
|
-
// the card, put in its note until they change it, and the card starts liked),
|
|
13
|
-
// avoid (their words: what they do not want from a reference they otherwise
|
|
14
|
-
// like; shown on the card and put in its leave-out box), also (one line per
|
|
15
|
-
// other screen of the same product, "<part>: <shot>", shown with the card).
|
|
16
|
-
//
|
|
17
|
-
// The pictures are the page: a masonry of shots at their own proportions, a
|
|
18
|
-
// small badge for a mark, and the notes of only the card they open, in a side
|
|
19
|
-
// panel. Keys: L lead, K like, N no, arrows to move, Esc to close.
|
|
20
|
-
//
|
|
21
|
-
// --topics .longbeard/design/families/board.md: each card takes its family from
|
|
22
|
-
// that board, matched by name, so the moodboard's own cards (with their like,
|
|
23
|
-
// avoid and move lines) are shown under the families design-families found.
|
|
24
|
-
// A card in no family keeps its part. Every card stays.
|
|
25
|
-
//
|
|
26
|
-
// --one-lead: one Lead on the whole board, not one per group. The direction's
|
|
27
|
-
// board is grouped by family, and its lead is one reference across them all.
|
|
28
|
-
//
|
|
29
|
-
// node moodboard.mjs .longbeard/design/moodboard/board.md --out .longbeard/design/moodboard/moodboard.html
|
|
30
|
-
// node moodboard.mjs .longbeard/design/pricing/board.md --out .longbeard/design/pricing/moodboard.html
|
|
31
|
-
//
|
|
32
|
-
// --overview 6 shows each family as its first six tiles (families.mjs writes
|
|
33
|
-
// the most typical first), how many more it has, and its measured ranges from a
|
|
34
|
-
// "Families:" header line, with a note per family (two looks in one, belongs
|
|
35
|
-
// with another). It checks the sorting; it never chooses: every family stays on
|
|
36
|
-
// the board that is marked next.
|
|
37
|
-
// node moodboard.mjs .longbeard/design/moodboard/board.md --overview 6 --out .longbeard/design/families/families.html
|
|
38
|
-
import { execSync } from "node:child_process";
|
|
39
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
40
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
41
|
-
|
|
42
|
-
const args = process.argv.slice(2);
|
|
43
|
-
const outAt = args.indexOf("--out");
|
|
44
|
-
const outArg = outAt === -1 ? "" : (args.splice(outAt, 2)[1] ?? "");
|
|
45
|
-
const overAt = args.indexOf("--overview");
|
|
46
|
-
const overview = overAt === -1 ? 0 : Number(args.splice(overAt, 2)[1]);
|
|
47
|
-
if (overAt !== -1 && !(Number.isInteger(overview) && overview >= 1 && overview <= 24)) {
|
|
48
|
-
console.error("moodboard: --overview takes how many tiles to show per family, 1 to 24");
|
|
49
|
-
process.exit(2);
|
|
50
|
-
}
|
|
51
|
-
const topicsAt = args.indexOf("--topics");
|
|
52
|
-
const topicsArg = topicsAt === -1 ? "" : (args.splice(topicsAt, 2)[1] ?? "");
|
|
53
|
-
const leadAt = args.indexOf("--one-lead");
|
|
54
|
-
const oneLead = leadAt !== -1;
|
|
55
|
-
if (oneLead) args.splice(leadAt, 1);
|
|
56
|
-
const boardArg = args[0];
|
|
57
|
-
if (!boardArg || !outArg || args.length !== 1) {
|
|
58
|
-
console.error("usage: node moodboard.mjs .longbeard/design/<step>/board.md --out .longbeard/design/<step>/moodboard.html");
|
|
59
|
-
process.exit(2);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function projectRoot() {
|
|
63
|
-
try {
|
|
64
|
-
return execSync("git rev-parse --show-toplevel", { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
65
|
-
} catch {
|
|
66
|
-
return process.cwd();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const root = projectRoot();
|
|
71
|
-
const resolvePath = (path) => (isAbsolute(path) ? path : resolve(root, path));
|
|
72
|
-
const boardPath = resolvePath(boardArg);
|
|
73
|
-
const outPath = resolvePath(outArg);
|
|
74
|
-
if (!existsSync(boardPath)) {
|
|
75
|
-
console.error(`moodboard: no board at ${boardArg}`);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const esc = (s) =>
|
|
80
|
-
String(s ?? "")
|
|
81
|
-
.replace(/&/g, "&")
|
|
82
|
-
.replace(/</g, "<")
|
|
83
|
-
.replace(/>/g, ">")
|
|
84
|
-
.replace(/"/g, """)
|
|
85
|
-
.replace(/'/g, "'");
|
|
86
|
-
// A local path in a src or href: each part encoded, so # ? % and spaces stay in the name.
|
|
87
|
-
const href = (abs) => {
|
|
88
|
-
const src = relative(dirname(outPath), abs)
|
|
89
|
-
.split("\\")
|
|
90
|
-
.join("/")
|
|
91
|
-
.split("/")
|
|
92
|
-
.map(encodeURIComponent)
|
|
93
|
-
.join("/");
|
|
94
|
-
return src.startsWith(".") ? src : `./${src}`;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
function fieldsOf(text) {
|
|
98
|
-
const fields = {};
|
|
99
|
-
for (const line of text.split(/\r?\n/)) {
|
|
100
|
-
const m = line.match(/^- ([a-z][a-z /-]*):\s*(.*)$/i);
|
|
101
|
-
if (!m) continue;
|
|
102
|
-
const k = m[1].toLowerCase();
|
|
103
|
-
if (k === "also") (fields.also ||= []).push(m[2].trim());
|
|
104
|
-
else fields[k] = m[2].trim();
|
|
105
|
-
}
|
|
106
|
-
return fields;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// The parts of a site, in the order a visitor meets them. A topic not here
|
|
110
|
-
// (an app's key screen, say) keeps the order it first appears in on the board.
|
|
111
|
-
const TOPICS = [
|
|
112
|
-
["Home", /^(home|homepage|landing|hero)$/],
|
|
113
|
-
// "menu" is left out: for a restaurant or a bakery it is the list of dishes, not the navigation.
|
|
114
|
-
["Navigation", /^(nav|navigation|nav menu|header)$/],
|
|
115
|
-
["Index", /^(index|listing|list|work|archive|grid|catalogue|catalog)$/],
|
|
116
|
-
["Case study", /^(case[ -]?stud(y|ies)|project|work detail)$/],
|
|
117
|
-
["Article", /^(article|editorial|reading|long[ -]?read|story)$/],
|
|
118
|
-
["Blog", /^(blog|journal|news|notes)$/],
|
|
119
|
-
["Photography", /^(photo|photos|photography|imagery|image|pictures)$/],
|
|
120
|
-
["Motion", /^(motion|animation|transition|transitions|interaction)$/],
|
|
121
|
-
];
|
|
122
|
-
function topicOf(raw) {
|
|
123
|
-
const t = String(raw || "").trim().toLowerCase();
|
|
124
|
-
if (!t) return { key: "", label: "Other", rank: 1e6 };
|
|
125
|
-
const at = TOPICS.findIndex(([, re]) => re.test(t));
|
|
126
|
-
if (at !== -1) return { key: t, label: TOPICS[at][0], rank: at };
|
|
127
|
-
return { key: t, label: t.charAt(0).toUpperCase() + t.slice(1), rank: 1000 };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Frames from capture.mjs --frames: 01-00000ms.jpg, 02-00500ms.jpg…
|
|
131
|
-
function framesOf(folder) {
|
|
132
|
-
const abs = resolvePath(folder.trim().replace(/\/$/, ""));
|
|
133
|
-
if (!existsSync(abs) || !statSync(abs).isDirectory()) return null;
|
|
134
|
-
const files = readdirSync(abs)
|
|
135
|
-
.filter((f) => /\.(jpe?g|png|webp)$/i.test(f))
|
|
136
|
-
.sort();
|
|
137
|
-
if (!files.length) return null;
|
|
138
|
-
return files.map((f, i) => ({ src: href(join(abs, f)), ms: Number(f.match(/(\d+)ms\./)?.[1] ?? i * 500) }));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const md = readFileSync(boardPath, "utf8");
|
|
142
|
-
const topicsMd = topicsArg ? (existsSync(resolvePath(topicsArg)) ? readFileSync(resolvePath(topicsArg), "utf8") : null) : "";
|
|
143
|
-
if (topicsMd === null) {
|
|
144
|
-
console.error(`moodboard: no board at ${topicsArg}`);
|
|
145
|
-
process.exit(1);
|
|
146
|
-
}
|
|
147
|
-
// name → family, from the sorted board.
|
|
148
|
-
const familyOf = new Map();
|
|
149
|
-
for (const chunk of topicsMd.split(/^### /m).slice(1)) {
|
|
150
|
-
const nl = chunk.indexOf("\n");
|
|
151
|
-
const name = (nl === -1 ? chunk : chunk.slice(0, nl)).trim();
|
|
152
|
-
const topic = fieldsOf(nl === -1 ? "" : chunk.slice(nl + 1)).topic;
|
|
153
|
-
if (topic && !familyOf.has(name)) familyOf.set(name, topic);
|
|
154
|
-
}
|
|
155
|
-
// Ranges per family, from board.md's header: "Families: f1 (light · empty 55–70%) — 42; f2 (…) — 18".
|
|
156
|
-
const ranges = new Map();
|
|
157
|
-
const familiesLine = (topicsMd || md).match(/^Families:\s*(.*)$/m)?.[1] || "";
|
|
158
|
-
for (const part of familiesLine.split(";")) {
|
|
159
|
-
const m = part.trim().match(/^(.+?)\s*\((.+)\)/);
|
|
160
|
-
if (m) ranges.set(m[1].trim().toLowerCase(), m[2].trim());
|
|
161
|
-
}
|
|
162
|
-
const cards = md
|
|
163
|
-
.split(/^### /m)
|
|
164
|
-
.slice(1)
|
|
165
|
-
.map((chunk) => {
|
|
166
|
-
const nl = chunk.indexOf("\n");
|
|
167
|
-
const name = (nl === -1 ? chunk : chunk.slice(0, nl)).trim();
|
|
168
|
-
return { name, ...fieldsOf((nl === -1 ? "" : chunk.slice(nl + 1)).split(/^## /m)[0]) };
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const sections = new Map();
|
|
172
|
-
let n = 0;
|
|
173
|
-
// A mark is saved under the card's name, so adding or dropping a card never
|
|
174
|
-
// moves a mark onto another. Two cards with one name tell apart by order.
|
|
175
|
-
const names = new Map();
|
|
176
|
-
for (const card of cards) {
|
|
177
|
-
const frames = card.frames ? framesOf(card.frames) : null;
|
|
178
|
-
if (card.frames && !frames) console.error(`moodboard: no frames in ${card.frames.trim()}`);
|
|
179
|
-
let poster = "";
|
|
180
|
-
if (card.shot) {
|
|
181
|
-
const shot = card.shot.trim();
|
|
182
|
-
// A shot may be a picture's URL (an exported library's pins): the page loads it as it is.
|
|
183
|
-
if (/^https?:\/\//i.test(shot)) poster = shot;
|
|
184
|
-
else if (existsSync(resolvePath(shot))) poster = href(resolvePath(shot));
|
|
185
|
-
else console.error(`moodboard: missing shot ${shot}`);
|
|
186
|
-
}
|
|
187
|
-
if (!poster && frames) poster = frames[frames.length - 1].src;
|
|
188
|
-
if (!poster) continue;
|
|
189
|
-
const id = `m${++n}`;
|
|
190
|
-
const seenName = (names.get(card.name) ?? 0) + 1;
|
|
191
|
-
names.set(card.name, seenName);
|
|
192
|
-
const markKey = seenName > 1 ? `${card.name} #${seenName}` : card.name;
|
|
193
|
-
const topic = topicOf(familyOf.get(card.name) || card.topic || card.part);
|
|
194
|
-
// A seed shared in chat has no URL, so its name is not a link.
|
|
195
|
-
const url = (card.link || "").trim().split(/\s+/)[0];
|
|
196
|
-
const name = /^https?:\/\//i.test(url)
|
|
197
|
-
? `<a class="name" href="${esc(url)}" target="_blank" rel="noopener noreferrer">${esc(card.name)}</a>`
|
|
198
|
-
: `<span class="name">${esc(card.name)}</span>`;
|
|
199
|
-
const like = (card.like || "").trim();
|
|
200
|
-
const avoid = (card.avoid || "").trim();
|
|
201
|
-
const line = ((card.pattern || card.move) ? `<p class="line">${esc(card.pattern || card.move)}</p>` : "") + (card.measured ? `<p class="measured">${esc(card.measured)}</p>` : "") + (like ? `<p class="liked">You liked: ${esc(like)}</p>` : "") + (avoid ? `<p class="avoided">Leave out: ${esc(avoid)}</p>` : "");
|
|
202
|
-
// Other screens of the same product: "<part>: <shot>", each shown small with the card.
|
|
203
|
-
const also = (card.also || [])
|
|
204
|
-
.map((line) => {
|
|
205
|
-
const m = line.match(/^(.*?):\s*(\S.*)$/);
|
|
206
|
-
const [part, shot] = m ? [m[1].trim(), m[2].trim()] : ["", line.trim()];
|
|
207
|
-
const src = /^https?:\/\//i.test(shot) ? shot : existsSync(resolvePath(shot)) ? href(resolvePath(shot)) : "";
|
|
208
|
-
if (!src) console.error(`moodboard: missing shot ${shot} (also, on ${card.name})`);
|
|
209
|
-
return src ? `<a class="sib" href="${esc(src)}" target="_blank" rel="noopener"><img src="${esc(src)}" alt="${esc(card.name)}: ${esc(part || "another screen")}" loading="lazy"><span>${esc(part || "screen")}</span></a>` : "";
|
|
210
|
-
})
|
|
211
|
-
.join("");
|
|
212
|
-
const play = frames
|
|
213
|
-
? `<button type="button" class="play" aria-label="Play ${esc(card.name)}">Play</button><span class="clock"></span>`
|
|
214
|
-
: "";
|
|
215
|
-
const tile = `<figure class="tile" data-id="${id}" data-title="${esc(card.name)}" data-topic="${esc(topic.label)}" data-key="${esc(markKey)}"${like ? ` data-like="${esc(like)}"` : ""}${avoid ? ` data-avoid="${esc(avoid)}"` : ""}${
|
|
216
|
-
frames ? ` data-frames="${esc(JSON.stringify(frames))}"` : ""
|
|
217
|
-
}>
|
|
218
|
-
<div class="frame" tabindex="0" role="button" aria-label="Open ${esc(card.name)}"><img src="${esc(poster)}" alt="${esc(card.name)}" loading="lazy"><span class="id">${id}</span><span class="badge" aria-hidden="true"></span>${play}</div>
|
|
219
|
-
<figcaption>
|
|
220
|
-
<button type="button" class="close" aria-label="Close">Close</button>
|
|
221
|
-
<a class="big" href="${esc(poster)}" target="_blank" rel="noopener" aria-label="Open the shot of ${esc(card.name)} at full size"><img data-src="${esc(poster)}" alt=""></a>
|
|
222
|
-
${also ? `<div class="also" aria-label="Other screens of the same product">${also}</div>` : ""}
|
|
223
|
-
${name}${line}
|
|
224
|
-
<div class="marks" role="group" aria-label="Mark ${esc(card.name)}">
|
|
225
|
-
<button type="button" data-mark="lead" aria-pressed="false">Lead</button>
|
|
226
|
-
<button type="button" data-mark="like" aria-pressed="false">Like</button>
|
|
227
|
-
<button type="button" data-mark="no" aria-pressed="false">No</button>
|
|
228
|
-
</div>
|
|
229
|
-
<input class="why" type="text" placeholder="What you like in it, and why (optional)" aria-label="What you like in ${esc(card.name)}, and why">
|
|
230
|
-
<input class="avoid" type="text" placeholder="Leave out: what you don't want from it (optional)" aria-label="What to leave out of ${esc(card.name)}">
|
|
231
|
-
</figcaption>
|
|
232
|
-
</figure>`;
|
|
233
|
-
// In the overview each family is its own section, named by its id as written (f1, not F1), so the
|
|
234
|
-
// copy-out names the list on disk (families/f1.tsv) and the board's Families: line finds its ranges.
|
|
235
|
-
const at = overview ? topic.key : topic.label;
|
|
236
|
-
if (!sections.has(at)) sections.set(at, { label: topic.label, key: topic.key, rank: topic.rank, order: sections.size, tiles: [] });
|
|
237
|
-
sections.get(at).tiles.push(tile);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (!n) {
|
|
241
|
-
console.error("moodboard: no card on the board has a shot or frames");
|
|
242
|
-
process.exit(1);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const ordered = [...sections.entries()].sort(([, a], [, b]) => a.rank - b.rank || a.order - b.order);
|
|
246
|
-
const slug = (s) => `t-${s.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`;
|
|
247
|
-
const jump = ordered
|
|
248
|
-
.map(([at, s]) => `<a href="#${slug(at)}">${esc(s.label)} <span>${s.tiles.length}</span></a>`)
|
|
249
|
-
.join("");
|
|
250
|
-
const body = ordered
|
|
251
|
-
.map(([at, s]) => {
|
|
252
|
-
const { label, key } = s;
|
|
253
|
-
const shown = overview ? s.tiles.slice(0, overview) : s.tiles;
|
|
254
|
-
const more = s.tiles.length - shown.length;
|
|
255
|
-
const head = overview
|
|
256
|
-
? `<h2>${esc(label)} <span>${s.tiles.length}</span></h2>
|
|
257
|
-
${ranges.has(key) ? `<p class="ranges">${esc(ranges.get(key))}</p>` : ""}
|
|
258
|
-
<div class="take"><input class="fam-note" type="text" data-family="${esc(key || label)}" placeholder="Note (optional): two looks in one, belongs with another…" aria-label="Note on ${esc(label)}">${more ? `<span class="more">+${more} more not shown</span>` : ""}</div>`
|
|
259
|
-
: `<h2>${esc(label)} <span>${s.tiles.length}</span></h2>`;
|
|
260
|
-
return `<section id="${slug(at)}">
|
|
261
|
-
${head}
|
|
262
|
-
<div class="grid">
|
|
263
|
-
${shown.join("\n ")}
|
|
264
|
-
</div>
|
|
265
|
-
</section>`;
|
|
266
|
-
})
|
|
267
|
-
.join("\n ");
|
|
268
|
-
|
|
269
|
-
// The Long Beard beard, small and one ink: it marks the page as the tool's and adds no colour.
|
|
270
|
-
const LOGO = "iVBORw0KGgoAAAANSUhEUgAAACoAAABYBAMAAABxB3iiAAAAMFBMVEWfn59ubm7Z2dn+/v7+/v7////+/v4AAAACAgIXFxcnJyfp6enX19c3NzdXV1dGRkbPaZsJAAAAEHRSTlP///AgWZ/+AP////7/////SdcINAAABTtJREFUeNpdlWtUVFUUx3/3zB1AZhhu4AO1hVOCj8yYKLKHyaiEq5eOS9DoQ2IFPj6UtSyVamm1AC2ttFUIZo6GikU6mrrMVTFoargsxzFTU2kkKN/OyENgHrcPd5jBzrfzW/+77/7vc/Y+0kLCK1Cf2jfgSwNAjkB35vPjEzeWWgFED90/fFfDtktd5tu0P415O+uDxwZ7tZ1ubPj7uhGHUp8/uUITh+nxiv5/UNCQ/9clcyTuD8FBv26GDUXfb7iTHhpsbap5JnftXse4u5fNdPZQdyB+cckqtcm0ZMh6773hHAKDdo9eesRUDHvGLRhjfsOq/W3ajfsfeGoaoDv4Ys399SmgG4uzPKBL0hINfv/gAedlMzIoV84fbg6biUlvnhDSvA1OapzfY/zLiSfr+1llwP+6swfiLzndMRVBcFBthyNCeWStoiCz/8TWa/Oj1NBefAsRGFauKlFI90yxHyElT/dFA8RUMXCizynqq1o2Odi7CQD9tpXsmOJUhNRS0aTf9/YxO+ipOxCsnGo4qYj0jSHa5yUOOA15RYesZZdlQ7pLbjcA04ZeGCrtmrJT4XKFMyU+oOt88nxSZanx95yJY7aNGJtzzGANxJyRx9v2heo2Fbda/l1+rGqhKv3pi/UiwCgNCS1yGd6Mrbz1UtJsz1ZLBgIPsXaJOR+1SqXMaLArSsnmNlG3b5u0yIsv9Io0S3rVZc5+vTPXqHs6eVJocJ/WB4suX2gZuMA2uWlv17m/xK3OE+/J9zDLOMVMKOtgYHZheuo62TQst92+sfGPornzJ/VfYunz68qOoCxL5LW7PqwuP2yqJFixTO813jQEdN6RCbNaLq5+y/vV1h9S+pU5qUzJdki5a5Z1391McRXfVV9yAqOOZ7jJHHH1xaXDYopTj8ZdNBoMhcZ34/6ZIS24+nDS3wvaT6Wb6lz32pKq6+LiTrp1j5/1VWYdqE1f935trX/UECXO23g9UzD65mTdqZwsvg7s2anf/I5VBNPQjRWJvuSjqyosB48MzHk0w53S5otHgBSvCneD3VPyAfHPTvDGTQUB0gs205ZHEIvzXi0cdbDPxxr90TrBp3rMvLzL6TE36b1BJwJk5R8T+63Jc5f6vPZrenNfrQM8h9bTwuoLw3Z9vmE7n3hABmVHwgMmNeBuwd8unZ38aaqCAL3PgR9VBTV2PVbJBQLuaEVVpS2DIca2RHLgBQFtAuj65C3AQqxd67eA6yZGBa8CFOgfQo1Mgm4rMVZAP86OTQEB49VushatBGBtPokWkCGBbwsKeq719PzC63chQMIVbYAuPFdBIIWk+ihVbcoBKwKCRm+UpjlW3QABU/ytUZqtb9sOAlR6N5Z0U8tXzOL/S6DuXNhbrYYAgXzmdl2CFuE+J1ATafreEzExok3UTpPxAo5HaEYvrS5CzQ6NJsRDMEK9No1KQHKEWqRohHmaMzugRKkfAFPEW3RVfxboTTu0QfJV6czwCJOj0lsnpk6eBOH7EC3lmdcAVzjf1tAmAHlkYxngUzXqxKe56rQBP4f/pkrVMB2yy4CYsFbONAH5/FJeiN7RFj4huuKvQx0l5dA+TxLhHK5kB2x6J2k2wPRcWptGA5aQzb+CKkDqzi4MayfuQOEpAIxJq7eH34Dg0Zr3WzQfdd8c98drjmXPE2GI87fa5r7h12nAud2HLfuGQvf5BtejPTWTMzaWcNEONfk3cqL1Dc1JKXEt/2Jr6bnmXpWU+w6v6VxTxvKEvN71fbziSEzeYkOB+7aqy42Z7jNFaqNV2/4HUzT8HOE538sAAAAASUVORK5CYII=";
|
|
271
|
-
|
|
272
|
-
const html = `<!DOCTYPE html>
|
|
273
|
-
<html lang="en">
|
|
274
|
-
<head>
|
|
275
|
-
<meta charset="utf-8">
|
|
276
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
277
|
-
<title>Moodboard</title>
|
|
278
|
-
<style>
|
|
279
|
-
/* Quiet chrome: the references are the only colour on the page. */
|
|
280
|
-
:root { --canvas: #f3f2ef; --paper: #ffffff; --ink: #1c1c1a; --muted: #6f6c65; --line: #dedbd4; --soft: #e9e7e2; --panel: 380px; }
|
|
281
|
-
* { box-sizing: border-box; }
|
|
282
|
-
html { color-scheme: light; scroll-padding-top: 76px; }
|
|
283
|
-
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
|
|
284
|
-
main { max-width: 1680px; margin: 0 auto; padding: 0 28px 160px; }
|
|
285
|
-
body[data-open] main { margin-right: calc(var(--panel) + 28px); }
|
|
286
|
-
header { padding: 22px 2px 2px; }
|
|
287
|
-
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
|
288
|
-
.brand img { height: 44px; width: auto; display: block; }
|
|
289
|
-
.brand span { font-size: 16px; font-weight: 600; }
|
|
290
|
-
h1 { margin: 0; font-size: 16px; font-weight: 400; color: var(--muted); }
|
|
291
|
-
h1::before { content: "/"; margin-right: 10px; color: var(--line); }
|
|
292
|
-
.how { margin: 0 0 6px; max-width: 900px; font-size: 13px; line-height: 1.5; color: var(--muted); }
|
|
293
|
-
.keys { white-space: nowrap; margin-left: 4px; }
|
|
294
|
-
kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--paper); color: var(--ink); }
|
|
295
|
-
/* Only the jump bar sticks, on one line that scrolls sideways, so thirty families never eat the screen. */
|
|
296
|
-
.sticky { position: sticky; top: 0; z-index: 2; background: var(--canvas); display: flex; align-items: center; gap: 12px; padding: 10px 2px; margin: 0 -2px; }
|
|
297
|
-
nav { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; flex: 1 1 auto; min-width: 0; scrollbar-width: thin; padding-bottom: 2px; }
|
|
298
|
-
nav a { white-space: nowrap; flex: none; }
|
|
299
|
-
nav a, .filters button { font-size: 13px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer; font-family: inherit; }
|
|
300
|
-
nav a span, h2 span { color: var(--muted); }
|
|
301
|
-
.filters { display: flex; gap: 6px; flex: none; }
|
|
302
|
-
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
|
|
303
|
-
section { margin-top: 26px; }
|
|
304
|
-
section[hidden] { display: none; }
|
|
305
|
-
h2 { margin: 0 0 12px 2px; font-size: 15px; font-weight: 600; }
|
|
306
|
-
/* A masonry: every shot at its own proportions, a tall page cut at its top. */
|
|
307
|
-
.grid { columns: 4 260px; column-gap: 14px; }
|
|
308
|
-
.tile { margin: 0 0 14px; break-inside: avoid; display: block; }
|
|
309
|
-
.tile[hidden] { display: none; }
|
|
310
|
-
.frame { position: relative; border-radius: 6px; overflow: hidden; background: var(--soft); cursor: zoom-in; outline: 2px solid transparent; outline-offset: 2px; }
|
|
311
|
-
.frame img { width: 100%; height: auto; max-height: 640px; object-fit: cover; object-position: top center; display: block; }
|
|
312
|
-
.tile[aria-current="true"] .frame { outline-color: var(--ink); }
|
|
313
|
-
.tile[data-state="no"] .frame img { opacity: 0.25; filter: grayscale(1); }
|
|
314
|
-
.id, .clock, .play, .badge { position: absolute; font-size: 11px; line-height: 1.5; padding: 1px 7px; border-radius: 4px; }
|
|
315
|
-
.id { top: 8px; left: 8px; font-family: ui-monospace, Menlo, monospace; background: rgba(255,255,255,0.88); color: var(--ink); pointer-events: none; }
|
|
316
|
-
.badge { top: 8px; right: 8px; font-weight: 600; border-radius: 999px; pointer-events: none; }
|
|
317
|
-
.badge:empty { display: none; }
|
|
318
|
-
.tile[data-state="lead"] .badge { background: var(--ink); color: var(--paper); }
|
|
319
|
-
.tile[data-state="like"] .badge { background: var(--paper); color: var(--ink); }
|
|
320
|
-
.tile[data-state="no"] .badge { background: var(--soft); color: var(--muted); }
|
|
321
|
-
.play { bottom: 8px; left: 8px; border: 0; cursor: pointer; font-family: inherit; font-weight: 600; background: rgba(0,0,0,0.65); color: #fff; }
|
|
322
|
-
.clock { bottom: 8px; right: 8px; pointer-events: none; background: rgba(0,0,0,0.65); color: #fff; }
|
|
323
|
-
.clock:empty { display: none; }
|
|
324
|
-
/* The notes of the open card only, in a side panel. */
|
|
325
|
-
figcaption { display: none; }
|
|
326
|
-
.tile[aria-current="true"] figcaption { display: flex; flex-direction: column; gap: 10px; position: fixed; z-index: 4; top: 16px; right: 16px; bottom: 96px; width: var(--panel); overflow-y: auto; padding: 16px; background: var(--paper); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.08); }
|
|
327
|
-
.big { display: block; border-radius: 4px; overflow: hidden; background: var(--soft); cursor: zoom-in; }
|
|
328
|
-
.big img { width: 100%; max-height: 52vh; object-fit: contain; display: block; }
|
|
329
|
-
.close { align-self: flex-end; font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; margin-bottom: -4px; }
|
|
330
|
-
.also { display: flex; gap: 6px; overflow-x: auto; }
|
|
331
|
-
.sib { flex: none; width: 76px; text-decoration: none; color: var(--muted); font-size: 11px; }
|
|
332
|
-
.sib img { width: 76px; height: 54px; object-fit: cover; object-position: top; border-radius: 3px; display: block; border: 1px solid var(--line); }
|
|
333
|
-
.name { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
|
|
334
|
-
a.name:hover { text-decoration: underline; }
|
|
335
|
-
.line { margin: -4px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
|
|
336
|
-
.measured { margin: -6px 0 0; font-size: 11px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
337
|
-
.liked, .avoided { margin: -4px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink); }
|
|
338
|
-
[data-overview] .liked, [data-overview] .avoided { display: none; }
|
|
339
|
-
.marks { display: flex; gap: 6px; }
|
|
340
|
-
.marks button { flex: 1; font: inherit; font-size: 13px; font-weight: 500; padding: 7px 0; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
|
|
341
|
-
.marks button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
|
|
342
|
-
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, .frame:focus-visible { outline: 2px solid #2f6fdb; outline-offset: 2px; }
|
|
343
|
-
.why, .avoid { font: inherit; font-size: 13px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
|
|
344
|
-
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; background: var(--paper); border-top: 1px solid var(--line); }
|
|
345
|
-
.bar-in { max-width: 1680px; margin: 0 auto; padding: 10px 28px; display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 12px; align-items: end; }
|
|
346
|
-
.bar label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
|
|
347
|
-
.bar textarea { width: 100%; font: 12px/1.4 ui-monospace, Menlo, monospace; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; height: 46px; }
|
|
348
|
-
#note { font-family: inherit; font-size: 13px; }
|
|
349
|
-
#out { background: var(--canvas); }
|
|
350
|
-
.side { display: flex; align-items: center; gap: 12px; }
|
|
351
|
-
#count { font-size: 13px; color: var(--muted); white-space: nowrap; }
|
|
352
|
-
[data-overview] .marks, [data-overview] .why, [data-overview] .avoid, [data-overview] .filters { display: none; }
|
|
353
|
-
.ranges { margin: -6px 0 10px 2px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
354
|
-
.take { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px 2px; }
|
|
355
|
-
.fam-note { flex: 1 1 260px; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; }
|
|
356
|
-
.more { font-size: 13px; color: var(--muted); }
|
|
357
|
-
#copy { font: inherit; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 6px; border: 0; background: var(--ink); color: var(--paper); cursor: pointer; white-space: nowrap; }
|
|
358
|
-
@media (max-width: 900px) {
|
|
359
|
-
body[data-open] main { margin-right: auto; }
|
|
360
|
-
main { padding: 0 16px 220px; }
|
|
361
|
-
.tile[aria-current="true"] figcaption { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; border-radius: 12px 12px 0 0; }
|
|
362
|
-
.bar-in { grid-template-columns: 1fr; padding: 10px 16px; } .sticky { flex-wrap: wrap; } nav { flex-basis: 100%; }
|
|
363
|
-
}
|
|
364
|
-
</style>
|
|
365
|
-
</head>
|
|
366
|
-
<body${overview ? " data-overview" : ""}>
|
|
367
|
-
<main>
|
|
368
|
-
<header>
|
|
369
|
-
<div class="brand"><img src="data:image/png;base64,${LOGO}" alt="" width="21" height="44"><span>Long Beard</span><h1>${overview ? "Families" : "Moodboard"}</h1></div>
|
|
370
|
-
${overview ? `<p class="how">Each family shows its most typical ${overview}. Every family stays on your board; this only checks the sorting. Note a family that looks like two, or that belongs with another.</p>` : ""}
|
|
371
|
-
<p class="how"${overview ? " hidden" : ""}>Open a picture to mark it: Lead what should set the tone (${oneLead ? "one on the whole board" : "one per group: a part, or a direction"}), Like what belongs, No what feels wrong. In each like, say what you like and why, and what to leave out of it. A tile in the wrong group gets the note "move to" and the group's name. <span class="keys"><kbd>L</kbd> lead <kbd>K</kbd> like <kbd>N</kbd> no <kbd>←</kbd><kbd>→</kbd> move <kbd>Esc</kbd> close</span></p>
|
|
372
|
-
</header>
|
|
373
|
-
<div class="sticky">
|
|
374
|
-
<nav aria-label="Parts">${jump}</nav>
|
|
375
|
-
<div class="filters" role="group" aria-label="Show">
|
|
376
|
-
<button type="button" data-show="all" aria-pressed="true">All</button>
|
|
377
|
-
<button type="button" data-show="open" aria-pressed="false">Not marked</button>
|
|
378
|
-
<button type="button" data-show="marked" aria-pressed="false">Marked</button>
|
|
379
|
-
</div>
|
|
380
|
-
</div>
|
|
381
|
-
${body}
|
|
382
|
-
</main>
|
|
383
|
-
<div class="bar">
|
|
384
|
-
<div class="bar-in">
|
|
385
|
-
<div><label for="note">Overall, in your words (optional)</label><textarea id="note" placeholder="What the board says, what is missing, what to leave behind"></textarea></div>
|
|
386
|
-
<div><label for="out">Copy this into the chat</label><textarea id="out" readonly></textarea></div>
|
|
387
|
-
<div class="side"><span id="count"></span><button type="button" id="copy">Copy picks</button></div>
|
|
388
|
-
</div>
|
|
389
|
-
</div>
|
|
390
|
-
<script>
|
|
391
|
-
(() => {
|
|
392
|
-
const key = "longbeard-moodboard:" + location.pathname;
|
|
393
|
-
const tiles = [...document.querySelectorAll(".tile")];
|
|
394
|
-
const note = document.getElementById("note");
|
|
395
|
-
const out = document.getElementById("out");
|
|
396
|
-
const count = document.getElementById("count");
|
|
397
|
-
let saved = {};
|
|
398
|
-
try { saved = JSON.parse(localStorage.getItem(key) || "{}"); } catch (e) { saved = {}; }
|
|
399
|
-
// Saved under the card's name, so a card added or dropped and the board
|
|
400
|
-
// rebuilt never moves a mark. A mark an earlier board saved under a running
|
|
401
|
-
// number and the name is still read.
|
|
402
|
-
const tag = (t) => t.dataset.key;
|
|
403
|
-
const old = (t) => t.dataset.id + "|" + t.dataset.title;
|
|
404
|
-
const marks = saved.marks || {};
|
|
405
|
-
const notes = saved.notes || {};
|
|
406
|
-
const avoids = saved.avoids || {};
|
|
407
|
-
const oneLead = ${oneLead};
|
|
408
|
-
const read = (from, t) => (tag(t) in from ? from[tag(t)] : from[old(t)]) || "";
|
|
409
|
-
note.value = saved.note || "";
|
|
410
|
-
const has = (from, t) => tag(t) in from || old(t) in from;
|
|
411
|
-
for (const t of tiles) {
|
|
412
|
-
const mark = read(marks, t);
|
|
413
|
-
// A like from the picker is already a like: it starts marked, until they change it.
|
|
414
|
-
if (mark) t.dataset.state = mark;
|
|
415
|
-
else if (t.dataset.like && !has(marks, t)) t.dataset.state = "like";
|
|
416
|
-
// Their words from the picker fill the note until they change it; a note they cleared stays cleared.
|
|
417
|
-
t.querySelector(".why").value = has(notes, t) ? read(notes, t) : t.dataset.like || "";
|
|
418
|
-
t.querySelector(".avoid").value = has(avoids, t) ? read(avoids, t) : t.dataset.avoid || "";
|
|
419
|
-
}
|
|
420
|
-
let show = "all";
|
|
421
|
-
const short = (s) => (s.length > 48 ? s.slice(0, 47) + "…" : s);
|
|
422
|
-
const label = (t) => t.dataset.id + " " + short(t.dataset.title) + " (" + t.dataset.topic + ")";
|
|
423
|
-
const list = (state) => tiles.filter((t) => t.dataset.state === state).map(label);
|
|
424
|
-
const famNotes = [...document.querySelectorAll(".fam-note")];
|
|
425
|
-
for (const i of famNotes) i.value = (saved.famNotes || {})[i.dataset.family] || "";
|
|
426
|
-
function renderFamilies() {
|
|
427
|
-
const lines = ["Family notes"];
|
|
428
|
-
const written = famNotes.filter((i) => i.value.trim());
|
|
429
|
-
for (const i of written) lines.push("- " + i.dataset.family + ": " + i.value.trim().replace(/\\s+/g, " "));
|
|
430
|
-
if (!written.length) lines.push("none: the sorting holds");
|
|
431
|
-
if (note.value.trim()) lines.push("note: " + note.value.trim().replace(/\\s+/g, " "));
|
|
432
|
-
out.value = lines.join("\\n");
|
|
433
|
-
count.textContent = famNotes.length + " families · " + written.length + " noted";
|
|
434
|
-
const keep = {};
|
|
435
|
-
for (const i of written) keep[i.dataset.family] = i.value;
|
|
436
|
-
try { localStorage.setItem(key, JSON.stringify({ famNotes: keep, note: note.value })); } catch (e) {}
|
|
437
|
-
}
|
|
438
|
-
for (const i of famNotes) i.addEventListener("input", () => render());
|
|
439
|
-
function render() {
|
|
440
|
-
if (famNotes.length) return renderFamilies();
|
|
441
|
-
const lines = ["Moodboard picks", "lead: " + (list("lead").join("; ") || "none"), "like: " + (list("like").join("; ") || "none"), "no: " + (list("no").join("; ") || "none")];
|
|
442
|
-
const written = tiles.filter((t) => t.querySelector(".why").value.trim());
|
|
443
|
-
if (written.length) {
|
|
444
|
-
lines.push("notes:");
|
|
445
|
-
for (const t of written) lines.push("- " + t.dataset.id + " " + short(t.dataset.title) + ": " + t.querySelector(".why").value.trim().replace(/\\s+/g, " "));
|
|
446
|
-
}
|
|
447
|
-
const left = tiles.filter((t) => t.querySelector(".avoid").value.trim());
|
|
448
|
-
if (left.length) {
|
|
449
|
-
lines.push("leave out:");
|
|
450
|
-
for (const t of left) lines.push("- " + t.dataset.id + " " + short(t.dataset.title) + ": " + t.querySelector(".avoid").value.trim().replace(/\\s+/g, " "));
|
|
451
|
-
}
|
|
452
|
-
if (note.value.trim()) lines.push("note: " + note.value.trim().replace(/\\s+/g, " "));
|
|
453
|
-
out.value = lines.join("\\n");
|
|
454
|
-
const marked = tiles.filter((t) => t.dataset.state).length;
|
|
455
|
-
count.textContent = list("lead").length + " lead · " + list("like").length + " like · " + list("no").length + " no · " + (tiles.length - marked) + " open";
|
|
456
|
-
const keepMarks = {};
|
|
457
|
-
const keepNotes = {};
|
|
458
|
-
const keepAvoids = {};
|
|
459
|
-
for (const t of tiles) {
|
|
460
|
-
const s = t.dataset.state || "";
|
|
461
|
-
for (const b of t.querySelectorAll(".marks button")) b.setAttribute("aria-pressed", b.dataset.mark === s ? "true" : "false");
|
|
462
|
-
t.querySelector(".badge").textContent = s ? s.charAt(0).toUpperCase() + s.slice(1) : "";
|
|
463
|
-
t.hidden = !(show === "all" || (show === "open" ? !s : !!s));
|
|
464
|
-
// A like from the picker that they unmarked is saved as unmarked, so it does not come back.
|
|
465
|
-
if (s || t.dataset.like) keepMarks[tag(t)] = s;
|
|
466
|
-
const w = t.querySelector(".why").value;
|
|
467
|
-
if (w.trim() || t.dataset.like) keepNotes[tag(t)] = w;
|
|
468
|
-
const a = t.querySelector(".avoid").value;
|
|
469
|
-
if (a.trim() || t.dataset.avoid) keepAvoids[tag(t)] = a;
|
|
470
|
-
}
|
|
471
|
-
for (const sec of document.querySelectorAll("section")) sec.hidden = ![...sec.querySelectorAll(".tile")].some((t) => !t.hidden);
|
|
472
|
-
try { localStorage.setItem(key, JSON.stringify({ marks: keepMarks, notes: keepNotes, avoids: keepAvoids, note: note.value })); } catch (e) {}
|
|
473
|
-
}
|
|
474
|
-
for (const t of tiles) {
|
|
475
|
-
for (const b of t.querySelectorAll(".marks button")) {
|
|
476
|
-
b.addEventListener("click", () => {
|
|
477
|
-
const mark = b.dataset.mark;
|
|
478
|
-
if (t.dataset.state === mark) delete t.dataset.state;
|
|
479
|
-
else {
|
|
480
|
-
// One lead per group (a piece), or on the whole board with --one-lead: a new lead turns the old one into a like.
|
|
481
|
-
if (mark === "lead") for (const o of tiles) if (o !== t && (oneLead || o.dataset.topic === t.dataset.topic) && o.dataset.state === "lead") o.dataset.state = "like";
|
|
482
|
-
t.dataset.state = mark;
|
|
483
|
-
}
|
|
484
|
-
render();
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
t.querySelector(".why").addEventListener("input", render);
|
|
488
|
-
t.querySelector(".avoid").addEventListener("input", render);
|
|
489
|
-
}
|
|
490
|
-
for (const b of document.querySelectorAll(".filters button")) {
|
|
491
|
-
b.addEventListener("click", () => {
|
|
492
|
-
show = b.dataset.show;
|
|
493
|
-
for (const o of document.querySelectorAll(".filters button")) o.setAttribute("aria-pressed", o === b ? "true" : "false");
|
|
494
|
-
render();
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
note.addEventListener("input", render);
|
|
498
|
-
// Recorded frames play at the times they were taken, on hover or on Play.
|
|
499
|
-
for (const t of tiles) {
|
|
500
|
-
if (!t.dataset.frames) continue;
|
|
501
|
-
const frames = JSON.parse(t.dataset.frames);
|
|
502
|
-
const img = t.querySelector(".frame img");
|
|
503
|
-
const clock = t.querySelector(".clock");
|
|
504
|
-
const button = t.querySelector(".play");
|
|
505
|
-
const poster = img.getAttribute("src");
|
|
506
|
-
let timer = 0;
|
|
507
|
-
let playing = false;
|
|
508
|
-
for (const f of frames) new Image().src = f.src;
|
|
509
|
-
const stop = () => {
|
|
510
|
-
clearTimeout(timer);
|
|
511
|
-
playing = false;
|
|
512
|
-
img.src = poster;
|
|
513
|
-
clock.textContent = "";
|
|
514
|
-
button.textContent = "Play";
|
|
515
|
-
};
|
|
516
|
-
const step = (i) => {
|
|
517
|
-
img.src = frames[i].src;
|
|
518
|
-
clock.textContent = (frames[i].ms / 1000).toFixed(1) + " s";
|
|
519
|
-
const next = (i + 1) % frames.length;
|
|
520
|
-
const wait = next ? Math.max(80, frames[next].ms - frames[i].ms) : 1200;
|
|
521
|
-
timer = setTimeout(() => step(next), wait);
|
|
522
|
-
};
|
|
523
|
-
const start = () => {
|
|
524
|
-
if (playing) return;
|
|
525
|
-
playing = true;
|
|
526
|
-
button.textContent = "Stop";
|
|
527
|
-
step(0);
|
|
528
|
-
};
|
|
529
|
-
button.addEventListener("click", () => (playing ? stop() : start()));
|
|
530
|
-
// Hover plays only for people who have not asked for less motion; Play always works.
|
|
531
|
-
if (!matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
532
|
-
t.querySelector(".frame").addEventListener("mouseenter", start);
|
|
533
|
-
t.querySelector(".frame").addEventListener("mouseleave", stop);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
// One card open at a time: its notes in the side panel, its shot loaded large only then.
|
|
537
|
-
let current = null;
|
|
538
|
-
const body = document.body;
|
|
539
|
-
function open(t) {
|
|
540
|
-
if (current) current.setAttribute("aria-current", "false");
|
|
541
|
-
current = t || null;
|
|
542
|
-
if (!current) {
|
|
543
|
-
if (body) delete body.dataset.open;
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
current.setAttribute("aria-current", "true");
|
|
547
|
-
const big = current.querySelector(".big img");
|
|
548
|
-
if (big && big.dataset && big.dataset.src && !big.getAttribute("src")) big.setAttribute("src", big.dataset.src);
|
|
549
|
-
if (body) body.dataset.open = "";
|
|
550
|
-
if (current.scrollIntoView) current.scrollIntoView({ block: "nearest" });
|
|
551
|
-
}
|
|
552
|
-
for (const t of tiles) {
|
|
553
|
-
t.querySelector(".frame").addEventListener("click", (e) => {
|
|
554
|
-
if (e && e.target && e.target.closest && e.target.closest(".play")) return;
|
|
555
|
-
open(current === t ? null : t);
|
|
556
|
-
});
|
|
557
|
-
t.querySelector(".close").addEventListener("click", () => open(null));
|
|
558
|
-
}
|
|
559
|
-
if (document.addEventListener) {
|
|
560
|
-
document.addEventListener("keydown", (e) => {
|
|
561
|
-
const typing = e.target && /^(INPUT|TEXTAREA)$/.test(e.target.tagName);
|
|
562
|
-
if (e.key === "Escape") {
|
|
563
|
-
if (typing) e.target.blur();
|
|
564
|
-
open(null);
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
if (typing || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
568
|
-
const k = e.key.toLowerCase();
|
|
569
|
-
if ((k === "enter" || k === " ") && e.target && e.target.classList && e.target.classList.contains("frame")) {
|
|
570
|
-
e.preventDefault();
|
|
571
|
-
e.target.click();
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
if (k === "arrowright" || k === "arrowleft") {
|
|
575
|
-
const shown = tiles.filter((t) => !t.hidden);
|
|
576
|
-
if (!shown.length) return;
|
|
577
|
-
const at = shown.indexOf(current);
|
|
578
|
-
e.preventDefault();
|
|
579
|
-
open(shown[at === -1 ? 0 : (at + (k === "arrowright" ? 1 : -1) + shown.length) % shown.length]);
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
const mark = { l: "lead", k: "like", n: "no" }[k];
|
|
583
|
-
if (mark && current && body && !body.hasAttribute("data-overview")) {
|
|
584
|
-
e.preventDefault();
|
|
585
|
-
current.querySelector('.marks [data-mark="' + mark + '"]').click();
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
// The text box is the real path: the clipboard API can be refused on a file:// page.
|
|
590
|
-
document.getElementById("copy").addEventListener("click", async (e) => {
|
|
591
|
-
out.focus();
|
|
592
|
-
out.select();
|
|
593
|
-
let ok = false;
|
|
594
|
-
try { await navigator.clipboard.writeText(out.value); ok = true; } catch (err) {}
|
|
595
|
-
if (!ok) { try { ok = document.execCommand("copy"); } catch (err) {} }
|
|
596
|
-
e.target.textContent = ok ? "Copied" : "Selected, press Cmd/Ctrl+C";
|
|
597
|
-
setTimeout(() => { e.target.textContent = "Copy picks"; }, 1800);
|
|
598
|
-
});
|
|
599
|
-
render();
|
|
600
|
-
})();
|
|
601
|
-
</script>
|
|
602
|
-
</body>
|
|
603
|
-
</html>
|
|
604
|
-
`;
|
|
605
|
-
|
|
606
|
-
mkdirSync(dirname(outPath), { recursive: true });
|
|
607
|
-
writeFileSync(outPath, html);
|
|
608
|
-
console.error(`moodboard: ${n} tiles in ${ordered.length} parts${cards.length > n ? `, ${cards.length - n} of ${cards.length} cards left out for a missing shot` : ""}`);
|
|
609
|
-
console.log(outArg);
|