@blueshed/joined 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/joined/SKILL.md +9 -1
- package/.claude/skills/joined/reference.md +270 -55
- package/.claude/skills/joined-door/SKILL.md +57 -0
- package/README.md +19 -50
- package/docs/design.md +76 -10
- package/docs/introduction.md +18 -18
- package/docs/light-and-shadow.svg +1 -1
- 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 +2 -1
- package/examples/cafe/books.html +2 -2
- package/examples/cafe/cafe.css +9 -16
- 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.rows.ts +22 -0
- package/examples/cafe/generated/staff.rules.ts +6 -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 +12 -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.ts +1 -1
- package/examples/cafe/look.ts +30 -0
- package/examples/cafe/menu.html +10 -26
- package/examples/cafe/menu.ts +8 -80
- package/examples/cafe/order.html +6 -6
- package/examples/cafe/order.ts +5 -1
- package/examples/cafe/routes.ts +0 -1
- package/examples/cafe/stories.jsonl +3 -1
- package/examples/cafe/supplies.html +34 -34
- package/examples/cafe/supplies.ts +14 -11
- package/examples/cafe/till.ts +5 -1
- package/examples/chart/arches.ts +148 -0
- package/examples/chart/chart.css +6 -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/generated/rows.ts +22 -0
- package/examples/desk/generated/rules.ts +34 -1
- package/examples/desk/index.html +9 -2
- package/examples/desk/routes.ts +0 -2
- package/examples/desk/stories.jsonl +3 -2
- package/examples/desk/thumbs.ts +2 -2
- 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 +4 -5
- package/examples/notes/generated/elements.ts +112 -0
- package/examples/notes/generated/queries.ts +36 -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 +21 -0
- package/examples/people/generated/rows.ts +22 -0
- package/examples/people/generated/rules.ts +11 -1
- package/examples/people/links.ts +2 -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 +4 -2
- 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 +12 -12
- 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/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/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 +7 -5
- package/package.json +8 -2
- package/src/awesome.ts +103 -0
- package/src/board.css +75 -0
- package/src/board.ts +173 -0
- package/src/cli.ts +15 -2
- package/src/compile.ts +569 -35
- package/src/definitions.ts +53 -15
- package/src/draft.ts +38 -23
- package/src/drawer.ts +222 -0
- package/src/engine.ts +240 -166
- package/src/fields.ts +268 -0
- package/src/files.ts +6 -4
- package/src/ground.ts +110 -0
- package/src/icon-names.ts +15 -2
- package/src/kit.ts +51 -0
- package/src/link.ts +3 -3
- package/src/map.css +133 -0
- package/src/map.ts +200 -0
- package/src/mcp.ts +176 -38
- 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 +65 -39
- package/src/members/keys.ts +93 -77
- package/src/members/panel.css +23 -17
- package/src/members/panel.ts +49 -35
- package/src/migrate.ts +120 -104
- package/src/month.css +125 -0
- package/src/month.ts +179 -0
- package/src/page.css +8 -0
- package/src/page.ts +11 -7
- package/src/parts.css +462 -170
- package/src/parts.ts +209 -26
- package/src/plane.css +56 -0
- package/src/plane.ts +151 -0
- package/src/postgres-server.ts +60 -0
- package/src/reading.css +77 -0
- package/src/reading.ts +238 -0
- package/src/rows.css +308 -0
- package/src/rows.ts +780 -0
- package/src/search.css +80 -0
- package/src/search.ts +130 -0
- package/src/server.ts +211 -114
- package/src/settings.ts +9 -4
- package/src/sheet.ts +114 -0
- package/src/skill.ts +40 -0
- package/src/slots.css +94 -0
- package/src/slots.ts +213 -0
- package/src/specs.ts +38 -0
- package/src/starter.ts +5 -2
- package/src/store.ts +184 -143
- package/src/stories.ts +43 -11
- package/src/surface.ts +159 -0
- package/src/timeline.css +111 -0
- package/src/timeline.ts +226 -0
- package/src/toast.ts +21 -48
- package/src/together.ts +0 -7
- package/src/tokens.css +78 -1
- package/src/tokens.json +249 -0
- package/src/tool.ts +211 -0
- package/src/upkeep.ts +18 -20
- package/src/views.css +44 -0
- package/src/views.ts +94 -0
- package/src/week.css +151 -0
- package/src/week.ts +250 -0
- package/src/write.ts +219 -73
- package/starter/CLAUDE.md +3 -3
- package/starter/bunfig +4 -0
- package/starter/prettierignore +4 -0
- package/starter/tests/hello.test.ts +2 -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
|
@@ -20,28 +20,94 @@ and offers nothing they can't.
|
|
|
20
20
|
- **A drawer** (Drawer) is editing: one thing's own fields, its deeds at its foot. Docked at the
|
|
21
21
|
right, `panel` wide, the page beside it as it was; on a phone, a sheet risen from the foot, the page dimmed
|
|
22
22
|
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.
|
|
23
|
+
- **A modal** (Modal, New event) is new or delete: one question, one answer, gone. It never edits. (What is
|
|
24
|
+
new by a modal, and what by a box on the page: Adding, below.)
|
|
24
25
|
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()`.
|
|
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.
|
|
26
30
|
- **A sheet** (Sheet, The group) shows a list beside the page. It has a title and its ×, and closes
|
|
27
31
|
when you tap away. A form in it is laid out as a drawer's: its fields one under another, its deeds at
|
|
28
32
|
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
|
-
|
|
33
|
+
- **On a phone, a drawer and a sheet are a phone's sheet,** Web Awesome's `wa-drawer` (`src/surface.ts`): the
|
|
34
|
+
width of the screen, risen from the foot, rounded at the top (`radius-sheet`), a grabber on its head, the page
|
|
35
|
+
dimmed behind by the `scrim`; a tap on the dimmed page closes it, as its × does. A modal is Web Awesome's
|
|
36
|
+
`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.
|
|
38
|
+
- **Web Awesome draws the simple surfaces and controls** (`src/awesome.ts`, MIT, its free parts alone): the
|
|
39
|
+
phone's drawer, the modal, the toast, the peek (`wa-popover`), a tooltip, a tick (`wa-checkbox`), words, long
|
|
40
|
+
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
|
|
42
|
+
(`tokens.json`'s `wa`), and its icons lucide's. joined keeps the binding, the controls of its own kinds and the
|
|
43
|
+
readings.
|
|
33
44
|
- **Each keeps its head and its foot in view.** A drawer, a modal and a sheet always show what it is
|
|
34
45
|
(its title, its ×) and what you may do (its deeds, a sheet's add field); only what's between them
|
|
35
46
|
scrolls, however tall it grows, under a band of its card (8px) below the head and above the foot, so
|
|
36
47
|
nothing half scrolled away touches a title or a button.
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
### When a change is kept
|
|
50
|
+
|
|
51
|
+
- **What's typed waits for Save; what's picked or dragged is kept at once.** Words are held until Save, one
|
|
52
|
+
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.
|
|
54
|
+
- **A surface is one or the other.** One with a typed field is a Save surface, and everything in it waits, its
|
|
55
|
+
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
|
+
both in one, where nobody could tell what Never mind takes back.
|
|
57
|
+
|
|
58
|
+
### Adding
|
|
59
|
+
|
|
60
|
+
A thing is added with the least it needs.
|
|
61
|
+
|
|
62
|
+
- **One field:** a box on the page, where the new thing will show (a note, a person's name, a cost).
|
|
63
|
+
- **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
|
|
65
|
+
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
|
+
without (what it needs, its title, what's offered filled in).
|
|
67
|
+
|
|
68
|
+
### A row
|
|
69
|
+
|
|
70
|
+
- **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
|
+
opens: a chevron at its end, and its ground under the pointer.
|
|
72
|
+
- **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
|
+
- **The row whose drawer is open is marked** while it is: its ground kept, a stripe of `accent` at its left.
|
|
75
|
+
- **One a person may not open is its words alone:** no chevron, nothing to press.
|
|
76
|
+
- A block on a calendar is tapped as a row is.
|
|
77
|
+
|
|
78
|
+
### A peek
|
|
79
|
+
|
|
80
|
+
- **An attribute pops a small view of what it points at, with the way to the whole** (Peek). An attribute is a
|
|
81
|
+
value with a view of its own (a when: its month; a where: its map) or a key to another object (a person, a
|
|
82
|
+
place). On a row it's said under the row's words (`mention()`); tapped, it pops (`peek()`): the intermediate
|
|
83
|
+
detail, between a word on a row and a whole reading.
|
|
84
|
+
- **The small view is the reading, small and about one thing:** the same display at two sizes (the notes'
|
|
85
|
+
`<j-month>`: a day's month popped, and the page's month). Its one button opens the whole, on that thing.
|
|
86
|
+
- **A primary relation never pops.** What a thing is part of, comes after or holds is the structure of the list,
|
|
87
|
+
and the list shows it: its order, its grouping, its columns.
|
|
88
|
+
- **Which a field is, the model says, never the page.** A plain value (words, a number, a tick) pops nothing. A
|
|
89
|
+
value with a form (a date-time, a place, a file) pops its form's view. A link is structure where it's marked
|
|
90
|
+
`part` (is a, has a, composition; and any link `gone: "with"`), and never pops; any other link is a reference,
|
|
91
|
+
and pops what it points at. Known as the thing is modelled, said once in the stories' `links` line. The
|
|
92
|
+
compiler writes what each field pops beside its collection (`collections.<name>.pops`, `generated/rules.ts`):
|
|
93
|
+
a form, a collection, or nothing. (A page still makes its own mentions from it: `todo.jsonl` #121.)
|
|
94
|
+
- **The whole** a pop's button opens is, for a value with a form, that form's reading of the same collection (the
|
|
95
|
+
calendar, the map); for a reference, the thing in its own place. Where the page has neither, no button. A pop's
|
|
96
|
+
own attributes don't pop again.
|
|
97
|
+
- **A thing in its own place opens** (A row): its drawer is its detail already.
|
|
98
|
+
- **A peek is read, not written.** It may hold a pick, kept at once; never a typed field, which a stray tap would
|
|
99
|
+
lose.
|
|
100
|
+
- **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.
|
|
103
|
+
- 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
|
+
phone alone, and a person's chip not at all: `todo.jsonl` #119.)
|
|
39
105
|
|
|
40
106
|
### A page shows one thing, in its readings
|
|
41
107
|
|
|
42
108
|
A page shows one document's collection in a reading: a list, a calendar, a map, a line. Nothing is
|
|
43
109
|
shown twice: the trip's week and its map are its events read two ways, one page split between them;
|
|
44
|
-
the
|
|
110
|
+
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
111
|
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
112
|
|
|
47
113
|
### What a tap does
|
|
@@ -165,7 +231,7 @@ Icons assets).
|
|
|
165
231
|
|
|
166
232
|
Things come and go as an iPhone's do (`src/tokens.json`, motion): a drawer or a sheet rises into place in
|
|
167
233
|
`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
|
-
|
|
234
|
+
a phone, a drawer from the right where it docks, a sheet a little from below. Web Awesome's surfaces (the
|
|
235
|
+
phone's drawer and sheet, a modal, the toast) move as Web Awesome moves them, the scrim fading with them; a menu drops a
|
|
170
236
|
few pixels from its button in `drop`; the Toast fades. Nothing else moves, and under
|
|
171
237
|
`prefers-reduced-motion` nothing does (`src/parts.css`).
|
package/docs/introduction.md
CHANGED
|
@@ -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
|
|
@@ -55,7 +55,9 @@ populates itself with `<j-event>` children. Each item's `id` is its `key` attrib
|
|
|
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,25 +69,23 @@ 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
|
|
|
@@ -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
|
|
@@ -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.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- Outer Host Frame: <calendar-map> -->
|
|
12
12
|
<rect width="880" height="360" rx="10" fill="#fafafa" stroke="#ccc"/>
|
|
13
|
-
<text x="20" y="25" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="13" font-weight="600" fill="#222"><calendar-map people="people"></text>
|
|
13
|
+
<text x="20" y="25" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="13" font-weight="600" fill="#222"><calendar-map people="the-people"></text>
|
|
14
14
|
<text x="860" y="25" font-size="12" fill="#666" text-anchor="end">The light DOM is the document; the shadow DOM is the display.</text>
|
|
15
15
|
|
|
16
16
|
<!-- Left Panel: Light DOM (The Document) -->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# The examples
|
|
2
|
+
|
|
3
|
+
Each is an app on joined, a folder of its own, served together by `bun run dev`. Each shows something no other does;
|
|
4
|
+
the skill's section that leans on it is in brackets. Copy the smallest that has what you need.
|
|
5
|
+
|
|
6
|
+
| App | What it shows that no other does |
|
|
7
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
8
|
+
| `hello/` | The smallest: one document anyone may change, no group, no collection. What `joined init` starts from (§1). |
|
|
9
|
+
| `notes/` | A collection drawn as rows by the compiler alone, and each member's own order (`mine` ranks) (§1, §15). |
|
|
10
|
+
| `people/` | The smallest with members: a document other pages hold, with no page of its own; links, adding, a grip's order (§2, §6). |
|
|
11
|
+
| `trip/` | The kit's readings over one document (week, month, map, timeline), a window by week, seeds (§3, §4, §14, §17). |
|
|
12
|
+
| `trips/` | A kind: each trip the root of a `trip:<id>` document of its own, and a stranger by its code (§15). |
|
|
13
|
+
| `weeks/` | A document read off others, as each member has it: no rows of its own (§15). |
|
|
14
|
+
| `chart/` | A dental chart: a display drawn in arches, and unique sets of fields together (§5, §15). |
|
|
15
|
+
| `account/` | A derived document: read off the chart by `derive.ts`, written nowhere (§15). |
|
|
16
|
+
| `cafe/` | Several documents on one page, displays and a drag, definitions and guests, and the kit's smallest sheet (§5, §7, §15, §17). |
|
|
17
|
+
| `desk/` | The recipes: lanes dragged, the moves `may` offers, thumbs, a tally, a glow (§16). |
|
|
18
|
+
|
|
19
|
+
The root's own (`routes.ts`, `index.html`, `page.ts`, `welcome.css`, `docs.ts`) is the welcome page that links them,
|
|
20
|
+
and the docs it serves; `app.css` is the look they share.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "charges": [{ "id": 1, "what": "Examination", "band": 1 }] }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// The account: a document derived from the chart, never typed. Complete the chart and the account takes care of
|
|
2
|
+
// itself: a charge for each piece of this course's work, to do or done (never what the patient came in with), and the
|
|
3
|
+
// course of treatment's band, the highest any charge reaches. NHS England's bands: an examination band 1; a filling,
|
|
4
|
+
// an extraction or a root filling band 2; a crown band 3; one charge a course, at its highest band.
|
|
5
|
+
|
|
6
|
+
import type { Read } from "joined/server";
|
|
7
|
+
|
|
8
|
+
export const doc = "account";
|
|
9
|
+
export const from = ["chart"];
|
|
10
|
+
|
|
11
|
+
type Surface = { tooth: string; surface: string; material: string; status: string };
|
|
12
|
+
type Condition = { tooth: string; state: string; status: string };
|
|
13
|
+
|
|
14
|
+
const BANDS: Record<string, [string, number]> = {
|
|
15
|
+
extract: ["extraction", 2],
|
|
16
|
+
"root filling": ["root filling", 2],
|
|
17
|
+
crown: ["crown", 3],
|
|
18
|
+
};
|
|
19
|
+
const thisCourse = (status: string) => status === "to do" || status === "done";
|
|
20
|
+
|
|
21
|
+
/** The examination, a charge for each tooth's fillings and its condition this course, and the course's band. */
|
|
22
|
+
export function derive(read: Read, member: number) {
|
|
23
|
+
const chart = read("chart", member),
|
|
24
|
+
surfaces = ((chart.surfaces ?? []) as Surface[]).filter((s) => thisCourse(s.status)),
|
|
25
|
+
conditions = ((chart.conditions ?? []) as Condition[]).filter((c) => thisCourse(c.status) && BANDS[c.state]);
|
|
26
|
+
const fillings = new Map<string, Surface[]>();
|
|
27
|
+
for (const s of surfaces) {
|
|
28
|
+
const k = `${s.tooth} ${s.material} ${s.status}`;
|
|
29
|
+
fillings.set(k, [...(fillings.get(k) ?? []), s]);
|
|
30
|
+
}
|
|
31
|
+
const charges = [
|
|
32
|
+
{ what: "Examination", band: 1 },
|
|
33
|
+
...[...fillings.values()].map((ss) => ({
|
|
34
|
+
what: `${ss[0]!.tooth} ${ss.map((s) => s.surface).join("")} ${ss[0]!.material} filling, ${ss[0]!.status}`,
|
|
35
|
+
band: 2,
|
|
36
|
+
})),
|
|
37
|
+
...conditions.map((c) => ({ what: `${c.tooth} ${BANDS[c.state]![0]}, ${c.status}`, band: BANDS[c.state]![1] })),
|
|
38
|
+
];
|
|
39
|
+
const band = Math.max(...charges.map((c) => c.band));
|
|
40
|
+
return { charges: [...charges, { what: "Course of treatment", band }].map((c, i) => ({ id: i + 1, ...c })) };
|
|
41
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Written by src/compile.ts from examples/account/derive.ts: change it and its example, not this.
|
|
2
|
+
|
|
3
|
+
// Each collection is an element, defined here: on a page, it holds the document, and its items
|
|
4
|
+
// are put inside it. Each item is an element, defined by the page: as it is, or by a view that
|
|
5
|
+
// extends it. A field is an attribute (a list of ids as IDREFS: "1 3"), and an item's key the
|
|
6
|
+
// document's id for it. How an item looks is the app's: its view, or a display holding the
|
|
7
|
+
// collection draws it. Ops go up as an "ops" event, for the page to send to account, with why they
|
|
8
|
+
// were made if it's said; only the ops the stories allow can be sent. Each returns its write's answer.
|
|
9
|
+
|
|
10
|
+
import { hold, letGo, type Answer } from "joined/page";
|
|
11
|
+
|
|
12
|
+
// the document an element is of: its collection's doc attribute (an instance of a kind, shelf:1), or account
|
|
13
|
+
const docOf = (el: Element) => el.closest("[doc]")?.getAttribute("doc") ?? "account";
|
|
14
|
+
// an element's ops go up as an "ops" event; what it returns is the write's answer, done or refused
|
|
15
|
+
const send = (from: Element, ops: object[], why?: string) => new Promise<Answer>((answer) => from.dispatchEvent(new CustomEvent("ops", { bubbles: true, composed: true, detail: { doc: docOf(from), ops, why, answer } })));
|
|
16
|
+
|
|
17
|
+
/** A charge's fields, as the stories give them. */
|
|
18
|
+
export type JChargeData = { "what": string; "band": number };
|
|
19
|
+
/** An add of a charge, as it's sent: its fields as the stories write them. */
|
|
20
|
+
export type JChargeValue = { "what": string; "band": number };
|
|
21
|
+
|
|
22
|
+
/** <j-charge key>: what (string), band (integer), each an attribute. */
|
|
23
|
+
export class JCharge extends HTMLElement {
|
|
24
|
+
static observedAttributes = ["what","band","may"];
|
|
25
|
+
#data?: JChargeData;
|
|
26
|
+
/** Its id in the document. */
|
|
27
|
+
get key() { return Number(this.getAttribute("key")); }
|
|
28
|
+
get path() { return `/charges/${this.key}`; }
|
|
29
|
+
/** Its fields, read from its attributes once and again when one changes: frozen, since they're shared. */
|
|
30
|
+
get data(): JChargeData {
|
|
31
|
+
return (this.#data ??= Object.freeze({ "what": this.getAttribute("what") ?? "", "band": Number(this.getAttribute("band")) }) as JChargeData);
|
|
32
|
+
}
|
|
33
|
+
/** How a view shows it, drawn again whenever an attribute changes (what its person may do, its may, too). */
|
|
34
|
+
draw?(): void;
|
|
35
|
+
attributeChangedCallback() { this.#data = undefined; this.draw?.(); }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** <j-charges>: the document's charges, each a <j-charge> inside it. */
|
|
39
|
+
export class JCharges extends HTMLElement {
|
|
40
|
+
connectedCallback() { hold(this, docOf(this), "charges", "j-charge", {"what":"string","band":"integer"}); }
|
|
41
|
+
disconnectedCallback() { letGo(this); }
|
|
42
|
+
/** Its charges, as the document has them. */
|
|
43
|
+
get items() { return [...this.children].filter((el): el is JCharge => el.localName === "j-charge"); }
|
|
44
|
+
}
|
|
45
|
+
customElements.define("j-charges", JCharges);
|
|
46
|
+
|
|
47
|
+
/** An op on account the stories allow, in any of its collections. */
|
|
48
|
+
export type AccountOp = never;
|
|
49
|
+
|
|
50
|
+
/** One write to account across its collections (a move with its legs): sent from an element of it, checked
|
|
51
|
+
* whole by its rules, and made whole or not at all. */
|
|
52
|
+
export function write(from: Element, ops: AccountOp[], why?: string) { return send(from, ops, why); }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Written by src/compile.ts from examples/account/derive.ts: change it and its example, not this.
|
|
2
|
+
|
|
3
|
+
// Each collection of account as rows (joined/rows, the skill's §3): a page defines the ones it shows, as they are or
|
|
4
|
+
// extended, by define() from joined/rows, and holds each collection's element in its rows:
|
|
5
|
+
// <j-charges-rows><j-charges></j-charges></j-charges-rows>
|
|
6
|
+
// A collection whose items are each of one of another's is drawn under it there, where its element is put in too.
|
|
7
|
+
// To change what one says or does, extend its class and override a part (label, named, says, facts, deeds, row,
|
|
8
|
+
// step, asks); to change how it looks, style its parts (::part(row), title, state, facts, deeds, mine, step, add,
|
|
9
|
+
// under, drawer). Its sheet, a search of it and how a field reads are joined/kit's, given these collections by
|
|
10
|
+
// use(specs) (define() gives a display's own). To draw something else altogether, don't define it: a display of the app's own holds the same
|
|
11
|
+
// elements. Never change this file: change the stories.
|
|
12
|
+
|
|
13
|
+
import { rows, type Spec } from "joined/rows";
|
|
14
|
+
import { JCharge } from "./elements.ts";
|
|
15
|
+
|
|
16
|
+
const charges: Spec = {"doc":"account","name":"charges","place":"j-charges","tag":"j-charge","one":"charge","title":"what","fields":[{"name":"what","type":"string","needed":true},{"name":"band","type":"integer","needed":true}]};
|
|
17
|
+
|
|
18
|
+
/** Each collection as joined's kit (joined/kit) is given it, by name: use(specs). */
|
|
19
|
+
export const specs = { "charges": charges };
|
|
20
|
+
|
|
21
|
+
/** <j-charges-rows>: account's charges as rows, each named by its what. */
|
|
22
|
+
export class JChargesRows extends rows(charges, { "j-charge": JCharge }) {}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Written by src/compile.ts from examples/account/derive.ts: change it and its example, not this.
|
|
2
|
+
|
|
3
|
+
export type Op = { op: "add" | "replace" | "remove"; path: string; value?: any };
|
|
4
|
+
|
|
5
|
+
/** The document, and each collection: its element, the element its items are, their fields, those an add needs, and
|
|
6
|
+
* what each link is to and what each field pops (a value with a form, its view; a reference, what it points at). */
|
|
7
|
+
export const doc = "account";
|
|
8
|
+
export const collections = {
|
|
9
|
+
"charges": {
|
|
10
|
+
"place": "j-charges",
|
|
11
|
+
"tag": "j-charge",
|
|
12
|
+
"fields": {
|
|
13
|
+
"what": "string",
|
|
14
|
+
"band": "integer"
|
|
15
|
+
},
|
|
16
|
+
"needs": [
|
|
17
|
+
"what",
|
|
18
|
+
"band"
|
|
19
|
+
],
|
|
20
|
+
"links": {},
|
|
21
|
+
"pops": {}
|
|
22
|
+
}
|
|
23
|
+
} as const;
|
|
24
|
+
/** Whether every story is anonymous, none told as a member: where every app's is, the project has no members. */
|
|
25
|
+
export const anonymous = true;
|
|
26
|
+
/** What kind of document account is, by the flows it uses: static, changed only with a release (a page reads it, and
|
|
27
|
+
* never subscribes); read-only, live, but no page writes it (derived); or shared, its members' to write. */
|
|
28
|
+
export const type = "read-only";
|
|
29
|
+
/** The parts of account a page may hold alone, by its query's parameters (its definitions' window): null, none. */
|
|
30
|
+
export const window = null;
|
|
31
|
+
/** The documents this one is derived from (its derive.ts): what the server derives it again on a write to. */
|
|
32
|
+
export const derived = ["chart"];
|
package/examples/app.css
CHANGED
package/examples/cafe/books.html
CHANGED
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
</nav>
|
|
28
28
|
</header>
|
|
29
29
|
<main class="cafe books">
|
|
30
|
-
<
|
|
30
|
+
<wa-card class="card" aria-label="Your books">
|
|
31
31
|
<j-entries></j-entries>
|
|
32
32
|
<p class="none" hidden>Nothing delivered yet. A supply you buy or sell shows here once it's delivered.</p>
|
|
33
33
|
<p class="sums"></p>
|
|
34
|
-
</
|
|
34
|
+
</wa-card>
|
|
35
35
|
</main>
|
|
36
36
|
<script type="module" src="./books.ts"></script>
|
|
37
37
|
</body>
|
package/examples/cafe/cafe.css
CHANGED
|
@@ -89,11 +89,9 @@ nav.bar a[aria-current="page"] {
|
|
|
89
89
|
display: grid;
|
|
90
90
|
gap: var(--space-16);
|
|
91
91
|
}
|
|
92
|
+
/* each part of a page is joined's card (wa-card) */
|
|
92
93
|
.cafe .card {
|
|
93
|
-
|
|
94
|
-
border: 1px solid var(--edge);
|
|
95
|
-
border-radius: 4px;
|
|
96
|
-
background: var(--card);
|
|
94
|
+
--spacing: var(--space-12);
|
|
97
95
|
}
|
|
98
96
|
.cafe h2 {
|
|
99
97
|
margin: 0 0 var(--space-8);
|
|
@@ -449,18 +447,9 @@ j-entry > b,
|
|
|
449
447
|
font: var(--font-row);
|
|
450
448
|
}
|
|
451
449
|
|
|
452
|
-
/* the menu:
|
|
453
|
-
main.menu
|
|
454
|
-
|
|
455
|
-
align-items: center;
|
|
456
|
-
justify-content: space-between;
|
|
457
|
-
gap: var(--space-8);
|
|
458
|
-
padding: var(--space-4) 0;
|
|
459
|
-
border-top: 1px solid var(--line);
|
|
460
|
-
font: var(--font-row);
|
|
461
|
-
}
|
|
462
|
-
main.menu j-item:first-child {
|
|
463
|
-
border-top: 0;
|
|
450
|
+
/* the menu: its items are rows (joined's Row), edge to edge in their card */
|
|
451
|
+
main.menu .card {
|
|
452
|
+
--spacing: 0;
|
|
464
453
|
}
|
|
465
454
|
|
|
466
455
|
/* the cafe's front page: how to try it, a card for each page saying whose it is, and what it shows */
|
|
@@ -510,3 +499,7 @@ main.menu j-item:first-child {
|
|
|
510
499
|
.front .go .act {
|
|
511
500
|
text-decoration: none;
|
|
512
501
|
}
|
|
502
|
+
/* the menu's search, at the head of its rows */
|
|
503
|
+
main.menu .card > .find {
|
|
504
|
+
padding: var(--space-16) var(--space-12) var(--space-8);
|
|
505
|
+
}
|