@jonandev/longbeard 0.12.2 → 0.14.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.
Files changed (61) hide show
  1. package/AGENTS.md +5 -6
  2. package/CHANGELOG.md +51 -0
  3. package/README.md +3 -4
  4. package/beard.json +6 -20
  5. package/bin/long-beard.js +2 -2
  6. package/package.json +2 -2
  7. package/skills/design/SKILL.md +21 -37
  8. package/skills/design-brief/SKILL.md +7 -5
  9. package/skills/design-check/SKILL.md +1 -1
  10. package/skills/design-check/references/design-rules.md +28 -5
  11. package/skills/design-check/scripts/rules.mjs +143 -9
  12. package/skills/design-content/SKILL.md +2 -0
  13. package/skills/design-direction/SKILL.md +87 -95
  14. package/skills/design-direction/references/design-floor.md +118 -0
  15. package/skills/design-direction/references/graphic.md +5 -10
  16. package/skills/design-direction/references/library.md +8 -6
  17. package/skills/design-direction/references/screen-template.html +3 -3
  18. package/skills/design-direction/references/subject.md +2 -2
  19. package/skills/design-direction/references/variants.js +43 -0
  20. package/skills/design-direction/scripts/canvas.mjs +311 -0
  21. package/skills/design-direction/scripts/colours.mjs +247 -0
  22. package/skills/design-direction/scripts/moodboard.mjs +233 -93
  23. package/skills/design-direction/scripts/rules.mjs +747 -0
  24. package/skills/design-direction/scripts/sheet.mjs +3 -1
  25. package/skills/design-figma/SKILL.md +3 -1
  26. package/skills/design-identity/SKILL.md +17 -8
  27. package/skills/{design-direction → design-identity}/references/controls.md +10 -10
  28. package/skills/design-identity/references/design-floor.md +118 -0
  29. package/skills/design-identity/references/identity-board.html +2 -2
  30. package/skills/design-identity/scripts/colours.mjs +35 -1
  31. package/skills/design-identity/scripts/sheet.mjs +3 -1
  32. package/skills/design-moodboard/SKILL.md +44 -76
  33. package/skills/design-moodboard/references/graphic.md +1 -1
  34. package/skills/design-moodboard/references/sources.md +12 -1
  35. package/skills/design-moodboard/scripts/group.mjs +1 -1
  36. package/skills/design-moodboard/scripts/moodboard.mjs +233 -93
  37. package/skills/design-prototype/SKILL.md +66 -82
  38. package/skills/design-prototype/references/design-floor.md +118 -0
  39. package/skills/design-prototype/references/design-md-template.md +3 -0
  40. package/skills/design-prototype/references/graphic.md +6 -5
  41. package/skills/design-prototype/references/variants.js +43 -0
  42. package/skills/design-prototype/scripts/drift.mjs +273 -0
  43. package/skills/design-prototype/scripts/links.mjs +5 -4
  44. package/skills/design-prototype/scripts/rules.mjs +143 -9
  45. package/skills/design-prototype/scripts/sheet.mjs +3 -1
  46. package/skills/design-wordmark/SKILL.md +8 -2
  47. package/skills/design-wordmark/scripts/sheet.mjs +3 -1
  48. package/skills/idea/SKILL.md +3 -3
  49. package/skills/design-direction/references/design-rules.md +0 -203
  50. package/skills/design-direction/references/five-second.md +0 -47
  51. package/skills/design-direction/references/full-build.md +0 -19
  52. package/skills/design-direction/references/grid.md +0 -114
  53. package/skills/design-direction/scripts/layout-diff.mjs +0 -118
  54. package/skills/design-families/SKILL.md +0 -138
  55. package/skills/design-families/scripts/contact-sheet.mjs +0 -259
  56. package/skills/design-families/scripts/families.mjs +0 -607
  57. package/skills/design-families/scripts/measure.mjs +0 -1728
  58. package/skills/design-families/scripts/moodboard.mjs +0 -469
  59. package/skills/design-families/scripts/tag.mjs +0 -289
  60. package/skills/design-prototype/references/design-rules.md +0 -203
  61. package/skills/design-prototype/references/five-second.md +0 -47
