@jonandev/longbeard 0.6.0 → 0.8.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.
@@ -0,0 +1,74 @@
1
+ # Sources: what to keep, and how to get the shot
2
+
3
+ A nominee is not a reference. Open it full size and drop anything weak before it goes on the board. A weak pass means fewer keeps, not a lower bar.
4
+
5
+ ## Galleries
6
+
7
+ - **Awwwards.** Open the site page, not the listing card. Keep Site of the Day, Month, or Year, or an Honorable Mention with overall and Design ≥ 7.5. Drop any 4s, and any gate or password wall.
8
+ - **Godly, Land-book, siteinspire, MaxiBestOf, Recent.** These are curated, not scored. Keep a live page with one clear idea: a crop, a component, or an arrangement. Drop generic SaaS (centred headline, three icon cards, soft gradient, Inter). MaxiBestOf sections and Supahero crops are pieces, not sites.
9
+ - **Dark Mode Design.** Only when the look is dark.
10
+ - **Muzli.** Only a way to reach the original, which then has to pass its own test.
11
+ - **Pinterest.** Keep a pin that is one real screen or page. Drop boards, collages, and AI mush. If you hit a login wall, write `Pinterest: login wall` under `Sources:` and move on.
12
+ - **Mobbin, Refero.** Shipped screens, often behind a login. Handle a login wall the same way.
13
+
14
+ ## Dribbble
15
+
16
+ Listing pages render in the browser, and shot pages hit human verification. Use the script on a popular listing for this year:
17
+
18
+ ```
19
+ node <skill>/scripts/dribbble-cards.mjs "https://dribbble.com/search/shots/popular/product-design?q=text+editor+screen&timeframe=year" --scrolls 4
20
+ ```
21
+
22
+ It prints `id-slug`, likes, views, image URL, and title. It drops merch, CVs, worksheets, posters, logos, and tool ads by slug and title. Extend that list with `--drop "a,b"` and relax it with `--keep "a,b"`. Download artwork from `cdn.dribbble.com` (`<url>?resize=1600x1200`).
23
+
24
+ - Use a category path and the form, not the word: `/product-design?q=…`, `/mobile?q=…`, `/web-design?q=…`.
25
+ - If most of what gets through is off-form, the query is wrong. Fix the query rather than scrolling further.
26
+ - Run one query at a time. If a query returns 0 cards, retry after 8 s, then 30 s. If it is still 0, note it under `Sources:` as a possible rate limit.
27
+ - Keep a shot when you can name what is worth taking in one line, and people actually saved it. Drop AI mush, fake browser chrome, purple-on-dark gradients, Inter everywhere, and emoji icons.
28
+ - A Dribbble illustration is imagery, never a site.
29
+
30
+ ## Cropping a downloaded image
31
+
32
+ To crop a picture you already have (a screen inside a marketing frame, a type specimen):
33
+
34
+ ```
35
+ node <skill>/scripts/capture.mjs "file://<abs path to image>" --out .design/refs/<name>.jpg --clip x,y,w,h
36
+ ```
37
+
38
+ `--clip` is in the image's own pixels.
39
+
40
+ ## Imagery
41
+
42
+ Search the subject, not a stock category. One real place or material beats a pile of similar ones. Zero imagery is a complete answer.
43
+
44
+ - **Unsplash.** On the search page, read `figure a[href*="/photos/"] img`. Take its `src` up to the `?` and download `<src>?w=1600&q=80`. The photo page is the `url`.
45
+ - **Wikimedia Commons.** Query the API with `-A "<project>-hunt/0.1"`, `prop=imageinfo&iiprop=url&iiurlwidth=1920`. Save `thumburl`. `descriptionurl` is the `url`.
46
+
47
+ ## Contact sheets
48
+
49
+ Viewing listing thumbnails is fine. It is not a capture. Build labelled grids in scratch, never under `.design/`:
50
+
51
+ ```
52
+ node <skill>/scripts/contact-sheet.mjs candidates.tsv --out <scratch>/sheets # TSV: label<TAB>imageURL
53
+ ```
54
+
55
+ ## Capture a live page
56
+
57
+ Only for a keep, run from the project root:
58
+
59
+ ```
60
+ node <skill>/scripts/capture.mjs <url> --out .design/refs/<name>.jpg
61
+ ```
62
+
63
+ The script dismisses cookie banners, scrolls so reveals load, unsticks fixed headers, and takes one full-page JPEG. Node 22+ and an installed Chrome are required (set `CHROME_PATH` if Chrome is somewhere unusual). Options:
64
+
65
+ - `--review <scratch>/x.jpg` writes a readable side-by-side version of a tall page.
66
+ - `--clip-selector "main"` or `--clip x,y,w,h` crops to a type specimen.
67
+
68
+ Open the file. Delete it and run again if it repeats a band, still shows a cookie dialog, or is mostly empty. If a page will not scroll (WebGL, a locked canvas), keep one viewport and say so on the card. Never stitch screenshots.
69
+
70
+ ## Colour and type
71
+
72
+ - **Colour.** Sample hexes from a crop of the element named (body text, active tab), never from a photo, a mockup frame, or a presentation background. Card hexes are what we saw, not the brand.
73
+ - **Contrast.** Check pairs with `node <skill>/scripts/contrast.mjs "#2c2824 on #f6f1e7" "#b0563a on #f6f1e7:mark"`. `:large` and `:mark` check 3:1. A failing pair is written as `sampled → used`.
74
+ - **Type.** A face's licence has to cover how this ships: bundled in an app, self-hosted web, or default UI. Set it at real sizes before you pick it. Check that the italic reads at quote size and that its figures suit where numbers sit.
@@ -7,6 +7,7 @@
7
7
  // node capture.mjs <url> --out .design/refs/name.jpg --clip x,y,w,h
