@blueshed/joined 0.2.1 → 0.3.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 (209) hide show
  1. package/.claude/skills/joined/SKILL.md +9 -1
  2. package/.claude/skills/joined/reference.md +270 -55
  3. package/.claude/skills/joined-door/SKILL.md +57 -0
  4. package/README.md +19 -50
  5. package/docs/design.md +76 -10
  6. package/docs/introduction.md +18 -18
  7. package/docs/light-and-shadow.svg +1 -1
  8. package/examples/README.md +20 -0
  9. package/examples/account/account.json +1 -0
  10. package/examples/account/derive.ts +41 -0
  11. package/examples/account/generated/elements.ts +52 -0
  12. package/examples/account/generated/rows.ts +22 -0
  13. package/examples/account/generated/rules.ts +32 -0
  14. package/examples/account/routes.ts +5 -0
  15. package/examples/app.css +2 -1
  16. package/examples/cafe/books.html +2 -2
  17. package/examples/cafe/cafe.css +9 -16
  18. package/examples/cafe/generated/books.rows.ts +22 -0
  19. package/examples/cafe/generated/books.rules.ts +3 -2
  20. package/examples/cafe/generated/kitchen.rows.ts +27 -0
  21. package/examples/cafe/generated/kitchen.rules.ts +11 -1
  22. package/examples/cafe/generated/menu.rows.ts +22 -0
  23. package/examples/cafe/generated/menu.rules.ts +3 -2
  24. package/examples/cafe/generated/order.rows.ts +27 -0
  25. package/examples/cafe/generated/order.rules.ts +11 -1
  26. package/examples/cafe/generated/staff.rows.ts +22 -0
  27. package/examples/cafe/generated/staff.rules.ts +6 -1
  28. package/examples/cafe/generated/supplies.queries.ts +4 -2
  29. package/examples/cafe/generated/supplies.rows.ts +22 -0
  30. package/examples/cafe/generated/supplies.rules.ts +12 -1
  31. package/examples/cafe/generated/till.queries.ts +2 -0
  32. package/examples/cafe/generated/till.rows.ts +27 -0
  33. package/examples/cafe/generated/till.rules.ts +11 -1
  34. package/examples/cafe/index.html +14 -15
  35. package/examples/cafe/kitchen.ts +1 -1
  36. package/examples/cafe/look.ts +30 -0
  37. package/examples/cafe/menu.html +10 -26
  38. package/examples/cafe/menu.ts +8 -80
  39. package/examples/cafe/order.html +6 -6
  40. package/examples/cafe/order.ts +5 -1
  41. package/examples/cafe/routes.ts +0 -1
  42. package/examples/cafe/stories.jsonl +3 -1
  43. package/examples/cafe/supplies.html +34 -34
  44. package/examples/cafe/supplies.ts +14 -11
  45. package/examples/cafe/till.ts +5 -1
  46. package/examples/chart/arches.ts +148 -0
  47. package/examples/chart/chart.css +6 -0
  48. package/examples/chart/chart.json +87 -0
  49. package/examples/chart/generated/elements.ts +105 -0
  50. package/examples/chart/generated/queries.ts +36 -0
  51. package/examples/chart/generated/rows.ts +27 -0
  52. package/examples/chart/generated/rules.ts +111 -0
  53. package/examples/chart/grid.ts +118 -0
  54. package/examples/chart/index.html +78 -0
  55. package/examples/chart/migrations/001-chart.ts +6 -0
  56. package/examples/chart/migrations/002-create-conditions.ts +6 -0
  57. package/examples/chart/page.ts +20 -0
  58. package/examples/chart/routes.ts +7 -0
  59. package/examples/chart/stories.jsonl +14 -0
  60. package/examples/chart/teeth.ts +57 -0
  61. package/examples/desk/generated/rows.ts +22 -0
  62. package/examples/desk/generated/rules.ts +34 -1
  63. package/examples/desk/index.html +9 -2
  64. package/examples/desk/routes.ts +0 -2
  65. package/examples/desk/stories.jsonl +3 -2
  66. package/examples/desk/thumbs.ts +2 -2
  67. package/examples/hello/generated/elements.ts +2 -2
  68. package/examples/hello/generated/rules.ts +3 -2
  69. package/examples/hello/hello.css +2 -4
  70. package/examples/hello/index.html +10 -3
  71. package/examples/hello/page.ts +4 -4
  72. package/examples/index.html +4 -5
  73. package/examples/notes/generated/elements.ts +112 -0
  74. package/examples/notes/generated/queries.ts +36 -0
  75. package/examples/notes/generated/rows.ts +27 -0
  76. package/examples/notes/generated/rules.ts +133 -0
  77. package/examples/notes/index.html +32 -0
  78. package/examples/notes/look.ts +41 -0
  79. package/examples/notes/migrations/001-notes.ts +7 -0
  80. package/examples/notes/notes.json +78 -0
  81. package/examples/notes/page.ts +21 -0
  82. package/examples/notes/routes.ts +6 -0
  83. package/examples/notes/stories.jsonl +21 -0
  84. package/examples/people/generated/rows.ts +22 -0
  85. package/examples/people/generated/rules.ts +11 -1
  86. package/examples/people/links.ts +2 -1
  87. package/examples/people/routes.ts +1 -3
  88. package/examples/people/stories.jsonl +1 -0
  89. package/examples/people/view.ts +5 -2
  90. package/examples/trip/generated/elements.ts +4 -2
  91. package/examples/trip/generated/queries.ts +12 -1
  92. package/examples/trip/generated/rows.ts +27 -0
  93. package/examples/trip/generated/rules.ts +56 -2
  94. package/examples/trip/index.html +58 -12
  95. package/examples/trip/line.css +186 -0
  96. package/examples/trip/line.ts +51 -40
  97. package/examples/trip/page.ts +65 -71
  98. package/examples/trip/routes.ts +9 -5
  99. package/examples/trip/stays.css +12 -12
  100. package/examples/trip/stays.ts +15 -10
  101. package/examples/trip/stories.jsonl +2 -0
  102. package/examples/trip/told.ts +3 -26
  103. package/examples/trip/trip.css +16 -0
  104. package/examples/trips/generated/rows.ts +22 -0
  105. package/examples/trips/generated/rules.ts +9 -1
  106. package/examples/trips/index.html +10 -10
  107. package/examples/trips/map.ts +3 -14
  108. package/examples/trips/new-trip.ts +14 -16
  109. package/examples/weeks/generated/elements.ts +1 -1
  110. package/examples/weeks/generated/queries.ts +11 -0
  111. package/examples/weeks/generated/rows.ts +22 -0
  112. package/examples/weeks/generated/rules.ts +11 -5
  113. package/examples/weeks/routes.ts +3 -2
  114. package/examples/weeks/stories.jsonl +1 -0
  115. package/examples/welcome.css +7 -5
  116. package/package.json +8 -2
  117. package/src/awesome.ts +103 -0
  118. package/src/board.css +75 -0
  119. package/src/board.ts +173 -0
  120. package/src/cli.ts +15 -2
  121. package/src/compile.ts +569 -35
  122. package/src/definitions.ts +53 -15
  123. package/src/draft.ts +38 -23
  124. package/src/drawer.ts +222 -0
  125. package/src/engine.ts +240 -166
  126. package/src/fields.ts +268 -0
  127. package/src/files.ts +6 -4
  128. package/src/ground.ts +110 -0
  129. package/src/icon-names.ts +15 -2
  130. package/src/kit.ts +51 -0
  131. package/src/link.ts +3 -3
  132. package/src/map.css +133 -0
  133. package/src/map.ts +200 -0
  134. package/src/mcp.ts +176 -38
  135. package/src/members/demo.ts +13 -12
  136. package/src/members/generated/rows.ts +22 -0
  137. package/src/members/generated/rules.ts +3 -2
  138. package/src/members/group.ts +65 -39
  139. package/src/members/keys.ts +93 -77
  140. package/src/members/panel.css +23 -17
  141. package/src/members/panel.ts +49 -35
  142. package/src/migrate.ts +120 -104
  143. package/src/month.css +125 -0
  144. package/src/month.ts +179 -0
  145. package/src/page.css +8 -0
  146. package/src/page.ts +11 -7
  147. package/src/parts.css +462 -170
  148. package/src/parts.ts +209 -26
  149. package/src/plane.css +56 -0
  150. package/src/plane.ts +151 -0
  151. package/src/postgres-server.ts +60 -0
  152. package/src/reading.css +77 -0
  153. package/src/reading.ts +238 -0
  154. package/src/rows.css +308 -0
  155. package/src/rows.ts +780 -0
  156. package/src/search.css +80 -0
  157. package/src/search.ts +130 -0
  158. package/src/server.ts +211 -114
  159. package/src/settings.ts +9 -4
  160. package/src/sheet.ts +114 -0
  161. package/src/skill.ts +40 -0
  162. package/src/slots.css +94 -0
  163. package/src/slots.ts +213 -0
  164. package/src/specs.ts +38 -0
  165. package/src/starter.ts +5 -2
  166. package/src/store.ts +184 -143
  167. package/src/stories.ts +43 -11
  168. package/src/surface.ts +159 -0
  169. package/src/timeline.css +111 -0
  170. package/src/timeline.ts +226 -0
  171. package/src/toast.ts +21 -48
  172. package/src/together.ts +0 -7
  173. package/src/tokens.css +78 -1
  174. package/src/tokens.json +249 -0
  175. package/src/tool.ts +211 -0
  176. package/src/upkeep.ts +18 -20
  177. package/src/views.css +44 -0
  178. package/src/views.ts +94 -0
  179. package/src/week.css +151 -0
  180. package/src/week.ts +250 -0
  181. package/src/write.ts +219 -73
  182. package/starter/CLAUDE.md +3 -3
  183. package/starter/bunfig +4 -0
  184. package/starter/prettierignore +4 -0
  185. package/starter/tests/hello.test.ts +2 -0
  186. package/docs/learning.md +0 -76
  187. package/examples/cafe/trust.ts +0 -20
  188. package/examples/desk/trust.ts +0 -24
  189. package/examples/people/trust.ts +0 -14
  190. package/examples/trip/answer-rows.ts +0 -70
  191. package/examples/trip/bar.ts +0 -89
  192. package/examples/trip/calendar-map.css +0 -711
  193. package/examples/trip/calendar-map.ts +0 -249
  194. package/examples/trip/drags.ts +0 -143
  195. package/examples/trip/drawer.ts +0 -250
  196. package/examples/trip/event-form.ts +0 -200
  197. package/examples/trip/holding.ts +0 -61
  198. package/examples/trip/map.ts +0 -234
  199. package/examples/trip/month.ts +0 -87
  200. package/examples/trip/other-weeks.ts +0 -67
  201. package/examples/trip/peek.ts +0 -71
  202. package/examples/trip/people-chips.ts +0 -74
  203. package/examples/trip/shell.ts +0 -39
  204. package/examples/trip/trust.ts +0 -51
  205. package/examples/trip/week.ts +0 -237
  206. package/examples/trip/writes.ts +0 -91
  207. package/examples/trip/zones.ts +0 -16
  208. package/examples/weeks/derive.ts +0 -23
  209. package/src/scrim.ts +0 -81
