@blueshed/joined 0.3.0 → 0.3.2

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 (109) hide show
  1. package/.claude/skills/joined/reference.md +57 -18
  2. package/docs/design.md +93 -38
  3. package/docs/introduction.md +9 -9
  4. package/docs/light-and-shadow.svg +1 -0
  5. package/docs/links-and-trust.svg +1 -0
  6. package/docs/stories-to-code.svg +2 -1
  7. package/docs/wire-op.svg +1 -0
  8. package/examples/app.css +9 -0
  9. package/examples/cafe/cafe.css +87 -69
  10. package/examples/cafe/generated/staff.elements.ts +7 -2
  11. package/examples/cafe/generated/staff.rules.ts +3 -0
  12. package/examples/cafe/generated/supplies.rules.ts +5 -0
  13. package/examples/cafe/kitchen.css +11 -19
  14. package/examples/cafe/kitchen.ts +6 -2
  15. package/examples/cafe/migrations/002-guard-supplies.ts +15 -0
  16. package/examples/cafe/order.html +2 -1
  17. package/examples/cafe/order.ts +1 -1
  18. package/examples/cafe/staff.json +5 -0
  19. package/examples/cafe/stories.jsonl +4 -2
  20. package/examples/cafe/supplies.html +1 -0
  21. package/examples/cafe/supplies.ts +45 -28
  22. package/examples/cafe/till.ts +14 -10
  23. package/examples/cafe/views.ts +7 -5
  24. package/examples/chart/arches.ts +5 -3
  25. package/examples/chart/chart.css +7 -2
  26. package/examples/desk/desk.css +6 -10
  27. package/examples/desk/generated/elements.ts +1 -1
  28. package/examples/desk/index.html +1 -1
  29. package/examples/desk/lanes.css +21 -19
  30. package/examples/desk/stories.jsonl +1 -1
  31. package/examples/desk/tally.css +1 -1
  32. package/examples/docs.ts +7 -4
  33. package/examples/index.html +16 -7
  34. package/examples/notes/generated/queries.ts +8 -2
  35. package/examples/notes/index.html +1 -1
  36. package/examples/notes/stories.jsonl +3 -0
  37. package/examples/page.ts +9 -2
  38. package/examples/people/links.ts +7 -9
  39. package/examples/people/people.css +1 -1
  40. package/examples/people/view.ts +1 -1
  41. package/examples/trip/generated/elements.ts +1 -1
  42. package/examples/trip/stays.css +1 -1
  43. package/examples/trip/stays.ts +1 -1
  44. package/examples/trips/generated/elements.ts +1 -1
  45. package/examples/trips/trips.css +24 -23
  46. package/examples/welcome.css +41 -33
  47. package/package.json +1 -1
  48. package/src/attachment.ts +17 -2
  49. package/src/board.css +2 -1
  50. package/src/board.ts +4 -4
  51. package/src/cli.ts +14 -2
  52. package/src/compile.ts +255 -77
  53. package/src/definitions.ts +62 -14
  54. package/src/demo.css +2 -5
  55. package/src/draft.ts +10 -4
  56. package/src/drawer.ts +30 -4
  57. package/src/engine.ts +14 -5
  58. package/src/fields.ts +88 -15
  59. package/src/file-value.ts +12 -2
  60. package/src/files.ts +113 -35
  61. package/src/icon-names.ts +4 -0
  62. package/src/keep.ts +16 -3
  63. package/src/map.css +23 -16
  64. package/src/map.ts +3 -3
  65. package/src/mcp.ts +24 -3
  66. package/src/members/group.ts +41 -17
  67. package/src/members/keys.ts +3 -3
  68. package/src/members/panel.css +17 -18
  69. package/src/members/panel.ts +9 -2
  70. package/src/migrate.ts +58 -21
  71. package/src/migrations/005-change-kept.ts +7 -0
  72. package/src/month.css +6 -2
  73. package/src/month.ts +5 -5
  74. package/src/ops.ts +40 -1
  75. package/src/page.css +3 -2
  76. package/src/page.ts +64 -16
  77. package/src/parts.css +178 -86
  78. package/src/parts.ts +60 -20
  79. package/src/plane.css +9 -4
  80. package/src/plane.ts +4 -2
  81. package/src/reading.css +1 -5
  82. package/src/rows.css +2 -21
  83. package/src/rows.ts +123 -39
  84. package/src/server.ts +157 -30
  85. package/src/sheet.ts +4 -2
  86. package/src/slots.css +0 -4
  87. package/src/specs.ts +1 -1
  88. package/src/starter.ts +15 -1
  89. package/src/store.ts +40 -18
  90. package/src/surface.ts +7 -2
  91. package/src/time.ts +2 -0
  92. package/src/timeline.ts +14 -5
  93. package/src/together.ts +15 -17
  94. package/src/tokens.css +12 -3
  95. package/src/tokens.json +38 -7
  96. package/src/tool.ts +6 -7
  97. package/src/upkeep.ts +31 -4
  98. package/src/views.css +8 -9
  99. package/src/views.ts +23 -6
  100. package/src/week.css +1 -2
  101. package/src/week.ts +11 -7
  102. package/src/write.ts +130 -15
  103. package/starter/CHANGELOG.md +8 -0
  104. package/starter/CLAUDE.md +7 -1
  105. package/starter/bunfig +2 -1
  106. package/starter/githooks/pre-commit +13 -0
  107. package/starter/prettierignore +1 -0
  108. package/starter/tests/records.test.ts +40 -0
  109. package/starter/todo.jsonl +0 -0
@@ -109,7 +109,8 @@ A story is one JSON line in dzql's words:
109
109
  of writes), told with nobody signed in. A project whose stories are all anonymous has no members. The
110
110
  grammar, and what the compiler refuses: `docs/stories.md`.
111
111
  - The model is only what the `does` stories do:
112
- - **A collection** is a path's first step (`/events`), named in the plural.
112
+ - **A collection** is a path's first step (`/events`), named in the plural: a regular one, or one of English's
113
+ irregular plurals a domain keeps (people, teeth, feet, children, men, women, mice, geese).
113
114
  - **A field** is a key an add gives or a replace names. Its type is its values': a string, or one
114
115
  read off its form (a date-time `2026-11-07T19:00:00`, a time zone `Asia/Tokyo`, an instant `2026-11-07T10:00:00Z`, a duration `PT2H`, a place `geo:35.69,139.70`, a file `file:<its SHA-256>.webp`, one kept by `/files`, §8),
115
116
  a boolean, an integer or a decimal (a value with a fraction), or a list of ids (§6). A value not its
@@ -130,7 +131,7 @@ A story is one JSON line in dzql's words:
130
131
  - a path no op can have;
131
132
  - a list of ids named for no collection;
132
133
  - an empty list nothing else types;
133
- - a collection that isn't a regular plural;
134
+ - a collection that isn't a plural (one the compiler knows: regular, or those above);
134
135
  - two documents with a collection of one name.
135
136
 
136
137
  Working: `examples/trip/stories.jsonl`; the model's rules in `tests/compile.test.ts`.
