@blueshed/joined 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/joined/SKILL.md +9 -1
- package/.claude/skills/joined/reference.md +316 -63
- package/.claude/skills/joined-door/SKILL.md +57 -0
- package/README.md +19 -50
- package/docs/design.md +158 -37
- package/docs/introduction.md +27 -27
- package/docs/light-and-shadow.svg +2 -1
- package/docs/links-and-trust.svg +1 -0
- package/docs/stories-to-code.svg +2 -1
- package/docs/wire-op.svg +1 -0
- package/examples/README.md +20 -0
- package/examples/account/account.json +1 -0
- package/examples/account/derive.ts +41 -0
- package/examples/account/generated/elements.ts +52 -0
- package/examples/account/generated/rows.ts +22 -0
- package/examples/account/generated/rules.ts +32 -0
- package/examples/account/routes.ts +5 -0
- package/examples/app.css +11 -1
- package/examples/cafe/books.html +2 -2
- package/examples/cafe/cafe.css +96 -85
- package/examples/cafe/generated/books.rows.ts +22 -0
- package/examples/cafe/generated/books.rules.ts +3 -2
- package/examples/cafe/generated/kitchen.rows.ts +27 -0
- package/examples/cafe/generated/kitchen.rules.ts +11 -1
- package/examples/cafe/generated/menu.rows.ts +22 -0
- package/examples/cafe/generated/menu.rules.ts +3 -2
- package/examples/cafe/generated/order.rows.ts +27 -0
- package/examples/cafe/generated/order.rules.ts +11 -1
- package/examples/cafe/generated/staff.elements.ts +7 -2
- package/examples/cafe/generated/staff.rows.ts +22 -0
- package/examples/cafe/generated/staff.rules.ts +9 -1
- package/examples/cafe/generated/supplies.queries.ts +4 -2
- package/examples/cafe/generated/supplies.rows.ts +22 -0
- package/examples/cafe/generated/supplies.rules.ts +17 -1
- package/examples/cafe/generated/till.queries.ts +2 -0
- package/examples/cafe/generated/till.rows.ts +27 -0
- package/examples/cafe/generated/till.rules.ts +11 -1
- package/examples/cafe/index.html +14 -15
- package/examples/cafe/kitchen.css +11 -19
- package/examples/cafe/kitchen.ts +7 -3
- package/examples/cafe/look.ts +30 -0
- package/examples/cafe/menu.html +10 -26
- package/examples/cafe/menu.ts +8 -80
- package/examples/cafe/migrations/002-guard-supplies.ts +15 -0
- package/examples/cafe/order.html +8 -7
- package/examples/cafe/order.ts +6 -2
- package/examples/cafe/routes.ts +0 -1
- package/examples/cafe/staff.json +5 -0
- package/examples/cafe/stories.jsonl +6 -2
- package/examples/cafe/supplies.html +35 -34
- package/examples/cafe/supplies.ts +59 -39
- package/examples/cafe/till.ts +19 -11
- package/examples/cafe/views.ts +7 -5
- package/examples/chart/arches.ts +150 -0
- package/examples/chart/chart.css +11 -0
- package/examples/chart/chart.json +87 -0
- package/examples/chart/generated/elements.ts +105 -0
- package/examples/chart/generated/queries.ts +36 -0
- package/examples/chart/generated/rows.ts +27 -0
- package/examples/chart/generated/rules.ts +111 -0
- package/examples/chart/grid.ts +118 -0
- package/examples/chart/index.html +78 -0
- package/examples/chart/migrations/001-chart.ts +6 -0
- package/examples/chart/migrations/002-create-conditions.ts +6 -0
- package/examples/chart/page.ts +20 -0
- package/examples/chart/routes.ts +7 -0
- package/examples/chart/stories.jsonl +14 -0
- package/examples/chart/teeth.ts +57 -0
- package/examples/desk/desk.css +6 -10
- package/examples/desk/generated/elements.ts +1 -1
- package/examples/desk/generated/rows.ts +22 -0
- package/examples/desk/generated/rules.ts +34 -1
- package/examples/desk/index.html +10 -3
- package/examples/desk/lanes.css +21 -19
- package/examples/desk/routes.ts +0 -2
- package/examples/desk/stories.jsonl +4 -3
- package/examples/desk/tally.css +1 -1
- package/examples/desk/thumbs.ts +2 -2
- package/examples/docs.ts +7 -4
- package/examples/hello/generated/elements.ts +2 -2
- package/examples/hello/generated/rules.ts +3 -2
- package/examples/hello/hello.css +2 -4
- package/examples/hello/index.html +10 -3
- package/examples/hello/page.ts +4 -4
- package/examples/index.html +20 -12
- package/examples/notes/generated/elements.ts +112 -0
- package/examples/notes/generated/queries.ts +42 -0
- package/examples/notes/generated/rows.ts +27 -0
- package/examples/notes/generated/rules.ts +133 -0
- package/examples/notes/index.html +32 -0
- package/examples/notes/look.ts +41 -0
- package/examples/notes/migrations/001-notes.ts +7 -0
- package/examples/notes/notes.json +78 -0
- package/examples/notes/page.ts +21 -0
- package/examples/notes/routes.ts +6 -0
- package/examples/notes/stories.jsonl +24 -0
- package/examples/page.ts +9 -2
- package/examples/people/generated/rows.ts +22 -0
- package/examples/people/generated/rules.ts +11 -1
- package/examples/people/links.ts +8 -9
- package/examples/people/people.css +1 -1
- package/examples/people/routes.ts +1 -3
- package/examples/people/stories.jsonl +1 -0
- package/examples/people/view.ts +5 -2
- package/examples/trip/generated/elements.ts +5 -3
- package/examples/trip/generated/queries.ts +12 -1
- package/examples/trip/generated/rows.ts +27 -0
- package/examples/trip/generated/rules.ts +56 -2
- package/examples/trip/index.html +58 -12
- package/examples/trip/line.css +186 -0
- package/examples/trip/line.ts +51 -40
- package/examples/trip/page.ts +65 -71
- package/examples/trip/routes.ts +9 -5
- package/examples/trip/stays.css +13 -13
- package/examples/trip/stays.ts +15 -10
- package/examples/trip/stories.jsonl +2 -0
- package/examples/trip/told.ts +3 -26
- package/examples/trip/trip.css +16 -0
- package/examples/trips/generated/elements.ts +1 -1
- package/examples/trips/generated/rows.ts +22 -0
- package/examples/trips/generated/rules.ts +9 -1
- package/examples/trips/index.html +10 -10
- package/examples/trips/map.ts +3 -14
- package/examples/trips/new-trip.ts +14 -16
- package/examples/trips/trips.css +24 -23
- package/examples/weeks/generated/elements.ts +1 -1
- package/examples/weeks/generated/queries.ts +11 -0
- package/examples/weeks/generated/rows.ts +22 -0
- package/examples/weeks/generated/rules.ts +11 -5
- package/examples/weeks/routes.ts +3 -2
- package/examples/weeks/stories.jsonl +1 -0
- package/examples/welcome.css +43 -33
- package/package.json +8 -2
- package/src/attachment.ts +17 -2
- package/src/awesome.ts +103 -0
- package/src/board.css +76 -0
- package/src/board.ts +173 -0
- package/src/cli.ts +28 -3
- package/src/compile.ts +821 -109
- package/src/definitions.ts +113 -27
- package/src/demo.css +2 -5
- package/src/draft.ts +48 -27
- package/src/drawer.ts +248 -0
- package/src/engine.ts +253 -170
- package/src/fields.ts +341 -0
- package/src/file-value.ts +12 -2
- package/src/files.ts +113 -33
- package/src/ground.ts +110 -0
- package/src/icon-names.ts +19 -2
- package/src/keep.ts +16 -3
- package/src/kit.ts +51 -0
- package/src/link.ts +3 -3
- package/src/map.css +140 -0
- package/src/map.ts +200 -0
- package/src/mcp.ts +129 -24
- package/src/members/demo.ts +13 -12
- package/src/members/generated/rows.ts +22 -0
- package/src/members/generated/rules.ts +3 -2
- package/src/members/group.ts +105 -55
- package/src/members/keys.ts +95 -79
- package/src/members/panel.css +40 -35
- package/src/members/panel.ts +58 -37
- package/src/migrate.ts +178 -125
- package/src/migrations/005-change-kept.ts +7 -0
- package/src/month.css +129 -0
- package/src/month.ts +179 -0
- package/src/ops.ts +40 -1
- package/src/page.css +11 -2
- package/src/page.ts +68 -17
- package/src/parts.css +614 -230
- package/src/parts.ts +259 -36
- package/src/plane.css +61 -0
- package/src/plane.ts +153 -0
- package/src/postgres-server.ts +60 -0
- package/src/reading.css +73 -0
- package/src/reading.ts +238 -0
- package/src/rows.css +289 -0
- package/src/rows.ts +864 -0
- package/src/search.css +80 -0
- package/src/search.ts +130 -0
- package/src/server.ts +355 -137
- package/src/settings.ts +9 -4
- package/src/sheet.ts +116 -0
- package/src/skill.ts +40 -0
- package/src/slots.css +90 -0
- package/src/slots.ts +213 -0
- package/src/specs.ts +38 -0
- package/src/starter.ts +19 -2
- package/src/store.ts +224 -161
- package/src/stories.ts +43 -11
- package/src/surface.ts +164 -0
- package/src/time.ts +2 -0
- package/src/timeline.css +111 -0
- package/src/timeline.ts +235 -0
- package/src/toast.ts +21 -48
- package/src/together.ts +15 -24
- package/src/tokens.css +89 -3
- package/src/tokens.json +287 -7
- package/src/tool.ts +210 -0
- package/src/upkeep.ts +47 -22
- package/src/views.css +43 -0
- package/src/views.ts +111 -0
- package/src/week.css +150 -0
- package/src/week.ts +254 -0
- package/src/write.ts +326 -78
- package/starter/CHANGELOG.md +8 -0
- package/starter/CLAUDE.md +9 -3
- package/starter/bunfig +5 -0
- package/starter/githooks/pre-commit +13 -0
- package/starter/prettierignore +5 -0
- package/starter/tests/hello.test.ts +2 -0
- package/starter/tests/records.test.ts +40 -0
- package/starter/todo.jsonl +0 -0
- package/docs/learning.md +0 -76
- package/examples/cafe/trust.ts +0 -20
- package/examples/desk/trust.ts +0 -24
- package/examples/people/trust.ts +0 -14
- package/examples/trip/answer-rows.ts +0 -70
- package/examples/trip/bar.ts +0 -89
- package/examples/trip/calendar-map.css +0 -711
- package/examples/trip/calendar-map.ts +0 -249
- package/examples/trip/drags.ts +0 -143
- package/examples/trip/drawer.ts +0 -250
- package/examples/trip/event-form.ts +0 -200
- package/examples/trip/holding.ts +0 -61
- package/examples/trip/map.ts +0 -234
- package/examples/trip/month.ts +0 -87
- package/examples/trip/other-weeks.ts +0 -67
- package/examples/trip/peek.ts +0 -71
- package/examples/trip/people-chips.ts +0 -74
- package/examples/trip/shell.ts +0 -39
- package/examples/trip/trust.ts +0 -51
- package/examples/trip/week.ts +0 -237
- package/examples/trip/writes.ts +0 -91
- package/examples/trip/zones.ts +0 -16
- package/examples/weeks/derive.ts +0 -23
- package/src/scrim.ts +0 -81
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: joined-door
|
|
3
|
+
description: Use when reading or changing a joined document through its MCP door (the read_<doc> and write_<doc> tools), for how a read and a write go, an op's path, $n links, the forms a value takes, and a refusal. For any app on joined, in any client.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# A joined document, through its door
|
|
7
|
+
|
|
8
|
+
An app on joined keeps its documents, and every page open on them, in step. Its door gives you two tools for each
|
|
9
|
+
document your link may hold: `read_<doc>` and `write_<doc>` (a document you can't write has only its read). Their
|
|
10
|
+
descriptions say what each document holds and each op it takes: read them, they're written from the app's own rules.
|
|
11
|
+
The app's own words, where it has any, come after these.
|
|
12
|
+
|
|
13
|
+
## Read first
|
|
14
|
+
|
|
15
|
+
- `read_<doc>` answers the document as your link's member sees it, with its `version`: whole, or one collection's
|
|
16
|
+
items (`collection`), or only some of those (`ids`). Read a big document a collection at a time.
|
|
17
|
+
- A kind's documents, one of many (`trip:1`), take `key`: the id of its item in the document that lists them, as the
|
|
18
|
+
tool says.
|
|
19
|
+
- Others write too, on their pages, while you work: read again before a write if a while has passed.
|
|
20
|
+
|
|
21
|
+
## A write
|
|
22
|
+
|
|
23
|
+
- `write_<doc>` takes `ops`, a list, and `why`: say why in a few words, for those who read it.
|
|
24
|
+
- The ops are made whole or not at all, and every open page has them at once. A write is your link's member's, made
|
|
25
|
+
via you: a page says so.
|
|
26
|
+
- An op is `add`, `replace` or `remove` on a path, as the tool's description lists them:
|
|
27
|
+
- an item added: `{"op": "add", "path": "/events/-", "value": {…its fields}}`;
|
|
28
|
+
- a field changed: `{"op": "replace", "path": "/events/3/title", "value": "Lunch"}`; a field the item may be
|
|
29
|
+
without, taken off: `remove` on its path;
|
|
30
|
+
- an item taken away: `{"op": "remove", "path": "/events/3"}`;
|
|
31
|
+
- a list of ids: one added at `/events/3/people/-` (its value the id), one taken away at `/events/3/people/2`;
|
|
32
|
+
- a document's own field is at its top: `/greeting`.
|
|
33
|
+
- `"$1"` in a value is the id this write's first add is given, `"$2"` its second: an item and what links to it in one
|
|
34
|
+
write. In a value only, never in a path.
|
|
35
|
+
- Done answers `{"done": true, "version", "ids"}`, the ids of what it added, in order.
|
|
36
|
+
|
|
37
|
+
## Values
|
|
38
|
+
|
|
39
|
+
Each field's form is in the tool's schema; a value in another is refused, in words.
|
|
40
|
+
|
|
41
|
+
| Form | As | Means |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| date-time | `2026-11-14T09:00:00` | a wall clock where it happens: no `Z`, no offset, never moved to your zone or UTC |
|
|
44
|
+
| zone | `Asia/Tokyo` | where that clock is, where an item has one |
|
|
45
|
+
| instant | `2026-11-14T00:00:00Z` | a moment, UTC |
|
|
46
|
+
| duration | `PT2H30M`, `P1DT3H` | how long, ISO 8601 |
|
|
47
|
+
| place | `geo:35.0116,135.7681` | latitude, longitude |
|
|
48
|
+
| file | `file:<sha256>.<ext>` | a file the app keeps |
|
|
49
|
+
| a link | `4` | an item's id, as a read shows it |
|
|
50
|
+
|
|
51
|
+
A field of words given an object or a list is written as its JSON text: a bag of pairs is held so.
|
|
52
|
+
|
|
53
|
+
## Refused
|
|
54
|
+
|
|
55
|
+
A refusal changes nothing and says why, in the app's words: an op the rules don't give you, a field missing or of
|
|
56
|
+
another form, an item that isn't there (`no j-event at /events/999`). Read the words, read the document again, and
|
|
57
|
+
write what they ask; never the same write twice.
|
package/README.md
CHANGED
|
@@ -11,28 +11,18 @@ elements.
|
|
|
11
11
|
|
|
12
12
|
## Why it's different
|
|
13
13
|
|
|
14
|
-
- **Stories are the source.** You don't write a schema, an API or a model. You write what people
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **The page is the document.** Every event is a `<j-event>` element,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- **
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
each of its parts; the
|
|
27
|
-
cafe's kitchen, `<kitchen-rail>`, a small one, about 100.
|
|
28
|
-
- **Links are plain HTML.** An event links to people as `people="1 3"`, so CSS finds who's on
|
|
29
|
-
what: `[people~="2"]`.
|
|
30
|
-
- **Sign-in is a link.** Your link is who you are, on every device. Friends who invite people
|
|
31
|
-
hold their links and can give them again. Behind them all is a kind BDFL, who always says why.
|
|
32
|
-
- **Small.** Bun, web components and one dependency (lucide, for icons), and PGlite, optional, for a
|
|
33
|
-
Postgres store; the migrations are joined's own. The compiler, the server, the page's side and the store
|
|
34
|
-
together are about 4,700 lines of code, and a change to one of 100,000 events costs at most twice one of 1,000
|
|
35
|
-
(`bun run claims` counts the one and times the other).
|
|
14
|
+
- **Stories are the source.** You don't write a schema, an API or a model. You write what people do, one story a
|
|
15
|
+
line, and joined works out the rest: what the document holds, what may change, and what's refused. The same
|
|
16
|
+
stories are the tests.
|
|
17
|
+
- **The page is the document.** Every event is a `<j-event>` element, its fields attributes. A change is an op on a
|
|
18
|
+
path (`replace /events/3/start`) and lands on exactly one element. No virtual DOM, no store beside the page.
|
|
19
|
+
- **Drawing is separate from holding.** A display holds the elements and draws them in its shadow, moving only what
|
|
20
|
+
changed. Add another way of seeing the same events without touching the others.
|
|
21
|
+
- **A kit to draw with.** `joined/kit` gives a page a list, a sheet to change an item, a search, and the same items
|
|
22
|
+
as a week, a month, a timeline, a map or a board, on Web Awesome. Use it, or draw your own, or both.
|
|
23
|
+
- **Sign-in is a link.** Your link is who you are, on every device. Members invite members.
|
|
24
|
+
- **Small to depend on.** Bun, web components, Lucide's icons and Web Awesome. It keeps everything in one SQLite
|
|
25
|
+
file, or in Postgres (a URL with its password, `JOINED_POSTGRES`), where several servers share one database.
|
|
36
26
|
|
|
37
27
|
## Try it
|
|
38
28
|
|
|
@@ -63,31 +53,15 @@ so its connector address is `…/mcp`, with no link, and Claude changes it as an
|
|
|
63
53
|
|
|
64
54
|
## Your own apps
|
|
65
55
|
|
|
66
|
-
joined is
|
|
67
|
-
folder like those in `examples/`. It's on npm as `@blueshed/joined`; once create-joined is published too, an app
|
|
68
|
-
begins with:
|
|
56
|
+
joined is on npm as `@blueshed/joined`. An app is a folder in `apps/`, like those in `examples/`:
|
|
69
57
|
|
|
70
58
|
```
|
|
71
59
|
bun create joined my-app
|
|
72
60
|
cd my-app && bun run dev
|
|
73
61
|
```
|
|
74
62
|
|
|
75
|
-
That
|
|
76
|
-
test
|
|
77
|
-
its stories), `start` (serves `apps/`, keeping what the pages change in `.data/`), `link`, `upgrade` and `test`.
|
|
78
|
-
`bun run upgrade` moves it to the newest joined and refreshes the skill.
|
|
79
|
-
|
|
80
|
-
Until then, `bun <joined>/create/index.ts my-app` makes it, on the newest joined from npm. To try a joined not
|
|
81
|
-
released yet, `bun run pack` in joined makes `.pack/blueshed-joined-<version>.tgz`, and `JOINED_FROM=<that tarball>`
|
|
82
|
-
makes the app on it. Never take joined's folder
|
|
83
|
-
itself (`file:../joined`): Bun copies a folder dependency whole, `.data/` (the store, and the members' keys)
|
|
84
|
-
included.
|
|
85
|
-
|
|
86
|
-
An app imports joined by its name, `joined/page`, `joined/draft`, `joined/parts` and the rest
|
|
87
|
-
(`package.json`'s `exports`), and a page links `joined/tokens.css` and `joined/page.css`, every page's layout. joined's own examples do the
|
|
88
|
-
same. A project's group begins from its own `apps/members.json`, if it gives one, else joined's.
|
|
89
|
-
Its stories are its tests: `tell(doc)` from `joined/stories` tells each on a server of its own and
|
|
90
|
-
says what didn't go as it says (`expect(await tell("notes")).toEqual([])`).
|
|
63
|
+
That gives you hello in `apps/`, the skill for Claude, a CLAUDE.md, a test, and the scripts (`dev`, `compile`,
|
|
64
|
+
`start`, `link`, `upgrade`, `test`). An app imports joined by name (`joined/page`, `joined/kit`), never by a path.
|
|
91
65
|
|
|
92
66
|
## A taste
|
|
93
67
|
|
|
@@ -103,15 +77,10 @@ anything else and says why. The story itself is run as a test, by someone signed
|
|
|
103
77
|
|
|
104
78
|
## Where next
|
|
105
79
|
|
|
106
|
-
- **[docs/introduction.md](docs/introduction.md):** how stories,
|
|
107
|
-
|
|
108
|
-
- **[docs/
|
|
109
|
-
- **[docs/
|
|
110
|
-
- **[docs/plan.md](docs/plan.md):** joined as it's aimed, self-contained: the architecture, the
|
|
111
|
-
words, what's decided and why, every story and seed, what's built, and the phases still to build.
|
|
112
|
-
- **[compiled-documents.md](../docs/architecture/compiled-documents.md):** where it came from.
|
|
113
|
-
joined joins dzql (documents compiled from stories), doclets (routes and resources) and fewer
|
|
114
|
-
(rows as elements) into one idea.
|
|
80
|
+
- **[docs/introduction.md](docs/introduction.md):** how stories, the page and displays fit together.
|
|
81
|
+
- **[docs/stories.md](docs/stories.md):** what a line of `stories.jsonl` may say.
|
|
82
|
+
- **[docs/design.md](docs/design.md):** how it looks.
|
|
83
|
+
- **[docs/plan.md](docs/plan.md):** what joined is, its parts and its rules, on one page.
|
|
115
84
|
|
|
116
85
|
## Licence
|
|
117
86
|
|
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
|
|
@@ -20,34 +23,103 @@ and offers nothing they can't.
|
|
|
20
23
|
- **A drawer** (Drawer) is editing: one thing's own fields, its deeds at its foot. Docked at the
|
|
21
24
|
right, `panel` wide, the page beside it as it was; on a phone, a sheet risen from the foot, the page dimmed
|
|
22
25
|
above it. Its changes wait in it until Save.
|
|
23
|
-
- **A modal** (Modal, New event) is new or delete: one question, one answer, gone. It never edits.
|
|
26
|
+
- **A modal** (Modal, New event) is new or delete: one question, one answer, gone. It never edits. (What is
|
|
27
|
+
new by a modal, and what by a box on the page: Adding, below.)
|
|
24
28
|
Removing, or anything that can't be taken back, is always asked first in the app's own modal,
|
|
25
|
-
never the browser's `confirm()`.
|
|
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)_.
|
|
26
33
|
- **A sheet** (Sheet, The group) shows a list beside the page. It has a title and its ×, and closes
|
|
27
34
|
when you tap away. A form in it is laid out as a drawer's: its fields one under another, its deeds at
|
|
28
35
|
its foot, removing apart.
|
|
29
|
-
- **On a phone, a drawer and a sheet are a phone's sheet
|
|
30
|
-
rounded at the top (`radius-sheet`), a grabber on its head, the page
|
|
31
|
-
the dimmed page closes
|
|
32
|
-
|
|
36
|
+
- **On a phone, a drawer and a sheet are a phone's sheet,** Web Awesome's `wa-drawer` (`src/surface.ts`): the
|
|
37
|
+
width of the screen, risen from the foot, rounded at the top (`radius-sheet`), a grabber on its head, the page
|
|
38
|
+
dimmed behind by the `scrim`; a tap on the dimmed page closes it, as its × does. A modal is Web Awesome's
|
|
39
|
+
`wa-dialog` anywhere, the page dimmed by the same scrim, over the drawer it asks over. Wider, the drawer docked
|
|
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)_.
|
|
42
|
+
- **Web Awesome draws the simple surfaces and controls** (`src/awesome.ts`, MIT, its free parts alone): the
|
|
43
|
+
phone's drawer, the modal, the toast, the peek (`wa-popover`), a tooltip, a tick (`wa-checkbox`), words, long
|
|
44
|
+
words and numbers (`wa-input`, `wa-textarea`, `wa-number-input`), a choice of a few (`wa-select`), the views'
|
|
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
|
|
47
|
+
(`tokens.json`'s `wa`), and its icons lucide's. joined keeps the binding, the controls of its own kinds and the
|
|
48
|
+
readings.
|
|
33
49
|
- **Each keeps its head and its foot in view.** A drawer, a modal and a sheet always show what it is
|
|
34
50
|
(its title, its ×) and what you may do (its deeds, a sheet's add field); only what's between them
|
|
35
51
|
scrolls, however tall it grows, under a band of its card (8px) below the head and above the foot, so
|
|
36
52
|
nothing half scrolled away touches a title or a button.
|
|
37
53
|
|
|
38
|
-
|
|
54
|
+
### When a change is kept
|
|
55
|
+
|
|
56
|
+
- **What's typed waits for Save; what's picked or dragged is kept at once.** Words are held until Save, one
|
|
57
|
+
write, and Never mind puts them back: half a sentence never reaches another's page. A pick alone (a colour, a
|
|
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)_.
|
|
60
|
+
- **A surface is one or the other.** One with a typed field is a Save surface, and everything in it waits, its
|
|
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
|
|
62
|
+
both in one, where nobody could tell what Never mind takes back.
|
|
63
|
+
|
|
64
|
+
### Adding
|
|
65
|
+
|
|
66
|
+
A thing is added with the least it needs.
|
|
67
|
+
|
|
68
|
+
- **One field:** a box on the page, where the new thing will show (a note, a person's name, a cost).
|
|
69
|
+
- **A few it can't be without:** a modal, asked and answered (a trip's name and its week).
|
|
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
|
|
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
|
|
73
|
+
without (what it needs, its title, what's offered filled in).
|
|
74
|
+
|
|
75
|
+
### A row
|
|
76
|
+
|
|
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
|
|
78
|
+
opens: a chevron at its end, and its ground under the pointer.
|
|
79
|
+
- **A button on a row does something else** (a tick, a grip), never what the row does: never a pencil at its end.
|
|
80
|
+
- **The row whose drawer is open is marked** while it is: its ground kept, a stripe of `accent` at its left.
|
|
81
|
+
- **One a person may not open is its words alone:** no chevron, nothing to press.
|
|
82
|
+
- A block on a calendar is tapped as a row is.
|
|
83
|
+
|
|
84
|
+
### A peek
|
|
85
|
+
|
|
86
|
+
- **An attribute pops a small view of what it points at, with the way to the whole** (Peek). An attribute is a
|
|
87
|
+
value with a view of its own (a when: its month; a where: its map) or a key to another object (a person, a
|
|
88
|
+
place). On a row it's said under the row's words (`mention()`); tapped, it pops (`peek()`): the intermediate
|
|
89
|
+
detail, between a word on a row and a whole reading.
|
|
90
|
+
- **The small view is the reading, small and about one thing:** the same display at two sizes (the notes'
|
|
91
|
+
`<j-month>`: a day's month popped, and the page's month). Its one button opens the whole, on that thing.
|
|
92
|
+
- **A primary relation never pops.** What a thing is part of, comes after or holds is the structure of the list,
|
|
93
|
+
and the list shows it: its order, its grouping, its columns.
|
|
94
|
+
- **Which a field is, the model says, never the page.** A plain value (words, a number, a tick) pops nothing. A
|
|
95
|
+
value with a form (a date-time, a place, a file) pops its form's view. A link is structure where it's marked
|
|
96
|
+
`part` (is a, has a, composition; and any link `gone: "with"`), and never pops; any other link is a reference,
|
|
97
|
+
and pops what it points at. Known as the thing is modelled, said once in the stories' `links` line. The
|
|
98
|
+
compiler writes what each field pops beside its collection (`collections.<name>.pops`, `generated/rules.ts`):
|
|
99
|
+
a form, a collection, or nothing. (A page still makes its own mentions from it: `todo.jsonl` #121.)
|
|
100
|
+
- **The whole** a pop's button opens is, for a value with a form, that form's reading of the same collection (the
|
|
101
|
+
calendar, the map); for a reference, the thing in its own place. Where the page has neither, no button. A pop's
|
|
102
|
+
own attributes don't pop again.
|
|
103
|
+
- **A thing in its own place opens** (A row): its drawer is its detail already.
|
|
104
|
+
- **A peek is read, not written.** It may hold a pick, kept at once; never a typed field, which a stray tap would
|
|
105
|
+
lose.
|
|
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
|
|
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)_.
|
|
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
|
|
110
|
+
phone alone, and a person's chip not at all: `todo.jsonl` #119.)
|
|
39
111
|
|
|
40
112
|
### A page shows one thing, in its readings
|
|
41
113
|
|
|
42
114
|
A page shows one document's collection in a reading: a list, a calendar, a map, a line. Nothing is
|
|
43
115
|
shown twice: the trip's week and its map are its events read two ways, one page split between them;
|
|
44
|
-
the
|
|
116
|
+
the kit's `<j-views>` reads them as a week, a Line or a month, by tabs, the map beside them. On a phone, a pin tapped peeks (Peek) before anything opens. A
|
|
45
117
|
place with a picture is drawn as it (a trip is its week and its map), never as a box of sections. A new reading is a new display over the same elements, never a new copy of the data.
|
|
46
118
|
|
|
47
119
|
### What a tap does
|
|
48
120
|
|
|
49
|
-
- A tap on something named is that thing, in one tap.
|
|
50
|
-
- Nothing opens by itself
|
|
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
|
|
51
123
|
you are.
|
|
52
124
|
Back closes it too, what's open being in the URL's hash (`#event=2`), so a link opens it again.
|
|
53
125
|
- Offer only what this person may do: each element's `may` says it, from the grants and their roles
|
|
@@ -77,45 +149,61 @@ place with a picture is drawn as it (a trip is its week and its map), never as a
|
|
|
77
149
|
a trackpad's; where it's put, it stays while the week does. The wheel alone scrolls the page.
|
|
78
150
|
- An order is dragged by its grip (`grip`), held by a finger: the row follows the pointer, and let go it takes a
|
|
79
151
|
place between its new neighbours, on every page. The arrow keys on the grip move it a place at a time.
|
|
80
|
-
- 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)_.
|
|
81
153
|
|
|
82
154
|
### Choosing
|
|
83
155
|
|
|
84
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.
|
|
85
160
|
- More than six is a typeahead, never a select: type, and the matches drop beneath (`typeahead()`,
|
|
86
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)_.
|
|
87
164
|
- Several of many are chips, each with its ×, and a typeahead for the rest (People, past six). Never a
|
|
88
|
-
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).
|
|
89
166
|
|
|
90
167
|
## Colour
|
|
91
168
|
|
|
92
169
|
- **The controls are black.** Links, focus and what is open or pressed are `accent`; the one button
|
|
93
|
-
that makes or keeps is `add` with `add-ink`. Never blue.
|
|
94
|
-
|
|
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.
|
|
95
175
|
- **The ground is `paper`; what sits on it is `card`,** framed by a 1px `edge`. Hairlines between
|
|
96
176
|
rows and hours are `line`. A recess (the map before its tiles) is `well`. Labels, notes
|
|
97
|
-
and an icon at rest are `muted
|
|
177
|
+
and an icon at rest are `muted` _(a wish where a label is `ink`)_.
|
|
98
178
|
- **Colour is for identity, never for a control.** A thing with a colour has it everywhere it shows,
|
|
99
179
|
so the eye joins them: a person's chip and their dot on each event; an event's block and its pin
|
|
100
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
|
|
101
|
-
shop's aisles), by its place in their list. Hues join things in one collection; the same digit in
|
|
102
|
-
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`)_.
|
|
103
183
|
- **A chip and a block are a tint and a stripe:** the hue at `tint` over `card` (`tint-strong`
|
|
104
|
-
under the pointer, or picked), a 3px stripe of the hue at the left, the words in `ink
|
|
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
|
|
105
186
|
with white words: white misses 3:1 on five of the ten hues.
|
|
106
|
-
- **A pin is solid:** its hue in a 2px white ring, `pin` across
|
|
107
|
-
|
|
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`)_.
|
|
108
191
|
- **A control's border is `control-edge`, 3:1 on `card`:** a field, a chip not pressed, a day on the strip,
|
|
109
192
|
a small tool. A frame (the calendar, the map, a drawer, a card) keeps the soft `edge`: it isn't a control.
|
|
110
193
|
|
|
111
194
|
## Type
|
|
112
195
|
|
|
113
|
-
One family, the system's own sans
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
116
200
|
label and a day's name, `tool` a button's word, `small` a note, the toast and a notice, `tiny` inside the
|
|
117
201
|
calendar, `body` the rest, and `field` every field, which a phone would zoom into if it were smaller.
|
|
118
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
|
+
|
|
119
207
|
## Icons
|
|
120
208
|
|
|
121
209
|
An icon is a word the page says in a picture, so each has one meaning, everywhere (Icons, and the
|
|
@@ -124,23 +212,27 @@ Icons assets).
|
|
|
124
212
|
- Lucide's, and only Lucide's, by joined's own names. Never an emoji, another set, or one drawn by
|
|
125
213
|
hand.
|
|
126
214
|
- Drawn as Lucide draws them, in its control's colour: `muted` at rest, `ink` under the pointer,
|
|
127
|
-
`danger` on Remove.
|
|
128
|
-
- A harmless deed is an icon alone (Icon button), its label saying the deed. Never a word link.
|
|
129
|
-
- 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)_.
|
|
130
219
|
|
|
131
220
|
## Layout
|
|
132
221
|
|
|
133
|
-
- **One breakpoint, 40rem
|
|
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
|
|
134
223
|
map; below it the drawer and a sheet rise from the foot, and the trip is a strip of its days (Day
|
|
135
224
|
strip) over one day.
|
|
136
225
|
- **A page is 72rem at most, its sides the `gutter`:** 1rem on a phone, 1.5rem where there's room. A row
|
|
137
226
|
that runs to the screen's edges bleeds by the gutter's name, `calc(-1 * var(--gutter))`, never its number.
|
|
138
|
-
- **Every space is a token** (`space-4` … `space-64`), on one scale, never a number of rem or px by hand.
|
|
139
|
-
|
|
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.
|
|
140
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
|
|
141
|
-
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)_.
|
|
142
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
|
|
143
|
-
the scrim behind them alone.
|
|
235
|
+
the scrim behind them alone _(a wish where the desk's card casts one as it's dragged)_.
|
|
144
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
|
|
145
237
|
by 40vh, its words lifted by as much, so nothing of the page shows under it where an iPhone's address bar floats
|
|
146
238
|
and comes and goes.
|
|
@@ -153,8 +245,8 @@ Icons assets).
|
|
|
153
245
|
|
|
154
246
|
## Words
|
|
155
247
|
|
|
156
|
-
- A button names its deed: "Add", "Save", "Never mind", "Remove". Never "OK" or "Submit".
|
|
157
|
-
- 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)_.
|
|
158
250
|
- A note says what isn't there ("Nothing links here yet"), and a held change what will happen to it
|
|
159
251
|
("Not kept yet: Save keeps it, Never mind puts it back").
|
|
160
252
|
- A refusal says why, in the server's own words, never a code.
|
|
@@ -165,7 +257,36 @@ Icons assets).
|
|
|
165
257
|
|
|
166
258
|
Things come and go as an iPhone's do (`src/tokens.json`, motion): a drawer or a sheet rises into place in
|
|
167
259
|
`rise` (420ms, quick then a long soft settle) and goes back the way it came in `fall` (280ms), from the foot on
|
|
168
|
-
a phone, a drawer from the right where it docks, a sheet a little from below
|
|
169
|
-
|
|
170
|
-
few pixels from its button in `drop`; the Toast fades. Nothing else moves, and under
|
|
260
|
+
a phone, a drawer from the right where it docks, a sheet a little from below. Web Awesome's surfaces (the
|
|
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
|
|
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
|
|
171
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.
|
package/docs/introduction.md
CHANGED
|
@@ -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
|
|
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**.
|
|
@@ -12,7 +12,7 @@ feature has to be written four times: a schema, an API endpoint, a store action,
|
|
|
12
12
|
`joined` collapses that stack into two operations—**reduce** and **map**:
|
|
13
13
|
|
|
14
14
|
1. **Stories reduce into the model.** You write what people do, one JSON line per story. The
|
|
15
|
-
compiler reduces those stories into server validation rules, SQLite
|
|
15
|
+
compiler reduces those stories into server validation rules, table migrations (SQLite or Postgres), and typed
|
|
16
16
|
HTML custom elements.
|
|
17
17
|
2. **Ops reduce into the light DOM; displays map the light DOM into their shadow DOM.** The wire
|
|
18
18
|
carries tiny JSON Patch ops (`/events/3/start`). On the page, each item is an HTML element and
|
|
@@ -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
|
|
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,14 +48,16 @@ stories and generates the server rules, the migrations, and the custom elements:
|
|
|
48
48
|
|
|
49
49
|
---
|
|
50
50
|
|
|
51
|
-
## 2. The
|
|
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
|
|
55
55
|
is an HTML attribute:
|
|
56
56
|
|
|
57
57
|
```html
|
|
58
|
-
<
|
|
58
|
+
<j-week for="events" when="start" length="duration"></j-week>
|
|
59
|
+
<j-map for="events" at="coordinates"></j-map>
|
|
60
|
+
<div hidden>
|
|
59
61
|
<j-events>
|
|
60
62
|
<j-event
|
|
61
63
|
key="2"
|
|
@@ -67,29 +69,27 @@ is an HTML attribute:
|
|
|
67
69
|
people="1 2"
|
|
68
70
|
></j-event>
|
|
69
71
|
</j-events>
|
|
70
|
-
</
|
|
72
|
+
</div>
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
Just as HTML's `<select>` holds `<option>` elements as data, `<
|
|
74
|
-
|
|
75
|
-
and
|
|
75
|
+
Just as HTML's `<select>` holds `<option>` elements as data, `<j-events>` holds the events in the
|
|
76
|
+
light DOM, hidden. The kit's readings draw them in their shadow DOM, `<j-week>` as a block on a
|
|
77
|
+
calendar day and `<j-map>` as a pin on an OpenStreetMap map:
|
|
76
78
|
|
|
77
79
|