@@ -14,4 +14,12 @@ A new app goes stories → compile → folder → look → links → tests: §2,
14
14
  `node_modules/joined/` (`src/`, `examples/`, `docs/`); joined's `tests/` isn't shipped, and an app's tests
15
15
  are its own (`tests/`, its stories told). Copy from joined's examples, smallest first.
16
16
 
17
- The rules, and the gate, are CLAUDE.md's. Traps already met are §13; the store, its migrations, and running elsewhere, §14 (and §3); views to copy, §16.
17
+ **New and delete are modal; edit is the drawer** (`docs/design.md`, Three surfaces and Adding). A new thing is a
18
+ box on the page (one field) or a modal (the few it can't be without), then filled in in its drawer; a removal is asked
19
+ first in a modal; a drawer, or a phone's sheet, edits one thing and never adds one. Check every surface against this
20
+ before it's shown.
21
+
22
+ Reading or changing a document through an app's MCP door is the `joined-door` skill, beside this one, which the door
23
+ itself says as it opens.
24
+
25
+ The rules, and the gate, are CLAUDE.md's. Traps already met are §13; the store, its migrations, and running elsewhere, §14 (and §3); views to copy, §16. A list, a form or a search is composed from the kit, §17, never written again.
@@ -5,12 +5,12 @@
5
5
  | 1 | [Start an app](#1-start-an-app) | `examples/hello/` |
6
6
  | 2 | [Stories, the source](#2-stories-the-source) | `examples/people/stories.jsonl` (the smallest with members), `examples/trip/stories.jsonl`, `tests/compile.test.ts` |
7
7
  | 3 | [What the compiler writes](#3-what-the-compiler-writes) | `examples/trip/generated/` |
8
- | 4 | [A view: an item element given a look](#4-a-view-an-item-element-given-a-look) | `examples/trip/stays.ts` (the smallest), `examples/hello/page.ts` (a Draft), `examples/cafe/menu.ts` (a drawer) |
9
- | 5 | [A display: a collection drawn in a shadow](#5-a-display-a-collection-drawn-in-a-shadow) | `examples/cafe/kitchen.ts` (the smallest), `examples/desk/tally.ts` (one that holds nothing), `examples/cafe/rail-drag.ts` (a drag), `examples/trip/calendar-map.ts` (grown, a part a file) |
8
+ | 4 | [A view: an item element given a look](#4-a-view-an-item-element-given-a-look) | `examples/trip/stays.ts` (the smallest), `examples/hello/page.ts` (a Draft), `examples/cafe/menu.html` (the kit, §17) |
9
+ | 5 | [A display: a collection drawn in a shadow](#5-a-display-a-collection-drawn-in-a-shadow) | `examples/cafe/kitchen.ts` (the smallest), `examples/desk/tally.ts` (one that holds nothing), `examples/cafe/rail-drag.ts` (a drag), `examples/trip/line.ts` (a reading of the kit's, grown) |
10
10
  | 6 | [Links between documents](#6-links-between-documents) | an event's `people`; `examples/people/links.ts` |
11
11
  | 7 | [Several documents on a page](#7-several-documents-on-a-page) | `examples/cafe/index.html`, `examples/trip/index.html` |
12
12
  | 8 | [Routes: pages and edges](#8-routes-pages-and-edges) | `examples/hello/routes.ts`, `examples/cafe/routes.ts`, `examples/trip/routes.ts` |
13
- | 9 | [Stylesheets](#9-stylesheets) | `examples/hello/hello.css`, `examples/cafe/kitchen.css` (a display's), `examples/trip/calendar-map.css` |
13
+ | 9 | [Stylesheets](#9-stylesheets) | `examples/hello/hello.css`, `examples/cafe/kitchen.css` (a display's), `examples/trip/line.css` |
14
14
  | 10 | [Icons](#10-icons) | `src/icons.ts` |
15
15
  | 11 | [The group: sign-in by link](#11-the-group-sign-in-by-link) | `src/members/`, `tests/sign-in.test.ts` |
16
16
  | 12 | [Tests](#12-tests) | `tests/pages.test.ts` (hello's), `tests/cafe.test.ts`, `tests/examples.test.ts` |
@@ -18,6 +18,7 @@
18
18
  | 14 | [Seeds, the store, and running it elsewhere](#14-seeds-the-store-and-running-it-elsewhere) | `examples/trip/trip.json`, `src/store.ts`, `src/migrate.ts` |
19
19
  | 15 | [What stories can't show: definitions, an app's own rules, a kind](#15-what-stories-cant-show-definitions-an-apps-own-rules-a-kind) | `examples/cafe/stories.jsonl`, `src/definitions.ts` |
20
20
  | 16 | [Recipes: views to copy](#16-recipes-views-to-copy) | `examples/desk/` (lanes, moves, thumbs, a tally, a glow, a rank), and the rest by where they're shown |
21
+ | 17 | [The kit: a page composed, not written](#17-the-kit-a-page-composed-not-written) | `examples/cafe/menu.html` (the smallest), `tests/kit/` (every kind of field, every reading) |
21
22
 
22
23
  ## 1. Start an app
23
24
 
@@ -46,6 +47,12 @@ examples/notes/
46
47
  notes.css how the document's elements look
47
48
  ```
48
49
 
50
+ **A page before it has a display of its own:** the compiler writes each collection one, rows
51
+ (`generated/rows.ts`, §3). `index.html` holds `<j-notes-rows><j-notes></j-notes></j-notes-rows>`, and `page.ts`
52
+ defines it: `define(JNotesRows)`, from `joined/rows` and `./generated/rows.ts`. Every op the stories allow is there
53
+ to do. It's the app's to extend (a word, how a field reads, a deed more) or to leave for a display of its own (§4,
54
+ §5) when rows aren't what the thing is. Working: `tests/rows/choices/`.
55
+
49
56
  Then `bun run compile`, add a link to the root page (`examples/index.html`), and `bun run dev`. The
50
57
  server finds the app by its `routes.ts` and nothing else. A document that other pages hold, and
51
58
  has no page of its own, needs only its stories, its seed and `routes.ts`, as `examples/people/` does.
@@ -56,7 +63,7 @@ element is the document); with the group and a collection, `examples/trips/`.
56
63
  **An app imports joined by its name, never by a path into `src/`,** as a project that takes joined as
57
64
  a dependency would; `tests/package.test.ts` refuses `../src/` under `examples/`. The names are
58
65
  `package.json`'s `exports`: `joined/page` (`Answer`, `ask`), `joined/keep` (`keep`, `Row`), `joined/draft`,
59
- `joined/parts` (`adopt`, `PARTS`, `face`, `said`, `askFirst`, `showsOpen`, `inHash`, `typeahead`), `joined/follow` (`follow`,
66
+ `joined/parts` (`adopt`, `PARTS`, `face`, `said`, `askFirst`, `showsOpen`, `inHash`, `typeahead`, `row`, `tick`, `mention`, `peek`), `joined/follow` (`follow`,
60
67
  `held`), `joined/time`, `joined/ics`, `joined/geo`, `joined/places`, `joined/place-search`, `joined/rank` (time, places and order: §16's
61
68
  "Shared, not copied"), `joined/icons`, `joined/hues` (`hueOf`), `joined/panel` (`members`, `signedIn`, `group`: §11), `joined/toast`, `joined/client` (`open`),
62
69
  `joined/stories` (`tell`), `joined/migrate`, `joined/server` (the type `Read`), `joined/compile`; and in a page's HTML
@@ -108,13 +115,18 @@ A story is one JSON line in dzql's words:
108
115
  a boolean, an integer or a decimal (a value with a fraction), or a list of ids (§6). A value not its
109
116
  form is refused in words.
110
117
  - **A field is needed** if every add gives it. A story more that leaves it out lets it go:
111
- `bun run compile` says so, naming the story.
118
+ `bun run compile` says so, naming the story. Where no story adds an item (a race's fleets, only replaced), the
119
+ seed's items are all there are: a field every one of them has is typed as there (`JFleetData.start: string`),
120
+ though its column is as a field no add needs.
112
121
  - **An op is allowed** only if a story does it.
113
122
  - **A field may be removed** if a story removes it (`remove /events/2/location`) and it isn't
114
123
  needed.
115
124
  - The compiler refuses, naming the story:
116
125
  - a field typed two ways;
117
- - a name that can't be an attribute;
126
+ - a name that can't be an attribute, or is every HTML element's own (`class`, `style`, `hidden`, `id`, `slot`,
127
+ `part`, `lang`, `dir`…): an item's fields are its element's attributes, so a boat's class is its `design`;
128
+ - a link's name given otherwise in another document of the app (a race's crossings' `boat` a link to boats, an
129
+ entry's `boat` a string), naming both: a link's name is its own wherever the app says it;
118
130
  - a path no op can have;
119
131
  - a list of ids named for no collection;
120
132
  - an empty list nothing else types;
@@ -155,6 +167,43 @@ Working: `examples/trip/stories.jsonl`; the model's rules in `tests/compile.test
155
167
  sent from any element of it; its ops typed as the stories allow them (`<Doc>Op`), so one they don't
156
168
  is a type error; it returns the write's answer too. Working: `tests/fixtures/ledger/page.ts`.
157
169
 
170
+ - **`rows.ts`:** a display for each collection, rows, drawn by `joined/rows` as this file says it: nothing is
171
+ guessed as it runs. It exports a class each (`JEventsRows`, its tag `j-events-rows`) and defines none: the page
172
+ does, `define(JEventsRows)` from `joined/rows`, as it is or extended, as an item's element is the page's to define.
173
+ - **A row** is its item's title (the first words an add needs, else its first words), where it's got to beside
174
+ it as a tag (a `moves` field), and under it what else it holds, as each reads: a number, a time, what a link is to,
175
+ people as their faces; a yes or no is a tick at its start, kept at once. At its end, what its person may do there, by its `may`: a
176
+ `mine` list pressed to be in it, the faces of those who are and how many (the lists it's said with taken back
177
+ in the same write); each step a `moves` field may take ("Mark settled").
178
+ - **Under it,** the collection whose items are each of one of its own (an add needs a link to one: an option's
179
+ `question`), where the page puts that collection's element in the rows too
180
+ (`<j-questions-rows><j-questions></j-questions><j-options></j-options></j-questions-rows>`): each item's own
181
+ beneath it, a way to add one there (the link given, never asked), and a note where there are none. One deep.
182
+ - **Tapped, its drawer:** the fields its person may change, its title first, each asked by its type (a tick, a
183
+ number, a time; a link to one chosen from six or fewer as a select, from more by typing: design.md's
184
+ Choosing), a `Draft` until Save, one write; Remove at its foot, asked first. What's open is in the hash
185
+ (`#option=2`). Add opens it empty, Save off until it has what an add needs. What the server fills is said,
186
+ never asked.
187
+ - **To extend it,** a class of the page's own: `class Options extends JOptionsRows { label(f) { … } }`, then
188
+ `define(Options)`. Each part is a method: `label(field)` (what it's called: its name, until the page says its
189
+ words), `named(item)`, `says(item, field)` (how one field reads), `facts(item)`, `deeds(item)` (call `super`
190
+ and add one), `step(field, to)` (a step's words), `row(item)` (the row whole), `asks(spec)` (the drawer's
191
+ fields, in order); `static sheets` adds stylesheets. **To restyle it,** its parts from the page's own
192
+ stylesheet: `j-options-rows::part(title)` (`list`, `row`, `open`, `title`, `state`, `facts`, `deeds`, `mine`,
193
+ `step`, `add`, `under`, `none`, `drawer`). **To replace it,** don't define it: a display of the app's own
194
+ holds the same elements (§5).
195
+ - **From the model alone,** with nothing said by the app (`examples/notes/page.ts` is twenty lines): a time (a
196
+ date and time, an instant) is a mention under the row's words, and tapped pops its month, small (`<j-month
197
+ small>`), whose button opens the page's month where `<j-views>` holds one. The rows are a list: read as a board
198
+ or a month, they're held in `<j-views>` beside `<j-board>` and `<j-month>` (§17, `examples/notes/index.html`).
199
+ Where a collection put in the rows is each member's own number for an
200
+ item (`mine: {"ranks": {"of": "note", "by": "by"}}`), the list is in my order (a grip, the arrow keys), another's
201
+ or everyone's (`?order=3`, `?order=all`); a collection an add needs only its name for is added by a box on the
202
+ page; the row whose drawer is open is marked. Each is a method to override (`pops`, `timed`, `below`,
203
+ `grip`, `adder`). An item opens in its collection's `<j-sheet>`, the page's, or one put on the page. Working: `tests/compiled.test.ts`.
204
+ - Not drawn yet: one of an object's fields, a list of ids that isn't `mine` (people's are faces, others
205
+ counted, neither chosen), a file, a place; a field emptied is left as it was.
206
+ Working: `tests/rows/choices/` (its page extends one, for two words), `tests/rows.test.ts`.
158
207
  - **`migrations/NNN-<what>.ts`,** in `src/migrate.ts`'s words (`createTable`, `addColumn`…), when the stories
159
208
  say more than the migrations so far: a collection is a table, a field a column (null where a story
160
209
  or the seed may leave it out), a list of ids a table of pairs, `<collection>_<field>`. The same
@@ -218,15 +267,16 @@ is for what no role can say. No story's field may be named `key` or `may`. Worki
218
267
 
219
268
  Words are changed in a drawer (`.drawer`, a part: `src/parts.css`), or a form on the page: it holds them as a
220
269
  draft, as the document has them until they're changed there, and Save sends the changes in one
221
- `replace()`; Never mind puts them back. Taking one away asks first, in a `<dialog>`: `askFirst(dialog)`
222
- from `joined/parts` wires its Never mind (`keep`) and its deed (`sure`), and returns the way to ask it,
223
- `ask(question, deed)`. The page's line, `#said`, says a request's refusal, emptied as the next is sent:
270
+ `replace()`; Never mind puts them back. Taking one away asks first, in a `<wa-dialog>`: `askFirst(dialog, words, follows)`
271
+ from `joined/parts` wires its Never mind (`keep`) and its deed (`sure`), puts a line under the question saying what
272
+ follows (`GONE` unless said), and returns the way to ask it, `ask(question, deed, follows?)`; `askOnPage(question,
273
+ deed, words?, follows?)` asks in the page's own, for a row in the page. The page's line, `#said`, says a request's refusal, emptied as the next is sent:
224
274
  `said(line)`, from `joined/parts`. A page's reading (a filter, a calendar or a line) is in its address's query, `?view=line`, read as it loads and
225
275
  said with `history.replaceState` as it changes, so a link opens it so (`examples/trip/page.ts`, `address`). What's
226
276
  open in a drawer is in the URL's hash (`#event=2`), so Back closes it
227
277
  and a link opens it: `inHash(name, items, picked, show, signal?)` from `joined/parts` returns `mark(key)`, called as one
228
- is opened or closed, and `again()`, called as the items change, to open one named before it was there (the trip's
229
- `<calendar-map>`). Its `signal` lets it go with the display.
278
+ is opened or closed, and `again()`, called as the items change, to open one named before it was there (the kit's
279
+ `<j-sheet>`). Its `signal` lets it go with the display.
230
280
 
231
281
  The draft is `Draft` from `joined/draft`, given the form (Save named `go`, Never mind `never`) and
232
282
  its note. `fill(saved, afresh)` sets the controls as the document has the item: afresh, all of
@@ -249,8 +299,8 @@ Working, smallest first:
249
299
  how many are left.
250
300
  - `examples/people/view.ts` (a person's row), `links.ts` (what links to them, kept as links come and go), `order.ts`
251
301
  (dragged by a grip), `adding.ts` (the page's form).
252
- - `examples/trip/event-form.ts` with `drawer.ts` and `writes.ts`: a `Draft` grown, in a drawer, its fields derived (a
253
- time made a duration), its parts a file each (`zones.ts`, `people-chips.ts`, `answer-rows.ts`; its place search is `joined/place-search`).
302
+ - The kit's `<j-sheet>` (§17): a `Draft` grown, in a drawer, a field for each kind (a time and how long, a zone, a
303
+ place searched, people as chips); the trip's events are edited in it.
254
304
 
255
305
  A file field (a post's photo, a PDF) is `attachment(doc, put, take?)` from `joined/attachment`: `el` to append, and
256
306
  `draw(value, { put, take })` called from the view's `draw()` with the item's value and its `may`
@@ -261,7 +311,7 @@ or an add form's field); `take` is `this.removeField("attachment")`. A photo or
261
311
 
262
312
  ## 5. A display: a collection drawn in a shadow
263
313
 
264
- A display holds the collection's element as its child (`<calendar-map><j-events></j-events></calendar-map>`).
314
+ A display holds the collection's element as its child (`<kitchen-rail><j-orders></j-orders></kitchen-rail>`).
265
315
  It never shows it, and draws its items in its shadow DOM:
266
316
 
267
317
  - **Watch it** with a `MutationObserver` on itself (`childList`, `subtree`, `attributes`). Its
@@ -287,6 +337,9 @@ It never shows it, and draws its items in its shadow DOM:
287
337
  name, asked of Photon); the form asks only the rest.
288
338
  - **Its look** is its own stylesheet, adopted in the shadow (§9). Its icons go in with
289
339
  `iconify(this.#root)` (§10).
340
+ - **Words in a drawing scaled by its `viewBox`** are sized in the drawing's units, so `font: var(--font-small)` there
341
+ shrinks or grows with the scale. Put the words over the drawing in HTML, where joined's type is as it says; or set
342
+ the text's `font-size` in the drawing's own units, from the scale it's drawn at (a custom property on the host).
290
343
  - **Another display's request** comes as an event on the item: `pick`, bubbling, is how the
291
344
  people's links pick an event on the calendar.
292
345
  - **Who changed it, and by what:** each change put on the page fires `changed` on every element it left changed (an
@@ -297,11 +350,8 @@ It never shows it, and draws its items in its shadow DOM:
297
350
 
298
351
  Working: `examples/cafe/kitchen.ts`, the smallest (about 130 lines: tickets kept by `keep` in columns, a ticket made
299
352
  again only as its order changes, the waits each minute), and `examples/cafe/rail-drag.ts`, the smallest drag (30
300
- lines, `follow` and `held`); `examples/trip/calendar-map.ts`, the same grown, the file that composes its parts (one
301
- change moves one block and one pin): `week.ts` (the calendar), `map.ts` (tiles, pins, pan, pinch), `month.ts`,
302
- `peek.ts`, `drawer.ts` and `writes.ts` (the form's drawer and its writes), `drags.ts` (what a hand gives), `holding.ts`
303
- (its events, read once a change), `told.ts` (the lists it's told of), `bar.ts`, `other-weeks.ts`, `shell.ts`; and
304
- `src/members/panel.ts`. **One concept a file, under 250 lines** (`tests/examples.test.ts` holds every example to it).
353
+ lines, `follow` and `held`); `examples/trip/line.ts`, a reading of the kit's (`Reading`, `joined/kit`) grown: its
354
+ week's stops (`line-stops.ts`, `line-words.ts`), the lists it's told of (`told.ts`); and `src/members/panel.ts`. **One concept a file, under 250 lines** (`tests/examples.test.ts` holds every example to it).
305
355
 
306
356
  ## 6. Links between documents
307
357
 
@@ -318,8 +368,8 @@ event's `people: [1, 3]`. The name is the rule, not a guess.
318
368
  only the ids added and taken.
319
369
  - **On the page it's an IDREFS attribute,** `people="1 3"`, so CSS finds the links:
320
370
  `[people~="2"]` is everything that links to person 2, in any document.
321
- - **A display watches the linked document** too: `<calendar-map people="people">` names where the
322
- people are, and observes it.
371
+ - **A display watches the linked document** too: `<trip-line people="the-people">` names where the
372
+ people are (by an id of its own: on a phone a sheet's content moves into its drawer), and observes it.
323
373
 
324
374
  Working: the trip's events and `examples/people/links.ts` (what links to a person, kept as links come and go, and
325
375
  `pick`); within one document, a line's `order` (`examples/cafe/views.ts`).
@@ -401,7 +451,8 @@ export const routes = (read: Read) => ({ "/trip/:n": page, "/trip/:n/trip.ics":
401
451
  stories (`doc`, `from`, `derive(read, member)`; its `routes.ts` re-exports `derive`) and an example,
402
452
  `<doc>.json`, its shape: elements with no ops, every write refused. The server derives it for each
403
453
  page's member as it's joined, and again after a write to what it's read from, sending it whole where it's
404
- changed. `tests/fixtures/statement`; `examples/weeks` (each trip's weeks, from the trips and their kind).
454
+ changed. `tests/fixtures/statement`. Where a query can say it, it's a read-only document by member (`documents`,
455
+ §15) and not a `derive.ts`: `examples/weeks` is.
405
456
  - **The root's page** is `examples/routes.ts`.
406
457
 
407
458
  Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an app of several documents:
@@ -435,10 +486,16 @@ Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an
435
486
  the parts. Read its section for what you draw; this section is how to draw it here.
436
487
  - **Every page's layout,** `src/page.css` (`joined/page.css`), linked after the tokens: the body, `h1`, `h2`,
437
488
  `.note`, `.bar`, `#said`, and `main` hidden signed out and dimmed away. A page's own look comes after it.
438
- - **The parts,** `src/parts.css`, once: buttons, fields, labels, the drawer (`.drawer`), the modal
439
- (`dialog`), the sheet (`.sheet`, a popover with a title and its ×) and a fixed foot (`.j-foot`). Adopted by the
440
- page and every shadow (`src/parts.ts`; a display's: `adopt(this.#root, SHEET)`, which also has its modals, sheets
441
- and drawers dim the page by its one scrim). A button with words is `.act` (`.ink`, `.danger`, `.quiet`), one with
489
+ - **The parts,** `src/parts.css`, once: buttons, fields, labels, the drawer (`.drawer`), the sheet
490
+ (`.sheet`, a popover with a title and its ×), a fixed foot (`.j-foot`), and how Web Awesome's parts sit in
491
+ joined's look. Adopted by the page and every shadow (`src/parts.ts`; a display's: `adopt(this.#root, SHEET)`).
492
+ - **Web Awesome** (`src/awesome.ts`, imported by the kit and the parts) is the modal (`wa-dialog`), a phone's
493
+ drawer and sheet (`wa-drawer`, by `Surface`, `joined/surface`), the toast, the peek (`wa-popover`), a tick
494
+ (`wa-checkbox`), words and numbers (`wa-input`, `wa-textarea`, `wa-number-input`), a choice of a few
495
+ (`wa-select`), tabs, a card (`wa-card`) and a refusal in place (`wa-callout`). A field of Web Awesome's draws a
496
+ moment after it's given a value: name it by attribute (`setAttribute("name", …)`), set a choice by `choose()`
497
+ and read it by `chosen()` (`joined/draft`), and wait for its `updateComplete` before asking a form if it's
498
+ valid. A button with words is `.act` (`.ink`, `.danger`, `.quiet`), one with
442
499
  its icon alone `.icon-only`; a field needs no class. Never a button's or a field's look in a display's own sheet:
443
500
  only how it sits (`flex: 1`).
444
501
  - **An app's rule wins over joined's:** the parts, the page's layout and the group's look are a layer, `joined`,
@@ -449,9 +506,9 @@ Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an
449
506
  parts: `members-panel::part(sheet)` (`bar`, `who`, `notice`, `sheet`, `menu`, `ask`, `waiting`).
450
507
  - **How it moves,** `src/tokens.json`'s motion (`--rise`, `--fall`, `--ask`, `--ask-out`, `--drop`): a drawer or a
451
508
  sheet rises (from the foot on a phone, a drawer from the right where it docks), a modal settles, a menu drops; on
452
- a phone a drawer and a sheet are a phone's sheet (rounded at the top, a grabber), the page dimmed behind by one
453
- scrim (`src/scrim.ts`) that fades in every browser, a tap on it closing the drawer on top. Never a surface's
454
- motion or scrim of an app's own.
509
+ a phone a drawer and a sheet are Web Awesome's `wa-drawer` (rounded at the top, a grabber), the page dimmed
510
+ behind by its scrim, a tap on it closing the drawer on top; Web Awesome's surfaces move as it moves them. Never a
511
+ surface's motion or scrim of an app's own.
455
512
  - **Type** is nine styles, each a font in `src/tokens.css`: `font: var(--font-row)` (`body`,
456
513
  `heading`, `title`, `row`, `label`, `tool`, `small`, `tiny`, `field`). Never a size by hand.
457
514
  - **The colours,** `src/tokens.css` (`--paper`, `--card`, `--ink`, `--muted`, `--line`, `--edge`, `--add`,
@@ -473,7 +530,7 @@ Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an
473
530
 
474
531
  ```ts
475
532
  import { adopt } from "joined/parts";
476
- import STYLE from "./calendar-map.css" with { type: "text" };
533
+ import STYLE from "./line.css" with { type: "text" };
477
534
  const SHEET = new CSSStyleSheet(); SHEET.replaceSync(STYLE);
478
535
  adopt(this.#root, SHEET); // joined's parts, then its own
479
536
  ```
@@ -483,7 +540,7 @@ Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an
483
540
 
484
541
  Working: `examples/app.css`, `examples/cafe/cafe.css` (a page's look over joined's parts),
485
542
  `examples/cafe/kitchen.css` (a display's own palette, named once on `:host`), `examples/people/people.css`,
486
- `examples/trip/calendar-map.css`.
543
+ `examples/trip/line.css`.
487
544
 
488
545
  ## 10. Icons
489
546
 
@@ -536,11 +593,20 @@ Working: `src/icons.ts`; the members panel and every example.
536
593
  - **To act for Peter,** use an agent's link he made, labelled (as `claude`). Its writes are his,
537
594
  `via` the label, and it holds none of his keys.
538
595
  - **The MCP door** (`src/mcp.ts`): an agent's link is a custom connector for Claude in a chat (claude.ai, a
539
- phone), and the Agents tab copies it so: `POST /mcp/<its token>`, MCP's Streamable HTTP in plain JSON. Only an agent's token opens it. Its tools are
540
- written from the compiled rules: `read_<doc>` (as its member sees it) and `write_<doc>` (one write, ops typed as
541
- the grants allow, answered `{ done, version, ids }` or a tool error in the refusal's words); a kind's take `key`;
542
- a window isn't one (read the document). An app's `routes.ts` may export `instructions`, its words for the agent,
543
- said as the door opens (`examples/trip/routes.ts`). Never print the token: the URL holds it. A project with no
596
+ phone), and the Agents tab copies it so: `POST /mcp/<its token>`, MCP's Streamable HTTP in plain JSON. Only an agent's token opens it. It speaks both
597
+ eras of MCP: the modern (2026-07-28: no handshake, each request's version and capabilities in its `_meta`, its
598
+ headers checked against its body, `server/discover`) and the legacy, opened by `initialize` (2025-06-18 and
599
+ before), which Claude's apps and Gemini CLI use today. Its tools are
600
+ written from the compiled rules: `read_<doc>` (as its member sees it; whole, or a `collection`'s items, some by
601
+ `ids`) and `write_<doc>` (one write, ops typed as the grants allow, in anyOf and enum as a strict client reads
602
+ them, a link's id a number or `"$1"`, answered `{ done, version, ids }` or a tool error in the refusal's words); a
603
+ kind's take `key`; a window isn't one (read the document). The door carries its own skill, how any document is
604
+ read and written there (`.claude/skills/joined-door/SKILL.md`, the one text, `src/skill.ts`): by MCP's skills
605
+ extension (`io.modelcontextprotocol/skills`, declared in `server/discover`; `skills/list`, `skills/get`, the
606
+ resource `skill://joined-door/SKILL.md`), and in its instructions, where a client doesn't say it loads skills
607
+ itself (one that does is told where the skill is). After it in the instructions come each app's words: its `routes.ts` may export `instructions`
608
+ (`examples/trip/routes.ts`), what's its own alone (what its documents mean, its people, its clock), never how a read
609
+ or a write goes. A change to how any document is read or written there changes that skill with it (`tests/mcp.test.ts`). Never print the token: the URL holds it. A project with no
544
610
  members (every story anonymous, hello) has no group and no agent's link: its door is anyone's, `POST /mcp` with no
545
611
  token, as a stranger's page is, each write logged "by anyone" (`tests/server.test.ts`).
546
612
  - **Never put `ROOT_TOKEN`, `.env`, the store (`joined.sqlite`, which holds the keys) or anyone's link in a commit,** nor in chat
@@ -558,8 +624,10 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
558
624
  - `page(url, doc, token)` is a page's socket subscribed to `doc`, signed in or refused, with
559
625
  `next(match)`, `subscribe(doc)` and `closed`. A page's first told may come before you listen: wait with
560
626
  `toldOnSignIn` (`tests/sign-in.test.ts`).
561
- - **The stories are told by who they say,** every app's and the group's: `expect(await tell(doc)).toEqual([])`
562
- (`tests/server.test.ts`). A story's `does` must pass, be heard by those it names, and leave what its
627
+ - **The stories are told by who they say,** every app's and the group's: `expect(await tell(app)).toEqual([])`
628
+ (`tests/server.test.ts`). `tell` is by app folder, not by document: an app whose stories write several documents
629
+ (a race and its entries, in `apps/race/`) is told whole by `tell("race")`, and `tell("entries")` is refused,
630
+ saying whose stories write it. A story's `does` must pass, be heard by those it names, and leave what its
563
631
  `then` says, and its `cannot` must be refused; `tell` says, a line each, any that didn't
564
632
  (`tests/then.test.ts`).
565
633
  - **What isn't an op** (the sign-in routes, links, notices, agents) is tested in
@@ -643,6 +711,13 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
643
711
  declared after it is made. The people's view threw on every load, unseen, and after its fix a helper declared below
644
712
  the define waited for a page served with links in it. `tests/examples.test.ts` refuses a declaration after a
645
713
  define; the pages test's "every page loads without an error thrown" (Chrome) catches what throws.
714
+ - **A font in a scaled SVG is in the drawing's units,** not the page's: `font: var(--font-small)` on a `<text>` in a
715
+ `viewBox` of 1000 drawn 300 wide is a third of its size. Words go over it in HTML, or are sized in its units (§5).
716
+ Met on raceday, 30 Nov 2026.
717
+ - **Never restyle a pressed button:** a display's `[aria-pressed="true"] { background: var(--tint-strong) }` set
718
+ an invalid background (`--tint-strong` is a percentage, for `color-mix`), while the parts kept a pressed `.act`'s
719
+ words in `--card`: the words vanished. A choice that stays pressed is the parts' own `.act[aria-pressed]`, a few
720
+ side by side `.j-tabs`, chips `.j-chips`; a display says only how they sit (§9). Met on raceday, 30 Nov 2026.
646
721
  - **What an AI copies is the example the skill points it at,** traps and all: idea-cards copied the calendar's frame
647
722
  and not its moving only what changed. Point at the smallest instance (the contents table), and fix a trap in the
648
723
  example, not only here. Met 3 Nov 2026.
@@ -654,13 +729,19 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
654
729
  file, `joined.sqlite` in the data folder (`DB`, from `JOINED_DB`; the folder from `JOINED_DATA`, or
655
730
  `.data/`, which git ignores). Every app's tables are in it, the group's keys too, made by
656
731
  migrations at start, joined's own first (`src/migrations/`), then the group's, then each app's.
657
- - **Or Postgres** (`JOINED_ENGINE=postgres`, or `start({ engine })`): PGlite in a folder (`postgres/` in
658
- the data folder), or in memory. The engine (`src/engine.ts`) answers synchronously, as SQLite does,
659
- so a write is the same one transaction; the compiler writes each document's query, items and
660
- triggers in both dialects (`generated/queries.ts`'s `postgres`). The stories are told on both
661
- (`tests/helpers.ts`'s `ENGINES`); `fresh({ engine })` and `tell(doc, dir, engine)` take one.
662
- joined doesn't vacuum or back up a Postgres store.
663
- - A write is one synchronous transaction: its rows, the document's version, a row of its change
732
+ - **Or Postgres:** a server, by its URL with its password (`JOINED_POSTGRES=postgres://user:password@host:5432/db`,
733
+ SCRAM and TLS as the URL says: that alone chooses it), or else (`JOINED_ENGINE=postgres`, or `start({ engine })`) PGlite in a
734
+ folder (`postgres/` in the data folder), or in memory. The engine (`src/engine.ts`) is awaited, on either:
735
+ the values go beside the SQL as parameters, one write at a time (on Postgres, by a lock every server takes), and
736
+ each commit is notified (`NOTIFY joined`), so several servers on one database tell their pages each other's
737
+ writes. The compiler writes each document's query, items and triggers in both dialects
738
+ (`generated/queries.ts`'s `postgres`). The stories are told on both (`tests/helpers.ts`'s `ENGINES`);
739
+ `fresh({ engine })` and `tell(doc, dir, engine)` take one. Old changes and unused files are let go on both;
740
+ joined vacuums and backs up a SQLite file alone (Postgres has its own).
741
+ - An app's rules, its `trust.ts`, `derive.ts`, reactions and routes read the documents at once, as they always
742
+ have (`read(doc)`, no await): joined reads each one they ask for first, and asks them again. A route's `write` is
743
+ awaited (`await write(doc, ops)`), and a route reads what it needs before it writes.
744
+ - A write is one transaction: its rows, the document's version, a row of its change
664
745
  (`changes`: the ledger, and what a page catching up is sent), and the group's keys when a member
665
746
  goes. Ids come from joined's sequences (`joined_sequences`): one is never handed out twice.
666
747
  - A document new to the store begins from a `<doc>.json` in the data folder (from before the
@@ -706,6 +787,11 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
706
787
  A list a link declares is typed by it, though every story gives it empty. `gone: "with"` on one id
707
788
  (`{ post: { to: "posts", one: true, gone: "with" } }`): removing the post removes what links to it first, in
708
789
  the same write, told to the pages as removals and undone with it; without it, the removal is refused.
790
+ `part: true` on one id (`{ order: { to: "orders", one: true, part: true } }`) says the link is structure (is a,
791
+ has a, composition), not a reference: a page places the item by it and never pops it; one `gone: "with"` is part
792
+ too. What each field pops is written beside its collection, `collections.<name>.pops` (a value with a form:
793
+ `{ form: "date-time" }`; a reference: `{ to: "items" }`; a plain value or structure isn't in it): `docs/design.md`,
794
+ "A peek".
709
795
  - `roles`: who someone is, a who-path each: `posts[role=keeper]@members`, `holdings@members`,
710
796
  `members/members[!inviter]`, and in a kind `@owners`, the root item's; but an `@field` the item a write is to
711
797
  has is the item's (a post's `@author` on a board, the board's `@owners`). Someone two roles to an item is told
@@ -722,7 +808,7 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
722
808
  named for the kind. A collection element takes its document from its `doc` attribute: a page for each
723
809
  (`/trip/:n`) sets it from its path (`examples/trip/page.ts`). A window is on an instance
724
810
  (`trip:1?week=2026-11-02`); another window is held by putting a new collection element in place of the old
725
- (the old one lets its window go), as the trip's page does a week (`examples/trip/page.ts`, `holding.ts`). Working: `examples/trips` and
811
+ (the old one lets its window go), as the trip's page does a month (`examples/trip/page.ts`, `hold`). Working: `examples/trips` and
726
812
  `examples/trip`.
727
813
  - `fills: { cards: { added: "now" }, boards: { count: 0 } }`: a field the server fills on every add,
728
814
  which no story gives (`"now"`, the instant; `"me"`, the member who adds it: a post's author); the server's alone, so a page giving or replacing it is
@@ -736,6 +822,21 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
736
822
  `noOverlap: { stays: { range: ["from", "until"], same: ["room"] } }` (half open; the end a time, a
737
823
  number, or a duration on from the start): asked once a write is done, in its transaction, of each item it
738
824
  touched, and refused in words (`people 3 has that name already`), none of it landed.
825
+ - `mine: {"tasks": [["ups", "downs"]]}`: lists of members that are each member's own: a member gives and takes
826
+ only their own id (`ups is each member's own to give`), however it's written (an id, the list whole, an item
827
+ added with it); lists said together (`[["ups", "downs"]]`, or one alone, `["going"]`) hold nobody twice on an item,
828
+ asked once the write is done, so a thumb turns over in one write (`tasks 3 has someone in two of ups and downs:
829
+ take one back first`). A thumb, a vote, who's coming: never a `trust.ts`. Checked by a `cannot` writing each
830
+ list. Working: `examples/desk/stories.jsonl`, `tests/mine.test.ts`.
831
+ A link to one member is one too: `mine: {"people": ["member"]}`, which person you are, set only to its writer and
832
+ taken back only by them. A field may say its own words: `{"people": [{"member": "you say which person you are, as
833
+ yourself"}]}`. Working: `examples/people/stories.jsonl`.
834
+ Or a collection of values, each one member's for one item of another: `mine: {"ranks": {"of": "note", "by":
835
+ "by"}}`, my place for a note, my rating, my word on it. `of` and `by` are links to one (`by` a member's); the
836
+ server fills `by` with its writer, a member has one for an item at most, and only they change or remove theirs
837
+ ("ranks are each member's own to change"). Everyone sees them: a page reads the list in my order, another's or
838
+ everyone's. Held to a cannot story that changes another's. The compiled rows never draw one as rows. Working:
839
+ `examples/notes/stories.jsonl`, drawn by the compiled rows (`tests/compiled.test.ts`).
739
840
  - `window` and `order`: a part of a collection a page may hold alone, and a collection held in a number's order
740
841
  (§8).
741
842
  - `copies: {"lines": {"from": "item", "fields": ["name", "price"]}}`: fields an item takes from what one of its
@@ -778,17 +879,41 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
778
879
  refused in its words; and a waits step no story adds. A story's premise may write the root (freeze it, then the
779
880
  cannot). Asked after trust.ts and the grants; a route's write or a reaction isn't asked them. Working:
780
881
  `tests/settings`.
882
+ - `frozen` of an item, by collection: kept as it is once it's settled, by its own yes-or-no field:
883
+ `{"frozen": {"supplies": {"by": "delivered", "fields": ["price", "terms"], "refused": "a delivered supply keeps its
884
+ price and terms"}}}`, those fields (an object's, each of its own; none named, all of them) changed by no write while
885
+ it's true. A trigger in the database, SQLite's and Postgres's, refused in its words.
886
+ - `addedWith`: an item added only in the write adding what a link of it points at, never after: `{"addedWith":
887
+ {"lines": {"order": "an order's lines are set when it's placed"}}}`. A trigger, in both: the item linked to is one
888
+ the write added (the rows a write changed, `joined_touched`).
889
+ - `within` and `apart`: an item's lists as the write leaves them. `{"within": {"events": [{"lists": ["keen", "asked",
890
+ "declined"], "of": "people", "refused": "an answer is from someone on the event"}]}}`: each id of those lists is in
891
+ its `of` list too; `{"apart": {"events": [{"lists": ["keen", "asked", "declined"], "refused": "one answer each"}]}}`:
892
+ no id is in two of them. SQLite holds them by code once the write is done (`listsHold`, generated); Postgres by a
893
+ constraint trigger that waits for the write's end (the store settles it then), so a list replaced whole, or an id
894
+ moved from one list to another, is held as it lands. Working: `examples/trip/stories.jsonl`.
895
+ Each of these is checked by a `cannot` refused in its words.
781
896
  - `where`: which rows each of an app's several documents holds, and who may hold it at all: `{"kitchen":
782
897
  {"holds": "kitchen | manager", "orders": {"status": ["placed", "being made", "ready"]}}}`; `last` and `by` keep only
783
898
  the newest so many; a collection's name in place of the fields, the rows linking to those (an order's lines).
784
899
  - `documents`: a read-only document worked out by member: `{"books": {"entries": {"from": "supplies", "when":
785
900
  "delivered", "sides": {"buyer": "bought", "supplier": "sold"}, "fields": ["title", "buyer", "supplier"], "total": {"sum": "qty",
786
901
  "times": "price"}}}}`, each side's books. A sum by member is this; a split (a cost divided among a group) isn't
787
- a definition: work it out on the page, from the items, as a pure function (the shopping list's `balances.ts`).
902
+ a definition: work it out on the page, from the items, as a pure function in a file of its own, tested alone.
903
+ Or rows counted by what they link to and their week: `{"weeks": {"weeks": {"from": "events", "by": {"trip":
904
+ "trips"}, "seen": ["organisers", "travellers"], "week": "start", "count": "events"}}}`, each trip the member is
905
+ on (a list of that trip's naming them), its events by the Monday of their week, numbered in order: items `id`,
906
+ `trip`, `week`, `events`. A document in a folder of its own is said in that folder's `stories.jsonl` alone, its
907
+ files unprefixed (`examples/weeks`).
788
908
  - **`<app>/trust.ts`**, exported from `routes.ts` (`export { trust } from "./trust.ts"`), is the app's own
789
909
  rule over a whole write, reading any document: `(write, { member, roles }, read) => why | null`. It's
790
910
  asked first, so a refusal is in its words; it reads the ops as sent, before they're checked. It's asked
791
- when the group is open too, of nobody (`member` 0).
911
+ when the group is open too, of nobody (`member` 0). The compiler can't read it, so write a `cannot` story,
912
+ `refused` in its words, for each rule in it: the stories told say so of one that refuses nothing they tell
913
+ (`<app>'s trust.ts refuses nothing its stories tell`), and no more than that. Look first for a definition that
914
+ says it (`mine`, `unique`, `noOverlap`, `moves`, `takes`, `frozen`, `addedWith`, `within`, `apart`): the examples
915
+ have no `trust.ts` (Peter, 30 Nov: their rules said once, the database's on Postgres). One that truly can't be
916
+ declared is a trigger in each dialect's SQL, not TypeScript.
792
917
  - **A story's words for them:** `premise` (each name's writes before it, in order; an anonymous story's, a list), `unseen` (who must not
793
918
  see it), `refused` (the words a cannot is refused in). `tell(doc, dir)` from `joined/stories` says each.
794
919
  - Working: the cafe's stories (`examples/cafe/stories.jsonl`) say `copies`, `totals`, `moves`, `guests`, `where`,
@@ -812,25 +937,24 @@ one:
812
937
  |---|---|---|---|
813
938
  | Lanes, dragged | `lanes.ts` | A display: a collection in lanes by a field, each in the collection's order, kept by `keep`; a card let go in another lane makes the step its `may` offers, and lands between the cards it's let go between, one write for both. | the kitchen's rail (fixed steps), cardlet's columns, idea-cards' stacks |
814
939
  | The moves `may` offers | `steps.ts` | A button for each step of a `moves` field this person may make from where the item is (`replace:status>review`), its words the page's by from and to ("Send back"): the stories say which there are and whose. | a post held for approval, an order's next move |
815
- | Thumbs | `thumbs.ts`, `trust.ts` | Up or down as two lists of ids (`ups`, `downs`, links to members): yours pressed, the other taken back in the same write (`write()` of the compiled elements); `trust.ts` holds a thumb to its giver, one an item. | idea-cards' thumbs, cardlet's votes |
940
+ | Thumbs | `thumbs.ts`, `stories.jsonl` | Up or down as two lists of ids (`ups`, `downs`, links to members): yours pressed, the other taken back in the same write (`write()` of the compiled elements); the desk's `mine` line holds a thumb to its giver, one an item (§15). | idea-cards' thumbs, cardlet's votes |
816
941
  | A summary strip (V6) | `tally.ts` | A display that holds nothing: it reads the page's live list and watches the collection for what it shows alone (`attributeFilter`: status, points), sums once a moment (`queueMicrotask`), and moves only a part's width and its words. Counts by a field, done of all, a sum; its parts tones of ink, never hues (a hue is a person's). | bluecount's totals and where it went, the cafe's books |
817
942
  | What just changed | `pulse.ts` | A row `keep` makes again for a change glows a moment, not on the first drawing, nor when it's drawn for someone else; the display's own row glows (a class in its shadow), never the document's element. | an agent's work seen as it lands |
818
943
  | A rank between | `joined/rank` | Where a thing let go lands among others: its place, and a rank halfway between its neighbours (one less than the first, one more than the last), so one write moves it. | the people's order, cardlet's columns |
819
944
 
820
945
  Who added an item is a field the server fills (`{"fills":{"tasks":{"by":"me"}}}`), drawn as their face. Who made the
821
- last change isn't told to a view yet (the ledger's #89, `docs/view-plan.md`'s step 3). The plan's V4 (a queue to
822
- approve) and V5 (filter by a link, a link matrix) are recipes still to add here (its step 8).
946
+ last change isn't told to a view yet (the ledger's #89).
823
947
 
824
948
  Elsewhere, by what it does:
825
949
 
826
- - A row changed in place and taken away: `examples/trip/stays.ts`. A drawer with a draft: `examples/cafe/menu.ts`.
950
+ - A row changed in place and taken away: `examples/trip/stays.ts`. An item's sheet, with a draft: the kit (§17).
827
951
  - A form on the page that adds, its refusal said under it: `examples/people/adding.ts`, the desk's `page.ts`.
828
952
  - What links to an item, kept as links come and go: `examples/people/links.ts`.
829
953
  - Dragged in order by a grip, or the arrow keys: `examples/people/order.ts`.
830
- - A list of people as chips, a typeahead past six: `examples/trip/people-chips.ts`.
831
- - Each person's answer to an item, a list of ids each: `examples/trip/answer-rows.ts`, `answers.ts`.
954
+ - People as chips, and each person's answer to an item (a list of ids each): the kit's `<j-field>` (§17); the trip's
955
+ `answers.ts` reads them.
832
956
  - A file on an item: `attachment()` (§4), `tests/attachments/board/page.ts`.
833
- - When and where by a hand (a calendar, a map): `examples/trip/calendar-map.ts` and its parts.
957
+ - When and where by a hand (a calendar, a map): the kit's readings (§17), as the trip's page has them.
834
958
 
835
959
  **Shared, not copied.** What three apps repeated is joined's, imported by name, never copied (each told in
836
960
  `tests/`, the place search by the trip's page):
@@ -847,3 +971,94 @@ Elsewhere, by what it does:
847
971
  - `joined/ics`: `toIcs(events, name)`, each event a `uid` (the same each time: a feed's calendar changes it, not adds
848
972
  it again), its `zone`, `location`, `coordinates`, `description`, `url` and `attendees` where it has them; and
849
973
  `fromIcs(text)`. Served as `text/calendar`, it's a download or a feed (`webcal://`); the trip's `routes.ts`.
974
+
975
+ ## 17. The kit: a page composed, not written
976
+
977
+ Before writing a list, a form or a search, compose them from the kit (`joined/kit`). Each part is bound to the
978
+ document by a collection's name and a field's: nothing is wired by hand, and every decision a person would otherwise
979
+ re-make (which control a kind of field takes, how a draft is held, where Save goes, how a sheet comes up on a phone,
980
+ what search hides and how it says what it found, which icon) is already made, and tested wide and on a phone. Write a
981
+ display of your own only for what the kit doesn't have (§5, §16), and let it open the kit's sheet for an item
982
+ (`document.querySelector('j-sheet[for="items"]').show(item)`). A calendar, a map, a timeline or a board is the kit's:
983
+ its readings, below.
984
+
985
+ The cafe's menu is the whole of it (`examples/cafe/menu.html`, and its `menu.ts` is four lines):
986
+
987
+ ```html
988
+ <header class="find"><j-search for="items" placeholder="Find on the menu"></j-search></header>
989
+ <j-items-rows><j-items doc="menu"></j-items></j-items-rows>
990
+
991
+ <j-sheet for="items">
992
+ <j-field name="name"></j-field>
993
+ <j-field name="price" as="money" currency="GBP"></j-field>
994
+ <j-field name="stock" label="Left" readonly></j-field>
995
+ </j-sheet>
996
+ ```
997
+
998
+ ```ts
999
+ import "joined/panel";
1000
+ import "joined/kit";
1001
+ import { define } from "joined/rows";
1002
+ import { JItemsRows } from "./generated/menu.rows.ts";
1003
+ define(JItemsRows);
1004
+ ```
1005
+
1006
+ `define()` gives the kit the compiler's collections (`specs`, in every `generated/rows.ts`); a page with no rows
1007
+ display gives them once: `use(specs)` from `joined/kit`.
1008
+
1009
+ | Part | What it is | Its attributes | Events |
1010
+ |---|---|---|---|
1011
+ | `<j-<collection>-rows>` (`joined/rows`) | The collection as rows: each its name and facts, money as money; pressed, its sheet opens, the row marked (`aria-current`, a stripe and a chevron); an add at the foot where the stories let this person add, asked in a modal (what it can't be without, then Add; new is never the sheet's). Only what the person `may` is offered: a cook sees rows that don't open. | (the compiler's) | hears `j-search`, tells `j-found` |
1012
+ | `<j-sheet for="items">` | One item's fields, as a drawer wide and a sheet on a phone (rising from the foot, a grabber, the page dimmed). A draft until Save (one write); Never mind puts it back; × closes; what's open is in the address (`#item=3`); a removal asked first; a refusal said in the story's words. Only the fields this person may replace are shown; the rest stay as they are. | `for` (a collection) | tells `j-open` |
1013
+ | `<j-field name="…">` | How one field is asked and read, in its sheet and its row, in the order written. Without any, the sheet asks every plain field, each link to one, and each list of people. | `label`, `as` (`money`, `long`), `currency` (ISO 4217: `GBP`, `JPY`), `readonly` (shown, not changed once the item exists; asked when adding) | |
1014
+ | `<j-search for="items">` | A field at the head of what it finds in, a magnifier at its start, × to clear (or Escape). Each letter hides the rows without every word, and it says "3 of 12". The page's alone: kept in the address (`?q=latte`), so a reload or a link keeps it. `folded`: the magnifier alone, for a bar, opening as it's tapped. | `for`, `placeholder`, `folded`, `param` (`q`) | tells `j-search`, hears `j-found` |
1015
+
1016
+ The control a field gets is its kind's (`src/fields.ts`), never chosen again:
1017
+
1018
+ | Kind (§2) | Control | Kept as |
1019
+ |---|---|---|
1020
+ | text | a box; `as="long"`, a textarea | as typed |
1021
+ | integer, decimal | a number box | a number |
1022
+ | integer, `as="money"` | a number box in the currency's units, its label "Price, £", the row "Price £3.60" | minor units (360) |
1023
+ | boolean | a tick, its label beside it | true / false |
1024
+ | date-time | the browser's date and time | a wall clock, `2026-11-15T10:30:00` |
1025
+ | duration | a box read as people say it, "2h 30m", "1.5h", its fault said ("A length, such as 45m or 2h 30m") and Save stopped | ISO 8601, `PT2H30M` |
1026
+ | zone | a box offering the zones as a city is typed | `Europe/London` |
1027
+ | place | a box finding the place by its name (Photon), the point shown, × for none | `geo:lat,lon` |
1028
+ | a link to one | a choice of six or fewer; a typeahead past six | its id |
1029
+ | a list of people (`ids`, to members) | a chip for each, pressed or not, a finger tall | the ids |
1030
+
1031
+ **The readings: the ways in.** A page opens on what its data is: things in time on a week, things in places on a map,
1032
+ things that move through steps on a board; a list is one reading of several, not the page. Each is bound like the
1033
+ rest, holds nothing (it finds the collection's items wherever they are on the page), shows only what the page's search
1034
+ finds, and opens the same `<j-sheet>`; each gesture is a write the item's `may` offers, refused in the story's words
1035
+ and put back. `<j-views>` holds several, a tab each, one shown, kept in `?view=`:
1036
+
1037
+ ```html
1038
+ <j-search for="plans"></j-search>
1039
+ <j-views>
1040
+ <j-plans-rows label="List"><j-plans></j-plans></j-plans-rows>
1041
+ <j-week for="plans"></j-week>
1042
+ <j-month for="plans"></j-month>
1043
+ <j-timeline for="plans" lane="who"></j-timeline>
1044
+ <j-map for="plans"></j-map>
1045
+ <j-board for="plans" by="done"></j-board>
1046
+ </j-views>
1047
+ ```
1048
+
1049
+ | Reading | Reads | What a person does there | Its attributes |
1050
+ |---|---|---|---|
1051
+ | `<j-week>` | a date-time, and a duration (an hour where none) | each item a block at its time, those at once side by side, now a line; a block tapped opens it, dragged it moves by quarter hours and to another day, its foot makes it longer; an empty hour tapped adds one there (asked in a modal, offered that day and hour: new is never the sheet's). On a phone, a day at a time, the week a strip of days above. | `when`, `length`, `from` and `until` (the hours, 8 and 20, grown to hold what's there) |
1052
+ | `<j-month>` | a date-time | each day its items, each its time and words; a day tapped is marked and its items listed under the month, with Add on that day; an item dragged to another day keeps its hour. On a phone, a mark on each day. | `when` |
1053
+ | `<j-timeline>` | a date-time and a duration | a Gantt: a lane for each value of `lane` (each person of a list of people, each item a link is to, yes or no, each word, and none), or each item its own row; bars at once stacked; dragged, moved, by its end longer; hours where everything lasts under a day, else days; scrolls sideways, its lanes' names staying. | `when`, `length`, `lane`, `scale` (`hour`, `day`) |
1054
+ | `<j-map>` | a place (`geo:`) | a pin each, fitted to them all until it's moved; dragged it pans, nearer and farther by its buttons, a pinch or a trackpad's; a pin tapped is peeked at the map's foot, then Open (its sheet) or Open in Maps; a pin held and dragged moves its place. | `at`, `when` (said in the peek) |
1055
+ | `<j-board>` | a field: yes or no, a link to one, a field that moves, or words | a lane for each value (`lanes="idea,booked,done"` names them and their order), a card each, its count; a card dragged to another lane is moved there where it may go (a field that moves, only to the steps its `may` offers); Add at each lane's foot. On a phone, lanes to swipe between. | `by`, `lanes` |
1056
+ | `<j-views>` | the readings in it | a tab each, its icon and its word (`label`, or the reading's own), the one chosen shown | `param` (`view`) |
1057
+
1058
+ Each reading opens on the day the address says (`?day=2026-11-15`), else today where something's on or after it, else
1059
+ the last day something was. A reading's attribute names a field (`when="start"`); left out, it's the first of its type.
1060
+
1061
+ Its look is joined's (`parts.css`, the tokens), light and dark, every control a finger tall on a phone; an app's
1062
+ stylesheet places the parts (`main.menu .card > .find`), never restyles them. `tests/kit.test.ts` and `tests/readings.test.ts` are each part, as
1063
+ a person uses it, wide and on a phone; `bun run look cafe`, and `JOINED_APPS=$PWD/tests/kit bun run look plans`, draw
1064
+ each state.