@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.
Files changed (237) hide show
  1. package/.claude/skills/joined/SKILL.md +9 -1
  2. package/.claude/skills/joined/reference.md +316 -63
  3. package/.claude/skills/joined-door/SKILL.md +57 -0
  4. package/README.md +19 -50
  5. package/docs/design.md +158 -37
  6. package/docs/introduction.md +27 -27
  7. package/docs/light-and-shadow.svg +2 -1
  8. package/docs/links-and-trust.svg +1 -0
  9. package/docs/stories-to-code.svg +2 -1
  10. package/docs/wire-op.svg +1 -0
  11. package/examples/README.md +20 -0
  12. package/examples/account/account.json +1 -0
  13. package/examples/account/derive.ts +41 -0
  14. package/examples/account/generated/elements.ts +52 -0
  15. package/examples/account/generated/rows.ts +22 -0
  16. package/examples/account/generated/rules.ts +32 -0
  17. package/examples/account/routes.ts +5 -0
  18. package/examples/app.css +11 -1
  19. package/examples/cafe/books.html +2 -2
  20. package/examples/cafe/cafe.css +96 -85
  21. package/examples/cafe/generated/books.rows.ts +22 -0
  22. package/examples/cafe/generated/books.rules.ts +3 -2
  23. package/examples/cafe/generated/kitchen.rows.ts +27 -0
  24. package/examples/cafe/generated/kitchen.rules.ts +11 -1
  25. package/examples/cafe/generated/menu.rows.ts +22 -0
  26. package/examples/cafe/generated/menu.rules.ts +3 -2
  27. package/examples/cafe/generated/order.rows.ts +27 -0
  28. package/examples/cafe/generated/order.rules.ts +11 -1
  29. package/examples/cafe/generated/staff.elements.ts +7 -2
  30. package/examples/cafe/generated/staff.rows.ts +22 -0
  31. package/examples/cafe/generated/staff.rules.ts +9 -1
  32. package/examples/cafe/generated/supplies.queries.ts +4 -2
  33. package/examples/cafe/generated/supplies.rows.ts +22 -0
  34. package/examples/cafe/generated/supplies.rules.ts +17 -1
  35. package/examples/cafe/generated/till.queries.ts +2 -0
  36. package/examples/cafe/generated/till.rows.ts +27 -0
  37. package/examples/cafe/generated/till.rules.ts +11 -1
  38. package/examples/cafe/index.html +14 -15
  39. package/examples/cafe/kitchen.css +11 -19
  40. package/examples/cafe/kitchen.ts +7 -3
  41. package/examples/cafe/look.ts +30 -0
  42. package/examples/cafe/menu.html +10 -26
  43. package/examples/cafe/menu.ts +8 -80
  44. package/examples/cafe/migrations/002-guard-supplies.ts +15 -0
  45. package/examples/cafe/order.html +8 -7
  46. package/examples/cafe/order.ts +6 -2
  47. package/examples/cafe/routes.ts +0 -1
  48. package/examples/cafe/staff.json +5 -0
  49. package/examples/cafe/stories.jsonl +6 -2
  50. package/examples/cafe/supplies.html +35 -34
  51. package/examples/cafe/supplies.ts +59 -39
  52. package/examples/cafe/till.ts +19 -11
  53. package/examples/cafe/views.ts +7 -5
  54. package/examples/chart/arches.ts +150 -0
  55. package/examples/chart/chart.css +11 -0
  56. package/examples/chart/chart.json +87 -0
  57. package/examples/chart/generated/elements.ts +105 -0
  58. package/examples/chart/generated/queries.ts +36 -0
  59. package/examples/chart/generated/rows.ts +27 -0
  60. package/examples/chart/generated/rules.ts +111 -0
  61. package/examples/chart/grid.ts +118 -0
  62. package/examples/chart/index.html +78 -0
  63. package/examples/chart/migrations/001-chart.ts +6 -0
  64. package/examples/chart/migrations/002-create-conditions.ts +6 -0
  65. package/examples/chart/page.ts +20 -0
  66. package/examples/chart/routes.ts +7 -0
  67. package/examples/chart/stories.jsonl +14 -0
  68. package/examples/chart/teeth.ts +57 -0
  69. package/examples/desk/desk.css +6 -10
  70. package/examples/desk/generated/elements.ts +1 -1
  71. package/examples/desk/generated/rows.ts +22 -0
  72. package/examples/desk/generated/rules.ts +34 -1
  73. package/examples/desk/index.html +10 -3
  74. package/examples/desk/lanes.css +21 -19
  75. package/examples/desk/routes.ts +0 -2
  76. package/examples/desk/stories.jsonl +4 -3
  77. package/examples/desk/tally.css +1 -1
  78. package/examples/desk/thumbs.ts +2 -2
  79. package/examples/docs.ts +7 -4
  80. package/examples/hello/generated/elements.ts +2 -2
  81. package/examples/hello/generated/rules.ts +3 -2
  82. package/examples/hello/hello.css +2 -4
  83. package/examples/hello/index.html +10 -3
  84. package/examples/hello/page.ts +4 -4
  85. package/examples/index.html +20 -12
  86. package/examples/notes/generated/elements.ts +112 -0
  87. package/examples/notes/generated/queries.ts +42 -0
  88. package/examples/notes/generated/rows.ts +27 -0
  89. package/examples/notes/generated/rules.ts +133 -0
  90. package/examples/notes/index.html +32 -0
  91. package/examples/notes/look.ts +41 -0
  92. package/examples/notes/migrations/001-notes.ts +7 -0
  93. package/examples/notes/notes.json +78 -0
  94. package/examples/notes/page.ts +21 -0
  95. package/examples/notes/routes.ts +6 -0
  96. package/examples/notes/stories.jsonl +24 -0
  97. package/examples/page.ts +9 -2
  98. package/examples/people/generated/rows.ts +22 -0
  99. package/examples/people/generated/rules.ts +11 -1
  100. package/examples/people/links.ts +8 -9
  101. package/examples/people/people.css +1 -1
  102. package/examples/people/routes.ts +1 -3
  103. package/examples/people/stories.jsonl +1 -0
  104. package/examples/people/view.ts +5 -2
  105. package/examples/trip/generated/elements.ts +5 -3
  106. package/examples/trip/generated/queries.ts +12 -1
  107. package/examples/trip/generated/rows.ts +27 -0
  108. package/examples/trip/generated/rules.ts +56 -2
  109. package/examples/trip/index.html +58 -12
  110. package/examples/trip/line.css +186 -0
  111. package/examples/trip/line.ts +51 -40
  112. package/examples/trip/page.ts +65 -71
  113. package/examples/trip/routes.ts +9 -5
  114. package/examples/trip/stays.css +13 -13
  115. package/examples/trip/stays.ts +15 -10
  116. package/examples/trip/stories.jsonl +2 -0
  117. package/examples/trip/told.ts +3 -26
  118. package/examples/trip/trip.css +16 -0
  119. package/examples/trips/generated/elements.ts +1 -1
  120. package/examples/trips/generated/rows.ts +22 -0
  121. package/examples/trips/generated/rules.ts +9 -1
  122. package/examples/trips/index.html +10 -10
  123. package/examples/trips/map.ts +3 -14
  124. package/examples/trips/new-trip.ts +14 -16
  125. package/examples/trips/trips.css +24 -23
  126. package/examples/weeks/generated/elements.ts +1 -1
  127. package/examples/weeks/generated/queries.ts +11 -0
  128. package/examples/weeks/generated/rows.ts +22 -0
  129. package/examples/weeks/generated/rules.ts +11 -5
  130. package/examples/weeks/routes.ts +3 -2
  131. package/examples/weeks/stories.jsonl +1 -0
  132. package/examples/welcome.css +43 -33
  133. package/package.json +8 -2
  134. package/src/attachment.ts +17 -2
  135. package/src/awesome.ts +103 -0
  136. package/src/board.css +76 -0
  137. package/src/board.ts +173 -0
  138. package/src/cli.ts +28 -3
  139. package/src/compile.ts +821 -109
  140. package/src/definitions.ts +113 -27
  141. package/src/demo.css +2 -5
  142. package/src/draft.ts +48 -27
  143. package/src/drawer.ts +248 -0
  144. package/src/engine.ts +253 -170
  145. package/src/fields.ts +341 -0
  146. package/src/file-value.ts +12 -2
  147. package/src/files.ts +113 -33
  148. package/src/ground.ts +110 -0
  149. package/src/icon-names.ts +19 -2
  150. package/src/keep.ts +16 -3
  151. package/src/kit.ts +51 -0
  152. package/src/link.ts +3 -3
  153. package/src/map.css +140 -0
  154. package/src/map.ts +200 -0
  155. package/src/mcp.ts +129 -24
  156. package/src/members/demo.ts +13 -12
  157. package/src/members/generated/rows.ts +22 -0
  158. package/src/members/generated/rules.ts +3 -2
  159. package/src/members/group.ts +105 -55
  160. package/src/members/keys.ts +95 -79
  161. package/src/members/panel.css +40 -35
  162. package/src/members/panel.ts +58 -37
  163. package/src/migrate.ts +178 -125
  164. package/src/migrations/005-change-kept.ts +7 -0
  165. package/src/month.css +129 -0
  166. package/src/month.ts +179 -0
  167. package/src/ops.ts +40 -1
  168. package/src/page.css +11 -2
  169. package/src/page.ts +68 -17
  170. package/src/parts.css +614 -230
  171. package/src/parts.ts +259 -36
  172. package/src/plane.css +61 -0
  173. package/src/plane.ts +153 -0
  174. package/src/postgres-server.ts +60 -0
  175. package/src/reading.css +73 -0
  176. package/src/reading.ts +238 -0
  177. package/src/rows.css +289 -0
  178. package/src/rows.ts +864 -0
  179. package/src/search.css +80 -0
  180. package/src/search.ts +130 -0
  181. package/src/server.ts +355 -137
  182. package/src/settings.ts +9 -4
  183. package/src/sheet.ts +116 -0
  184. package/src/skill.ts +40 -0
  185. package/src/slots.css +90 -0
  186. package/src/slots.ts +213 -0
  187. package/src/specs.ts +38 -0
  188. package/src/starter.ts +19 -2
  189. package/src/store.ts +224 -161
  190. package/src/stories.ts +43 -11
  191. package/src/surface.ts +164 -0
  192. package/src/time.ts +2 -0
  193. package/src/timeline.css +111 -0
  194. package/src/timeline.ts +235 -0
  195. package/src/toast.ts +21 -48
  196. package/src/together.ts +15 -24
  197. package/src/tokens.css +89 -3
  198. package/src/tokens.json +287 -7
  199. package/src/tool.ts +210 -0
  200. package/src/upkeep.ts +47 -22
  201. package/src/views.css +43 -0
  202. package/src/views.ts +111 -0
  203. package/src/week.css +150 -0
  204. package/src/week.ts +254 -0
  205. package/src/write.ts +326 -78
  206. package/starter/CHANGELOG.md +8 -0
  207. package/starter/CLAUDE.md +9 -3
  208. package/starter/bunfig +5 -0
  209. package/starter/githooks/pre-commit +13 -0
  210. package/starter/prettierignore +5 -0
  211. package/starter/tests/hello.test.ts +2 -0
  212. package/starter/tests/records.test.ts +40 -0
  213. package/starter/todo.jsonl +0 -0
  214. package/docs/learning.md +0 -76
  215. package/examples/cafe/trust.ts +0 -20
  216. package/examples/desk/trust.ts +0 -24
  217. package/examples/people/trust.ts +0 -14
  218. package/examples/trip/answer-rows.ts +0 -70
  219. package/examples/trip/bar.ts +0 -89
  220. package/examples/trip/calendar-map.css +0 -711
  221. package/examples/trip/calendar-map.ts +0 -249
  222. package/examples/trip/drags.ts +0 -143
  223. package/examples/trip/drawer.ts +0 -250
  224. package/examples/trip/event-form.ts +0 -200
  225. package/examples/trip/holding.ts +0 -61
  226. package/examples/trip/map.ts +0 -234
  227. package/examples/trip/month.ts +0 -87
  228. package/examples/trip/other-weeks.ts +0 -67
  229. package/examples/trip/peek.ts +0 -71
  230. package/examples/trip/people-chips.ts +0 -74
  231. package/examples/trip/shell.ts +0 -39
  232. package/examples/trip/trust.ts +0 -51
  233. package/examples/trip/week.ts +0 -237
  234. package/examples/trip/writes.ts +0 -91
  235. package/examples/trip/zones.ts +0 -16
  236. package/examples/weeks/derive.ts +0 -23
  237. package/src/scrim.ts +0 -81