@@ -0,0 +1,118 @@
1
+ # Design floor
2
+
3
+ Generated from `rules/design-rules.md` by `npm run share`: its opening sections and every hard check. The soft checks and the tells are `design-check`'s.
4
+
5
+ How a screen is checked. `design-check` reads all of it on every frame and build. The skills that build read only the floor (`design-floor.md`: these opening sections and every hard check), so a better model's craft is never held to a textbook while drawing.
6
+
7
+ These rules decide execution, never the look. The direction and `DESIGN.md` decide the look. A rule that seems to ask for a colour, a typeface or a style is misread. It asks only that whatever was chosen is used with intent.
8
+
9
+ ## Before you build
10
+
11
+ A studio applies these while drawing each screen, not as a check after. Each is the numbered rule's, said there.
12
+
13
+ - One most prominent element and one primary action (rule 1).
14
+ - Contrast where the text sits, over pictures too (rules 6 and 12).
15
+ - One picture leads; pictures that share the screen never compete (rule 12).
16
+ - Text size at its floor (rule 5).
17
+ - One grouping device per group (rule 2).
18
+ - Every screen follows the direction's principles (before the pick, their whys), and reads as the same product as the first.
19
+
20
+ ## How to use this
21
+
22
+ - Check from a screenshot. Every check below can be passed or failed by looking at a rendered screen at its real size. When a check needs a state you cannot see (focus, error, empty), it needs that state's frame, and a missing frame fails rule 8.
23
+ - Go in order: **Idea** first, then every **hard** check, then **soft**.
24
+ - **Hard** is the floor: structure, contrast, text size, targets, focus and states. A hard failure blocks the screen. `DESIGN.md` cannot waive it, except for what the person liked or asked for (below).
25
+ - **When the floor meets a liked concept:**
26
+ - Text a person acts on (body, labels, prices, fields, navigation, buttons): the floor wins. The fix comes from inside the concept: its own ink, another crop, a device the board already has. Never by moving the text off the concept or dropping the concept.
27
+ - Display and composition (giant type over a picture, overlaps, crops): the concept wins, and the fault is written down.
28
+ - A colour or a small size the person liked or asked for: kept, reported as a warning with its measure, not a block. Marked `WARN liked, kept` in `DESIGN.md`; on a page, small text is marked `data-board-size`.
29
+ - **Soft** is a default. `DESIGN.md` may override a soft check on purpose, with a written reason. A soft finding with no reason in `DESIGN.md` is reported, not blocked.
30
+ - A finding is four things: the rule (number and check), hard or soft, where on the screen, and the fix.
31
+ - The shared core applies to everything, except where the Graphics list says it does not. Then add the site, app or graphics list, whichever the brief's surface says.
32
+
33
+ ## 1. Hierarchy
34
+
35
+ **Principle:** the eye lands first on what matters most, then moves in the order the task needs.
36
+ - [hard] Exactly one element is the most prominent on the screen. Squint or blur the shot: one thing still stands out.
37
+ - [hard] The primary action is easier to find than any secondary action. If two actions look equally important, only one of them should be.
38
+
39
+ ## 2. Grouping
40
+
41
+ **Principle:** things that belong together look together, and things that do not are kept apart.
42
+ - [hard] The space between related items is clearly smaller than the space between groups. A label sits closer to its field than to the field above.
43
+
44
+ ## 3. Alignment and grid
45
+
46
+ **Principle:** every element sits on a line shared with something else.
47
+ - [hard] Left edges of text blocks in one column line up. No block is nudged a few pixels off its neighbours.
48
+
49
+ ## 5. Typography
50
+
51
+ **Principle:** a few sizes, far apart, set for reading.
52
+ - [hard] At the screen's real size, nothing is under 12px, text a person acts on (links, buttons, labels, fields, prices, navigation) is at least 14px, and body is 16px at every width. Where a reference sets smaller, keep its proportions and scale the step up.
53
+ - [hard] No text is clipped, overlapped, or cut mid-word by its container, in any language the product ships.
54
+
55
+ ## 6. Colour
56
+
57
+ **Principle:** colour carries meaning, and the meaning stays the same everywhere.
58
+ - [hard] Body text has a contrast ratio of at least 4.5:1 against its background. Large text (24px, or 18.66px bold, and up) and the visible parts of controls and icons have at least 3:1. When `DESIGN.md` or the design brief sets the level to AAA: 7:1 for body text and 4.5:1 for large text.
59
+ - [hard] Colour is never the only signal. An error, a selected item or a required field also changes shape, weight, an icon or text.
60
+ - [hard] A product with more than one theme has one set of colour tokens, with a value for each theme, and passes every check here in each theme. A colour that stays the same when the theme changes, and should not, fails.
61
+
62
+ ## 7. Consistency
63
+
64
+ **Principle:** the same thing looks and behaves the same everywhere.
65
+ - [hard] One action has one look. Two primary buttons on different screens are the same component, same size and same label case.
66
+
67
+ ## 8. States
68
+
69
+ **Principle:** every screen is shown in every state a person will meet.
70
+ - [hard] The screen has a frame for each of empty, loading and error that a person can reach, next to the default. A state nobody can reach is recorded as not needed, with the reason. A reachable state with no frame is a failure, not a later task.
71
+ - [hard] Empty says what goes here and gives the one action that fills it. Error says what went wrong in plain words and how to recover.
72
+ - [hard] Interactive components show hover (pointer surfaces), focus, pressed, disabled, and selected where they apply. Each state is visibly different from default.
73
+
74
+ ## 9. Affordance and feedback
75
+
76
+ **Principle:** what can be acted on looks like it, and every action visibly answers.
77
+ - [hard] Every interactive element looks interactive without hovering. Text links are distinct from body text by more than colour alone, unless their position makes them obvious (a nav bar).
78
+ - [hard] Nothing that looks interactive is not. A card that looks clickable is clickable, or loses the look.
79
+
80
+ ## 10. Accessibility
81
+
82
+ **Principle:** the screen works for people who see, move and read differently.
83
+ - [hard] The focused state of every interactive element shows a visible indicator with at least 3:1 contrast against what is around it. Check it in the focus frame.
84
+ - [hard] Targets are at least 24×24 CSS pixels, or have that much space around them (WCAG 2.2 AA). The app list raises this for touch.
85
+ - [hard] Every input has a visible label. A placeholder alone is not a label.
86
+ - [hard] Text is real text, not text in an image, except in logos.
87
+
88
+ ## 11. Copy
89
+
90
+ **Principle:** words do the job of the screen in the product's own voice, made from facts it has.
91
+ - [hard] No placeholder copy: no lorem ipsum, no "Title", no "Button", no "User Name".
92
+
93
+ ## 12. Imagery
94
+
95
+ **Principle:** pictures show the real thing, or there are none.
96
+ - [hard] Text over an image meets the contrast floor in rule 6 across the whole text area, not only on the darkest part.
97
+
98
+ ## 13. Responsive
99
+
100
+ **Principle:** each size is designed, not squeezed.
101
+ - [hard] At mobile width (360–390px) nothing scrolls sideways, nothing is clipped, and nothing overlaps.
102
+ - [hard] The primary action is reachable at every size without hunting: visible, or one obvious step away.
103
+
104
+ ## Sites
105
+
106
+ - [hard] The first screen at mobile and desktop says what this is and who it is for, without scrolling.
107
+
108
+ ## Apps
109
+
110
+ - [hard] Touch targets on touch platforms are at least 44×44 pt (Apple) or 48×48 dp (Material), whichever platform it ships on. The web floor in rule 10 still applies.
111
+ - [hard] The person always knows where they are: the current place in navigation is marked, and the screen title matches the nav item.
112
+
113
+ ## Graphics
114
+
115
+ - **Applies:** rules 0 to 3, 5, 6, 11, 12 and 14. Rule 4 holds for the margin and the gaps between groups. Rule 7 holds across the pieces of a set.
116
+ - **Does not apply:** rule 8 (states), rule 9 (affordance), the targets, focus and label checks of rule 10, and rule 13 (responsive). A missing state frame is not a finding.
117
+ - [hard] Readable at its distance. Scale the shot to how the piece is seen (a poster read across a street, about 400 px on its long side; a feed post at phone width). The headline and every fact the brief gives still read.
118
+ - [hard] Nothing important in the trim. On a print piece, no word, fact or logo sits in the trim or the safe margin. A picture or a crop that runs off the edge on purpose is not a finding.
@@ -1,6 +1,6 @@
1
1
  # Direction for a graphic