|
|
78
80
|
|
|
79
81
|
- **No store beside the DOM:** `el.data` reads the element's attributes once, freezes the object,
|
|
80
82
|
and caches it until an attribute changes.
|
|
81
|
-
- **Drafts until Save (`src/draft.ts`):**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
another field while your drawer is open, the drawer updates that field while keeping your unsaved
|
|
85
|
-
edit intact.
|
|
83
|
+
- **Drafts until Save (`src/draft.ts`):** An event opened in the kit's sheet (`<j-sheet>`) holds
|
|
84
|
+
your edits until you press **Save**, which sends a single write. If someone else changes another
|
|
85
|
+
field while it's open, the sheet updates that field while keeping your unsaved edit intact.
|
|
86
86
|
- **Surgical updates (`MutationObserver` + `keep()`):** When `key="2"`'s `start` attribute changes,
|
|
87
|
-
the `MutationObserver` tells
|
|
88
|
-
event's
|
|
87
|
+
the `MutationObserver` tells each reading that `<j-event key="2">` mutated, and only that
|
|
88
|
+
event's block and pin move. Every other node on the page is untouched.
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
-
## 3. One
|
|
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.
|
|
@@ -106,8 +106,9 @@ When Peter drags an event on his laptop and clicks **Save**, the element dispatc
|
|
|
106
106
|
- the tables' own guards, as the rows are written: each value's CHECK, named for the words it's refused
|
|
107
107
|
in, and triggers for what an add needs and a link's target.
|
|
108
108
|
- `store.write(doc, ops, by, via)` applies the ops and records the change in `changes` inside a
|
|
109
|
-
single transaction (SQLite, or Postgres), then
|
|
110
|
-
|
|
109
|
+
single transaction (SQLite, or Postgres), then the server sends the committed change via Bun's WebSocket
|
|
110
|
+
pub/sub to every tab holding that week; a tab holding another week isn't told. On Postgres the commit is
|
|
111
|
+
notified too (`NOTIFY`), so another server on the same database tells its tabs.
|
|
111
112
|
3. **Away and back (`since`):** If a phone sleeps or switches networks, the page marks itself
|
|
112
113
|
`data-away` (keeping any unsaved edit in its form so nothing is lost) and reconnects
|
|
113
114
|
automatically. On reconnect, it sends `{ subscribe: "trip:1?week=2026-11-02", since: version }`. A whole document is
|
|
@@ -116,14 +117,14 @@ When Peter drags an event on his laptop and clicks **Save**, the element dispatc
|
|
|
116
117
|
|
|
117
118
|
---
|
|
118
119
|
|
|
119
|
-
## 4. Links as HTML `IDREFS`, and
|
|
120
|
+
## 4. Links as HTML `IDREFS`, and sign-in as a trust tree
|
|
120
121
|
|
|
121
122
|
Two ideas complete the picture: how documents link to one another, and how people (and their AI
|
|
122
123
|
agents) sign in.
|
|
123
124
|
|
|
124
125
|

