fastdraw 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -138,7 +138,7 @@ bin/fastdraw preview-look team.look
138
138
  ```
139
139
 
140
140
  A diagram picks its look with one line, `look "./team.look"`, or names one that ships with FastDraw:
141
- `look headline`, `look reference`, `look sketch` or `look whiteboard`. In the editor, the **Look** button
141
+ `look headline`, `look night`, `look reference`, `look sketch` or `look whiteboard`. In the editor, the **Look** button
142
142
  previews the diagram in each one before you keep it. A look can also bring its own fonts
143
143
  (`fontdir`) and colour icons (`icondir`). `fastdraw guide look` explains the format.
144
144
 
@@ -163,6 +163,7 @@ All of these were written by agents from the guides alone. Sources are in
163
163
  | `agents/` | Thin instruction files that point coding agents at `fastdraw guide` |
164
164
  | `looks/reference.look` | Test look that mirrors diagram-design's default palette, for quality comparison |
165
165
  | `looks/whiteboard.look` | Whiteboard: an online-whiteboard look with pastel sticky notes, white rounded shapes, curved connectors and one blue accent. Samples in `examples/whiteboard/` |
166
+ | `looks/night.look` | Night: the built-in look after dark, on a deep navy page with the same styles, so a diagram can switch with one line |
166
167
  | `looks/headline.look` | Headline: serif headline over flat newspaper-graphics blocks, one muted crimson accent. An alternative to the built-in look |
167
168
  | `editor/` | The browser editor (Vite + React) |
168
169
  | `examples/` | Diagrams written by agents from the guides, and looks used in tests |
package/dist/cli.js CHANGED
@@ -125,6 +125,7 @@ var DEFAULT_LOOK = `// FastDraw default look. Copy it with "fastdraw init-look"
125
125
  canvas paper=paper dots=ink/0.07 dotgap=24
126
126
 
127
127
  color paper #f6f7fb
128
+ color card #ffffff
128
129
  color ink #0f172a
129
130
  color muted #475569
130
131
  color soft #94a3b8
@@ -567,6 +568,101 @@ guidance "Never fill a shape with ink to make it stand out; use the accent, or a
567
568
  guidance "tag= is a 3 or 4 letter type marker in the corner of a box. sub= is a short second line of detail."
568
569
  guidance "A title reads best with a dek under it: one plain sentence saying what the diagram shows."
569
570
  guidance "Finish with a legend: one statement, 'legend at x,y' followed by style=\\"what it means\\" for each style you used."