8
8
  // node capture.mjs <url> --out .design/refs/name.jpg --clip-selector "main"
9
9
  // node capture.mjs file:///abs/path/moodboard.html --out /tmp/moodboard.jpg
10
+ // node capture.mjs file:///abs/path/shot.jpg --out .design/refs/name.jpg --clip x,y,w,h
10
11
  import { spawn, execSync } from "node:child_process";
11
12
  import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
12
13
  import { tmpdir } from "node:os";
@@ -200,7 +201,14 @@ await page("Emulation.setDeviceMetricsOverride", {
200
201
  deviceScaleFactor: 1,
201
202
  mobile: false,
202
203
  });
203
- await page("Page.navigate", { url }, 40000);
204
+ // Chrome centres an image file and shrinks it to the window. A page that holds
205
+ // it at full size from 0,0 makes --clip x,y,w,h the image's own pixels.
206
+ let target = url;
207
+ if (/^file:\/\/.*\.(png|jpe?g|webp|gif)$/i.test(url)) {
208
+ target = `file://${join(dir, "image.html")}`;
209
+ writeFileSync(join(dir, "image.html"), `<!doctype html><body style="margin:0;background:#000"><img src="${url.replace(/"/g, "%22")}" style="display:block">`);
210
+ }
211
+ await page("Page.navigate", { url: target }, 40000);
204
212
  await sleep(2500);
205
213
 
206
214
  const beforeHref = (
@@ -348,11 +356,13 @@ const shotClip = clipBox
348
356
  }
349
357
  : { x: 0, y: 0, width: fullWidth, height: fullHeight, scale: 1 };
350
358
 
359
+ // The file is what its name says, so a reader that trusts the extension is right.
360
+ const format = /\.png$/i.test(out) ? "png" : /\.webp$/i.test(out) ? "webp" : "jpeg";
351
361
  const { data } = await page(
352
362
  "Page.captureScreenshot",
353
363
  {
354
- format: "jpeg",
355
- quality: 70,
364
+ format,
365
+ ...(format === "png" ? {} : { quality: 70 }),
356
366
  captureBeyondViewport: true,
357
367
  clip: shotClip,
358
368
  },
@@ -369,7 +379,7 @@ if (reviewOut) {
369
379
  const reviewHtml = `<!doctype html><meta charset=utf-8>
370
380
  <canvas id=c></canvas>
371
381
  <script>
372
- const src = "data:image/jpeg;base64,${data}";
382
+ const src = "data:image/${format};base64,${data}";
373
383
  const img = new Image();
374
384
  img.onload = () => {
375
385
  const colH = 2800;
@@ -411,7 +421,7 @@ img.src = src;
411
421
  const { data: reviewData } = await page(
412
422
  "Page.captureScreenshot",
413
423
  {
414
- format: "jpeg",
424
+ format: /\.png$/i.test(reviewOut) ? "png" : "jpeg",
415
425
  quality: 75,
416
426
  clip: { x: 0, y: 0, width: sizeResult.value.w, height: sizeResult.value.h, scale: 1 },
417
427
  captureBeyondViewport: true,
@@ -37,9 +37,10 @@ const lines = readFileSync(tsvPath, "utf8")
37
37
  .map((l) => l.trim())
38
38
  .filter(Boolean)
39
39
  .map((l) => {
40
- const tab = l.indexOf("\t");
41
- if (tab === -1) return { label: l, url: l };
42
- return { label: l.slice(0, tab).trim(), url: l.slice(tab + 1).trim() };
40
+ // label\timageURL, and any columns after that (a listing URL) are ignored.
41
+ const cols = l.split("\t").map((c) => c.trim());
42
+ if (cols.length === 1) return { label: l, url: l };
43
+ return { label: cols[0], url: cols[1] };
43
44
  })
44
45
  .filter((r) => /^https?:\/\//i.test(r.url));
45
46
 
@@ -47,6 +47,10 @@ const OFF_TOPIC = [
47
47
  "logo", "logotype", "branding", "brand identity", "packaging",
48
48
  "poster", "book cover", "sticker", "mockup",
49
49
  "chatbot", "mood tracker", "habit tracker",
50
+ // "Editor" on Dribbble is mostly code, video, and photo tools and AI products.
51
+ "video editor", "photo editor", "code editor", "ide",
52
+ "agent", "assistant", "copilot", "generator",
53
+ "dashboard", "saas", "crm",
50
54
  ];
51
55
  const keep = words(flag("keep", ""));
52
56
  const dropWords = [...OFF_TOPIC.filter((w) => !keep.includes(w)), ...words(flag("drop", ""))];