2
2
 
3
- Read when the product brief's surface is a graphic. Everything in `SKILL.md` and its references holds except what is said here. A piece counts as a screen wherever a skill says screen, and the eight screens are eight pieces.
3
+ Read when the product brief's surface is a graphic. Everything in `SKILL.md` holds except what is said here. A piece counts as a screen wherever a skill says screen, and the eight screens are eight pieces.
4
4
 
5
5
  ## The size
6
6
 
@@ -8,8 +8,8 @@ The size is the format in `docs/brief.md`, never phone or desktop. The design br
8
8
 
9
9
  - **On screen:** the pixels the format gives.
10
10
  - **In print:** the paper's ratio, at a working width of 1200 px (A3 portrait is 1200 × 1697). Figma carries the real size later.
11
- - **Build at it:** each screen is built at `?size=<width>x<height>`, and the page's own default size is set to the format, so every later capture is the whole piece. `grid.md`'s "px at 1440" means px at this working width, and every measure stays a share of the piece's width and height.
12
- - **Capture at it.** Every `--clip 0,0,1440,900` in `grid.md` and `five-second.md` is `--width <w> --clip 0,0,<w>,<h>` at this size, whole piece, never its top half. On the sheet, a tall piece takes more columns (`--cols 4`). Whether `sheet.mjs` lays out portrait tiles well is not checked: look at the sheet before showing it.
11
+ - **Build at it:** each screen is built at `?size=<width>x<height>`, and the page's own default size is set to the format, so every later capture is the whole piece. "1440 by 900" means this working size, and every measure stays a share of the piece's width and height.
12
+ - **Capture at it.** Every `--clip 0,0,1440,900` is `--width <w> --clip 0,0,<w>,<h>` at this size, whole piece, never its top half. On the canvas a tall piece shows whole, at its own proportions; look at it before showing it.
13
13
  - **A reference of another proportion** (a wide poster for a tall brief) is a base only if its layout survives at the format's ratio, with each measure kept as a share of its own sides. Otherwise it lends moves and is never a base.
14
14
 
15
15
  ## What the pieces carry
@@ -20,16 +20,11 @@ The size is the format in `docs/brief.md`, never phone or desktop. The design br
20
20
  - **No navigation.** The direction doc says `navigation: none`.
21
21
  - **The rest** (the second language, the small print, other sizes of a set) is written down for `design-prototype`.
22
22
 
23
- ## Steps that do not run
23
+ ## Checks and the trim
24
24
 
25
- - **The other width, before the yes:** skipped. A set's other sizes are `design-prototype`'s.
26
- - **Touch-up:** the same rule, repair and never tidy. Contrast where text sits is fixed; so is a fact the brief gives that is not on the piece, added where the facts sit. Text over a picture, giant type, crops, overlaps and collisions are never faults here, and type cropped by the edge on purpose carries `data-crop`.
25
+ - **Checks:** the same rule, a check reports and the concept wins. Contrast where text sits is fixed; so is a fact the brief gives that is not on the piece, added where the facts sit. Text over a picture, giant type, crops, overlaps and collisions are never faults here, and type cropped by the edge on purpose carries `data-crop`.
27
26
  - **Nothing important in the trim:** on a print piece, mark where the trim and a safe margin fall at the working size (3 mm each by default, theirs if they give one). A word or a fact in the trim is a fault. A crop or a picture that runs off the edge on purpose is not.
28
27
 
29
- ## The five-second check
30
-
31
- The questions are the same. The capture is shown at the size the piece reaches the eye: a poster read across a street, scaled so its long side is about 400 px; a feed post at phone size, about 390 px wide. "What would you do first" is what they would do about it: go, scan, remember the date. It is checked against the design brief's `read from` line and its takeaway.
32
-
33
28
  ## The doc
34
29
 
35
30
  `docs/design/design-direction.md` as in the skill, with `navigation: none` and the format on the first line of Composition. `Primary action:` says "none" or the link, the code or the date to save.