@@ -9,12 +9,6 @@
9
9
  font: var(--font-row);
10
10
  color: var(--ink);
11
11
  }
12
- :host([hidden]) {
13
- display: none;
14
- }
15
- [hidden] {
16
- display: none !important;
17
- }
18
12
  .bar {
19
13
  display: flex;
20
14
  gap: var(--space-8);
@@ -62,9 +56,9 @@
62
56
  box-sizing: border-box;
63
57
  /* as wide as its words, as the screen allows: fixed at the middle, it would fit only the half to its right */
64
58
  width: max-content;
65
- max-width: min(36rem, calc(100vw - 2rem));
59
+ max-width: min(var(--size-said), calc(100% - 2 * var(--space-16)));
66
60
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-16);
67
- border-radius: 4px;
61
+ border-radius: var(--radius);
68
62
  background: var(--ink);
69
63
  color: var(--card);
70
64
  font: var(--font-small);
@@ -77,38 +71,48 @@
77
71
  .notice button {
78
72
  color: inherit;
79
73
  }
80
- /* the group opens from the button that names you, under it, and flips to keep on the page */
74
+ /* the group opens from the button that names you, under it, and flips to keep on the page; on a phone it's a
75
+ phone's sheet (src/surface.ts). Its title, the tabs, the way to invite and to sign out stay where they are, and
76
+ only the list of people (or agents) scrolls, however many there are */
81
77
  .who {
82
78
  anchor-name: --who;
83
79
  }