|
|
125
126
|
|
|
126
|
-
### Cross-
|
|
127
|
+
### Cross-document links (`people="1 2"`)
|
|
127
128
|
|
|
128
129
|
A field holding a list of IDs, named after another document's collection (`people: [1, 2]`), is a
|
|
129
130
|
link.
|
|
@@ -135,7 +136,7 @@ link.
|
|
|
135
136
|
- On the server, referential integrity is enforced automatically: Kenji cannot be removed from
|
|
136
137
|
`people` while any event in Japan's trip links to him (`"1 event in trip:1 links to it"`).
|
|
137
138
|
|
|
138
|
-
### Sign-
|
|
139
|
+
### Sign-in by link (`src/members/`)
|
|
139
140
|
|
|
140
141
|
The group of people who may use the app is itself a compiled document, `members`, held on every page
|
|
141
142
|
by `<members-panel><j-members>…</j-members></members-panel>`. A project whose stories have no `as` has
|
|
@@ -155,7 +156,7 @@ no group: anyone may read and write.
|
|
|
155
156
|
to its member (`via` the agent), while `group.ts` refuses any attempt by an agent to invite or
|
|
156
157
|
remove members.
|
|
157
158
|
|
|
158
|
-
### Claude in a
|
|
159
|
+
### Claude in a chat (`src/mcp.ts`)
|
|
159
160
|
|
|
160
161
|
An agent's link is also an MCP connector. The Agents tab copies it as `/mcp/<token>`, ready to paste
|
|
161
162
|
into claude.ai's custom connectors, so Claude in a chat, on a phone too, can work with the app.
|
|
@@ -173,7 +174,7 @@ into claude.ai's custom connectors, so Claude in a chat, on a phone too, can wor
|
|
|
173
174
|
|
|
174
175
|
---
|
|
175
176
|
|
|
176
|
-
## 5. An
|
|
177
|
+
## 5. An app is a folder
|
|
177
178
|
|
|
178
179
|
Everything an app needs lives in one folder under `examples/`:
|
|
179
180
|
|
|
@@ -182,12 +183,11 @@ Everything an app needs lives in one folder under `examples/`:
|
|
|
182
183
|
| `stories.jsonl` | What people do to the document—compiles the model and runs as tests |
|
|
183
184
|
| `<doc>.json` | The committed seed where stories and tests begin |
|
|
184
185
|
| `generated/` | Written by `bun run compile`: `rules.ts` (server checks) and `elements.ts` (DOM elements) |
|
|
185
|
-
| `migrations/` | Numbered
|
|
186
|
+
| `migrations/` | Numbered table migrations written by `bun run compile` |
|
|
186
187
|
| `<doc>.css` & views | How the document's elements or shadow displays look |
|
|
187
188
|
| `index.html` & `page.ts` | The page and its controls |
|
|
188
189
|
| `routes.ts` | Exports `document` and `routes` (the page and any edges like `/trip/1/trip.ics`) |
|
|
189
190
|
|
|
190
|
-
To read deeper, `docs/plan.md` in joined's repository
|
|
191
|
-
and why, every story and seed, what's built, and the phases still to build. See [docs/design.md](design.md) for how it
|
|
191
|
+
To read deeper: what `joined` is, its parts and its rules, on one page, is `docs/plan.md` in joined's repository. See [docs/design.md](design.md) for how it
|
|
192
192
|
looks: the rules for its surfaces, taps and drags, colour, type, icons and words, whose values and parts
|
|
193
193
|
are `joined`'s design system.
|