@@ -10,6 +10,7 @@ Write `.longbeard/design/direction/library.json`, one reading per reference (the
10
10
  "references": [{
11
11
  "name": "<card name>",
12
12
  "likes": [{ "what": "<what they like in it, in their words>", "why": "<what it does for them: the rule for using it>" }],
13
+ "avoid": ["<what they wrote to leave out of it, in their words>"],
13
14
  "concept": "<what makes it, in one or two sentences: the idea a designer would defend>",
14
15
  "move": "<the one move a person would point at: the disc cutting into the title, one word filling the width>",
15
16
  "layout": "<where everything sits, as a share of the screen: margins, columns, the picture's box, the headline's box, the small text's places, what overlaps or runs off an edge, how much is empty>",
@@ -21,18 +22,18 @@ Write `.longbeard/design/direction/library.json`, one reading per reference (the
21
22
  "motion": { "what": "…", "trigger": "…", "ms": 600, "easing": "…", "character": "…", "by": "page | frames | not seen" },
22
23
  "finish": { "css": "…", "by": "page | eye" },
23
24
  "picture_kind": "photo | illustration | 3d | mixed",
24
- "slots": { "headline": { "words": 3, "lines": 2 }, "small": 3, "pictures": 1 },
25
+ "slots": { "headline": { "words": 3, "lines": 2 }, "small": 3, "blocks": 5, "pictures": 1 },
25
26
  "devices": ["<each element that is not content: a disc, a ruled line, a word band, a ring of text>"],
26
27
  "measured": { "empty": 62, "pictures": 28, "radius": 12 }
27
28
  }]
28
29
  }
29
30
  ```
30
31
 
31
- ## Measure first, then look
32
+ ## Measure a page, read a picture
32
33
 
33
34
  **A live page:** `measure.mjs <link>` lists its fonts, sizes, weights, colours and gradients (`by: page`). It also lists the page's motion (each transition and animation with its property, time, easing and trigger) and its finish (shadows, filters, blends and textures with the share of the screen they cover), read before anything is judged by eye.
34
35
 
35
- **A reference that is only a picture** (a shot, a poster, a presentation frame):
36
+ **A reference that is only a picture** (a shot, a poster, a presentation frame): read it yourself, at full size: the layout as shares of the screen, the type sizes at 1440 wide, the colours, how much is empty. Its reading says `by: eye`. Scripts guess at pictures; your eye is the better reader, and gets better with every model. For a number you cannot read (a size on a busy shot, the exact ground), measure it:
36
37
 
37
38
  ```
38
39
  node <skill>/scripts/measure.mjs .longbeard/design/moodboard/refs/<name>.jpg --lines
@@ -40,7 +41,7 @@ node <skill>/scripts/measure.mjs .longbeard/design/moodboard/refs/<name>.jpg --l
40
41
 
41
42
  It reads inside a presentation frame, and gives the ground, the `ink`, the palette (`common`, `loud`), how much is `empty` and how much is `pictures`, and the type: the display line's `px1440`, `weight`, `case`, `box`, the body size, the `scale`, the headline's words and lines, the text `blocks`. `--lines` lists every line it read, with its box: that is the layout's measurements. Sizes are given as px at 1440 wide, which is the size to build at.
42
43
 
43
- What it cannot read (text on a photograph, rotated text, script faces, letters that touch) is read by eye with the picture at full size, and says `by: eye`. A number that disagrees with what you plainly see is a misread: use your reading, and say so.
44
+ A number that disagrees with what you plainly see is a misread: use your reading, and say so.
44
45
 
45
46
  **The face, from a picture:** the nearest free face by its measured shape, of the kind you see:
46
47
 
@@ -53,11 +54,12 @@ Give it every measure the picture gave (`width`, `xheight`, `dark`, `contrast`).
53
54
  ## What each part is for
54
55
 
55
56
  - **`likes`:** their words from the board's note (or the card's `like:`). What they like is what the designs borrow; why is how it is used, and where it would be wrong.
56
- - **`concept` and `move`:** what must survive every change; the critic and the not-a-copy check judge on them.
57
+ - **`avoid`:** their words from the board's Leave out box (or the card's `avoid:`). Never on a screen built on it, never borrowed from it; the reading still records it (in `devices`, `palette`, wherever it sits), so the rebuild knows what to drop. Empty when they wrote nothing.
58
+ - **`concept` and `move`:** what must survive every change; a screen built on it keeps them.
57
59
  - **`layout`, `type`, `spacing`:** the system, in numbers, so the rebuild is measured, not approximated. Type sizes are the reference's against its screen: a 96 px headline on a 1440 screen stays 96 px.
58
60
  - **`palette`:** the colours as they work together. A palette is borrowed whole, or one colour they did not name is swapped for another of the same role. Never one colour picked out of it by itself.
59
61
  - **`pictures`:** the treatment the product's pictures get on a screen built from it.
60
- - **`slots`:** how much text it carries; a screen built on it carries the same, and one small element more at most.
62
+ - **`slots`:** how much text it carries, with its text `blocks` as `measure.mjs` counts them (or by eye); a screen built on it carries the same, and one small element more at most.
61
63
  - **`devices`:** every element that is not content, so each on a screen traces to one.
62
64
 
63
65
  ## Motion, finish and picture kind
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  One direction screen, to copy to .longbeard/design/direction/screens/<n>.html.
4
4
  A screen is one reference rebuilt faithfully with the product's content, then
5
- changed by one or two moves borrowed from other references (grid.md). Write
5
+ changed by one or two moves borrowed from other references. Write
6
6
  it as a designer would write a static page: plain HTML and CSS, measured
7
7
  sizes in px at the screen's width. The template only does what is the same
8
8
  every time: the look as variables, overrides in the URL, the faces loaded,
@@ -19,11 +19,11 @@
19
19
  - PROVENANCE: for every face, colour, element and effect on the screen, the
20
20
  reference it comes from. Anything that cannot name one does not belong.
21
21
 
22
- URL overrides (design-identity, the touch-up): ?face= &body= &weight=
22
+ URL overrides (design-identity): ?face= &body= &weight=
23
23
  &ground=%23… &ink=%23… &accent=%23… (accent=none hides it) &size=390x844.
24
24
 
25
25
  CONTROLS: empty in a built screen. When the screen is chosen, first.html gets