84
- /* the group is a sheet (src/parts.css), anchored under its button; on a phone, rising from the foot */
85
80
  #group {
86
81
  position-anchor: --who;
87
82
  position-area: block-end span-inline-end;
88
83
  position-try-fallbacks: flip-inline;
89
84
  inset: auto;
90
- margin: 4px 0 0;
91
- }
92
- @media (max-width: 40rem) {
93
- #group {
94
- position-area: none;
95
- inset: auto 0 0;
96
- margin: 0;
97
- }
85
+ margin: var(--space-4) 0 0;
98
86
  }
99
- /* the sheet holds still: its title, the tabs, the way to invite and to sign out stay where they are, and only the
100
- list of people (or agents) scrolls, however many there are */
101
87
  #group:popover-open {
102
88
  display: flex;
103
89
  flex-direction: column;
104
90
  max-height: min(85dvh, 36rem);
105
91
  overflow: hidden;
106
92
  }
107
- #group > :not(.people, .agents) {
93
+ #group > header,
94
+ .leave {
108
95
  flex: none;
109
96
  }
110
- .people,
111
- .agents {
97
+ .group {
98
+ display: flex;
99
+ flex-direction: column;
100
+ min-height: 0;
101
+ gap: var(--space-10);
102
+ }
103
+ /* a tab's panel takes no room of its own over and under what it holds (Web Awesome's is a big space each way):
104
+ the group's own gap is all there is between the tabs, the invite and the way out */
105
+ wa-tab-panel {
106
+ --padding: var(--space-8) 0 0;
107
+ }
108
+ wa-tab-group.alone::part(nav) {
109
+ display: none;
110
+ }
111
+ wa-tab-group::part(body) {
112
+ padding-top: var(--space-8);
113
+ }
114
+ /* the tab shown (Web Awesome hides the other, as long as nothing here says how it's drawn) */
115
+ :is(.people, .agents)[active] {
112
116
  display: flex;
113
117
  flex-direction: column;
114
118
  flex: 0 1 auto;
@@ -129,7 +133,7 @@
129
133
  position: relative;
130
134
  display: flex;
131
135
  align-items: center;
132
- gap: 8px;
136
+ gap: var(--space-8);
133
137
  min-height: 36px;
134
138
  }
135
139
  /* a line for each step in, to who invited them */
@@ -146,17 +150,17 @@
146
150
  li input {
147
151
  flex: 1;
148
152
  min-width: 0;
149
- margin-left: 8px;
153
+ margin-left: var(--space-8);
150
154
  overflow: hidden;
151
155
  text-overflow: ellipsis;
152
156
  white-space: nowrap;
153
157
  }
154
158
  /* your own name, changed where it is: a field, 16px (src/parts.css), its edge shown only when touched */
155
159
  li input {
156
- padding: 2px 6px;
160
+ padding: 2px var(--space-6);
157
161
  margin-left: 2px;
158
162
  border: 1px solid transparent;
159
- border-radius: 4px;
163
+ border-radius: var(--radius);
160
164
  background: none;
161
165
  color: inherit;
162
166
  }
@@ -165,7 +169,7 @@
165
169
  border-color: var(--control-edge);
166
170
  }