571
+ `,
572
+ night: `// Night: the built-in look after dark. A deep navy page, raised navy cards with a two-tone icon,
573
+ // softly tinted zones, cool greys for everything else and one bright indigo for the subject and the
574
+ // main path. Same styles as the built-in look, so a diagram moves between them without changes.
575
+
576
+ canvas paper=paper dots=ink/0.08 dotgap=24
577
+
578
+ color paper #0b1226
579
+ color card #131c38
580
+ color ink #e2e8f0
581
+ color muted #94a3b8
582
+ color soft #64748b
583
+ color accent #8b8cff
584
+ color link #38bdf8
585
+ color teal #2dd4bf
586
+ color amber #fbbf24
587
+ color rose #fb7185
588
+ color violet #a78bfa
589
+
590
+ font sans "Geist"
591
+ font mono "Geist Mono"
592
+ font serif "Newsreader"
593
+
594
+ // ---- boxes ----------------------------------------------------------------
595
+ style node shape=rect radius=10 size=144x64 fill=#131c38 stroke=ink/0.14 sw=1 sub.font=sans sub.color=muted
596
+ tag.color=muted tag.border=ink/0.18 tag.font=mono icon.color=accent icon.fill=accent/0.14
597
+ use="default box: a backend, service, component or step"
598
+ style focal extends node fill=#131c38 stroke=accent sw=2 title.color=accent
599
+ tag.color=accent tag.border=accent/0.4 ghost.color=accent/0.10
600
+ use="the one or two elements the diagram is about"
601
+ style store extends node shape=path stroke=ink/0.18 icon.color=violet icon.fill=violet/0.14 tag.color=violet tag.border=violet/0.4
602
+ path="M0,0.1 C0,-0.035 1,-0.035 1,0.1 L1,0.9 C1,1.035 0,1.035 0,0.9 Z M0,0.1 C0,0.235 1,0.235 1,0.1 C1,0.235 0,0.235 0,0.1"
603
+ use="something that holds data or state"
604
+ style cloud extends node stroke=link/0.45 icon.color=link icon.fill=link/0.14 tag.color=link tag.border=link/0.4
605
+ use="a hosted or third-party platform"
606
+ style external extends node stroke=ink/0.28 dash=5,4 icon.color=muted icon.fill=ink/0.06
607
+ use="a person or system outside what you own"
608
+ style optional extends node fill=#131c38/0.6 stroke=ink/0.22 dash=3,3 tag.color=soft tag.border=ink/0.18
609
+ use="optional or asynchronous participant"
610
+ style sticky extends node radius=4 size=120x120 fill=#3a3315 stroke=amber/0.45 tag.color=ink tag.border=ink/0.3
611
+ use="a yellow sticky note: an idea, comment or open question"
612
+ style sticky-orange extends sticky fill=#3b1d26 stroke=rose/0.45 use="an orange sticky note: a risk or issue"
613
+ style sticky-violet extends sticky fill=#261f45 stroke=violet/0.45 use="a violet sticky note: a decision or note"
614
+
615
+ // ---- flowchart shapes -----------------------------------------------------
616
+ style step extends node size=160x48 use="flowchart action"
617
+ style terminal extends node radius=24 size=160x48 fill=#131c38 stroke=ink/0.30
618
+ use="flowchart start or end"
619
+ style terminal-focal extends terminal stroke=accent sw=2 title.color=accent
620
+ use="the flowchart outcome that matters most"
621
+ style decision shape=diamond size=200x96 fill=#131c38 stroke=ink/0.30 sw=1
622
+ use="flowchart yes/no question; put the text on two short lines"
623
+
624
+ // ---- regions and markers --------------------------------------------------
625
+ style zone shape=rect radius=16 fill=ink/0.03 stroke=ink/0.12 sw=1 layer=back
626
+ title.pos=top title.align=left title.font=sans title.size=11 title.weight=600 title.color=muted title.spacing=0 title.caps=0
627
+ use="a labelled region drawn behind a group of boxes; always give WxH"
628
+ style bar shape=rect radius=2 size=8x80 fill=accent/0.10 stroke=accent/0.6 sw=1
629
+ use="sequence diagram activation bar, centred on a lifeline; always give WxH"
630
+
631
+ style table shape=table radius=10 fill=#131c38 stroke=ink/0.16 sw=1 head.fill=accent/0.08 rule=ink/0.08
632
+ cell.font=mono cell.size=10 detail.color=muted
633
+ use="an entity, class or database table: a header and rows. One line per row: | id \\"name\\" \\"type\\" \\"key\\". Arrows can end on a row: orders.user_id -> users.id"
634
+ style matrix extends table align=center grid=1 cell.font=sans
635
+ use="a grid of values: first row with |= for the column headings, first cell of each row is its name"
636
+ style chart shape=chart fill=none stroke=ink/0.5 sw=1 mask=0 bar.radius=2 grid.color=ink/0.08
637
+ tick.font=mono tick.size=9 tick.color=muted
638
+ use="axes with your numbers drawn for you: chart at x,y WxH x=\\"Q1,Q2,Q3\\" y=0..100, then a line per series: | bars \\"Revenue\\" 42 61 75"
639
+
640
+ // ---- lines ----------------------------------------------------------------
641
+ style arrow line stroke=ink/0.45 sw=1.4 route=ortho radius=8 label.font=sans label.size=10 label.color=muted label.spacing=0 label.caps=0
642
+ use="default arrow"
643
+ style primary extends arrow stroke=accent sw=2 label.color=accent use="the main path; at most two per diagram"
644
+ style link extends arrow stroke=link label.color=link use="an HTTP or API request crossing a boundary"
645
+ style return extends arrow dash=5,4 use="a response, or something optional or asynchronous"
646
+ style relation extends relation stroke=ink/0.5 label.font=sans label.size=10 label.spacing=0 label.caps=0
647
+ style lifeline line head=none stroke=ink/0.20 sw=1 dash=4,4 route=straight use="sequence diagram lifeline"
648
+ style rule line head=none stroke=ink/0.10 sw=1 route=straight use="thin separator, e.g. above a legend"
649
+
650
+ // ---- text -----------------------------------------------------------------
651
+ style h1 text font=sans size=26 weight=600 color=ink use="diagram title"
652
+ style kicker text font=mono size=10 weight=500 color=accent spacing=0.12 caps=1 use="optional: a short category above the title, e.g. PROCESS"
653
+ style dek text font=sans size=14 color=muted use="optional: one line under the title saying what the diagram shows"
654
+ style eyebrow text font=mono size=8 color=muted spacing=0.14 caps=1 use="small caps label, e.g. LEGEND"
655
+ style caption text font=sans size=9.5 color=muted use="small explanatory text"
656
+ style legend extends legend rule=ink/0.1 title.font=mono item.size=9.5
657
+ style note text font=sans size=13 color=muted use="a short aside; at most two"
658
+ style small text font=mono size=9 color=muted use="technical detail: a port, path or command"
659
+
660
+ guidance "focal, terminal-focal and primary are the accent. Use the accent on at most two things in one diagram."
661
+ guidance "Never fill a shape with ink to make it stand out; use the accent, or a tint such as accent/0.14."
662
+ guidance "tag= is a 3 or 4 letter type marker in the corner of a box (EXT, EDGE, API, DB). Use it on architecture boxes, not flowchart shapes."
663
+ guidance "sub= is a short second line of detail: a product name, path, port or protocol. Names of things go in the main text."
664
+ guidance "kicker and dek are optional. Add a kicker only when the diagram belongs to a named category, and a dek only when there is one clear message; most diagrams need neither."
665
+ guidance "Finish with a legend: one statement, 'legend at x,y' followed by style=\\"what it means\\" for each style you used."
570
666
  `,
571
667
  reference: `// Reference look for the quality comparison.