26
- the ranges its board uses (references/controls.md). The page then shows a few
26
+ the ranges its board uses (design-identity's references/controls.md). The page then shows a few
27
27
  live controls over the screen when opened with ?controls, never in a capture
28
28
  (no ?controls, or ?capture). Display text is what carries the class "display".
29
29
  -->
@@ -4,7 +4,7 @@ Read by `design-direction`, step 0 and step 2.
4
4
 
5
5
  ## Pictures
6
6
 
7
- Before the grid: three or four pictures of what the product is about (the bakery's bread and its bench, the climbing gym's wall, the app's real data on a desk). Not other designs, which is the moodboard's job: the product's own world. Every screen from here on uses them, so nothing is judged on grey boxes or on another product's pictures, and their colours become one more palette (step 2).
7
+ Before the screens: three or four pictures of what the product is about (the bakery's bread and its bench, the climbing gym's wall, the app's real data on a desk). Not other designs, which is the moodboard's job: the product's own world. Every screen from here on uses them, so nothing is judged on grey boxes or on another product's pictures, and their colours become one more palette (step 2).
8
8
 
9
9
  - **Theirs first.** The design brief says whether they have pictures. If they do, ask for three or four, and save them to `.longbeard/design/pictures/`.
10
10
  - **None yet:** find stand-ins, a few, never a bulk search. Search the subject, not a mood: the brief's identity nouns, one query per picture you need.
@@ -30,4 +30,4 @@ node <skill>/scripts/subject-colours.mjs .longbeard/design/pictures --json
30
30
 
31
31
  **Then look, and name every colour.** Open its sheet (`--sheet <scratch>/subject.html`, captured), which shows each proposed colour beside the pictures with the places it comes from lit up. Every colour must be something a person sees as the subject and can name: "the crust", "the flour", "the oven's black". A colour that lights up the backdrop, a cloth, a wall or a prop is not the subject's, even when it fills the photo: drop it (`--exclude "#hex"`) and run it again. The script already flags colours that sit mostly at the edges as background and never makes them the signature or the accent; the look is the check it cannot do. Write the name beside each colour wherever it is shown ("crust, lightened to carry white text").
32
32
 
33
- Only then it goes in the library as `"subject"`. Never tune them stronger to make a screen livelier: a colour no reference would set a page on is not a direction they chose.
33
+ Its proposal is a start, not the answer: a colour you can name better from the pictures (the crust's real brown, not the averaged one) replaces it, contrast checked with `colours.mjs`. Only then it goes in the library as `"subject"`. Never tune them stronger to make a screen livelier: a colour no reference would set a page on is not a direction they chose.
@@ -0,0 +1,43 @@
1
+ // Options on the real page. Each option is an element with data-variant="1", "2", …
2
+ // and data-from="<the reference it comes from>". The page shows one, chosen by
3
+ // ?variant=<n> (1 when absent), and a small bar at the bottom centre: the option's
4
+ // number, its reference, and arrows. ← and → flip between them and keep the URL in
5
+ // step, so a capture or a link opens the same option. ?bar=0 hides the bar for captures.
6
+ // Copy this file next to the page and load it last: <script src="variants.js"></script>
7
+ (() => {
8
+ const all = [...document.querySelectorAll("[data-variant]")];
9
+ const ns = [...new Set(all.map((el) => el.dataset.variant))].sort((a, b) => Number(a) - Number(b));
10
+ if (!ns.length) return;
11
+ const params = new URLSearchParams(location.search);
12
+ let at = Math.max(0, ns.indexOf(params.get("variant") || ns[0]));
13
+ const bar = document.createElement("div");
14
+ bar.setAttribute("role", "toolbar");
15
+ bar.setAttribute("aria-label", "Options");
16
+ bar.style.cssText = "position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:2147483647;display:flex;gap:12px;align-items:center;padding:8px 12px;border-radius:999px;background:#111;color:#fff;font:500 13px/1.2 system-ui,sans-serif;box-shadow:0 2px 12px rgba(0,0,0,.25)";
17
+ const button = (text, label, step) => {
18
+ const b = document.createElement("button");
19
+ b.type = "button";
20
+ b.textContent = text;
21
+ b.setAttribute("aria-label", label);
22
+ b.style.cssText = "all:unset;cursor:pointer;padding:4px 8px;min-width:24px;text-align:center";
23
+ b.onclick = () => show(at + step);
24
+ return b;
25
+ };
26
+ const label = document.createElement("span");
27
+ bar.append(button("←", "Previous option", -1), label, button("→", "Next option", 1));
28
+ function show(i) {
29
+ at = (i + ns.length) % ns.length;
30
+ for (const el of all) el.hidden = el.dataset.variant !== ns[at];
31
+ const from = all.find((el) => el.dataset.variant === ns[at])?.dataset.from || "";
32
+ label.textContent = `${at + 1} / ${ns.length}${from ? " \u00b7 from " + from : ""}`;
33
+ params.set("variant", ns[at]);
34
+ history.replaceState(null, "", "?" + params.toString() + location.hash);
35
+ }
36
+ addEventListener("keydown", (e) => {
37
+ if (e.target.closest?.("input, textarea, select, [contenteditable]")) return;
38
+ if (e.key === "ArrowLeft") show(at - 1);
39
+ if (e.key === "ArrowRight") show(at + 1);
40
+ });
41
+ if (params.get("bar") !== "0") document.body.append(bar);
42
+ show(at);
43
+ })();
@@ -0,0 +1,311 @@
1
+ #!/usr/bin/env node
2
+ // The direction's screens as one page to choose from: every screen in a strip
3
+ // (each round, and a screen's parts, in a row), the one
4
+ // they open shown large, and beside it what it is made from: its base and each
5
+ // move, with the reference's picture and their own words. Actions write a
6
+ // line for the chat. No dependencies. It shows what was built; it adds no
7
+ // colour of its own.
8
+ //
9
+ // node canvas.mjs .longbeard/design/direction/screens.json --board .longbeard/design/direction/board.md --shots .longbeard/design/direction/grid --out .longbeard/design/direction/canvas.html
10
+ //
11
+ // screens.json entries (the skill's step 3): n, base, moves [{ what, from, like }], state,
12
+ // kind ("concept", with idea: the concept it keeps, shown in place of "Base"),
13
+ // failure, and optionally round (1 when left out), of (the screen it belongs to),
14
+ // part (a part of that screen), fault (one line), shot
15
+ // (a picture; else <shots>/<n>.png). board.md cards give each reference's shot and like.
16
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
17
+ import { dirname, isAbsolute, relative, resolve } from "node:path";
18
+
19
+ const args = process.argv.slice(2);
20
+ const flag = (name) => {
21
+ const i = args.indexOf(`--${name}`);
22
+ return i === -1 ? "" : (args.splice(i, 2)[1] ?? "");
23
+ };
24
+ const boardArg = flag("board");
25
+ const shotsArg = flag("shots");
26
+ const outArg = flag("out");
27
+ const [screensArg] = args;
28
+ if (!screensArg || !outArg || !shotsArg || args.length !== 1 || !/\.html$/.test(outArg)) {
29
+ console.error("usage: node canvas.mjs <screens.json> --shots <folder of n.png> [--board <board.md>] --out <canvas.html>");
30
+ process.exit(2);
31
+ }
32
+ const outPath = resolve(outArg);
33
+ const href = (abs) => {
34
+ const src = relative(dirname(outPath), abs).split("\\").join("/").split("/").map(encodeURIComponent).join("/");
35
+ return src.startsWith(".") ? src : `./${src}`;
36
+ };
37
+ const esc = (s) => String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
38
+
39
+ if (!existsSync(screensArg)) {
40
+ console.error(`canvas: no screens at ${screensArg}`);
41
+ process.exit(1);
42
+ }
43
+ let screens;
44
+ try {
45
+ screens = JSON.parse(readFileSync(screensArg, "utf8"));
46
+ } catch (e) {
47
+ console.error(`canvas: ${screensArg} could not be read: ${e.message}`);
48
+ process.exit(1);
49
+ }
50
+ if (!Array.isArray(screens) || !screens.length) {
51
+ console.error(`canvas: ${screensArg} lists no screens`);
52
+ process.exit(1);
53
+ }
54
+ const open = screens.filter((s) => !s.state);
55
+ if (open.length) {
56
+ console.error(`canvas: screen ${open.map((s) => s.n).join(", ")} has no state yet; draw the canvas when every screen has ended`);
57
+ process.exit(1);
58
+ }
59
+
60
+ // The board's cards, by name: their shot and their words.
61
+ const cards = new Map();
62
+ if (boardArg) {
63
+ if (!existsSync(boardArg)) {
64
+ console.error(`canvas: no board at ${boardArg}`);
65
+ process.exit(1);
66
+ }
67
+ for (const chunk of readFileSync(boardArg, "utf8").split(/^### /m).slice(1)) {
68
+ const nl = chunk.indexOf("\n");
69
+ const name = (nl === -1 ? chunk : chunk.slice(0, nl)).trim();
70
+ const fields = {};
71
+ for (const line of (nl === -1 ? "" : chunk.slice(nl + 1)).split(/\r?\n/)) {
72
+ const m = line.match(/^- ([a-z][a-z /-]*):\s*(.*)$/i);
73
+ if (m && !(m[1].toLowerCase() in fields)) fields[m[1].toLowerCase()] = m[2].trim();
74
+ }
75
+ const shot = fields.shot || "";
76
+ const src = /^https?:\/\//i.test(shot) ? shot : shot && existsSync(resolve(shot)) ? href(resolve(shot)) : "";
77
+ cards.set(name, { name, src, like: fields.like || "", avoid: fields.avoid || "" });
78
+ }
79
+ }
80
+ const cardOf = (name) => cards.get(name) || { name: name || "", src: "", like: "", avoid: "" };
81
+
82
+ let missing = 0;
83
+ const shotOf = (s) => {
84
+ const path = s.shot ? (isAbsolute(s.shot) ? s.shot : resolve(s.shot)) : resolve(shotsArg, `${s.n}.png`);
85
+ if (existsSync(path)) return href(path);
86
+ missing++;
87
+ console.error(`canvas: no picture for screen ${s.n} at ${relative(process.cwd(), path)}`);
88
+ return "";
89
+ };
90
+
91
+ // Rows: each round, then each screen's parts.
92
+ const rows = new Map();
93
+ for (const s of screens) {
94
+ const key = s.of != null ? `${s.of} · ${s.part || "parts"}` : `Round ${s.round || 1}`;
95
+ if (!rows.has(key)) rows.set(key, []);
96
+ rows.get(key).push(s);
97
+ }
98
+ const label = (s) => (s.state === "failed" ? "failed" : "built");
99
+ const data = screens.map((s) => {
100
+ const base = cardOf(s.base);
101
+ return {
102
+ n: String(s.n),
103
+ src: shotOf(s),
104
+ label: label(s),
105
+ of: s.of != null ? String(s.of) : "",
106
+ part: s.part || "",
107
+ concept: s.kind === "concept" ? s.idea || "its concept" : "",
108
+ fault: s.state === "failed" ? `failed: ${s.failure || "no reason given"}` : s.fault || "",
109
+ base: { name: base.name, src: base.src, like: base.like, avoid: base.avoid },
110
+ moves: (s.moves || []).map((m) => {
111
+ const c = cardOf(m.from);
112
+ return { what: m.what || "", from: c.name, src: c.src, like: m.like || c.like || "", proposed: Boolean(s.proposed) };
113
+ }),
114
+ };
115
+ });
116
+
117
+ const strip = [...rows.entries()]
118
+ .map(
119
+ ([name, list]) => `<div class="row"><span class="rl">${esc(name)}</span>${list
120
+ .map((s) => {
121
+ const d = data.find((x) => x.n === String(s.n));
122
+ return `<button type="button" class="th" data-n="${esc(d.n)}"${d.label === "failed" ? " data-failed" : ""}>${d.src ? `<img src="${esc(d.src)}" alt="">` : `<span class="none">no picture</span>`}<span class="tl">${esc(d.n)} · ${esc(d.label)}</span></button>`;
123
+ })
124
+ .join("")}</div>`,
125
+ )
126
+ .join("");
127
+
128
+ // The Long Beard beard, small and one ink: it marks the page as the tool's and adds no colour.
129
+ 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=";
130
+
131
+ const html = `<!DOCTYPE html>
132
+ <html lang="en">
133
+ <head>
134
+ <meta charset="utf-8">
135
+ <meta name="viewport" content="width=device-width, initial-scale=1">
136
+ <title>Direction</title>
137
+ <style>
138
+ /* Quiet chrome: the screens and references are the only colour on the page. */
139
+ :root { --canvas: #f3f2ef; --paper: #ffffff; --ink: #1c1c1a; --muted: #6f6c65; --line: #dedbd4; --soft: #e9e7e2; }
140
+ * { box-sizing: border-box; }
141
+ html { color-scheme: light; }
142
+ 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; }
143
+ main { max-width: 1680px; margin: 0 auto; padding: 22px 28px 150px; }
144
+ .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
145
+ .brand img { height: 44px; width: auto; display: block; }
146
+ .brand span { font-size: 16px; font-weight: 600; }
147
+ .brand h1 { margin: 0; font-size: 16px; font-weight: 400; color: var(--muted); }
148
+ .brand h1::before { content: "/"; margin-right: 10px; color: var(--line); }
149
+ .brand .keys { margin-left: auto; font-size: 12px; color: var(--muted); }
150
+ 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); }
151
+ .strip { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
152
+ .row { display: flex; gap: 10px; align-items: flex-end; overflow-x: auto; padding: 4px 2px 6px; }
153
+ .rl { flex: none; width: 110px; font-size: 12px; color: var(--muted); padding-bottom: 20px; }
154
+ .th { flex: none; width: 150px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: var(--muted); }
155
+ .th img, .th .none { width: 150px; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; display: block; border-radius: 4px; background: var(--soft); outline: 2px solid transparent; outline-offset: 2px; }
156
+ .th .none { display: grid; place-items: center; font-size: 11px; }
157
+ .tl { display: block; font: 11px ui-monospace, Menlo, monospace; margin-top: 5px; }
158
+ .th[aria-current="true"] img, .th[aria-current="true"] .none { outline-color: var(--ink); }
159
+ .th[aria-current="true"] .tl { color: var(--ink); }
160
+ .th[data-failed] .tl { text-decoration: line-through; }
161
+ .main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
162
+ .stage { display: grid; gap: 14px; grid-template-columns: 1fr; }
163
+ .stage[data-compare] { grid-template-columns: 1fr 1fr; }
164
+ .shot { display: block; background: var(--paper); border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); text-decoration: none; }
165
+ .shot img { width: 100%; max-height: 72vh; object-fit: contain; object-position: top; background: var(--soft); display: block; }
166
+ .shot .cap { display: block; padding: 6px 10px; font-size: 12px; color: var(--muted); }
167
+ .basebox[hidden] { display: none; }
168
+ h2 { margin: 14px 0 2px; font-size: 16px; font-weight: 600; }
169
+ .fault { margin: 4px 0 0; color: var(--ink); }
170
+ .fault:empty { display: none; }
171
+ .fault::before { content: "Fault: "; font-weight: 600; }
172
+ .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
173
+ .acts button, .acts input { font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
174
+ .acts button { cursor: pointer; }
175
+ .acts .primary { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }
176
+ .acts input { min-width: 220px; flex: 1 1 220px; }
177
+ aside h3 { margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
178
+ .ing { display: grid; grid-template-columns: 96px 1fr; gap: 12px; margin-bottom: 16px; }
179
+ .ing img, .ing .none { width: 96px; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: 4px; display: block; background: var(--soft); }
180
+ .ing b { display: block; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
181
+ .ing i { display: block; font-style: normal; color: var(--muted); font-size: 13px; line-height: 1.4; }
182
+ .ing q { display: block; font-size: 13px; line-height: 1.4; margin-top: 3px; quotes: "\\201C" "\\201D"; }
183
+ .ing q:empty { display: none; }
184
+ .ing .out { display: block; font-size: 13px; margin-top: 3px; color: var(--muted); }
185
+ .ing .out:empty { display: none; }
186
+ .bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); }
187
+ .bar-in { max-width: 1680px; margin: 0 auto; padding: 10px 28px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
188
+ .bar label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
189
+ .bar textarea { width: 100%; font: 12px/1.4 ui-monospace, Menlo, monospace; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; height: 46px; resize: vertical; background: var(--canvas); }
190
+ #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; }
191
+ button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #2f6fdb; outline-offset: 2px; }
192
+ @media (max-width: 900px) {
193
+ main { padding: 16px 16px 200px; }
194
+ .main, .stage[data-compare] { grid-template-columns: 1fr; }
195
+ .brand .keys { display: none; }
196
+ .rl { width: 64px; }
197
+ .bar-in { grid-template-columns: 1fr; padding: 10px 16px; }
198
+ }
199
+ </style>
200
+ </head>
201
+ <body>
202
+ <main>
203
+ <div class="brand"><img src="data:image/png;base64,${LOGO}" alt="" width="21" height="44"><span>Long Beard</span><h1>Direction</h1><span class="keys"><kbd>←</kbd><kbd>→</kbd> move between screens</span></div>
204
+ <div class="strip">${strip}</div>
205
+ <div class="main">
206
+ <section>
207
+ <div class="stage" id="stage">
208
+ <a class="shot" id="shot" target="_blank" rel="noopener"><img id="big" alt=""><span class="cap" id="cap"></span></a>
209
+ <a class="shot basebox" id="basebox" target="_blank" rel="noopener" hidden><img id="baseimg" alt=""><span class="cap" id="basecap"></span></a>
210
+ </div>
211
+ <h2 id="title"></h2>
212
+ <p class="fault" id="fault"></p>
213
+ <div class="acts">
214
+ <button type="button" class="primary" data-act="take">Take this one</button>
215
+ <button type="button" data-act="more">More of this</button>
216
+ <button type="button" data-act="compare" aria-pressed="false">Beside its base</button>
217
+ <input type="text" id="ask" placeholder="Or say it: with 6's colours, open the menu…" aria-label="What to do with this screen">
218
+ </div>
219
+ </section>
220
+ <aside><h3>Made from</h3><div id="made"></div></aside>
221
+ </div>
222
+ </main>
223
+ <div class="bar"><div class="bar-in">
224
+ <div><label for="out">Copy this into the chat</label><textarea id="out" readonly></textarea></div>
225
+ <button type="button" id="copy">Copy</button>
226
+ </div></div>
227
+ <script>
228
+ (() => {
229
+ const screens = ${JSON.stringify(data).replace(/</g, "\\u003c")};
230
+ const key = "longbeard-canvas:" + location.pathname;
231
+ const $ = (id) => document.getElementById(id);
232
+ const thumbs = [...document.querySelectorAll(".th")];
233
+ const esc = (s) => String(s || "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
234
+ const said = [];
235
+ let at = 0;
236
+ try { at = Math.max(0, screens.findIndex((s) => s.n === localStorage.getItem(key))); } catch (e) {}
237
+ const ing = (src, title, what, like, avoid) =>
238
+ '<div class="ing">' + (src ? '<img src="' + esc(src) + '" alt="">' : '<span class="none"></span>') +
239
+ '<div><b>' + esc(title) + '</b><i>' + esc(what) + '</i><q>' + esc(like) + '</q><span class="out">' + (avoid ? "left out: " + esc(avoid) : "") + '</span></div></div>';
240
+ function show(i) {
241
+ at = (i + screens.length) % screens.length;
242
+ const s = screens[at];
243
+ for (const t of thumbs) t.setAttribute("aria-current", t.dataset.n === s.n ? "true" : "false");
244
+ $("big").src = s.src || "";
245
+ $("shot").href = s.src || "#";
246
+ $("cap").textContent = s.n + " · " + s.label;
247
+ $("baseimg").src = s.base.src || "";
248
+ $("basebox").href = s.base.src || "#";
249
+ $("basecap").textContent = "Base: " + s.base.name;
250
+ const kind = s.part ? s.part + " of " + s.of : (s.concept ? "concept from " : "on ") + s.base.name;
251
+ $("title").textContent = s.n + " · " + kind;
252
+ $("fault").textContent = s.fault;
253
+ $("made").innerHTML =
254
+ (s.concept
255
+ ? ing(s.base.src, "Concept · " + s.base.name, "its idea, redrawn for this product: " + s.concept, s.base.like, s.base.avoid)
256
+ : ing(s.base.src, "Base · " + s.base.name, "the layout, spacing and everything no move names", s.base.like, s.base.avoid)) +
257
+ s.moves.map((m) => ing(m.src, "+ " + m.from, m.what + (m.proposed ? " (proposed)" : ""), m.like, "")).join("");
258
+ try { localStorage.setItem(key, s.n); } catch (e) {}
259
+ }
260
+ function write() {
261
+ $("out").value = said.length ? said.join("\\n") : "";
262
+ }
263
+ for (const t of thumbs) t.addEventListener("click", () => show(screens.findIndex((s) => s.n === t.dataset.n)));
264
+ for (const b of document.querySelectorAll("[data-act]")) {
265
+ b.addEventListener("click", () => {
266
+ const s = screens[at];
267
+ if (b.dataset.act === "compare") {
268
+ const on = b.getAttribute("aria-pressed") !== "true";
269
+ b.setAttribute("aria-pressed", on ? "true" : "false");
270
+ $("basebox").hidden = !on;
271
+ if (on) $("stage").dataset.compare = ""; else delete $("stage").dataset.compare;
272
+ return;
273
+ }
274
+ said.push(b.dataset.act === "take" ? "take " + s.n : "more of " + s.n);
275
+ write();
276
+ });
277
+ }
278
+ $("ask").addEventListener("keydown", (e) => {
279
+ if (e.key !== "Enter" || !e.target.value.trim()) return;
280
+ said.push(screens[at].n + " " + e.target.value.trim().replace(/\\s+/g, " "));
281
+ e.target.value = "";
282
+ write();
283
+ });
284
+ document.addEventListener("keydown", (e) => {
285
+ if (/^(INPUT|TEXTAREA)$/.test(e.target.tagName) || e.metaKey || e.ctrlKey || e.altKey) return;
286
+ if (e.key === "ArrowRight") { e.preventDefault(); show(at + 1); }
287
+ if (e.key === "ArrowLeft") { e.preventDefault(); show(at - 1); }
288
+ });
289
+ // The text box is the real path: the clipboard API can be refused on a file:// page.
290
+ $("copy").addEventListener("click", async (e) => {
291
+ const out = $("out");
292
+ out.focus();
293
+ out.select();
294
+ let ok = false;
295
+ try { await navigator.clipboard.writeText(out.value); ok = true; } catch (err) {}
296
+ if (!ok) { try { ok = document.execCommand("copy"); } catch (err) {} }
297
+ e.target.textContent = ok ? "Copied" : "Selected, press Cmd/Ctrl+C";
298
+ setTimeout(() => { e.target.textContent = "Copy"; }, 1800);
299
+ });
300
+ show(at);
301
+ write();
302
+ })();
303
+ </script>
304
+ </body>
305
+ </html>
306
+ `;
307
+
308
+ mkdirSync(dirname(outPath), { recursive: true });
309
+ writeFileSync(outPath, html);
310
+ console.error(`canvas: ${screens.length} screens in ${rows.size} row${rows.size === 1 ? "" : "s"}${missing ? `, ${missing} without a picture` : ""}`);
311
+ console.log(outArg);