@blueshed/joined 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/joined/SKILL.md +9 -1
- package/.claude/skills/joined/reference.md +316 -63
- package/.claude/skills/joined-door/SKILL.md +57 -0
- package/README.md +19 -50
- package/docs/design.md +158 -37
- package/docs/introduction.md +27 -27
- package/docs/light-and-shadow.svg +2 -1
- package/docs/links-and-trust.svg +1 -0
- package/docs/stories-to-code.svg +2 -1
- package/docs/wire-op.svg +1 -0
- package/examples/README.md +20 -0
- package/examples/account/account.json +1 -0
- package/examples/account/derive.ts +41 -0
- package/examples/account/generated/elements.ts +52 -0
- package/examples/account/generated/rows.ts +22 -0
- package/examples/account/generated/rules.ts +32 -0
- package/examples/account/routes.ts +5 -0
- package/examples/app.css +11 -1
- package/examples/cafe/books.html +2 -2
- package/examples/cafe/cafe.css +96 -85
- package/examples/cafe/generated/books.rows.ts +22 -0
- package/examples/cafe/generated/books.rules.ts +3 -2
- package/examples/cafe/generated/kitchen.rows.ts +27 -0
- package/examples/cafe/generated/kitchen.rules.ts +11 -1
- package/examples/cafe/generated/menu.rows.ts +22 -0
- package/examples/cafe/generated/menu.rules.ts +3 -2
- package/examples/cafe/generated/order.rows.ts +27 -0
- package/examples/cafe/generated/order.rules.ts +11 -1
- package/examples/cafe/generated/staff.elements.ts +7 -2
- package/examples/cafe/generated/staff.rows.ts +22 -0
- package/examples/cafe/generated/staff.rules.ts +9 -1
- package/examples/cafe/generated/supplies.queries.ts +4 -2
- package/examples/cafe/generated/supplies.rows.ts +22 -0
- package/examples/cafe/generated/supplies.rules.ts +17 -1
- package/examples/cafe/generated/till.queries.ts +2 -0
- package/examples/cafe/generated/till.rows.ts +27 -0
- package/examples/cafe/generated/till.rules.ts +11 -1
- package/examples/cafe/index.html +14 -15
- package/examples/cafe/kitchen.css +11 -19
- package/examples/cafe/kitchen.ts +7 -3
- package/examples/cafe/look.ts +30 -0
- package/examples/cafe/menu.html +10 -26
- package/examples/cafe/menu.ts +8 -80
- package/examples/cafe/migrations/002-guard-supplies.ts +15 -0
- package/examples/cafe/order.html +8 -7
- package/examples/cafe/order.ts +6 -2
- package/examples/cafe/routes.ts +0 -1
- package/examples/cafe/staff.json +5 -0
- package/examples/cafe/stories.jsonl +6 -2
- package/examples/cafe/supplies.html +35 -34
- package/examples/cafe/supplies.ts +59 -39
- package/examples/cafe/till.ts +19 -11
- package/examples/cafe/views.ts +7 -5
- package/examples/chart/arches.ts +150 -0
- package/examples/chart/chart.css +11 -0
- package/examples/chart/chart.json +87 -0
- package/examples/chart/generated/elements.ts +105 -0
- package/examples/chart/generated/queries.ts +36 -0
- package/examples/chart/generated/rows.ts +27 -0
- package/examples/chart/generated/rules.ts +111 -0
- package/examples/chart/grid.ts +118 -0
- package/examples/chart/index.html +78 -0
- package/examples/chart/migrations/001-chart.ts +6 -0
- package/examples/chart/migrations/002-create-conditions.ts +6 -0
- package/examples/chart/page.ts +20 -0
- package/examples/chart/routes.ts +7 -0
- package/examples/chart/stories.jsonl +14 -0
- package/examples/chart/teeth.ts +57 -0
- package/examples/desk/desk.css +6 -10
- package/examples/desk/generated/elements.ts +1 -1
- package/examples/desk/generated/rows.ts +22 -0
- package/examples/desk/generated/rules.ts +34 -1
- package/examples/desk/index.html +10 -3
- package/examples/desk/lanes.css +21 -19
- package/examples/desk/routes.ts +0 -2
- package/examples/desk/stories.jsonl +4 -3
- package/examples/desk/tally.css +1 -1
- package/examples/desk/thumbs.ts +2 -2
- package/examples/docs.ts +7 -4
- package/examples/hello/generated/elements.ts +2 -2
- package/examples/hello/generated/rules.ts +3 -2
- package/examples/hello/hello.css +2 -4
- package/examples/hello/index.html +10 -3
- package/examples/hello/page.ts +4 -4
- package/examples/index.html +20 -12
- package/examples/notes/generated/elements.ts +112 -0
- package/examples/notes/generated/queries.ts +42 -0
- package/examples/notes/generated/rows.ts +27 -0
- package/examples/notes/generated/rules.ts +133 -0
- package/examples/notes/index.html +32 -0
- package/examples/notes/look.ts +41 -0
- package/examples/notes/migrations/001-notes.ts +7 -0
- package/examples/notes/notes.json +78 -0
- package/examples/notes/page.ts +21 -0
- package/examples/notes/routes.ts +6 -0
- package/examples/notes/stories.jsonl +24 -0
- package/examples/page.ts +9 -2
- package/examples/people/generated/rows.ts +22 -0
- package/examples/people/generated/rules.ts +11 -1
- package/examples/people/links.ts +8 -9
- package/examples/people/people.css +1 -1
- package/examples/people/routes.ts +1 -3
- package/examples/people/stories.jsonl +1 -0
- package/examples/people/view.ts +5 -2
- package/examples/trip/generated/elements.ts +5 -3
- package/examples/trip/generated/queries.ts +12 -1
- package/examples/trip/generated/rows.ts +27 -0
- package/examples/trip/generated/rules.ts +56 -2
- package/examples/trip/index.html +58 -12
- package/examples/trip/line.css +186 -0
- package/examples/trip/line.ts +51 -40
- package/examples/trip/page.ts +65 -71
- package/examples/trip/routes.ts +9 -5
- package/examples/trip/stays.css +13 -13
- package/examples/trip/stays.ts +15 -10
- package/examples/trip/stories.jsonl +2 -0
- package/examples/trip/told.ts +3 -26
- package/examples/trip/trip.css +16 -0
- package/examples/trips/generated/elements.ts +1 -1
- package/examples/trips/generated/rows.ts +22 -0
- package/examples/trips/generated/rules.ts +9 -1
- package/examples/trips/index.html +10 -10
- package/examples/trips/map.ts +3 -14
- package/examples/trips/new-trip.ts +14 -16
- package/examples/trips/trips.css +24 -23
- package/examples/weeks/generated/elements.ts +1 -1
- package/examples/weeks/generated/queries.ts +11 -0
- package/examples/weeks/generated/rows.ts +22 -0
- package/examples/weeks/generated/rules.ts +11 -5
- package/examples/weeks/routes.ts +3 -2
- package/examples/weeks/stories.jsonl +1 -0
- package/examples/welcome.css +43 -33
- package/package.json +8 -2
- package/src/attachment.ts +17 -2
- package/src/awesome.ts +103 -0
- package/src/board.css +76 -0
- package/src/board.ts +173 -0
- package/src/cli.ts +28 -3
- package/src/compile.ts +821 -109
- package/src/definitions.ts +113 -27
- package/src/demo.css +2 -5
- package/src/draft.ts +48 -27
- package/src/drawer.ts +248 -0
- package/src/engine.ts +253 -170
- package/src/fields.ts +341 -0
- package/src/file-value.ts +12 -2
- package/src/files.ts +113 -33
- package/src/ground.ts +110 -0
- package/src/icon-names.ts +19 -2
- package/src/keep.ts +16 -3
- package/src/kit.ts +51 -0
- package/src/link.ts +3 -3
- package/src/map.css +140 -0
- package/src/map.ts +200 -0
- package/src/mcp.ts +129 -24
- package/src/members/demo.ts +13 -12
- package/src/members/generated/rows.ts +22 -0
- package/src/members/generated/rules.ts +3 -2
- package/src/members/group.ts +105 -55
- package/src/members/keys.ts +95 -79
- package/src/members/panel.css +40 -35
- package/src/members/panel.ts +58 -37
- package/src/migrate.ts +178 -125
- package/src/migrations/005-change-kept.ts +7 -0
- package/src/month.css +129 -0
- package/src/month.ts +179 -0
- package/src/ops.ts +40 -1
- package/src/page.css +11 -2
- package/src/page.ts +68 -17
- package/src/parts.css +614 -230
- package/src/parts.ts +259 -36
- package/src/plane.css +61 -0
- package/src/plane.ts +153 -0
- package/src/postgres-server.ts +60 -0
- package/src/reading.css +73 -0
- package/src/reading.ts +238 -0
- package/src/rows.css +289 -0
- package/src/rows.ts +864 -0
- package/src/search.css +80 -0
- package/src/search.ts +130 -0
- package/src/server.ts +355 -137
- package/src/settings.ts +9 -4
- package/src/sheet.ts +116 -0
- package/src/skill.ts +40 -0
- package/src/slots.css +90 -0
- package/src/slots.ts +213 -0
- package/src/specs.ts +38 -0
- package/src/starter.ts +19 -2
- package/src/store.ts +224 -161
- package/src/stories.ts +43 -11
- package/src/surface.ts +164 -0
- package/src/time.ts +2 -0
- package/src/timeline.css +111 -0
- package/src/timeline.ts +235 -0
- package/src/toast.ts +21 -48
- package/src/together.ts +15 -24
- package/src/tokens.css +89 -3
- package/src/tokens.json +287 -7
- package/src/tool.ts +210 -0
- package/src/upkeep.ts +47 -22
- package/src/views.css +43 -0
- package/src/views.ts +111 -0
- package/src/week.css +150 -0
- package/src/week.ts +254 -0
- package/src/write.ts +326 -78
- package/starter/CHANGELOG.md +8 -0
- package/starter/CLAUDE.md +9 -3
- package/starter/bunfig +5 -0
- package/starter/githooks/pre-commit +13 -0
- package/starter/prettierignore +5 -0
- package/starter/tests/hello.test.ts +2 -0
- package/starter/tests/records.test.ts +40 -0
- package/starter/todo.jsonl +0 -0
- package/docs/learning.md +0 -76
- package/examples/cafe/trust.ts +0 -20
- package/examples/desk/trust.ts +0 -24
- package/examples/people/trust.ts +0 -14
- package/examples/trip/answer-rows.ts +0 -70
- package/examples/trip/bar.ts +0 -89
- package/examples/trip/calendar-map.css +0 -711
- package/examples/trip/calendar-map.ts +0 -249
- package/examples/trip/drags.ts +0 -143
- package/examples/trip/drawer.ts +0 -250
- package/examples/trip/event-form.ts +0 -200
- package/examples/trip/holding.ts +0 -61
- package/examples/trip/map.ts +0 -234
- package/examples/trip/month.ts +0 -87
- package/examples/trip/other-weeks.ts +0 -67
- package/examples/trip/peek.ts +0 -71
- package/examples/trip/people-chips.ts +0 -74
- package/examples/trip/shell.ts +0 -39
- package/examples/trip/trust.ts +0 -51
- package/examples/trip/week.ts +0 -237
- package/examples/trip/writes.ts +0 -91
- package/examples/trip/zones.ts +0 -16
- package/examples/weeks/derive.ts +0 -23
- package/src/scrim.ts +0 -81
package/src/members/panel.css
CHANGED
|
@@ -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(
|
|
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:
|
|
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:
|
|
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 >
|
|
93
|
+
#group > header,
|
|
94
|
+
.leave {
|
|
108
95
|
flex: none;
|
|
109
96
|
}
|
|
110
|
-
.
|
|
111
|
-
|
|
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:
|
|
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:
|
|
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
|
|
160
|
+
padding: 2px var(--space-6);
|
|
157
161
|
margin-left: 2px;
|
|
158
162
|
border: 1px solid transparent;
|
|
159
|
-
border-radius:
|
|
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:
|
|
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:
|
|
177
|
-
padding: 0
|
|
180
|
+
border-radius: var(--radius-pill);
|
|
181
|
+
padding: 0 var(--space-6);
|
|
178
182
|
}
|
|
179
183
|
form {
|
|
180
184
|
display: flex;
|
|
181
|
-
gap:
|
|
185
|
+
gap: var(--space-8);
|
|
182
186
|
margin: 0;
|
|
183
187
|
}
|
|
184
188
|
.people form,
|
|
185
189
|
.agents form {
|
|
186
|
-
padding-top:
|
|
187
|
-
margin-top:
|
|
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:
|
|
215
|
+
border-radius: var(--radius);
|
|
211
216
|
}
|
|
212
217
|
svg.icon {
|
|
213
218
|
flex: none;
|
package/src/members/panel.ts
CHANGED
|
@@ -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
|
|
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"
|
|
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
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
101
|
-
|
|
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
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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>("
|
|
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
|
-
$(`
|
|
216
|
-
|
|
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 = $<
|
|
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.
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
|
261
|
-
if (!asked.open) asked.
|
|
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"
|