@@ -150,7 +151,7 @@ Working: `examples/trip/stories.jsonl`; the model's rules in `tests/compile.test
150
151
  - **The collection's element** (`JEvents`, defined there): `items`, and `add(...values)`, one write
151
152
  for them all, each a `JEventValue`: the fields as the stories write them, a dotted one nested (`terms: { days
152
153
  }`), and a link to one item its id or an add's before it in the same write (`"$1"`, the till's lines naming
153
- their order). On a page it holds its document (§7). An app's own `write(el, ops)` is typed the same.
154
+ their order); a list of ids may hold one too (`papers: [4, "$1"]`: an add and the line naming it, one write). On a page it holds its document (§7). An app's own `write(el, ops)` is typed the same.
154
155
  - **The item's element** (`JEvent`, defined by the page, as it is or extended by a view, §4):
155
156
  - `key`, `path` and `data` (its fields, read from its attributes; a missing number reads as
156
157
  `undefined`, a boolean as `false`, a list as `[]`);
@@ -200,9 +201,11 @@ Working: `examples/trip/stories.jsonl`; the model's rules in `tests/compile.test
200
201
  item (`mine: {"ranks": {"of": "note", "by": "by"}}`), the list is in my order (a grip, the arrow keys), another's
201
202
  or everyone's (`?order=3`, `?order=all`); a collection an add needs only its name for is added by a box on the
202
203
  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.
204
+ `grip`, `adder`), and `adds(collection, under)`, whether Add is offered there: an app says no where its own
205
+ rules (its `trust.ts`) would refuse the add, so it's never offered and then refused. An item opens in its collection's `<j-sheet>`, the page's, or one put on the page. Working: `tests/compiled.test.ts`.
206
+ - Not drawn yet in a row: one of an object's fields, a list of ids that isn't `mine` (people's are faces, others
207
+ counted, neither chosen), a file, a place; a field emptied is left as it was. (In its sheet a file is joined's
208
+ attachment, in the drawer and in the add modal alike.)
206
209
  Working: `tests/rows/choices/` (its page extends one, for two words), `tests/rows.test.ts`.
207
210
  - **`migrations/NNN-<what>.ts`,** in `src/migrate.ts`'s words (`createTable`, `addColumn`…), when the stories
208
211
  say more than the migrations so far: a collection is a table, a field a column (null where a story
@@ -392,7 +395,8 @@ and the `away` event; `back` when it returns; the group's button says "· back s
392
395
  op `add` at a collection's end: a cost, a person) is kept on the device (`src/outbox.ts`, under who wrote it), its
393
396
  sender answered at once, and the page told what's waiting (`body[data-waiting]`, the `waiting` event, the group's
394
397
  bar: "2 waiting for signal"); it's sent by itself once the page is back and holds its documents again, oldest first,