572
668
  // It mirrors the palette and type of diagram-design's default skin so the two can be
@@ -920,7 +1016,7 @@ var BUILTIN = [
920
1016
  ];
921
1017
  function emptyLook() {
922
1018
  const look = {
923
- colors: /* @__PURE__ */ new Map([["ink", "#222222"], ["muted", "#666666"], ["paper", "#ffffff"]]),
1019
+ colors: /* @__PURE__ */ new Map([["ink", "#222222"], ["muted", "#666666"], ["paper", "#ffffff"], ["card", "#ffffff"]]),
924
1020
  fonts: /* @__PURE__ */ new Map([["sans", "Helvetica"], ["mono", "monospace"], ["serif", "serif"]]),
925
1021
  fontDirs: [],
926
1022
  canvas: {},
@@ -16,7 +16,7 @@ A box from `x0,y0` to `x1,y1`, standing from z to z+h, has four top corners: A (
16
16
 
17
17
  ```
18
18
  // desk: 24,28 to 68,52, z 6 to 16 · origin 450,142
19
- polygon at 422,152 points=24,0;68,22;68,32;44,44;0,22;0,12 fill=#ffffff stroke=ink sw=1 overlap=ok // silhouette A B Bb Cb Db D
19
+ polygon at 422,152 points=24,0;68,22;68,32;44,44;0,22;0,12 fill=card stroke=ink sw=1 overlap=ok // silhouette A B Bb Cb Db D
20
20
  polygon at 422,164 points=0,0;44,22;44,32;0,10 fill=ink/0.07 stroke=none overlap=ok mask=0 // left face: D C Cb Db
21
21
  polygon at 466,174 points=0,12;24,0;24,10;0,22 fill=ink/0.15 stroke=none overlap=ok mask=0 // right face: C B Bb Cb
22
22
  polygon at 422,164 points=0,0;44,22;44,32;44,22;68,10 open=1 stroke=ink/0.55 sw=0.8 overlap=ok // inner edges: D C Cb C B
@@ -40,7 +40,7 @@ One room or one building: the accent floor tint and an accent tag. Its furniture
40
40
 
41
41
  ## Text
42
42
 
43
- - Each room is named by a tag: `rect "Kitchen" sub="café, lockers" at 456,300 96x32 radius=2 fill=#ffffff stroke=ink/0.12 sw=0.8 title.size=12 sub.size=8 overlap=ok`. The focal tag has `stroke=accent title.color=accent sub.color=accent`. Tags are level, never tilted onto the floor, and written after every box so no wall cuts them. One or two words per name.
43
+ - Each room is named by a tag: `rect "Kitchen" sub="café, lockers" at 456,300 96x32 radius=2 fill=card stroke=ink/0.12 sw=0.8 title.size=12 sub.size=8 overlap=ok`. The focal tag has `stroke=accent title.color=accent sub.color=accent`. Tags are level, never tilted onto the floor, and written after every box so no wall cuts them. One or two words per name.
44
44
  - A tag goes on open floor inside its room: project a floor point (z=6), centre the 96x32 tag on it. Accept the spot only if the whole tag rectangle lies inside the slab outline and does not touch the silhouette of any box (tall boxes in front of the spot reach 2h units up the screen) or another tag. Step the point in 5-unit moves until it passes; a script can test the rectangle's corners and edge midpoints with a point-in-polygon check. On a 300x200 plan with two furnished rooms there is room for about one spot per room.
45
45
  - When no spot passes (a small plan, a crowded room, a building tag that would sit on furniture), put the tag outside the slab: a 6x6 dot (`ellipse ... fill=ink stroke=none overlap=ok`) on the floor point, a level leader to the tag (`px,py -- tagright,py stroke=ink/0.4 sw=0.8 layer=front`) and the tag 12px beyond the slab's left corner (`ox - Y`) or right corner (`ox + X`), at the same height as the dot. Pick a height where the leader crosses no tall box. A building's tag may instead sit on its roof.
46
46
 
package/guide/exploded.md CHANGED
@@ -10,7 +10,7 @@ FastDraw has no 3D. A plate is four `rect`s with the same `at` and size, each wi
10
10
  // title at y=52. One plate: a square slab with rounded corners, 384 wide and 208 high on screen (16 of that is its thickness).
11
11
  // This is the bottom one of three: y = 96 + 116 * 2
12
12
  title: text "What the thermostat is made of" at 40,52 style=h1
13
- data: rect at 208,328 384x208 fill=#ffffff stroke=ink sw=1.2 overlap=ok shape=path
13
+ data: rect at 208,328 384x208 fill=card stroke=ink sw=1.2 overlap=ok shape=path
14
14
  path="M0,0.462 Q0.003,0.442 0.013,0.433 L0.469,0.029 Q0.5,0 0.531,0.029 L0.987,0.433 Q0.997,0.442 1,0.462 L1,0.538 Q0.997,0.558 0.987,0.567 L0.531,0.971 Q0.5,1 0.469,0.971 L0.013,0.567 Q0.003,0.558 0,0.538 Z"
15
15
  rect at 208,328 384x208 fill=ink/0.07 stroke=none overlap=ok mask=0 shape=path // left face, lit
16
16
  path="M0,0.462 Q0.003,0.481 0.013,0.49 L0.469,0.894 Q0.484,0.909 0.5,0.909 L0.5,0.986 Q0.484,0.986 0.469,0.971 L0.013,0.567 Q0.003,0.558 0,0.538 Z"
package/guide/guide.md CHANGED
@@ -21,7 +21,7 @@ One statement per line. An indented line continues the statement above it. `//`
21
21
 
22
22
  ```
23
23
  look "./team.look" // path relative to this file; leave the line out to use the built-in look
24
- // or a look that ships with FastDraw: look headline | reference | sketch | whiteboard
24
+ // or a look that ships with FastDraw: look headline | night | reference | sketch | whiteboard
25
25
  canvas paper=#ffffff dots=none dotgap=24 // optional: changes the look's background for this diagram only
26
26
 
27
27
  // shape: id: style "text" at x,y WxH key=value ...
package/guide/look.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A look is one text file (`.look`) that decides how every style is drawn: colours, fonts, shapes, lines and text. Diagrams point to it with `look "./team.look"`. Change the look and every diagram that uses it changes.
4
4
 
5
- Four looks ship with FastDraw and need no file: `look headline`, `look reference`, `look sketch` and `look whiteboard` (a bare name, no quotes or `.look`). In the editor, the **Look** button shows the diagram in each of them and the built-in look, to try one before keeping it.
5
+ Five looks ship with FastDraw and need no file: `look headline`, `look night`, `look reference`, `look sketch` and `look whiteboard` (a bare name, no quotes or `.look`). In the editor, the **Look** button shows the diagram in each of them and the built-in look, to try one before keeping it.
6
6
 
7
7
  ## How to work
8
8
 
@@ -43,7 +43,7 @@ guidance "Use focal on at most two things in one diagram."
43
43
 
44
44
  ### Colours
45
45
 
46
- A colour value is `#hex`, a name defined with `color`, or either followed by `/opacity`: `ink/0.3`, `#ffffff/0.85`. `none` means no fill or no stroke. Define `paper`, `ink` and `muted` at least; built-in parts fall back to those names.
46
+ A colour value is `#hex`, a name defined with `color`, or either followed by `/opacity`: `ink/0.3`, `#ffffff/0.85`. `none` means no fill or no stroke. Define `paper`, `ink` and `muted` at least; built-in parts fall back to those names. `card` is the fill of a plain box (white unless a look sets it; a dark look sets it to its box colour), so a diagram that writes `fill=card` stays right in every look.
47
47
 
48
48
  ### Fonts
49
49
 
@@ -9,12 +9,12 @@ Title at 40,52 (`style=h1`); the header row starts at y=96. A `table`/`matrix` w
9
9
  ```
10
10
  // columns: labels at x=40 (200 wide), then one per role: x = 248 + 144*j, 136 wide
11
11
  // rows: header at y=96 (52 high), then y = 160 + 40*k, 36 high
12
- corner: rect "Component" sub="vs. AD group" at 40,96 200x52 radius=6 fill=#ffffff stroke=ink/0.12 title.size=11
12
+ corner: rect "Component" sub="vs. AD group" at 40,96 200x52 radius=6 fill=card stroke=ink/0.12 title.size=11
13
13
  r1: rect "Data Engineer" sub="GRP-DATA-ENG" at 248,96 136x52 radius=6 fill=ink/0.07 stroke=none title.weight=700 sub.color=muted title.size=11
14
14
 
15
- c1: rect "Object storage" at 40,160 200x36 radius=4 fill=#ffffff stroke=ink/0.12 title.size=11 title.align=left
15
+ c1: rect "Object storage" at 40,160 200x36 radius=4 fill=card stroke=ink/0.12 title.size=11 title.align=left
16
16
  text "S3" at 228,181 style=small anchor=end
17
- c11: rect "Write" at 248,160 136x36 radius=4 title.size=10 title.weight=400 stroke=ink/0.12 fill=#ffffff
17
+ c11: rect "Write" at 248,160 136x36 radius=4 title.size=10 title.weight=400 stroke=ink/0.12 fill=card
18
18
  ```
19
19
 
20
20
  Four levels, and only four. The cell text is free ("SELECT", "Login", "R/W"); the look of the cell comes from the level it belongs to:
@@ -22,7 +22,7 @@ Four levels, and only four. The cell text is free ("SELECT", "Login", "R/W"); th
22
22
  | Level | Add to the cell |
23
23
  |---|---|
24
24
  | Full / admin | `fill=ink/0.12 title.weight=600` |
25
- | Read and write | `fill=#ffffff title.weight=400` |
25
+ | Read and write | `fill=card title.weight=400` |
26
26
  | Read only | `fill=muted/0.08 title.color=muted title.weight=400` |
27
27
  | No access | `fill=none title.color=soft title.weight=400` |
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastdraw",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Diagrams that an AI agent writes as text and a person edits on a canvas",
5
5
  "keywords": [
6
6
  "diagram",