167
171
  .agents li svg.icon {
168
- margin-left: 8px;
172
+ margin-left: var(--space-8);
169
173
  color: var(--muted);
170
174
  }
171
175
  .tag {
@@ -173,22 +177,23 @@
173
177
  line-height: 16px;
174
178
  color: var(--muted);
175
179
  border: 1px solid var(--edge);
176
- border-radius: 999px;
177
- padding: 0 6px;
180
+ border-radius: var(--radius-pill);
181
+ padding: 0 var(--space-6);
178
182
  }
179
183
  form {
180
184
  display: flex;
181
- gap: 8px;
185
+ gap: var(--space-8);
182
186
  margin: 0;
183
187
  }
184
188
  .people form,
185
189
  .agents form {
186
- padding-top: 10px;
187
- margin-top: 6px;
190
+ padding-top: var(--space-10);
191
+ margin-top: var(--space-6);
188
192
  border-top: 1px solid var(--line);
189
193
  }
190
- form input {
194
+ form wa-input {
191
195
  flex: 1;
196
+ min-width: 0;
192
197
  }
193
198
  /* the way out, and all you can see to take with you, side by side */
194
199
  .leave {
@@ -207,7 +212,7 @@
207
212
  min-width: 12rem;
208
213
  padding: var(--space-4);
209
214
  border: 1px solid var(--edge);
210
- border-radius: 4px;
215
+ border-radius: var(--radius);
211
216
  }
212
217
  svg.icon {
213
218
  flex: none;
@@ -17,7 +17,8 @@ import { collections } from "./generated/rules.ts";
17
17
  import { JMember, type JMembers } from "./generated/elements.ts";
18
18
  import { consequences, type Member } from "./trust.ts";
19
19
  import STYLE from "./panel.css" with { type: "text" };
20
- import { adopt, said, showsOpen } from "../parts.ts";
20
+ import { adopt, said } from "../parts.ts";
21
+ import { Surface } from "../surface.ts";
21
22
  import type { Answer } from "../page.ts";
22
23
 
23
24
  customElements.define(collections.members.tag, JMember);
@@ -80,25 +81,36 @@ class MembersPanel extends HTMLElement {
80
81
  if (!this.querySelector(collections.members.place)) this.append(document.createElement(collections.members.place));
81
82
  adopt(this.#root, SHEET);
82
83
  this.#root.innerHTML = `
83
- <div class="bar" part="bar"><button class="who act" part="who" popovertarget="group" type="button"><span>The group</span></button><span class="status" role="status"></span><span class="waiting" part="waiting" role="status"></span><span class="note"></span></div>
84
+ <div class="bar" part="bar"><button class="who act" part="who" type="button" aria-expanded="false"><span>The group</span></button><span class="status" role="status"></span><span class="waiting" part="waiting" role="status"></span><span class="note"></span></div>
84
85
  <div class="notice" part="notice" hidden><p></p><button class="icon-only" type="button" name="close" aria-label="Close" title="Close" data-icon="close"></button></div>
85
- <div id="group" class="sheet" part="sheet" popover>
86
- <header><h2>The group</h2><button type="button" class="icon-only" popovertarget="group" popovertargetaction="hide" aria-label="Close" title="Close" data-icon="close"></button></header>
87
- <div class="j-tabs" role="tablist" aria-label="The group"><button type="button" role="tab" name="people"></button><button type="button" role="tab" name="agents"></button></div>
88
- <div class="people" role="tabpanel"><ul class="tree"></ul>
89
- <form class="invite"><input name="name" placeholder="Invite someone by name" aria-label="Invite someone by name" required autocomplete="off"><button type="button" name="readonly" class="act icon-only" aria-pressed="false" aria-label="Invite them read-only" title="Invite them read-only" data-icon="read-only"></button><button class="act ink icon-only" aria-label="Invite" title="Invite" data-icon="person-add"></button></form></div>
90
- <div class="agents" role="tabpanel"><ul></ul>
91
- <form class="agent"><input name="label" placeholder="A label, as claude" aria-label="An agent's label" required autocomplete="off"><button class="act" data-icon="add">Make</button></form></div>
86
+ <div class="group">
87
+ <wa-tab-group aria-label="The group"><wa-tab slot="nav" panel="people"></wa-tab><wa-tab slot="nav" panel="agents"></wa-tab>
88
+ <wa-tab-panel name="people" class="people"><ul class="tree"></ul>
89
+ <form class="invite"><wa-input class="j-bare" name="name" placeholder="Invite someone by name" label="Invite someone by name" required autocomplete="off"></wa-input><button type="button" name="readonly" class="act icon-only" aria-pressed="false" aria-label="Invite them read-only" title="Invite them read-only" data-icon="read-only"></button><button class="act ink icon-only" aria-label="Invite" title="Invite" data-icon="person-add"></button></form></wa-tab-panel>
90
+ <wa-tab-panel name="agents" class="agents"><ul></ul>
91
+ <form class="agent"><wa-input class="j-bare" name="label" placeholder="A label, as claude" label="An agent's label" required autocomplete="off"></wa-input><button class="act" data-icon="add">Make</button></form></wa-tab-panel></wa-tab-group>
92
92
  <div class="leave"><form class="out" method="post" action="/out"><button class="act quiet" data-icon="out">Sign out of this browser</button></form><a class="act quiet" href="/export" download="joined.json" data-icon="download">Download all you can see</a></div>
93
93
  <div class="menu j-choices" part="menu" popover role="menu"></div>
94
- <dialog class="ask" part="ask"><h2></h2><p></p><label>Why, in words they'll read<textarea></textarea></label>
95
- <footer><button type="button" name="no" class="act">Never mind</button><button type="button" name="yes" class="act danger"></button></footer></dialog>
96
- </div>`;
94
+ </div>
95
+ <wa-dialog class="ask j-ask" part="ask" light-dismiss><h2 slot="label"></h2><p></p><wa-textarea label="Why, in words they'll read" resize="auto"></wa-textarea>
96
+ <footer slot="footer"><button type="button" name="no" class="act">Never mind</button><button type="button" name="yes" class="act danger"></button></footer></wa-dialog>`;
97
97
  iconify(this.#root);
98
- showsOpen(this.#root);
99
98
  const $ = <T extends Element>(s: string) => this.#root.querySelector<T>(s)!;
100
- for (const tab of ["people", "agents"] as const)
101
- $(`[role=tab][name=${tab}]`).addEventListener("click", () => ((this.#tab = tab), this.#draw()));
99
+ const who = $<HTMLButtonElement>(".who"),
100
+ sheet: Surface = new Surface("sheet", $(".group"), null, () => shown(false), { label: "The group" }),
101
+ // the button that opens it says so while it's open
102
+ shown = (open: boolean) => ((sheet.open = open), who.setAttribute("aria-expanded", String(open)));
103
+ sheet.title.textContent = "The group";
104
+ for (const el of sheet.els) el.id = el === sheet.wide ? "group" : "group-phone";
105
+ this.#root.append(...sheet.els);
106
+ // pressed while it's open, it closes: as it was when the press began (a tap away closes a popover first)
107
+ let was = false;
108
+ who.addEventListener("pointerdown", () => (was = sheet.open));
109
+ who.addEventListener("click", (e) => shown(e.detail ? !was : !sheet.open));
110
+ $("wa-tab-group").addEventListener("wa-tab-show", (e) => {
111
+ this.#tab = (e as CustomEvent<{ name: "people" | "agents" }>).detail.name;
112
+ this.#draw();
113
+ });
102
114
  // inviting someone read-only: they see everything and change nothing until you give it back
103
115
  const readonly = $<HTMLButtonElement>("form.invite [name=readonly]");
104
116
  const pressed = () => readonly.getAttribute("aria-pressed") === "true";
@@ -106,7 +118,7 @@ class MembersPanel extends HTMLElement {
106
118
  $("form.invite").addEventListener("submit", (e) => {
107
119
  e.preventDefault();
108
120
  const name = ($("form.invite") as HTMLFormElement).elements.namedItem("name") as HTMLInputElement;
109
- if (this.#told && name.value.trim())
121
+ if (this.#told && name.value?.trim())
110
122
  this.#said(
111
123
  this.querySelector<JMembers>(collections.members.place)!.add({
112
124
  name: name.value.trim(),
@@ -120,18 +132,19 @@ class MembersPanel extends HTMLElement {
120
132
  $("form.agent").addEventListener("submit", (e) => {
121
133
  e.preventDefault();
122
134
  const label = ($("form.agent") as HTMLFormElement).elements.namedItem("label") as HTMLInputElement;
123
- this.#said(ask("members", { agent: label.value.trim().toLowerCase() }));
135
+ this.#said(ask("members", { agent: (label.value ?? "").trim().toLowerCase() }));
124
136
  label.value = "";
125
137
  });
126
138
  $("[name=close]").addEventListener("click", () => this.#said(ask("members", { closeNotice: true })));
127
- $("[name=no]").addEventListener("click", () => $<HTMLDialogElement>("dialog.ask").close());
128
- // a dialog's close event comes a moment after it closes: if it's been asked again since, it's that act's
129
- $("dialog.ask").addEventListener(
130
- "close",
131
- (e) => !(e.target as HTMLDialogElement).open && ((this.#act = null), this.#draw()),
139
+ const asking = $<HTMLElement & { open: boolean }>("wa-dialog.ask");
140
+ $("[name=no]").addEventListener("click", () => (asking.open = false));
141
+ // closed (Never mind, its ×, Escape, a tap away): the act asked for is let go; asked again since, it's that act's
142
+ asking.addEventListener(
143
+ "wa-after-hide",
144
+ (e) => e.target === asking && !asking.open && ((this.#act = null), this.#draw()),
132
145
  );
133
146
  $("[name=yes]").addEventListener("click", () => this.#confirm());
134
- $("textarea").addEventListener("input", () => this.#draw());
147
+ $("wa-textarea").addEventListener("input", () => this.#draw());
135
148
 
136
149
  document.addEventListener("told", (e) => {
137
150
  const m = (e as CustomEvent).detail;
@@ -207,15 +220,16 @@ class MembersPanel extends HTMLElement {
207
220
  // people and agents, a tab each; an agent, or someone signed out, sees only the people
208
221
  const ours = !!told && !told.agent;
209
222
  if (!ours) this.#tab = "people";
210
- $<HTMLElement>(".j-tabs")!.hidden = !ours;
223
+ const tabs = $<HTMLElement & { active: string }>("wa-tab-group")!;
224
+ tabs.classList.toggle("alone", !ours);
211
225
  for (const [tab, words] of [
212
226
  ["people", `People · ${members.length}`],
213
227
  ["agents", `Agents · ${told?.agents.length ?? 0}`],
214
228
  ] as const) {
215
- $(`[role=tab][name=${tab}]`)!.textContent = words;
216
- $(`[role=tab][name=${tab}]`)!.ariaSelected = String(tab === this.#tab);
217
- $<HTMLElement>(`[role=tabpanel].${tab}`)!.hidden = tab !== this.#tab;
229
+ const t = $(`wa-tab[panel=${tab}]`)!;
230
+ if (t.textContent !== words) t.textContent = words;
218
231
  }
232
+ if (tabs.active !== this.#tab) tabs.setAttribute("active", this.#tab);
219
233
  $<HTMLElement>("form.invite")!.hidden = !ours;
220
234
  $<HTMLElement>(".leave")!.hidden = !told; // signed in: a way out, and what they can see to take
221
235
  keep(
@@ -238,27 +252,34 @@ class MembersPanel extends HTMLElement {
238
252
  })),
239
253
  );
240
254
  // an act asked for, in a dialog: what follows, why, and yes; gone meanwhile, it closes
241
- const asked = $<HTMLDialogElement>("dialog.ask")!,
255
+ const asked = $<HTMLElement & { open: boolean }>("wa-dialog.ask")!,
242
256
  them = members.find((m) => m.id === this.#act?.member);
243
257
  if (!this.#act || !them) {
244
- if (asked.open) asked.close();
258
+ if (asked.open) asked.open = false;
245
259
  return;
246
260
  }
247
261
  const yes = asked.querySelector<HTMLButtonElement>("[name=yes]")!,
248
- why = asked.querySelector("textarea")!;
262
+ why = asked.querySelector<HTMLTextAreaElement>("wa-textarea")!;
249
263
  const does =
250
264
  this.#act.kind === "removed"
251
265
  ? `Remove ${them.name}`
252
266
  : this.#act.kind === "read-only"
253
267
  ? `Make ${them.name} read-only`
254
268
  : `Give ${them.name} back what they could do`;
255
- asked.querySelector("h2")!.textContent = `${does}?`;
256
- asked.querySelector("p")!.textContent = consequences(this.#act.kind, them, members);
257
- asked.querySelector("label")!.hidden = this.#act.kind === "restored";
269
+ // its title what will happen, its line what follows from it (a modal states: its buttons ask)
270
+ const will =
271
+ this.#act.kind === "removed"
272
+ ? `${them.name} will be removed.`
273
+ : this.#act.kind === "read-only"
274
+ ? `${them.name} will be made read-only.`
275
+ : `${them.name} gets back what they could do.`;
276
+ asked.querySelector("h2")!.textContent = will;
277
+ asked.querySelector("p")!.textContent = consequences(this.#act.kind, them, members).replace(`${will} `, "");
278
+ why.hidden = this.#act.kind === "restored";
258
279
  yes.replaceChildren(icon(MARKS[this.#act.kind]), does);
259
280
  yes.className = this.#act.kind === "restored" ? "act ink" : "act danger";
260
- yes.disabled = this.#act.kind !== "restored" && !why.value.trim();
261
- if (!asked.open) asked.showModal();
281
+ yes.disabled = this.#act.kind !== "restored" && !why.value?.trim();
282
+ if (!asked.open) asked.open = true;
262
283
  }
263
284
 
264
285
  /** Each member's row, depth first from the BDFL: their name, what they are, and what you may do. What
@@ -384,14 +405,14 @@ class MembersPanel extends HTMLElement {
384
405
 
385
406
  #ask(act: Act) {
386
407
  this.#act = act;
387
- this.#root.querySelector("textarea")!.value = "";
408
+ this.#root.querySelector<HTMLTextAreaElement>("wa-textarea")!.value = "";
388
409
  this.#draw();
389
410
  }
390
411
 
391
412
  #confirm() {
392
413
  const act = this.#act,
393
414
  el = act && this.#element(act.member),
394
- why = this.#root.querySelector("textarea")!.value.trim();
415
+ why = (this.#root.querySelector<HTMLTextAreaElement>("wa-textarea")!.value ?? "").trim();
395
416
  if (!act || !el) return;
396
417
  this.#said(
397
418
  act.kind === "removed"