395
- and one refused then is said in the toast and let go. Anything else it sends is refused at once (an edit made away
398
+ and one refused then is said in the toast and let go. Each is sent with its own id (`kept`), so one the server made
399
+ already (its answer lost as the signal went, or sent by two tabs from the one device) is answered done, not made twice. Anything else it sends is refused at once (an edit made away
396
400
  could overwrite what changed meanwhile: a Draft keeps it to save again), and it comes back by itself, each document
397
401
  put in place by key. Only
398
402
  the server closing it on purpose, or the door refusing it, signs it out. A write refused, draw again,
@@ -451,7 +455,9 @@ export const routes = (read: Read) => ({ "/trip/:n": page, "/trip/:n/trip.ics":
451
455
  stories (`doc`, `from`, `derive(read, member)`; its `routes.ts` re-exports `derive`) and an example,
452
456
  `<doc>.json`, its shape: elements with no ops, every write refused. The server derives it for each
453
457
  page's member as it's joined, and again after a write to what it's read from, sending it whole where it's
454
- changed. `tests/fixtures/statement`. Where a query can say it, it's a read-only document by member (`documents`,
458
+ changed. Its fields are its items' attributes, so never a capital (`likeName` is refused: it would arrive
459
+ `likename`). Two derived documents may each derive one kind of item (`spans`) only where it's the same, field for
460
+ field: one element for both. `tests/fixtures/statement`. Where a query can say it, it's a read-only document by member (`documents`,
455
461
  §15) and not a `derive.ts`: `examples/weeks` is.
456
462
  - **The root's page** is `examples/routes.ts`.
457
463
 
@@ -482,6 +488,12 @@ Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an
482
488
 
483
489
  ## 9. Stylesheets
484
490
 
491
+ - **How the look is built,** `docs/design.md`'s last section, six rules each held by a test on every page: hidden
492
+ always hides (never `hidden` to keep a thing's room); joined's class names (`bar`, `brand`, `lead`, `note`, `act`,
493
+ `danger`, `icon-only`, `said`, `drawer`, `sheet`) mean joined's parts, so an app names its own thing otherwise;
494
+ layers decide, never specificity; into a shadow by its parts alone (`j-sheet::part(field-accountants)`,
495
+ `j-week::part(item)`, `j-views::part(tab-papers)`), never script; tokens only, a control's words a field's size;
496
+ and every page looked at whole, wide and on a phone.
485
497
  - **What the look is,** `docs/design.md`: the surfaces, colour, a chip, a pin, type, icons, layout and
486
498
  the parts. Read its section for what you draw; this section is how to draw it here.
487
499
  - **Every page's layout,** `src/page.css` (`joined/page.css`), linked after the tokens: the body, `h1`, `h2`,
@@ -509,8 +521,9 @@ Working: `examples/hello/routes.ts`, the smallest; `examples/cafe/routes.ts` (an
509
521
  a phone a drawer and a sheet are Web Awesome's `wa-drawer` (rounded at the top, a grabber), the page dimmed
510
522
  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
523
  surface's motion or scrim of an app's own.
512
- - **Type** is nine styles, each a font in `src/tokens.css`: `font: var(--font-row)` (`body`,
513
- `heading`, `title`, `row`, `label`, `tool`, `small`, `tiny`, `field`). Never a size by hand.
524
+ - **Type** is thirteen styles, each a font in `src/tokens.css`: `font: var(--font-row)` (`display`, `lead`,
525
+ `section`, `name`, `body`, `heading`, `title`, `row`, `label`, `tool`, `small`, `tiny`, `field`), and a family,
526
+ `--sans` or `--mono`. Never a size by hand. A control's words (`tool`, `row`) are a field's size, 16px.
514
527
  - **The colours,** `src/tokens.css` (`--paper`, `--card`, `--ink`, `--muted`, `--line`, `--edge`, `--add`,
515
528
  `--danger`, `--scrim`, `--tint`…), light and dark, linked by every page before `app.css`. Every colour
516
529
  is one of them, in a shadow too: custom properties pass into it. An app's own palette is named once, as properties
@@ -698,7 +711,7 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
698
711
  whole width. Met on the Stays sheet, 2 Nov 2026.
699
712
  - **A search on a change's path costs what the page holds:** `querySelector` on a display's shadow seeks past every
700
713
  block before the part it wants, and on the document past every item. Keep a display's own parts once found, and
701
- read a kind of element from a live list (`getElementsByTagName`). `bun run claims` times it; Chrome's profiler
714
+ read a kind of element from a live list (`getElementsByTagName`). `bun run scale` times it; Chrome's profiler
702
715
  (`view.cdp("Profiler.start")`) says where. Met on the trip, 2 Nov 2026: 1.8 ms a change at 100,000 events, now 0.4.
703
716
  - **Bun writes nothing copying a file into one it's asked `exists()` of** (`Bun.write(file, Bun.file(from))`, Bun
704
717
  1.4.4): write to the path instead. `joined init` made every file empty, met on its first try from the packed
@@ -718,6 +731,13 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
718
731
  an invalid background (`--tint-strong` is a percentage, for `color-mix`), while the parts kept a pressed `.act`'s
719
732
  words in `--card`: the words vanished. A choice that stays pressed is the parts' own `.act[aria-pressed]`, a few
720
733
  side by side `.j-tabs`, chips `.j-chips`; a display says only how they sit (§9). Met on raceday, 30 Nov 2026.
734
+ - **What a tap overwrites is decided by the unique keys:** with one condition per tooth (`unique: conditions
735
+ [["tooth"]]`), a root filling written onto a crowned tooth replaced the crown, and the record was lost. Keyed by the
736
+ place and its own value (`[["tooth", "state"]]`), the two sit side by side. A tool writes the item its place and its
737
+ own value name, nothing else. Met on the dental chart, by Peter, 30 Nov 2026.
738
+ - **A picture in a shadow styled inline can't show state:** an inline `style` beats the rules that read an item's
739
+ state (`[data-crown="to do"]`), so the picture never changes. It draws itself by its own SVG `<style>`, its rules
740
+ reading the attributes. Met on the dental chart, 30 Nov 2026.
721
741
  - **What an AI copies is the example the skill points it at,** traps and all: idea-cards copied the calendar's frame
722
742
  and not its moving only what changed. Point at the smallest instance (the contents table), and fix a trap in the
723
743
  example, not only here. Met 3 Nov 2026.
@@ -754,7 +774,8 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
754
774
  A change is kept 90 days (`JOINED_HISTORY`), and any of a document's last 500 for good (what a page
755
775
  catching up is sent); an older one is let go before the vacuum.
756
776
  The files the documents name are in `files/` beside it, as its backups are, or a bucket (`JOINED_FILES`:
757
- `s3://<bucket>/<prefix>`, a prefix each site's own); one no item and no kept change names is let go once it's
777
+ `s3://<bucket>/<prefix>`, a prefix each site's own); a kind that keeps its files apart (§15) keeps each instance's
778
+ in a folder of its own, `book-1/`; one no item and no kept change names is let go once it's
758
779
  older than the history and the backups' week. A test's server has a files
759
780
  folder of its own (`fresh()`).
760
781
  To go back to one, stop joined and put it in the store's place, with no `-wal` or `-shm` beside it.
@@ -781,6 +802,8 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
781
802
  - **`stories.jsonl`'s header lines**, after the cast, one a key (`{"owns":"owner | author"}`), say what the
782
803
  stories can't show; the compiler alone reads them, refuses one no story checks, and writes them into
783
804
  `generated/rules.ts` as code (`src/definitions.ts` says each key and the who-path):
805
+ - `title`: the field that names a collection's items (in a row, a chooser, a peek), where it isn't the first field
806
+ of words the stories give: `{"title": {"accounts": "name"}}`, never its code; refused if it isn't a field of words.
784
807
  - `links`: a field linking though not named for its collection, a list (`{ owners: "members" }`) or one
785
808
  id (`{ account: { to: "accounts", one: true } }`), in its own document or another's. A link may name an
786
809
  item an add before it in the same write makes: the id the store will give it.
@@ -789,7 +812,10 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
789
812
  the same write, told to the pages as removals and undone with it; without it, the removal is refused.
790
813
  `part: true` on one id (`{ order: { to: "orders", one: true, part: true } }`) says the link is structure (is a,
791
814
  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:
815
+ too. `holds` on a link to members names who it may name, a who-path of collections asked of the one named (not
816
+ the writer): `{ supplier: { to: "members", one: true, holds: "staff/posts[role=supplier]@members" } }`, any other
817
+ refused "supplier names someone who isn't among staff's posts with role supplier", checked by a cannot (the
818
+ cafe's "Peter can't order from Nora: she isn't a supplier"). What each field pops is written beside its collection, `collections.<name>.pops` (a value with a form:
793
819
  `{ form: "date-time" }`; a reference: `{ to: "items" }`; a plain value or structure isn't in it): `docs/design.md`,
794
820
  "A peek".
795
821
  - `roles`: who someone is, a who-path each: `posts[role=keeper]@members`, `holdings@members`,
@@ -809,13 +835,26 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
809
835
  (`/trip/:n`) sets it from its path (`examples/trip/page.ts`). A window is on an instance
810
836
  (`trip:1?week=2026-11-02`); another window is held by putting a new collection element in place of the old
811
837
  (the old one lets its window go), as the trip's page does a month (`examples/trip/page.ts`, `hold`). Working: `examples/trips` and
812
- `examples/trip`.
838
+ `examples/trip`. `kind: { root: "books", files: "apart" }` keeps each instance's files in a folder of its own
839
+ (`book-1/<name>`, never served by its name alone), and `/export/book-1` hands it back to whoever is on it: a tar of
840
+ its document, its root item and its files. Any instance's file is served at `/files/book-1/<name>`
841
+ (`fileUrl(value, doc)`) only to who holds it and sees an item naming it. Working: `tests/apart`.
813
842
  - `fills: { cards: { added: "now" }, boards: { count: 0 } }`: a field the server fills on every add,
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
843
+ which no story gives (`"now"`, the instant, or a wall clock, below; `"me"`, the member who adds it: a post's author); the server's alone, so a page giving or replacing it is
815
844
  refused, and a route's write or a reaction keeps it (a count, a total). But `"random"`, a code: a story may
816
845
  replace it (`{"op":"replace","path":"/boards/1/code","value":"new"}`, granted its teller's role), and the server
817
846
  makes the new code, whatever the write gives, before it's checked and kept: told and kept, twelve of a URL's own
818
847
  characters. A board's secret link made new: the old one opens nothing (`tests/visitors`).
848
+ **`"now"` is as its field is:** where the seed gives the field wall clocks (`"at": "2026-07-01T12:41:07"`, no `Z`),
849
+ it's one too, on the clock of its zone, so it stands beside the times kept so (a crossing beside its start). The
850
+ zone is a field named `zone` (a time zone, `Europe/London`): the item's own where it gives one, else its kind's
851
+ root's (a board's), else the document's own (`/zone`). No such field, and it's refused as it compiles; none said
852
+ when it's added, and the add is refused. No seed of it, and it's an instant. Working: `tests/fixtures/regatta`,
853
+ `tests/fixtures/tide` (`tests/clock.test.ts`). A store that kept it as an instant before has rows a wall clock's
854
+ CHECK refuses: put them on the clock in a migration of their own, before the compiler's.
855
+ - `notEmpty: { notes: ["text"] }`: fields of words that are never none, nor only spaces, whoever writes them,
856
+ refused "text cannot be empty" (a trigger, in both databases; no migration, and a row that's empty already is left
857
+ until it's changed). Checked by a cannot refused in those words. Working: `examples/notes/stories.jsonl`.
819
858
  - `timed: { cards: "due" }`: an instant the stories give; when it comes the server clears it, as its own
820
859
  write, and the app's reactions do what follows (a clock's next tick sets it again).
821
860
  - `unique: { people: ["name"] }` (or fields together, `[["hotel", "name"]]`) and
@@ -911,7 +950,7 @@ Working: `src/members/`; `tests/sign-in.test.ts`; `tests/mcp.test.ts` (the door)
911
950
  when the group is open too, of nobody (`member` 0). The compiler can't read it, so write a `cannot` story,
912
951
  `refused` in its words, for each rule in it: the stories told say so of one that refuses nothing they tell
913
952
  (`<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
953
+ says it (`mine`, `unique`, `noOverlap`, `notEmpty`, `moves`, `takes`, `frozen`, `addedWith`, `within`, `apart`): the examples
915
954
  have no `trust.ts` (Peter, 30 Nov: their rules said once, the database's on Postgres). One that truly can't be
916
955
  declared is a trigger in each dialect's SQL, not TypeScript.
917
956
  - **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
@@ -1009,8 +1048,8 @@ display gives them once: `use(specs)` from `joined/kit`.
1009
1048
  | Part | What it is | Its attributes | Events |
1010
1049
  |---|---|---|---|
1011
1050
  | `<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) | |
1051
+ | `<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. A page reaches what's in it by its parts, never by script into its shadow: `j-sheet::part(field-accountants)` (each field `field` and `field-<name>`), `part(label)`, `part(control)`, `part(hint)`, `part(chips)`, `part(chip chosen)` and `part(chip offered)` (each chip's person its `data-key`), `part(foot)`, `part(drawer)`. | `for` (a collection) | tells `j-open` |
1052
+ | `<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), `hint` (a line under its label: "Tap to choose"), `not` (of a link: none another field holds now offered, `not="owners"`, unless already chosen; it follows the form as it's changed) | |
1014
1053
  | `<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
1054
 
1016
1055
  The control a field gets is its kind's (`src/fields.ts`), never chosen again:
package/docs/design.md CHANGED
@@ -9,9 +9,12 @@ the system's page. Where joined doesn't meet a rule yet, the rule says so, with
9
9
  `todo.jsonl`. The look comes down from fewer's design system and Paintbrush's plain look:
10
10
  hairlines, black controls, 4px corners, no shadows, plain words.
11
11
 
12
+ A rule here is held: by its part (joined's stylesheets and code), or by a test. One that isn't yet is marked
13
+ _(a wish)_; one held in some places but not all, _(a wish where …)_, saying where it isn't.
14
+
12
15
  ## What a page is for
13
16
 
14
- A page brings what a person needs to act to one place. It says where they are and what they can do,
17
+ A page brings what a person needs to act to one place _(a wish)_. It says where they are and what they can do,
15
18
  and offers nothing they can't.
16
19
 
17
20
  ### Three surfaces, three meanings
@@ -23,10 +26,10 @@ and offers nothing they can't.
23
26
  - **A modal** (Modal, New event) is new or delete: one question, one answer, gone. It never edits. (What is
24
27
  new by a modal, and what by a box on the page: Adding, below.)
25
28
  Removing, or anything that can't be taken back, is always asked first in the app's own modal,
26
- never the browser's `confirm()`. Asked first, it's as Apple's alerts are (the Human Interface Guidelines'
27
- Alerts and Buttons): its title the question, a line under it saying what follows ("It goes for everyone at
28
- once, and can't be put back."), 24px around it, and its two answers a finger tall (44px), sharing its width
29
- 12px apart, Never mind first and the deed last, in its own words; none is pressed by Return alone.
29
+ never the browser's `confirm()`. Asked first, its title says what will happen ("Dinner in Shinjuku will be
30
+ removed."), never a question: its buttons ask. A line under it says what follows ("It goes for everyone at
31
+ once, and can't be put back."), and, as Apple's alerts are (the Human Interface Guidelines' Alerts and Buttons), 24px around it, and its two answers a finger tall (44px), sharing its width
32
+ 12px apart, Never mind first and the deed last, in its own words. None is pressed by Return alone _(a wish)_.
30
33
  - **A sheet** (Sheet, The group) shows a list beside the page. It has a title and its ×, and closes
31
34
  when you tap away. A form in it is laid out as a drawer's: its fields one under another, its deeds at
32
35
  its foot, removing apart.
@@ -34,11 +37,13 @@ and offers nothing they can't.
34
37
  width of the screen, risen from the foot, rounded at the top (`radius-sheet`), a grabber on its head, the page
35
38
  dimmed behind by the `scrim`; a tap on the dimmed page closes it, as its × does. A modal is Web Awesome's
36
39
  `wa-dialog` anywhere, the page dimmed by the same scrim, over the drawer it asks over. Wider, the drawer docked
37
- at the right and a sheet popped beside its button are joined's own.
40
+ at the right and a sheet popped beside its button are joined's own _(a wish where a sheet is put beside its
41
+ button: each app places its own)_.
38
42
  - **Web Awesome draws the simple surfaces and controls** (`src/awesome.ts`, MIT, its free parts alone): the
39
43
  phone's drawer, the modal, the toast, the peek (`wa-popover`), a tooltip, a tick (`wa-checkbox`), words, long
40
44
  words and numbers (`wa-input`, `wa-textarea`, `wa-number-input`), a choice of a few (`wa-select`), the views'
41
- tabs, a card (`wa-card`) and a refusal said in place (`wa-callout`). Its `--wa-` tokens are joined's
45
+ tabs, a card (`wa-card`) and a refusal said in place (`wa-callout`) _(a wish where joined's typeaheads and
46
+ search, and the trip's event form, still draw native inputs)_. Its `--wa-` tokens are joined's
42
47
  (`tokens.json`'s `wa`), and its icons lucide's. joined keeps the binding, the controls of its own kinds and the
43
48
  readings.
44
49
  - **Each keeps its head and its foot in view.** A drawer, a modal and a sheet always show what it is
@@ -50,7 +55,8 @@ and offers nothing they can't.
50
55
 
51
56
  - **What's typed waits for Save; what's picked or dragged is kept at once.** Words are held until Save, one
52
57
  write, and Never mind puts them back: half a sentence never reaches another's page. A pick alone (a colour, a
53
- tick, a step) or a drag (a block, a pin, an order) is kept as it's made, and undone by undoing it.
58
+ tick, a step) or a drag (a block, a pin, an order) is kept as it's made, and undone by undoing it _(a wish
59
+ where the trip's drags wait in its drawer for Save: Peter's to decide, todo #136)_.
54
60
  - **A surface is one or the other.** One with a typed field is a Save surface, and everything in it waits, its
55
61
  picks too: Never mind puts all of it back. One of picks alone has no Save, and keeps each as it's made. Never
56
62
  both in one, where nobody could tell what Never mind takes back.
@@ -61,7 +67,8 @@ A thing is added with the least it needs.
61
67
 
62
68
  - **One field:** a box on the page, where the new thing will show (a note, a person's name, a cost).
63
69
  - **A few it can't be without:** a modal, asked and answered (a trip's name and its week).
64
- - **Everything else** is filled in afterwards, in its drawer. Never a long form in a modal, and never a new
70
+ - **Everything else** is filled in afterwards, in its drawer. Never a long form in a modal _(a wish where the trip asks a new
71
+ event with its whole form)_, and never a new
65
72
  thing in a drawer or a sheet: joined's rows and readings ask a new item in a modal, only what it can't be
66
73
  without (what it needs, its title, what's offered filled in).
67
74
 
@@ -70,7 +77,6 @@ A thing is added with the least it needs.
70
77
  - **A row is one target** (Row): all of it, and a tap opens its drawer. It's 44px tall at least, and says that it
71
78
  opens: a chevron at its end, and its ground under the pointer.
72
79
  - **A button on a row does something else** (a tick, a grip), never what the row does: never a pencil at its end.
73
- (The cafe's supplies, cards of several lines, still open by one: `todo.jsonl` #116.)
74
80
  - **The row whose drawer is open is marked** while it is: its ground kept, a stripe of `accent` at its left.
75
81
  - **One a person may not open is its words alone:** no chevron, nothing to press.
76
82
  - A block on a calendar is tapped as a row is.
@@ -98,8 +104,8 @@ A thing is added with the least it needs.
98
104
  - **A peek is read, not written.** It may hold a pick, kept at once; never a typed field, which a stray tap would
99
105
  lose.
100
106
  - **It's by what was tapped,** under it, over it or beside it, never on it; it doesn't dim the page, and goes at a
101
- tap elsewhere; on a phone, a small sheet from the foot.
102
- - **A peek says what a thing is; a menu says what may be done to it** (`.j-choices`). Never one for the other.
107
+ tap elsewhere; on a phone, a small sheet from the foot _(a wish where a phone shows it: a popover there too)_.
108
+ - **A peek says what a thing is; a menu says what may be done to it** (`.j-choices`). Never one for the other _(a wish)_.
103
109
  - Shown on the notes (a note's day), and held by `tests/compiled.test.ts`. (The trip's pin peeks by its own, on a
104
110
  phone alone, and a person's chip not at all: `todo.jsonl` #119.)
105
111
 
@@ -112,8 +118,8 @@ place with a picture is drawn as it (a trip is its week and its map), never as a
112
118
 
113
119
  ### What a tap does
114
120
 
115
- - A tap on something named is that thing, in one tap.
116
- - Nothing opens by itself, and closing changes nothing. One thing open at a time; Escape closes it, wherever
121
+ - A tap on something named is that thing, in one tap _(a wish)_.
122
+ - Nothing opens by itself. Closing changes nothing _(a wish)_. One thing open at a time _(a wish)_; Escape closes it, wherever
117
123
  you are.
118
124
  Back closes it too, what's open being in the URL's hash (`#event=2`), so a link opens it again.
119
125
  - Offer only what this person may do: each element's `may` says it, from the grants and their roles
@@ -143,45 +149,61 @@ place with a picture is drawn as it (a trip is its week and its map), never as a
143
149
  a trackpad's; where it's put, it stays while the week does. The wheel alone scrolls the page.
144
150
  - An order is dragged by its grip (`grip`), held by a finger: the row follows the pointer, and let go it takes a
145
151
  place between its new neighbours, on every page. The arrow keys on the grip move it a place at a time.
146
- - Whatever a drag can do, the drawer's fields can do too.
152
+ - Whatever a drag can do, the drawer's fields can do too _(a wish)_.
147
153
 
148
154
  ### Choosing
149
155
 
150
156
  - Six choices or fewer are shown as themselves: People chips, or a select.
157
+ - A select says it opens by joined's chevron (the icon `choose`, in `muted`), set in from its edge as its words
158
+ are, with room between them: never the browser's own, which Chrome draws at the edge. The whole field is what's
159
+ tapped; the chevron only says so.
151
160
  - More than six is a typeahead, never a select: type, and the matches drop beneath (`typeahead()`,
152
161
  `joined/parts`; the Place search, and an event's people past six).
162
+ Its active match, the first until the arrows move it, is ringed as a focused button is: Enter chooses it, Escape
163
+ lets the matches go. To a screen reader it's a combobox _(a wish where a place is searched for)_.
153
164
  - Several of many are chips, each with its ×, and a typeahead for the rest (People, past six). Never a
154
- native multi-select. Six or fewer, they're chips to press (People chips).
165
+ native multi-select _(a wish)_. Six or fewer, they're chips to press (People chips).
155
166
 
156
167
  ## Colour
157
168
 
158
169
  - **The controls are black.** Links, focus and what is open or pressed are `accent`; the one button
159
- that makes or keeps is `add` with `add-ink`. Never blue.
160
- - **`danger` is for taking away, and for a refusal,** nothing else: Remove, a refusal's words. Filled (`danger` with `danger-ink`) only as a modal's answer.
170
+ that makes or keeps is `add` with `add-ink`. Never blue. An app may give `add` its own colour, as the cafe gives
171
+ each page its flavour, its main buttons in it (Peter, 2 Dec 2026: a design choice).
172
+ - **`danger` is for taking away, and for a refusal,** and for now on the week and the timeline, a line meant to
173
+ be seen at once (a design choice): Remove, a refusal's words. Filled (`danger` with `danger-ink`) only as a
174
+ modal's answer.
161
175
  - **The ground is `paper`; what sits on it is `card`,** framed by a 1px `edge`. Hairlines between
162
176
  rows and hours are `line`. A recess (the map before its tiles) is `well`. Labels, notes
163
- and an icon at rest are `muted`.
177
+ and an icon at rest are `muted` _(a wish where a label is `ink`)_.
164
178
  - **Colour is for identity, never for a control.** A thing with a colour has it everywhere it shows,
165
179
  so the eye joins them: a person's chip and their dot on each event; an event's block and its pin
166
180
  (Identity). Its hue is `hue-0` … `hue-9` by its key's last digit; a kind of thing with no key, a fixed few (a
167
- shop's aisles), by its place in their list. Hues join things in one collection; the same digit in another means
168
- nothing.
181
+ shop's aisles), by its place in their list _(a wish)_. Hues join things in one collection; the same digit in
182
+ another means nothing _(a wish where the kit's readings colour by `accent`)_.
169
183
  - **A chip and a block are a tint and a stripe:** the hue at `tint` over `card` (`tint-strong`
170
- under the pointer, or picked), a 3px stripe of the hue at the left, the words in `ink`. Never solid
184
+ under the pointer, or picked), a 3px stripe of the hue at the left, the words in `ink` _(a wish where the
185
+ kit's readings tint by `accent`)_. Never solid
171
186
  with white words: white misses 3:1 on five of the ten hues.
172
- - **A pin is solid:** its hue in a 2px white ring, `pin` across.
173
- - **Picked is a 2px `ink` outline,** on the block and the pin both.
187
+ - **A pin is solid:** its hue in a 2px white ring, `pin` across _(a wish where the kit's map fills it
188
+ `accent`, in a ring of `card`)_.
189
+ - **Picked is a 2px `ink` outline,** on the block and the pin both _(a wish where the kit's readings outline
190
+ 1px `accent`)_.
174
191
  - **A control's border is `control-edge`, 3:1 on `card`:** a field, a chip not pressed, a day on the strip,
175
192
  a small tool. A frame (the calendar, the map, a drawer, a card) keeps the soft `edge`: it isn't a control.
176
193
 
177
194
  ## Type
178
195
 
179
- One family, the system's own sans. Every text joined draws is one of the thirteen styles, never a size by
180
- hand. A landing page (the root, a list of trips) speaks up: `display` its headline, `lead` the words under it,
181
- `section` a section's name, and `name` a thing's name on its card. Every page is named in `section`, under joined at its top (Page head). Inside a page: `heading` a part's name, `title` a drawer's, modal's or sheet's, `row` a row's words, `label` a
196
+ One family, the system's own sans _(a wish where the welcome page sets code in monospace)_. Every text joined
197
+ draws is one of the thirteen styles, never a size by hand _(a wish where the welcome page's code is 12.5px)_. A
198
+ landing page (the root, a list of trips) speaks up: `display` its headline, `lead` the words under it,
199
+ `section` a section's name, and `name` a thing's name on its card _(a wish)_. Every page is named in `section`, under joined at its top (Page head). Inside a page: `heading` a part's name, `title` a drawer's, modal's or sheet's, `row` a row's words, `label` a
182
200
  label and a day's name, `tool` a button's word, `small` a note, the toast and a notice, `tiny` inside the
183
201
  calendar, `body` the rest, and `field` every field, which a phone would zoom into if it were smaller.
184
202
 
203
+ A control's words are a field's size, 16px: a button's, a chip's, a tab's, a link drawn as one, a row's (`tool`,
204
+ `row`), never smaller or lighter than the boxes beside them (Apple's HIG). The deed that makes or keeps (Add, Save,
205
+ Order) is 600, heavier than the rest. Only what's drawn inside a reading (a calendar's blocks, its hours) is smaller.
206
+
185
207
  ## Icons
186
208
 
187
209
  An icon is a word the page says in a picture, so each has one meaning, everywhere (Icons, and the
@@ -190,23 +212,27 @@ Icons assets).
190
212
  - Lucide's, and only Lucide's, by joined's own names. Never an emoji, another set, or one drawn by
191
213
  hand.
192
214
  - Drawn as Lucide draws them, in its control's colour: `muted` at rest, `ink` under the pointer,
193
- `danger` on Remove.
194
- - A harmless deed is an icon alone (Icon button), its label saying the deed. Never a word link.
195
- - A deed that makes, keeps or removes says its word, its icon beside it (Button).
215
+ `danger` on Remove _(a wish where a row's chevron rests in `edge`)_.
216
+ - A harmless deed is an icon alone (Icon button), its label saying the deed. Never a word link _(a wish)_.
217
+ - A deed that makes, keeps or removes says its word, its icon beside it (Button) _(a wish where a modal's deed
218
+ isn't Remove: only Remove gets its icon)_.
196
219
 
197
220
  ## Layout
198
221
 
199
- - **One breakpoint, 40rem.** Above it the drawer docks at the right and the week stands beside the
222
+ - **One breakpoint, 40rem** (`size-phone`; every `@media` and `matchMedia` held to it by `tests/sizes.test.ts`). Above it the drawer docks at the right and the week stands beside the
200
223
  map; below it the drawer and a sheet rise from the foot, and the trip is a strip of its days (Day
201
224
  strip) over one day.
202
225
  - **A page is 72rem at most, its sides the `gutter`:** 1rem on a phone, 1.5rem where there's room. A row
203
226
  that runs to the screen's edges bleeds by the gutter's name, `calc(-1 * var(--gutter))`, never its number.
204
- - **Every space is a token** (`space-4` … `space-64`), on one scale, never a number of rem or px by hand.
205
- - **Under a finger, 44px:** a button (`touch`), an icon button (`control`) and a field.
227
+ - **Every space is a token** (`space-4` … `space-64`), on one scale, never a number of rem or px by hand _(a wish where a stylesheet still owes some, as `tests/sizes.json`
228
+ records)_.
229
+ - **Under a finger, 44px** (`size-finger`): a button, an icon button and a field. Where there's room, a button is
230
+ `touch` and an icon button `control`, 32px.
206
231
  - **4px corners everywhere** (`radius`), a card's too; 3px inside a 4px box; a tag is a pill; a dot and a face are
207
- round; on a phone, a drawer's and a sheet's top corners are 14px (`radius-sheet`), as a phone's sheet.
232
+ round; on a phone, a drawer's and a sheet's top corners are 14px (`radius-sheet`), as a phone's sheet _(a wish
233
+ where the desk's tally and the trip's stays type 2px)_.
208
234
  - **No shadows.** A drawer, a modal and a sheet are set apart by a 1px `edge`; on a phone, a drawer and a sheet by
209
- the scrim behind them alone.
235
+ the scrim behind them alone _(a wish where the desk's card casts one as it's dragged)_.
210
236
  - **A foot fixed at the screen's foot** (a quick add, a balance) is `.j-foot`: it runs on past the screen's foot
211
237
  by 40vh, its words lifted by as much, so nothing of the page shows under it where an iPhone's address bar floats
212
238
  and comes and goes.
@@ -219,8 +245,8 @@ Icons assets).
219
245
 
220
246
  ## Words
221
247
 
222
- - A button names its deed: "Add", "Save", "Never mind", "Remove". Never "OK" or "Submit".
223
- - Sentence case; labels in plain words.
248
+ - A button names its deed: "Add", "Save", "Never mind", "Remove". Never "OK" or "Submit" _(a wish)_.
249
+ - Sentence case; labels in plain words _(a wish)_.
224
250
  - A note says what isn't there ("Nothing links here yet"), and a held change what will happen to it
225
251
  ("Not kept yet: Save keeps it, Never mind puts it back").
226
252
  - A refusal says why, in the server's own words, never a code.
@@ -233,5 +259,34 @@ Things come and go as an iPhone's do (`src/tokens.json`, motion): a drawer or a
233
259
  `rise` (420ms, quick then a long soft settle) and goes back the way it came in `fall` (280ms), from the foot on
234
260
  a phone, a drawer from the right where it docks, a sheet a little from below. Web Awesome's surfaces (the
235
261
  phone's drawer and sheet, a modal, the toast) move as Web Awesome moves them, the scrim fading with them; a menu drops a
236
- few pixels from its button in `drop`; the Toast fades. Nothing else moves, and under
262
+ few pixels from its button in `drop`; the Toast fades. Nothing else moves _(a wish where the desk's lanes pulse and its tally slides)_, and under
237
263
  `prefers-reduced-motion` nothing does (`src/parts.css`).
264
+
265
+ ## How the look is built
266
+
267
+ The look is held by six rules, each a test on every page of every example, wide and on a phone
268
+ (`tests/pages.test.ts`, `tests/sizes.test.ts`). Each answers a fault met building it.
269
+
270
+ 1. **Hidden always hides.** `[hidden] { display: none !important }`, once, in joined's layer (`src/parts.css`,
271
+ adopted by the page and every display's shadow): whatever display a part's or an app's own rules give an element,
272
+ hidden takes it away, and no app rule can undo it. A thing that keeps its room unseen says so by a class of its own
273
+ (the week's `.mark.none`), never by `hidden`. (Met: the cafe's tabs, a reading in `<j-views>`, the till's stock
274
+ bar, each drawn though hidden.)
275
+ 2. **joined's names mean joined's parts.** The plain class names joined's page and parts style are its own: `bar`
276
+ (a `nav` or `p` of buttons), `brand`, `lead`, `note`, `members-only` on the page; `act`, `danger`, `icon-only`,
277
+ `said`, `drawer`, `sheet` everywhere. An app names its own thing otherwise (the till's `stock`, once a `bar`). Its
278
+ own parts are `j-`.
279
+ 3. **Layers decide, never specificity.** joined's rules are `@layer joined`, at the lowest weight (`:where`); an
280
+ app's own stylesheet comes after and wins, without `!important` or a selector made heavier; an app's reset is
281
+ `@layer reset`, beneath joined's.
282
+ 4. **Into a shadow by its parts alone.** Each display names what's in it as parts, passed out of every shadow it
283
+ draws in (`exportparts`): the sheet's `field`, `field-<name>`, `label`, `control`, `hint`, `chips`, `chip
284
+ chosen`/`offered`, `foot`; the rows' `row`, `open`, `title`, `facts`, `deeds`…; each reading's `item`, `head`,
285
+ `day`, `now`, `lane`, `today`, `add` (the map's `pin`, `peek`, `zoom`); `<j-views>`' `tab` and `tab-<its word>`;
286
+ the group's `bar`, `who`, `sheet`. A page styles them as `j-sheet::part(field-accountants)`, never by script into
287
+ a shadow.
288
+ 5. **Tokens only.** Every size, colour and font is a token (`src/tokens.json`); one breakpoint (`size-phone`); a
289
+ control's words are a field's size, the deed that makes or keeps heavier (Type).
290
+ 6. **Looked at whole.** On every page: room at its top, nothing wider than a phone, every control a finger tall
291
+ on one, every control's words a field's size, what's hidden drawn nowhere, joined's names used for joined's parts;
292
+ and a stylesheet types no more sizes by hand than it owes, which only goes down.
@@ -1,6 +1,6 @@
1
1
  <img src="logo.svg" alt="joined" style="width:64px;height:64px;margin:0 0 0.5rem">
2
2
 
3
- # An Introduction to `joined`
3
+ # An introduction to `joined`
4
4
 
5
5
  `joined` turns user stories into real-time, multi-user web applications where **the page itself is
6
6
  the document**.
@@ -20,7 +20,7 @@ feature has to be written four times: a schema, an API endpoint, a store action,
20
20
 
21
21
  ---
22
22
 
23
- ## 1. Stories Are the Source
23
+ ## 1. Stories are the source
24
24
 
25
25
  An application in `joined` starts as `stories.jsonl`—a plain list of who does what to a document,
26
26
  and who sees the result:
@@ -48,7 +48,7 @@ stories and generates the server rules, the migrations, and the custom elements:
48
48
 
49
49
  ---
50
50
 
51
- ## 2. The Light DOM Is the Document; the Shadow DOM Is the Display
51
+ ## 2. The light DOM is the document; the shadow DOM is the display
52
52
 
53
53
  Once a collection element (`<j-events>`) is placed on a page, it subscribes to its document on the page's WebSocket and
54
54
  populates itself with `<j-event>` children. Each item's `id` is its `key` attribute, and each field
@@ -89,7 +89,7 @@ calendar day and `<j-map>` as a pin on an OpenStreetMap map:
89
89
 
90
90
  ---
91
91
 
92
- ## 3. One Socket per Page, Ops on Paths
92
+ ## 3. One socket per page, ops on paths
93
93
 
94
94
  Regardless of how many documents a page holds (a week of Japan's trip, `trip:1?week=2026-11-02`; `people`;
95
95
  `members`), the browser opens a single `/ws` connection per tab.
@@ -117,14 +117,14 @@ When Peter drags an event on his laptop and clicks **Save**, the element dispatc
117
117
 
118
118
  ---
119
119
 
120
- ## 4. Links as HTML `IDREFS`, and Sign-In as a Trust Tree
120
+ ## 4. Links as HTML `IDREFS`, and sign-in as a trust tree
121
121
 
122
122
  Two ideas complete the picture: how documents link to one another, and how people (and their AI
123
123
  agents) sign in.
124
124
 
125
125
  ![Cross-document IDREFS links and the members trust network](links-and-trust.svg)
126
126
 
127
- ### Cross-Document Links (`people="1 2"`)
127
+ ### Cross-document links (`people="1 2"`)
128
128
 
129
129
  A field holding a list of IDs, named after another document's collection (`people: [1, 2]`), is a
130
130
  link.
@@ -136,7 +136,7 @@ link.
136
136
  - On the server, referential integrity is enforced automatically: Kenji cannot be removed from
137
137
  `people` while any event in Japan's trip links to him (`"1 event in trip:1 links to it"`).
138
138
 
139
- ### Sign-In by Link (`src/members/`)
139
+ ### Sign-in by link (`src/members/`)
140
140
 
141
141
  The group of people who may use the app is itself a compiled document, `members`, held on every page
142
142
  by `<members-panel><j-members>…</j-members></members-panel>`. A project whose stories have no `as` has
@@ -156,7 +156,7 @@ no group: anyone may read and write.
156
156
  to its member (`via` the agent), while `group.ts` refuses any attempt by an agent to invite or
157
157
  remove members.
158
158
 
159
- ### Claude in a Chat (`src/mcp.ts`)
159
+ ### Claude in a chat (`src/mcp.ts`)
160
160
 
161
161
  An agent's link is also an MCP connector. The Agents tab copies it as `/mcp/<token>`, ready to paste
162
162
  into claude.ai's custom connectors, so Claude in a chat, on a phone too, can work with the app.
@@ -174,7 +174,7 @@ into claude.ai's custom connectors, so Claude in a chat, on a phone too, can wor
174
174
 
175
175
  ---
176
176
 
177
- ## 5. An App Is a Folder
177
+ ## 5. An app is a folder
178
178
 
179
179
  Everything an app needs lives in one folder under `examples/`:
180
180
 
@@ -1,4 +1,5 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 880 360" font-family="system-ui, -apple-system, sans-serif">
2
+ <style>/* drawn dark on a dark page: each of its colours as joined's dark tokens have it (src/tokens.json) */ @media (prefers-color-scheme: dark) { [fill="#222"] { fill: #e5e5e5; } [fill="#444"] { fill: #e5e5e5; } [fill="#666"] { fill: #a8a8a8; } [fill="#555"] { fill: #a8a8a8; } [fill="#2c5282"] { fill: #9cbde6; } [fill="#ffffff"] { fill: #1a1b1e; } [fill="#fff"] { fill: #1a1b1e; } [fill="#f8f9fa"] { fill: #111213; } [fill="#fafafa"] { fill: #111213; } [fill="#f3f4f6"] { fill: #23262b; } [fill="#eef3f8"] { fill: #1f2a38; } [fill="#e8eff7"] { fill: #1f2a38; } [fill="#e8eef2"] { fill: #1f2a38; } [fill="#dbe6ec"] { fill: #1f2a38; } [fill="#fdf6ec"] { fill: #2e2418; } [fill="#fdebd6"] { fill: #2e2418; } [stroke="#e5e5e5"] { stroke: #2e2e33; } [stroke="#eee"] { stroke: #2e2e33; } [stroke="#f3f3f3"] { stroke: #2e2e33; } [stroke="#ddd"] { stroke: #2e2e33; } [stroke="#dde5ea"] { stroke: #2e2e33; } [stroke="#ccc"] { stroke: #60616b; } [stroke="#222"] { stroke: #e5e5e5; } [stroke="#fff"] { stroke: #1a1b1e; } }</style>
2
3
  <defs>
3
4
  <marker id="arrow-obs" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
4
5
  <path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#4e79a7"/>
@@ -1,4 +1,5 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 880 320" font-family="system-ui, -apple-system, sans-serif">
2
+ <style>/* drawn dark on a dark page: each of its colours as joined's dark tokens have it (src/tokens.json) */ @media (prefers-color-scheme: dark) { [fill="#222"] { fill: #e5e5e5; } [fill="#666"] { fill: #a8a8a8; } [fill="#555"] { fill: #a8a8a8; } [fill="#ffffff"] { fill: #1a1b1e; } [fill="#fff"] { fill: #1a1b1e; } [fill="#f8f9fa"] { fill: #111213; } [fill="#fafafa"] { fill: #111213; } [fill="#f3f4f6"] { fill: #23262b; } [fill="#ccc"] { fill: #3a3b42; } [fill="#fdf6ec"] { fill: #2e2418; } [stroke="#e5e5e5"] { stroke: #2e2e33; } [stroke="#ddd"] { stroke: #2e2e33; } [stroke="#ccc"] { stroke: #60616b; } [stroke="#888"] { stroke: #6e6f78; } [stroke="#222"] { stroke: #e5e5e5; } }</style>
2
3
  <defs>
3
4
  <marker id="l-arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
4
5
  <path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#e15759"/>
@@ -1,4 +1,5 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 880 390" font-family="system-ui, -apple-system, sans-serif">
2
+ <style>/* drawn dark on a dark page: each of its colours as joined's dark tokens have it (src/tokens.json) */ @media (prefers-color-scheme: dark) { [fill="#222"] { fill: #e5e5e5; } [fill="#666"] { fill: #a8a8a8; } [fill="#555"] { fill: #a8a8a8; } [fill="#2c5282"] { fill: #9cbde6; } [fill="#ffffff"] { fill: #1a1b1e; } [fill="#fff"] { fill: #1a1b1e; } [fill="#fafafa"] { fill: #111213; } [fill="#f3f4f6"] { fill: #23262b; } [fill="#ddd"] { fill: #3a3b42; } [fill="#eef3f8"] { fill: #1f2a38; } [stroke="#e5e5e5"] { stroke: #2e2e33; } [stroke="#ccc"] { stroke: #60616b; } [stroke="#222"] { stroke: #e5e5e5; } [stroke="#666"] { stroke: #a8a8a8; } }</style>
2
3
  <defs>
3
4
  <marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
4
5
  <path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#666"/>
@@ -43,7 +44,7 @@
43
44
  <g transform="translate(190, 160)">
44
45
  <rect width="500" height="58" rx="8" fill="#222" stroke="#222"/>
45
46
  <text x="250" y="23" font-size="13" font-weight="600" fill="#fff" text-anchor="middle">src/compile.ts — modelOf(stories)</text>
46
- <text x="250" y="43" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="10.5" fill="#ddd" text-anchor="middle">
47
+ <text x="250" y="43" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="10.5" fill="#ddd" text-anchor="middle" textLength="476" lengthAdjust="spacingAndGlyphs">
47
48
  events → &lt;j-events&gt;&lt;j-event&gt; · tables · required · replace · clear · links
48
49
  </text>
49
50
  </g>
package/docs/wire-op.svg CHANGED
@@ -1,4 +1,5 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 880 310" font-family="system-ui, -apple-system, sans-serif">
2
+ <style>/* drawn dark on a dark page: each of its colours as joined's dark tokens have it (src/tokens.json) */ @media (prefers-color-scheme: dark) { [fill="#222"] { fill: #e5e5e5; } [fill="#666"] { fill: #a8a8a8; } [fill="#555"] { fill: #a8a8a8; } [fill="#2c5282"] { fill: #9cbde6; } [fill="#2b6e22"] { fill: #8fd17f; } [fill="#a33"] { fill: #ef6b6b; } [fill="#ffffff"] { fill: #1a1b1e; } [fill="#fff"] { fill: #1a1b1e; } [fill="#f8f9fa"] { fill: #111213; } [fill="#fafafa"] { fill: #111213; } [fill="#f3f4f6"] { fill: #23262b; } [fill="#eef3f8"] { fill: #1f2a38; } [fill="#eef7ec"] { fill: #1e2b1c; } [stroke="#e5e5e5"] { stroke: #2e2e33; } [stroke="#eee"] { stroke: #2e2e33; } [stroke="#ddd"] { stroke: #2e2e33; } [stroke="#ccc"] { stroke: #60616b; } [stroke="#222"] { stroke: #e5e5e5; } }</style>
2
3
  <defs>
3
4
  <marker id="w-arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
4
5
  <path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#4e79a7"/>
package/examples/app.css CHANGED
@@ -18,6 +18,15 @@ form.add wa-input {
18
18
  flex: 1;
19
19
  min-width: 0;
20
20
  }
21
+ /* on a phone, the box takes the line and its deeds go under it, side by side: never a box cut to a word */
22
+ @media (max-width: 40rem) {
23
+ form.add wa-input {
24
+ flex-basis: 100%;
25
+ }
26
+ form.add > .act {
27
+ flex: 1 1 0;
28
+ }
29
+ }
21
30
  .edge {
22
31
  display: flex;
23
32
  flex-wrap: wrap;