@blueshed/joined 0.0.0-stage → 0.1.20
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 +17 -0
- package/.claude/skills/joined/reference.md +768 -0
- package/LICENSE +19 -0
- package/README.md +115 -2
- package/docs/design.md +148 -0
- package/docs/introduction.md +193 -0
- package/docs/learning.md +76 -0
- package/docs/stories.md +82 -0
- package/examples/app.css +27 -0
- package/examples/cafe/books.html +38 -0
- package/examples/cafe/books.json +13 -0
- package/examples/cafe/books.ts +64 -0
- package/examples/cafe/cafe.css +512 -0
- package/examples/cafe/front.html +115 -0
- package/examples/cafe/front.ts +7 -0
- package/examples/cafe/generated/books.elements.ts +52 -0
- package/examples/cafe/generated/books.queries.ts +11 -0
- package/examples/cafe/generated/books.rules.ts +42 -0
- package/examples/cafe/generated/kitchen.elements.ts +87 -0
- package/examples/cafe/generated/kitchen.queries.ts +47 -0
- package/examples/cafe/generated/kitchen.rules.ts +98 -0
- package/examples/cafe/generated/menu.elements.ts +61 -0
- package/examples/cafe/generated/menu.queries.ts +28 -0
- package/examples/cafe/generated/menu.rules.ts +65 -0
- package/examples/cafe/generated/order.elements.ts +87 -0
- package/examples/cafe/generated/order.queries.ts +47 -0
- package/examples/cafe/generated/order.rules.ts +95 -0
- package/examples/cafe/generated/staff.elements.ts +55 -0
- package/examples/cafe/generated/staff.queries.ts +27 -0
- package/examples/cafe/generated/staff.rules.ts +59 -0
- package/examples/cafe/generated/supplies.elements.ts +62 -0
- package/examples/cafe/generated/supplies.queries.ts +43 -0
- package/examples/cafe/generated/supplies.rules.ts +84 -0
- package/examples/cafe/generated/till.elements.ts +93 -0
- package/examples/cafe/generated/till.queries.ts +57 -0
- package/examples/cafe/generated/till.rules.ts +113 -0
- package/examples/cafe/index.html +70 -0
- package/examples/cafe/kitchen.css +107 -0
- package/examples/cafe/kitchen.html +39 -0
- package/examples/cafe/kitchen.ts +125 -0
- package/examples/cafe/menu.html +55 -0
- package/examples/cafe/menu.json +41 -0
- package/examples/cafe/menu.ts +84 -0
- package/examples/cafe/migrations/001-cafe.ts +11 -0
- package/examples/cafe/order.html +37 -0
- package/examples/cafe/order.ts +45 -0
- package/examples/cafe/rail-drag.ts +30 -0
- package/examples/cafe/routes.ts +32 -0
- package/examples/cafe/staff.json +20 -0
- package/examples/cafe/stories.jsonl +43 -0
- package/examples/cafe/supplies.html +77 -0
- package/examples/cafe/supplies.json +33 -0
- package/examples/cafe/supplies.ts +170 -0
- package/examples/cafe/till.json +95 -0
- package/examples/cafe/till.ts +122 -0
- package/examples/cafe/trust.ts +20 -0
- package/examples/cafe/views.ts +171 -0
- package/examples/docs.ts +28 -0
- package/examples/film.jpg +0 -0
- package/examples/hello/generated/elements.ts +45 -0
- package/examples/hello/generated/queries.ts +24 -0
- package/examples/hello/generated/rules.ts +45 -0
- package/examples/hello/hello.css +27 -0
- package/examples/hello/hello.json +1 -0
- package/examples/hello/index.html +32 -0
- package/examples/hello/migrations/001-hello.ts +6 -0
- package/examples/hello/page.ts +49 -0
- package/examples/hello/routes.ts +6 -0
- package/examples/hello/stories.jsonl +3 -0
- package/examples/index.html +146 -0
- package/examples/page.ts +11 -0
- package/examples/people/adding.ts +20 -0
- package/examples/people/generated/elements.ts +68 -0
- package/examples/people/generated/queries.ts +28 -0
- package/examples/people/generated/rules.ts +85 -0
- package/examples/people/links.ts +124 -0
- package/examples/people/migrations/001-people.ts +6 -0
- package/examples/people/migrations/002-add-people-member-and-guard-people.ts +7 -0
- package/examples/people/migrations/003-add-people-rank-and-guard-people.ts +7 -0
- package/examples/people/order.ts +61 -0
- package/examples/people/people.css +65 -0
- package/examples/people/people.json +26 -0
- package/examples/people/routes.ts +12 -0
- package/examples/people/stories.jsonl +20 -0
- package/examples/people/trust.ts +14 -0
- package/examples/people/view.ts +115 -0
- package/examples/routes.ts +11 -0
- package/examples/trip/answer-rows.ts +70 -0
- package/examples/trip/answers.ts +11 -0
- package/examples/trip/bar.ts +89 -0
- package/examples/trip/calendar-map.css +709 -0
- package/examples/trip/calendar-map.ts +249 -0
- package/examples/trip/drags.ts +143 -0
- package/examples/trip/drawer.ts +250 -0
- package/examples/trip/event-form.ts +199 -0
- package/examples/trip/generated/elements.ts +144 -0
- package/examples/trip/generated/queries.ts +46 -0
- package/examples/trip/generated/rules.ts +239 -0
- package/examples/trip/holding.ts +61 -0
- package/examples/trip/ics.ts +117 -0
- package/examples/trip/index.html +82 -0
- package/examples/trip/line-stops.ts +92 -0
- package/examples/trip/line-words.ts +79 -0
- package/examples/trip/line.ts +121 -0
- package/examples/trip/map.ts +234 -0
- package/examples/trip/mercator.ts +28 -0
- package/examples/trip/migrations/001-trip.ts +7 -0
- package/examples/trip/migrations/002-add-events-zone-and-guard-events.ts +7 -0
- package/examples/trip/migrations/003-guard-events-and-create-events_asked-and-more.ts +9 -0
- package/examples/trip/migrations/004-create-stays.ts +6 -0
- package/examples/trip/migrations/005-guard-events-and-create-events_arrives-and-more.ts +8 -0
- package/examples/trip/month.ts +87 -0
- package/examples/trip/other-weeks.ts +67 -0
- package/examples/trip/page.ts +121 -0
- package/examples/trip/peek.ts +71 -0
- package/examples/trip/people-chips.ts +74 -0
- package/examples/trip/place-search.ts +51 -0
- package/examples/trip/places.ts +34 -0
- package/examples/trip/routes.ts +27 -0
- package/examples/trip/shell.ts +39 -0
- package/examples/trip/stays.css +51 -0
- package/examples/trip/stays.ts +68 -0
- package/examples/trip/stories.jsonl +72 -0
- package/examples/trip/time.ts +46 -0
- package/examples/trip/told.ts +48 -0
- package/examples/trip/trip.json +69 -0
- package/examples/trip/trust.ts +51 -0
- package/examples/trip/week.ts +237 -0
- package/examples/trip/words.ts +4 -0
- package/examples/trip/writes.ts +91 -0
- package/examples/trip/zones.ts +16 -0
- package/examples/trips/card.ts +149 -0
- package/examples/trips/generated/elements.ts +60 -0
- package/examples/trips/generated/queries.ts +28 -0
- package/examples/trips/generated/rules.ts +62 -0
- package/examples/trips/index.html +47 -0
- package/examples/trips/map.ts +52 -0
- package/examples/trips/migrations/001-trips.ts +8 -0
- package/examples/trips/new-trip.ts +46 -0
- package/examples/trips/page.ts +9 -0
- package/examples/trips/routes.ts +7 -0
- package/examples/trips/stories.jsonl +12 -0
- package/examples/trips/trips.css +183 -0
- package/examples/trips/trips.json +7 -0
- package/examples/weeks/derive.ts +23 -0
- package/examples/weeks/generated/elements.ts +52 -0
- package/examples/weeks/generated/rules.ts +33 -0
- package/examples/weeks/routes.ts +4 -0
- package/examples/weeks/weeks.json +1 -0
- package/examples/welcome.css +299 -0
- package/package.json +55 -4
- package/src/attachment.ts +70 -0
- package/src/cli.ts +52 -0
- package/src/client.ts +98 -0
- package/src/compile.ts +2034 -0
- package/src/css.d.ts +5 -0
- package/src/definitions.ts +268 -0
- package/src/demo.css +29 -0
- package/src/demo.ts +42 -0
- package/src/draft.ts +69 -0
- package/src/engine.ts +288 -0
- package/src/file-value.ts +13 -0
- package/src/files.ts +187 -0
- package/src/follow.ts +56 -0
- package/src/hues.ts +3 -0
- package/src/icon-names.ts +77 -0
- package/src/icon.png +0 -0
- package/src/icons.ts +32 -0
- package/src/keep.ts +33 -0
- package/src/link.ts +31 -0
- package/src/mcp.ts +252 -0
- package/src/members/demo.ts +53 -0
- package/src/members/generated/elements.ts +68 -0
- package/src/members/generated/queries.ts +29 -0
- package/src/members/generated/rules.ts +65 -0
- package/src/members/group.ts +294 -0
- package/src/members/keys.ts +221 -0
- package/src/members/members.json +9 -0
- package/src/members/migrations/001-members.ts +6 -0
- package/src/members/migrations/002-guard-members.ts +11 -0
- package/src/members/migrations/003-add-members-act-and-guard-members.ts +7 -0
- package/src/members/panel.css +208 -0
- package/src/members/panel.ts +398 -0
- package/src/members/routes.ts +4 -0
- package/src/members/stories.jsonl +27 -0
- package/src/members/trust.ts +116 -0
- package/src/migrate.ts +597 -0
- package/src/migrations/001-joined.ts +13 -0
- package/src/migrations/002-group-keys.ts +16 -0
- package/src/migrations/003-change-inverse.ts +10 -0
- package/src/migrations/004-change-followed.ts +6 -0
- package/src/ops.ts +61 -0
- package/src/page.css +79 -0
- package/src/page.ts +413 -0
- package/src/parts.css +471 -0
- package/src/parts.ts +152 -0
- package/src/server.ts +862 -0
- package/src/settings.ts +94 -0
- package/src/starter.ts +89 -0
- package/src/store.ts +815 -0
- package/src/stories.ts +387 -0
- package/src/toast.ts +52 -0
- package/src/together.ts +167 -0
- package/src/tokens.css +85 -0
- package/src/tokens.json +457 -0
- package/src/upkeep.ts +86 -0
- package/src/visitors.ts +43 -0
- package/src/write.ts +567 -0
- package/starter/CLAUDE.md +37 -0
- package/starter/gitignore +3 -0
- package/starter/tests/hello-page.test.ts +14 -0
- package/starter/tests/hello.test.ts +8 -0
- package/starter/tsconfig.json +17 -0
package/src/tokens.css
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* joined's tokens, made from src/tokens.json by scripts/design.ts (bun run design): never edited by
|
|
2
|
+
hand. Linked by every page, before app.css. A display's shadow reads them as they are, since custom
|
|
3
|
+
properties pass into a shadow; never import this file as text into one (a page that links it makes
|
|
4
|
+
it {} in its bundle). What each is for: src/tokens.json, and docs/design.md. */
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
color-scheme: light dark;
|
|
8
|
+
--paper: #f8f9fa;
|
|
9
|
+
--card: #ffffff;
|
|
10
|
+
--card-hover: #f0f0f0;
|
|
11
|
+
--well: #e9ecef;
|
|
12
|
+
--ink: #1a1a1a;
|
|
13
|
+
--muted: #555555;
|
|
14
|
+
--line: #eeeeee;
|
|
15
|
+
--edge: #cccccc;
|
|
16
|
+
--control-edge: #8f8f8f;
|
|
17
|
+
--accent: #1a1a1a;
|
|
18
|
+
--add: #1a1a1a;
|
|
19
|
+
--add-ink: #ffffff;
|
|
20
|
+
--add-hover: #333333;
|
|
21
|
+
--danger: #b02a2a;
|
|
22
|
+
--danger-ink: #ffffff;
|
|
23
|
+
--scrim: rgba(26, 26, 26, 0.35);
|
|
24
|
+
--hue-0: #4e79a7;
|
|
25
|
+
--hue-1: #f28e2b;
|
|
26
|
+
--hue-2: #e15759;
|
|
27
|
+
--hue-3: #76b7b2;
|
|
28
|
+
--hue-4: #59a14f;
|
|
29
|
+
--hue-5: #edc948;
|
|
30
|
+
--hue-6: #b07aa1;
|
|
31
|
+
--hue-7: #ff9da7;
|
|
32
|
+
--hue-8: #9c755f;
|
|
33
|
+
--hue-9: #bab0ac;
|
|
34
|
+
--tint: 16%;
|
|
35
|
+
--tint-strong: 28%;
|
|
36
|
+
--sans: system-ui, -apple-system, sans-serif;
|
|
37
|
+
--font-body: 400 15px/1.45 var(--sans);
|
|
38
|
+
--font-display: 650 clamp(34px, 5vw, 52px)/1.05 var(--sans);
|
|
39
|
+
--font-lead: 400 18px/1.55 var(--sans);
|
|
40
|
+
--font-section: 650 28px/1.2 var(--sans);
|
|
41
|
+
--font-name: 650 20px/1.25 var(--sans);
|
|
42
|
+
--font-heading: 600 20px/1.25 var(--sans);
|
|
43
|
+
--font-title: 600 17px/1.3 var(--sans);
|
|
44
|
+
--font-row: 400 14px/1.45 var(--sans);
|
|
45
|
+
--font-label: 600 13px/16px var(--sans);
|
|
46
|
+
--font-tool: 400 13px/1.45 var(--sans);
|
|
47
|
+
--font-small: 400 13px/1.45 var(--sans);
|
|
48
|
+
--font-tiny: 400 12px/1.45 var(--sans);
|
|
49
|
+
--font-field: 400 16px/1.45 var(--sans);
|
|
50
|
+
--space-4: 4px;
|
|
51
|
+
--space-6: 6px;
|
|
52
|
+
--space-8: 8px;
|
|
53
|
+
--space-10: 10px;
|
|
54
|
+
--space-12: 12px;
|
|
55
|
+
--space-14: 14px;
|
|
56
|
+
--space-16: 16px;
|
|
57
|
+
--space-20: 20px;
|
|
58
|
+
--space-24: 24px;
|
|
59
|
+
--space-32: 32px;
|
|
60
|
+
--space-48: 48px;
|
|
61
|
+
--space-64: 64px;
|
|
62
|
+
--gutter: clamp(1rem, 4vw, 1.5rem);
|
|
63
|
+
}
|
|
64
|
+
@media (prefers-color-scheme: dark) {
|
|
65
|
+
:root {
|
|
66
|
+
--paper: #111213;
|
|
67
|
+
--card: #1a1b1e;
|
|
68
|
+
--card-hover: #232327;
|
|
69
|
+
--well: #23262b;
|
|
70
|
+
--ink: #e5e5e5;
|
|
71
|
+
--muted: #a8a8a8;
|
|
72
|
+
--line: #2e2e33;
|
|
73
|
+
--edge: #60616b;
|
|
74
|
+
--control-edge: #6e6f78;
|
|
75
|
+
--accent: #e5e5e5;
|
|
76
|
+
--add: #e5e5e5;
|
|
77
|
+
--add-ink: #111213;
|
|
78
|
+
--add-hover: #ffffff;
|
|
79
|
+
--danger: #ef4444;
|
|
80
|
+
--danger-ink: #111213;
|
|
81
|
+
--scrim: rgba(0, 0, 0, 0.55);
|
|
82
|
+
--tint: 28%;
|
|
83
|
+
--tint-strong: 40%;
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/tokens.json
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "joined",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"color": {
|
|
5
|
+
"themes": [
|
|
6
|
+
{
|
|
7
|
+
"id": "light",
|
|
8
|
+
"name": "Light"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "dark",
|
|
12
|
+
"name": "Dark"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"tokens": [
|
|
16
|
+
{
|
|
17
|
+
"name": "paper",
|
|
18
|
+
"value": {
|
|
19
|
+
"light": "#f8f9fa",
|
|
20
|
+
"dark": "#111213"
|
|
21
|
+
},
|
|
22
|
+
"usage": "The ground: behind every page, and a phone's tab strip."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "card",
|
|
26
|
+
"value": {
|
|
27
|
+
"light": "#ffffff",
|
|
28
|
+
"dark": "#1a1b1e"
|
|
29
|
+
},
|
|
30
|
+
"usage": "What sits on the ground: the calendar, the greetings card, rows, the drawer, a modal, a sheet, a field, an unpressed chip."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "card-hover",
|
|
34
|
+
"value": {
|
|
35
|
+
"light": "#f0f0f0",
|
|
36
|
+
"dark": "#232327"
|
|
37
|
+
},
|
|
38
|
+
"usage": "A card under the pointer: a place found, a person's link."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "well",
|
|
42
|
+
"value": {
|
|
43
|
+
"light": "#e9ecef",
|
|
44
|
+
"dark": "#23262b"
|
|
45
|
+
},
|
|
46
|
+
"usage": "A recess: the map's ground before its tiles, a notice, a link to copy."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "ink",
|
|
50
|
+
"value": {
|
|
51
|
+
"light": "#1a1a1a",
|
|
52
|
+
"dark": "#e5e5e5"
|
|
53
|
+
},
|
|
54
|
+
"usage": "Text on paper, card and well, above 4.5:1 in both themes; a button's edge; the picked outline; the toast's fill."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "muted",
|
|
58
|
+
"value": {
|
|
59
|
+
"light": "#555555",
|
|
60
|
+
"dark": "#a8a8a8"
|
|
61
|
+
},
|
|
62
|
+
"usage": "Labels, notes, states, the hours, an icon at rest, an unpressed chip's words: about 7:1 on card in both themes."
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "line",
|
|
66
|
+
"value": {
|
|
67
|
+
"light": "#eeeeee",
|
|
68
|
+
"dark": "#2e2e33"
|
|
69
|
+
},
|
|
70
|
+
"usage": "Hairlines: between rows, between a day's hours, under a day's name."
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "edge",
|
|
74
|
+
"value": {
|
|
75
|
+
"light": "#cccccc",
|
|
76
|
+
"dark": "#60616b"
|
|
77
|
+
},
|
|
78
|
+
"usage": "The 1px frame of what holds things: the calendar, the map, a drawer, a modal, a sheet, a card. Soft, as Paintbrush's look: a frame isn't a control."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "control-edge",
|
|
82
|
+
"value": {
|
|
83
|
+
"light": "#8f8f8f",
|
|
84
|
+
"dark": "#6e6f78"
|
|
85
|
+
},
|
|
86
|
+
"usage": "The border of a field, and of a control drawn light (a chip not pressed, a day on the strip): 3:1 on card in both themes, as a control's border wants."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "accent",
|
|
90
|
+
"value": {
|
|
91
|
+
"light": "#1a1a1a",
|
|
92
|
+
"dark": "#e5e5e5"
|
|
93
|
+
},
|
|
94
|
+
"usage": "Links, focus, and what is open or pressed (a sheet's button, the day shown): black, not blue."
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "add",
|
|
98
|
+
"value": {
|
|
99
|
+
"light": "#1a1a1a",
|
|
100
|
+
"dark": "#e5e5e5"
|
|
101
|
+
},
|
|
102
|
+
"usage": "The one button that makes or keeps (.act.ink: Add, Save, Say it): its fill and edge."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "add-ink",
|
|
106
|
+
"value": {
|
|
107
|
+
"light": "#ffffff",
|
|
108
|
+
"dark": "#111213"
|
|
109
|
+
},
|
|
110
|
+
"usage": "Words and icon on add."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "add-hover",
|
|
114
|
+
"value": {
|
|
115
|
+
"light": "#333333",
|
|
116
|
+
"dark": "#ffffff"
|
|
117
|
+
},
|
|
118
|
+
"usage": "add under the pointer."
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "danger",
|
|
122
|
+
"value": {
|
|
123
|
+
"light": "#b02a2a",
|
|
124
|
+
"dark": "#ef4444"
|
|
125
|
+
},
|
|
126
|
+
"usage": "Remove (.act.danger), a refusal's words, and events outside the trip's days: 6.5:1 on card light, about 4.6:1 dark."
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "danger-ink",
|
|
130
|
+
"value": {
|
|
131
|
+
"light": "#ffffff",
|
|
132
|
+
"dark": "#111213"
|
|
133
|
+
},
|
|
134
|
+
"usage": "Words on a filled danger: a modal's answer when it takes away."
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "scrim",
|
|
138
|
+
"value": {
|
|
139
|
+
"light": "rgba(26, 26, 26, 0.35)",
|
|
140
|
+
"dark": "rgba(0, 0, 0, 0.55)"
|
|
141
|
+
},
|
|
142
|
+
"usage": "Behind a modal (its ::backdrop), and a sheet on a phone."
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "hue-0",
|
|
146
|
+
"value": "#4e79a7",
|
|
147
|
+
"usage": "d3's Tableau10 blue: the colour of an item whose key ends in 0, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words."
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "hue-1",
|
|
151
|
+
"value": "#f28e2b",
|
|
152
|
+
"usage": "d3's Tableau10 orange: the colour of an item whose key ends in 1, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words; white words on it would miss 3:1."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "hue-2",
|
|
156
|
+
"value": "#e15759",
|
|
157
|
+
"usage": "d3's Tableau10 red: the colour of an item whose key ends in 2, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words."
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "hue-3",
|
|
161
|
+
"value": "#76b7b2",
|
|
162
|
+
"usage": "d3's Tableau10 teal: the colour of an item whose key ends in 3, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words; white words on it would miss 3:1."
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "hue-4",
|
|
166
|
+
"value": "#59a14f",
|
|
167
|
+
"usage": "d3's Tableau10 green: the colour of an item whose key ends in 4, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words."
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "hue-5",
|
|
171
|
+
"value": "#edc948",
|
|
172
|
+
"usage": "d3's Tableau10 yellow: the colour of an item whose key ends in 5, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words; white words on it would miss 3:1."
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "hue-6",
|
|
176
|
+
"value": "#b07aa1",
|
|
177
|
+
"usage": "d3's Tableau10 purple: the colour of an item whose key ends in 6, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words."
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "hue-7",
|
|
181
|
+
"value": "#ff9da7",
|
|
182
|
+
"usage": "d3's Tableau10 pink: the colour of an item whose key ends in 7, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words; white words on it would miss 3:1."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "hue-8",
|
|
186
|
+
"value": "#9c755f",
|
|
187
|
+
"usage": "d3's Tableau10 brown: the colour of an item whose key ends in 8, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words."
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "hue-9",
|
|
191
|
+
"value": "#bab0ac",
|
|
192
|
+
"usage": "d3's Tableau10 grey: the colour of an item whose key ends in 9, the same in both themes, wherever the thing shows (a person's chip and dots, an event's block and pin). Never on a control. As a chip it is a tint over card with ink words; white words on it would miss 3:1."
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"type": {
|
|
197
|
+
"fonts": [],
|
|
198
|
+
"families": {
|
|
199
|
+
"sans": "system-ui, -apple-system, sans-serif"
|
|
200
|
+
},
|
|
201
|
+
"groups": [
|
|
202
|
+
{
|
|
203
|
+
"name": "joined",
|
|
204
|
+
"family": "sans",
|
|
205
|
+
"styles": [
|
|
206
|
+
{
|
|
207
|
+
"name": "body",
|
|
208
|
+
"fontSize": "15px",
|
|
209
|
+
"lineHeight": 1.45,
|
|
210
|
+
"fontWeight": 400,
|
|
211
|
+
"usage": "Text outside the parts: a page's note, the root's list."
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "display",
|
|
215
|
+
"fontSize": "clamp(34px, 5vw, 52px)",
|
|
216
|
+
"lineHeight": 1.05,
|
|
217
|
+
"fontWeight": 650,
|
|
218
|
+
"usage": "A landing page's headline, its h1: \"Write what people do. Get a live, shared app.\""
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "lead",
|
|
222
|
+
"fontSize": "18px",
|
|
223
|
+
"lineHeight": 1.55,
|
|
224
|
+
"fontWeight": 400,
|
|
225
|
+
"usage": "The words under a landing page's headline, and a trip's next event."
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "section",
|
|
229
|
+
"fontSize": "28px",
|
|
230
|
+
"lineHeight": 1.2,
|
|
231
|
+
"fontWeight": 650,
|
|
232
|
+
"usage": "A page's name, its h1: \"Your trips\", \"The till\"; a section of a landing page, its h2: \"Try it\"."
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "name",
|
|
236
|
+
"fontSize": "20px",
|
|
237
|
+
"lineHeight": 1.25,
|
|
238
|
+
"fontWeight": 650,
|
|
239
|
+
"usage": "A thing's name on its card: a trip, an example."
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"name": "heading",
|
|
243
|
+
"fontSize": "20px",
|
|
244
|
+
"lineHeight": 1.25,
|
|
245
|
+
"fontWeight": 600,
|
|
246
|
+
"usage": "A part of a page's name, its h2: \"New order\" on the till."
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "title",
|
|
250
|
+
"fontSize": "17px",
|
|
251
|
+
"lineHeight": 1.3,
|
|
252
|
+
"fontWeight": 600,
|
|
253
|
+
"usage": "A drawer's, a modal's and a sheet's title, an h2: \"Editing “Dinner in Shinjuku”\"; a day's date in a phone's strip."
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "row",
|
|
257
|
+
"fontSize": "14px",
|
|
258
|
+
"lineHeight": 1.45,
|
|
259
|
+
"fontWeight": 400,
|
|
260
|
+
"usage": "A row's words: a greeting, a member; the words inside a drawer, a modal and a sheet."
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "label",
|
|
264
|
+
"fontSize": "13px",
|
|
265
|
+
"lineHeight": "16px",
|
|
266
|
+
"fontWeight": 600,
|
|
267
|
+
"usage": "A label over its field, a day's name over its hours, the week's name: in plain case."
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"name": "tool",
|
|
271
|
+
"fontSize": "13px",
|
|
272
|
+
"lineHeight": 1.45,
|
|
273
|
+
"fontWeight": 400,
|
|
274
|
+
"usage": "A button's word, and a person's chip."
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "small",
|
|
278
|
+
"fontSize": "13px",
|
|
279
|
+
"lineHeight": 1.45,
|
|
280
|
+
"fontWeight": 400,
|
|
281
|
+
"usage": "A note, a modal's question, a refusal, the toast, a person's links."
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "tiny",
|
|
285
|
+
"fontSize": "12px",
|
|
286
|
+
"lineHeight": 1.45,
|
|
287
|
+
"fontWeight": 400,
|
|
288
|
+
"usage": "Inside the calendar: a block's times, the hours; a tally; a tag (BDFL, you)."
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "field",
|
|
292
|
+
"fontSize": "16px",
|
|
293
|
+
"lineHeight": 1.45,
|
|
294
|
+
"fontWeight": 400,
|
|
295
|
+
"usage": "Every field: a phone zooms into anything smaller."
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
"spacing": {
|
|
302
|
+
"note": "joined's parts space in these steps (src/parts.css), each a custom property too (--space-12); a page's sides are the gutter, its own layout in rem.",
|
|
303
|
+
"tokens": [
|
|
304
|
+
{
|
|
305
|
+
"name": "space-4",
|
|
306
|
+
"value": "4px",
|
|
307
|
+
"usage": "A label above its field; between a tab strip's tabs; between a phone strip's days."
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "space-6",
|
|
311
|
+
"value": "6px",
|
|
312
|
+
"usage": "Between a button's icon and its word."
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "space-8",
|
|
316
|
+
"value": "8px",
|
|
317
|
+
"usage": "Between buttons at a foot, a sheet's head's parts, a group row's parts."
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"name": "space-10",
|
|
321
|
+
"value": "10px",
|
|
322
|
+
"usage": "Inside a field, either side; between a sheet's parts."
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"name": "space-12",
|
|
326
|
+
"value": "12px",
|
|
327
|
+
"usage": "Inside a button, either side; between a form's fields; a sheet's padding."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "space-14",
|
|
331
|
+
"value": "14px",
|
|
332
|
+
"usage": "A drawer's padding; between a modal's parts."
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "space-16",
|
|
336
|
+
"value": "16px",
|
|
337
|
+
"usage": "Between a page's parts: a head and what follows it, a form's rows on a page."
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"name": "space-20",
|
|
341
|
+
"value": "20px",
|
|
342
|
+
"usage": "A modal's padding."
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"name": "space-24",
|
|
346
|
+
"value": "24px",
|
|
347
|
+
"usage": "Between a page's sections' parts; a card's padding on a landing page."
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "space-32",
|
|
351
|
+
"value": "32px",
|
|
352
|
+
"usage": "Before a page's next section."
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "space-48",
|
|
356
|
+
"value": "48px",
|
|
357
|
+
"usage": "Between a landing page's sections."
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"name": "space-64",
|
|
361
|
+
"value": "64px",
|
|
362
|
+
"usage": "Above a landing page's headline."
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"name": "gutter",
|
|
366
|
+
"value": "clamp(1rem, 4vw, 1.5rem)",
|
|
367
|
+
"usage": "A page's side padding: 1rem on a phone, 1.5rem where there's room. A row that runs to the screen's edges bleeds by it, calc(-1 * var(--gutter)), never by its number."
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
"radius": {
|
|
372
|
+
"tokens": [
|
|
373
|
+
{
|
|
374
|
+
"name": "radius",
|
|
375
|
+
"value": "4px",
|
|
376
|
+
"usage": "Everything that has a corner: a button, a field, a block, the calendar, the map, a drawer, a modal, a sheet, the toast."
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"name": "radius-inner",
|
|
380
|
+
"value": "3px",
|
|
381
|
+
"usage": "Inside a 4px box: a tab, a menu's row."
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"name": "radius-pill",
|
|
385
|
+
"value": "999px",
|
|
386
|
+
"usage": "A tag: BDFL, you, read-only."
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "radius-dot",
|
|
390
|
+
"value": "50%",
|
|
391
|
+
"usage": "A person's dot on a block, a pin, a person's hue in the people."
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
"size": {
|
|
396
|
+
"note": "One breakpoint, 40rem (640px): above it the drawer docks at the right and the week stands beside the map; below it the drawer and a sheet rise from the foot and the week is a strip of its days. Under a finger (pointer: coarse) or below 40rem, a button and a field are 44px.",
|
|
397
|
+
"tokens": [
|
|
398
|
+
{
|
|
399
|
+
"name": "touch",
|
|
400
|
+
"value": "32px",
|
|
401
|
+
"usage": "A button with words, a field: 44px under a finger."
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"name": "control",
|
|
405
|
+
"value": "32px",
|
|
406
|
+
"usage": "A button that is its icon alone (.icon-only), square: 44px under a finger."
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "panel",
|
|
410
|
+
"value": "320px",
|
|
411
|
+
"usage": "The drawer docked at the right."
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"name": "modal",
|
|
415
|
+
"value": "25rem",
|
|
416
|
+
"usage": "A modal's width at most, within the screen less 1rem a side."
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"name": "sheet",
|
|
420
|
+
"value": "22rem",
|
|
421
|
+
"usage": "A sheet's width at most, within the screen less 1rem a side."
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"name": "pin",
|
|
425
|
+
"value": "16px",
|
|
426
|
+
"usage": "A pin on the map: a dot of its hue in a 2px white ring; 20px picked."
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"name": "dot",
|
|
430
|
+
"value": "7px",
|
|
431
|
+
"usage": "A person's dot on an event's block."
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"name": "grip",
|
|
435
|
+
"value": "7px",
|
|
436
|
+
"usage": "The foot of an event's block: dragged, it lasts longer or shorter, in 15-minute steps."
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
"mix": {
|
|
441
|
+
"note": "How much of a hue a chip and a block take over card, light and dark.",
|
|
442
|
+
"tokens": [
|
|
443
|
+
{
|
|
444
|
+
"name": "tint",
|
|
445
|
+
"value": "16%",
|
|
446
|
+
"usage": "A chip or a block at rest: its hue at this much over card, a 3px stripe of the hue at its left, its words in ink.",
|
|
447
|
+
"dark": "28%"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"name": "tint-strong",
|
|
451
|
+
"value": "28%",
|
|
452
|
+
"usage": "A chip under the pointer, a block picked or being made.",
|
|
453
|
+
"dark": "40%"
|
|
454
|
+
}
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
}
|
package/src/upkeep.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// What a kept store needs that SQLite never does for itself: nothing gives back the pages a removed row left,
|
|
2
|
+
// gathers what the planner reads, or copies the file anywhere. joined does both when it's idle: a VACUUM and
|
|
3
|
+
// PRAGMA optimize once enough has been written (what's let go first: `trim`, the old changes), and a backup once a day, a copy the store's own size
|
|
4
|
+
// (VACUUM INTO), the last seven kept. A backup is a store: to go back to one, stop joined and put it in the
|
|
5
|
+
// store's place (JOINED_DB), with no -wal or -shm beside it.
|
|
6
|
+
|
|
7
|
+
import type { Engine } from "./engine.ts";
|
|
8
|
+
import { mkdirSync, readdirSync, statSync, unlinkSync } from "node:fs";
|
|
9
|
+
|
|
10
|
+
const IDLE = 10_000; // no write for this long: idle
|
|
11
|
+
const WRITES = 500; // vacuum after this many writes, or an hour after the first
|
|
12
|
+
const HOUR = 3_600_000;
|
|
13
|
+
const DAY = 24 * HOUR;
|
|
14
|
+
/** The backups kept, one a day: a week of them. */
|
|
15
|
+
export const KEEP = 7;
|
|
16
|
+
|
|
17
|
+
/** The store's upkeep, looked at every minute (`every`); `wrote` when a write commits, `run(true)` to do it now.
|
|
18
|
+
* `trim` lets go what the store no longer needs before it's vacuumed, and says how many rows; then `letGo`, the
|
|
19
|
+
* files nothing names any more (src/files.ts), and how many, in a while (a bucket is asked over the network). */
|
|
20
|
+
export function upkeep(
|
|
21
|
+
db: Engine,
|
|
22
|
+
backups: string,
|
|
23
|
+
log: (line: string) => void,
|
|
24
|
+
{
|
|
25
|
+
every = 60_000,
|
|
26
|
+
trim = () => 0,
|
|
27
|
+
letGo = async () => 0,
|
|
28
|
+
}: { every?: number; trim?: () => number; letGo?: () => Promise<number> } = {},
|
|
29
|
+
) {
|
|
30
|
+
let lastWrite = 0,
|
|
31
|
+
writes = 0,
|
|
32
|
+
vacuumedAt = Date.now();
|
|
33
|
+
mkdirSync(backups, { recursive: true });
|
|
34
|
+
const kept = files(backups);
|
|
35
|
+
let backedUpAt = kept.length ? statSync(`${backups}/${kept.at(-1)}`).mtimeMs : 0;
|
|
36
|
+
|
|
37
|
+
/** Now, or when idle: vacuum if enough was written, back up if a day has passed. */
|
|
38
|
+
function run(now = false) {
|
|
39
|
+
const at = Date.now();
|
|
40
|
+
const done: { vacuumed?: boolean; backup?: string; files?: Promise<number> } = {};
|
|
41
|
+
if (!now && at - lastWrite < IDLE) return done;
|
|
42
|
+
if (now || writes >= WRITES || (writes > 0 && at - vacuumedAt > HOUR)) {
|
|
43
|
+
const gone = trim();
|
|
44
|
+
if (gone) log(`let go ${gone} old changes`);
|
|
45
|
+
done.files = letGo().then(
|
|
46
|
+
(n) => (n && log(`let go ${n} files nothing names`), n),
|
|
47
|
+
(e) => (log(`letting files go failed: ${e}`), 0),
|
|
48
|
+
);
|
|
49
|
+
db.run("VACUUM");
|
|
50
|
+
db.run("PRAGMA optimize");
|
|
51
|
+
log(`vacuumed after ${writes} writes`);
|
|
52
|
+
[writes, vacuumedAt, done.vacuumed] = [0, at, true];
|
|
53
|
+
}
|
|
54
|
+
if (now || at - backedUpAt > DAY) {
|
|
55
|
+
done.backup = `${backups}/${new Date(at).toISOString().replace(/[:.]/g, "-")}.sqlite`;
|
|
56
|
+
db.run("VACUUM INTO ?", [done.backup]);
|
|
57
|
+
backedUpAt = at;
|
|
58
|
+
for (const old of files(backups).slice(0, -KEEP)) unlinkSync(`${backups}/${old}`);
|
|
59
|
+
log(`backed up to ${done.backup}`);
|
|
60
|
+
}
|
|
61
|
+
return done;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const timer = setInterval(() => {
|
|
65
|
+
try {
|
|
66
|
+
run();
|
|
67
|
+
} catch (e) {
|
|
68
|
+
log(`upkeep failed: ${e}`);
|
|
69
|
+
}
|
|
70
|
+
}, every);
|
|
71
|
+
timer.unref();
|
|
72
|
+
return {
|
|
73
|
+
run,
|
|
74
|
+
wrote() {
|
|
75
|
+
lastWrite = Date.now();
|
|
76
|
+
writes++;
|
|
77
|
+
},
|
|
78
|
+
stop: () => clearInterval(timer),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Backups, oldest first: their names are their times.
|
|
83
|
+
const files = (dir: string) =>
|
|
84
|
+
readdirSync(dir)
|
|
85
|
+
.filter((f) => f.endsWith(".sqlite"))
|
|
86
|
+
.sort();
|
package/src/visitors.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// A secret link's level (definitions' visitors): what a guest holding a kind's instance by its root's code may do is
|
|
2
|
+
// that root item's own setting, a field holding a level (`{ boards: "visitors" }`: a board's "reader", "commenter",
|
|
3
|
+
// "writer"). Its guest is the role `guest:` its level, granted what the stories have a guest on an item of that
|
|
4
|
+
// level do, and never a member's role of the same name, nor what's granted anyone (a member): a visitor who is
|
|
5
|
+
// nobody may do what its level may, and no more. A level no story has a guest do anything on (a board's "none", or
|
|
6
|
+
// none given) is No access. The compiler and the server both ask it, of the rules each has.
|
|
7
|
+
|
|
8
|
+
import type { Op } from "./ops.ts";
|
|
9
|
+
|
|
10
|
+
/** What a guest's level is read by: the kind, and the field of its root holding the level. */
|
|
11
|
+
type Levelled = { kind?: { root: string } | null; visitors?: Record<string, string> };
|
|
12
|
+
|
|
13
|
+
/** The field of a kind's root holding its guest's level (visitors), or none. */
|
|
14
|
+
export const levelled = ({ kind, visitors }: Levelled) => (kind ? visitors?.[kind.root] : undefined);
|
|
15
|
+
|
|
16
|
+
/** The role a guest of an item is: `guest`, or where its kind's root says a level (visitors), `guest:` the item's. */
|
|
17
|
+
export const guestRole = (r: Levelled, item: any) => {
|
|
18
|
+
const field = levelled(r);
|
|
19
|
+
return field ? `guest:${item?.[field]}` : "guest";
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** Whether a guest of an item may hold it: an item at all, and of a level the stories have a guest do something on
|
|
23
|
+
* (without visitors, any). */
|
|
24
|
+
export const admits = (r: Levelled & { grants: Record<string, string[]> }, item: any) =>
|
|
25
|
+
!!item && (guestRole(r, item) === "guest" || Object.values(r.grants).some((g) => g.includes(guestRole(r, item))));
|
|
26
|
+
|
|
27
|
+
/** Why an app's visitors is refused, or null: it names a kind's root its guests name, and a story checks it, a
|
|
28
|
+
* guest's does on an item of one level and a guest's cannot on one of another. A story's guest role, `levelOf`. */
|
|
29
|
+
export function visitorsRefused<S extends { as?: string; does?: { ops: Op[] }; cannot?: { ops: Op[] } }>(
|
|
30
|
+
defs: Levelled & { guests?: Record<string, string> },
|
|
31
|
+
stories: S[],
|
|
32
|
+
levelOf: (s: S) => string[],
|
|
33
|
+
): string | null {
|
|
34
|
+
for (const coll of Object.keys(defs.visitors ?? {})) {
|
|
35
|
+
if (defs.kind?.root !== coll || !defs.guests?.[coll])
|
|
36
|
+
return `visitors names ${coll}, but a visitor's level is a kind's root's, held by the code its guests name`;
|
|
37
|
+
const levels = (told: "does" | "cannot") => stories.filter((s) => s.as === undefined && s[told]).flatMap(levelOf);
|
|
38
|
+
const cannot = levels("cannot");
|
|
39
|
+
if (!levels("does").some((l) => cannot.some((c) => c !== l)))
|
|
40
|
+
return "visitors is checked by no story: a guest's does on an item of one level, and a guest's cannot on one of another";
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|