Isometric line figures that answer the pointer. For React and for anything with a DOM.
Skill: hairline-create draws an empty state, and a figure from a mark the person asks for
Lucas Marques6a3e9bd44f49
diff --git a/packages/hairline/test/skill/shape.test.ts b/packages/hairline/test/skill/shape.test.tsindex 0a0447d..218ce8b 100644--- a/packages/hairline/test/skill/shape.test.ts+++ b/packages/hairline/test/skill/shape.test.ts@@ -80,3 +80,29 @@ it("look.mjs reads points as world or viewBox points, and keeps its cache outsidexpect(look.cacheDir({}, "linux", "/h")).toBe(join("/h", ".cache", "hairline-look"));expect(look.SHOTS.map((s: string[]) => s[0])).toEqual(["rest", "answer", "small", "small-answer", "low", "high", "dark", "light"]);});++it("concepts.md says how to draw an empty state and how to draw from a mark, and the rules make room for both", () => {+ const concepts = text("concepts.md"), rules = text("rules.md"), look = text("look.md");+ const empty = concepts.split("## An empty state")[1].split("\n## ")[0];+ expect(empty).toMatch(/The subject is absence/);+ expect(empty).toMatch(/160px/);+ expect(empty).toMatch(/smaller than `look\.mjs`'s small picture, so judge that picture as if it were two-thirds its size/);+ expect(empty).toMatch(/counts to zero/);+ const mark = concepts.split("## From a mark")[1].split("\n## ")[0];+ expect(mark).toMatch(/The mark is the object/);+ expect(mark).toMatch(/never trace it/);+ expect(mark).toMatch(/theirs to use/);+ const r05 = rules.split("## 05")[1].split("## 06")[0];+ expect(r05).toMatch(/when emptiness is the concept/);+ const r09 = rules.split("## 09")[1].split("## 10")[0];+ expect(r09).toMatch(/\*\*Keep it, for a mark:\*\* a mark keeps its own corners/);+ const r10 = rules.split("## 10")[1].split("## The frame")[0];+ expect(r10).toMatch(/a figure made from a mark/);+ expect(r10).toMatch(/logos/);+ expect(r10.split("- **Rejected when:**")[1].split("\n")[0]).toMatch(/other than the mark, and a glyph that belongs to it, in a figure made from a mark/);+ expect(look.split(/^11\. /m)[1].split("\n")[0]).toMatch(/In a figure made from a mark, the mark itself and a glyph that is part of it are the exception/);+ /* the glyph-as-subject case the Keep-it line allows is exempt where it is checked, too */+ for (const line of [r10.split("- **Rejected when:**")[1].split("\n")[0], look.split(/^11\. /m)[1].split("\n")[0]]) expect(line).toMatch(/a glyph built as a solid that is the figure's whole subject/);+ expect(look).toMatch(/^13\. \*\*An empty state says something is missing\.\*\*/m);+ expect(text("SKILL.md").split("\n").length).toBeLessThan(120);+});diff --git a/skills/hairline-create/SKILL.md b/skills/hairline-create/SKILL.mdindex bbf4782..42fc65d 100644--- a/skills/hairline-create/SKILL.md+++ b/skills/hairline-create/SKILL.md@@ -14,7 +14,7 @@ Every file named below is in this skill's folder. The figure and the page are wr## 1. Concept-Read `concepts.md`. Then offer two or three concepts, one line each:+Read `concepts.md`. It has a section for an empty state and one for a figure drawn from a mark. Then offer two or three concepts, one line each:> **Name.** The object. What the pointer does to it. What the read-out says.@@ -37,7 +37,7 @@ One figure, one idea. A concept that needs a label to be understood is not a con## 3. Check1. `node look.mjs <name>.js --answer x,y,z --edge x,y,z`, the points being world points of your figure, as `look.md` says. It builds the page, validates it, takes the eight pictures on one sheet, `hairline-<name>-look.png`, and checks the frame, the read-out and the console. Fix every line it prints as failed, and run it again until it exits 0.-2. Read `look.md`, then the sheet, and answer its twelve questions. Fix what fails, then go back to 1.+2. Read `look.md`, then the sheet, and answer its questions. Fix what fails, then go back to 1.`look.mjs` needs a browser and installs `playwright-core` once, outside this folder. Without one, check with `node validate.mjs hairline-<name>.html` after each build and do the look as `look.md` says under "Without a browser". Without Node, read the list of checks at the top of `validate.mjs` and answer each one from your code.@@ -66,5 +66,6 @@ When the person asks for a change, edit only `<name>.js`, then run `look.mjs` ag| drawing a box with twelve edges | `prism` of two rounded rings: a silhouette and one crease (rule 09) || drawing a part as a plain rounded block | give it the features that make it what it is, the ones you named in the concept (`concepts.md`) || leaving rest flat, empty, or symmetric because that was easy | compose it: rest is the thumbnail (rule 05) |+| stamping a mark on a box to say whose it is | build the mark as the object, or leave it out (`concepts.md`, "From a mark") || editing the kernel or the bench to make something work | the figure is wrong; change the figure || letting in a second idea | cut it: one figure, one idea |diff --git a/skills/hairline-create/concepts.md b/skills/hairline-create/concepts.mdindex 57ab48f..ca42b7d 100644--- a/skills/hairline-create/concepts.md+++ b/skills/hairline-create/concepts.md@@ -27,6 +27,25 @@ The package's six figures each answer the pointer a different way. A new figure`examples/terrain.js` is the first and `examples/riffle.js` the second, in full.+## An empty state++Asked for an empty state (no results, nothing here yet, not found), draw the absence, not a sad face.++- **The subject is absence.** Pick the tool that looks for things or holds them, and show it holding none: a sieve with a bare mesh, a rail of bare hangers, a loupe over a blank sheet.+- **Rest is the whole figure.** An empty state sits small above a heading and a button, and most people never bring the pointer to it. Judge the rest pose first. The site's thumbnail is 160px, smaller than `look.mjs`'s small picture, so judge that picture as if it were two-thirds its size.+- **Empty is not blank.** The object is all there and composed; what is missing is what it would hold. One bright mark says where to look.+- **The read-out counts to zero.** Under the pointer it names the part and what it holds, none: `sieve 2 · 0`, `row 4 · 0`. At rest it still says `rest`.++## From a mark++Asked to draw from a company's mark, the mark is not a label on something else.++- **The mark is the object.** Build it as a solid with the kernel, the way you would build a padlock; never trace it flat onto a face.+- **Take the idea from the product.** Its own empty state names it: "No deployments yet", "No pages inside". The figure shows that.+- **Give the mark something to answer with.** It lands, it joins, it opens. A mark that only sits there is an icon.+- **One mark, drawn whole.** Keep its proportions and the features that make it that mark. A glyph that is part of the mark is a relief on a face, built, not written.+- **Ask whether the mark is theirs to use.** If it belongs to someone else, say that the page shows another company's trademark and is theirs to publish or not.+## A weak conceptDrop it, or fix it before building, when:@@ -36,7 +55,7 @@ Drop it, or fix it before building, when:- **It holds more than one idea.** Two gestures, two variables, two objects.- **The pointer has no reason.** The figure would be the same as a loop.- **It is a diagram.** Boxes, arrows and lines between them are not an object.-- **It is an icon.** The literal symbol of the idea (a padlock for security) has nothing to answer with.+- **It is an icon.** The literal symbol of the idea (a padlock for security) has nothing to answer with. A mark the person asked for is the exception: see "From a mark".- **It depends on colour.** The palette is one stroke in four weights.- **It will not read at 240px.** Too many parts, or parts too small.diff --git a/skills/hairline-create/look.md b/skills/hairline-create/look.mdindex 2814af2..99397e1 100644--- a/skills/hairline-create/look.md+++ b/skills/hairline-create/look.md@@ -59,11 +59,12 @@ Answer each with yes or no. A no is fixed in the figure before anything is hande8. **The read-out names what is under the pointer**, in a few characters, and says `rest` at rest. `look.mjs` prints every picture's read-out, and fails when the rest picture's is not `rest`. A warning that an answering picture still says `rest` means the `--answer` point misses the part, or the hit test does. Whether the name is right is for you to say.9. **Nothing leaves the frame.** With the slider at each end (`?intensity=0`, `?intensity=1`) and the pointer at the figure's edges, every part stays inside the plate. `look.mjs` fails when the drawing's box leaves the 400 × 320 viewBox in any picture. The box is the geometry: a stroke reaches half its width past it, so a line on the frame's edge is still a no. It also says how much of the frame the rest pose covers, and warns below a quarter; the examples cover 36%.10. **Both themes.** In `?theme=dark` and `?theme=light`, nothing vanishes and nothing is left the wrong colour.-11. **No words** (rule 10). Nothing in the drawing is a letter, a digit, an arrow or an icon.+11. **No words** (rule 10). Nothing in the drawing is a letter, a digit, an arrow or an icon. In a figure made from a mark, the mark itself and a glyph that is part of it are the exception, and so is a glyph built as a solid that is the figure's whole subject; anything else still fails.12. **The page is clean.** No line under the stage reporting an error, and nothing on the console. `look.mjs` reads both, on every picture, and fails on any console error, console warning or page error.+13. **An empty state says something is missing.** Only for an empty state: in the smallest picture, at rest, with no read-out, can you say what the object would hold and that it holds none?If you are unsure whether the figure's weight is right, build an example the same way and put the two side by side: `node <skill folder>/build.mjs <skill folder>/examples/terrain.js`. Or look at it: `node <skill folder>/look.mjs <skill folder>/examples/terrain.js --answer 30,90,0` writes its sheet beside yours.## Without a browser-Answer the same twelve from the code, each with the line that makes it true: the rest values for 2, the falloff or stagger for 3, the hit test for 4, the paint order for 6. Then say at hand-over, in these words, that the figure was **not looked at in a browser**. Do not skip the list and do not guess a yes.+Answer the same questions from the code, each with the line that makes it true: the rest values for 2, the falloff or stagger for 3, the hit test for 4, the paint order for 6. Then say at hand-over, in these words, that the figure was **not looked at in a browser**. Do not skip the list and do not guess a yes.diff --git a/skills/hairline-create/rules.md b/skills/hairline-create/rules.mdindex a789976..5d35ba2 100644--- a/skills/hairline-create/rules.md+++ b/skills/hairline-create/rules.md@@ -36,7 +36,8 @@ No fills, glows or shadows. The active edge goes from the silhouette's stroke toLeaving returns the figure to a composition: a dune, a lean, a slight explode. The still frame is the thumbnail, so it has to hold up alone.- **Keep it:** give every part a rest value that is not zero and not uniform (Terrain's dune is two Gaussians; Riffle's cards lean back 12°). Put one bright mark at rest where the eye should start. When the pointer chooses, the mark gives the bright up to what it chose (rule 04).-- **Rejected when:** at rest the figure is a flat grid, an empty tray, a perfectly regular row; at rest nothing says what the figure is about; rest and "nothing rendered yet" look alike.+- **Keep it, when emptiness is the concept:** an empty state shows an object holding nothing. That is right when the object itself is composed, uneven and whole, and one bright mark says where to look. The tray is empty; the drawing is not.+- **Rejected when:** at rest the figure is a flat grid, a tray left empty because nothing was drawn in it, a perfectly regular row; at rest nothing says what the figure is about; rest and "nothing rendered yet" look alike.## 06 · honesty: construction stays honest@@ -65,6 +66,7 @@ A solid is the hull of two rounded rings, its top and its base. The vertical cor- **Keep it:** `rings(x0, y0, x1, y1, r, b)` then `prism(P, front, ring, inner, z0, z1)` into `solid(parent)` with `put`. A thin plate gets a second line for its thickness, not a second solid. Round flat outlines with `fillet`. `rings` takes four steps round each corner, so a full round has sixteen sides, and they show once its radius on screen passes about 20 viewBox units (r × S; r 12 at S 1.9). For a large round, build the two rings yourself with more steps: `rrect(x0, y0, x1, y1, r, 14)` and `rrect(x0 + b, y0 + b, x1 - b, y1 - b, r - b, 14)`.- **Keep it, when a solid's top is smaller than its foot** (a cabin, a roof, a tower that tapers): `prism` stands one ring straight up, so write its two strings yourself, from two rings. With `foot`, `top` and `inner` each an `rrect`, `inner` being `top` inset by b: the silhouette is `poly(hull(ringAt(P, foot, z0).concat(ringAt(P, top, z1))))` and the crease is `open(ringAt(P, run(inner, front), z1))`. Then `put(solid(parent), { sil, crease })`, as with `prism`. That is all `prism` does, so there is nothing to look up under the index.+- **Keep it, for a mark:** a mark keeps its own corners where rounding would make it another mark. Use the smallest radius that still reads as built, half a unit to two, and round everything that is not the mark as usual.- **Rejected when:** a box shows twelve edges or any vertical corner line; a corner is sharp; inner lines are as bright as the silhouette; a solid has more than its silhouette, one crease, and at most a few marks the object would really have.## 10 · quiet: no words inside the figure@@ -72,7 +74,9 @@ A solid is the hull of two rounded rings, its top and its base. The vertical corGeometry carries identity: a punch on a card's tab, a dot code on a crate's lid, a bright edge instead of a label. Names go to the corner read-out, outside the drawing. Anything decorative has to be something the object would really have.- **Keep it:** `read.textContent = …` names what is under the pointer, in a few characters (`cell 4·2`, `08`), and says `rest` when nothing is. Number things with dots.-- **Rejected when:** the svg holds text, letters or digits drawn as paths, icons, arrows or logos; the figure cannot be understood without its read-out; the read-out is a sentence.+- **Keep it, for a figure made from a mark:** logos stay out when they label something else. The one exception is a figure made from a mark, where the mark is the object: built as a solid, answering the pointer. A glyph that belongs to the mark is a relief on one face. Nothing else in that figure is a letter, and the mark's name still goes to the read-out's side, never into the drawing.+- **Keep it, when a glyph is the subject:** a glyph may be the object when it is built as a solid and is the figure's whole subject, as the package's Query is: a question mark made of a bent bar over a loose ball, answering the pointer. It is a thing in the scene, not a label on one, and nothing else in that figure is a letter.+- **Rejected when:** the svg holds text, letters or digits drawn as paths, icons, arrows or logos, other than the mark, and a glyph that belongs to it, in a figure made from a mark, or a glyph built as a solid that is the figure's whole subject; the figure cannot be understood without its read-out; the read-out is a sentence.## The frame