@blueshed/joined 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/joined/SKILL.md +9 -1
- package/.claude/skills/joined/reference.md +267 -53
- package/.claude/skills/joined-door/SKILL.md +57 -0
- package/README.md +19 -50
- package/docs/design.md +76 -10
- package/docs/introduction.md +18 -18
- package/docs/light-and-shadow.svg +1 -1
- package/examples/README.md +20 -0
- package/examples/account/account.json +1 -0
- package/examples/account/derive.ts +41 -0
- package/examples/account/generated/elements.ts +52 -0
- package/examples/account/generated/rows.ts +22 -0
- package/examples/account/generated/rules.ts +32 -0
- package/examples/account/routes.ts +5 -0
- package/examples/app.css +2 -1
- package/examples/cafe/books.html +2 -2
- package/examples/cafe/cafe.css +9 -16
- package/examples/cafe/generated/books.rows.ts +22 -0
- package/examples/cafe/generated/books.rules.ts +3 -2
- package/examples/cafe/generated/kitchen.rows.ts +27 -0
- package/examples/cafe/generated/kitchen.rules.ts +11 -1
- package/examples/cafe/generated/menu.rows.ts +22 -0
- package/examples/cafe/generated/menu.rules.ts +3 -2
- package/examples/cafe/generated/order.rows.ts +27 -0
- package/examples/cafe/generated/order.rules.ts +11 -1
- package/examples/cafe/generated/staff.rows.ts +22 -0
- package/examples/cafe/generated/staff.rules.ts +6 -1
- package/examples/cafe/generated/supplies.queries.ts +4 -2
- package/examples/cafe/generated/supplies.rows.ts +22 -0
- package/examples/cafe/generated/supplies.rules.ts +12 -1
- package/examples/cafe/generated/till.queries.ts +2 -0
- package/examples/cafe/generated/till.rows.ts +27 -0
- package/examples/cafe/generated/till.rules.ts +11 -1
- package/examples/cafe/index.html +14 -15
- package/examples/cafe/kitchen.ts +1 -1
- package/examples/cafe/look.ts +30 -0
- package/examples/cafe/menu.html +10 -26
- package/examples/cafe/menu.ts +8 -80
- package/examples/cafe/order.html +6 -6
- package/examples/cafe/order.ts +5 -1
- package/examples/cafe/routes.ts +0 -1
- package/examples/cafe/stories.jsonl +3 -1
- package/examples/cafe/supplies.html +34 -34
- package/examples/cafe/supplies.ts +14 -11
- package/examples/cafe/till.ts +5 -1
- package/examples/chart/arches.ts +148 -0
- package/examples/chart/chart.css +6 -0
- package/examples/chart/chart.json +87 -0
- package/examples/chart/generated/elements.ts +105 -0
- package/examples/chart/generated/queries.ts +36 -0
- package/examples/chart/generated/rows.ts +27 -0
- package/examples/chart/generated/rules.ts +111 -0
- package/examples/chart/grid.ts +118 -0
- package/examples/chart/index.html +78 -0
- package/examples/chart/migrations/001-chart.ts +6 -0
- package/examples/chart/migrations/002-create-conditions.ts +6 -0
- package/examples/chart/page.ts +20 -0
- package/examples/chart/routes.ts +7 -0
- package/examples/chart/stories.jsonl +14 -0
- package/examples/chart/teeth.ts +57 -0
- package/examples/desk/generated/rows.ts +22 -0
- package/examples/desk/generated/rules.ts +34 -1
- package/examples/desk/index.html +9 -2
- package/examples/desk/routes.ts +0 -2
- package/examples/desk/stories.jsonl +3 -2
- package/examples/desk/thumbs.ts +2 -2
- package/examples/hello/generated/elements.ts +2 -2
- package/examples/hello/generated/rules.ts +3 -2
- package/examples/hello/hello.css +2 -4
- package/examples/hello/index.html +10 -3
- package/examples/hello/page.ts +4 -4
- package/examples/index.html +4 -5
- package/examples/notes/generated/elements.ts +112 -0
- package/examples/notes/generated/queries.ts +36 -0
- package/examples/notes/generated/rows.ts +27 -0
- package/examples/notes/generated/rules.ts +133 -0
- package/examples/notes/index.html +32 -0
- package/examples/notes/look.ts +41 -0
- package/examples/notes/migrations/001-notes.ts +7 -0
- package/examples/notes/notes.json +78 -0
- package/examples/notes/page.ts +21 -0
- package/examples/notes/routes.ts +6 -0
- package/examples/notes/stories.jsonl +21 -0
- package/examples/people/generated/rows.ts +22 -0
- package/examples/people/generated/rules.ts +11 -1
- package/examples/people/links.ts +2 -1
- package/examples/people/routes.ts +1 -3
- package/examples/people/stories.jsonl +1 -0
- package/examples/people/view.ts +5 -2
- package/examples/trip/generated/elements.ts +4 -2
- package/examples/trip/generated/queries.ts +12 -1
- package/examples/trip/generated/rows.ts +27 -0
- package/examples/trip/generated/rules.ts +56 -2
- package/examples/trip/index.html +58 -12
- package/examples/trip/line.css +186 -0
- package/examples/trip/line.ts +51 -40
- package/examples/trip/page.ts +65 -71
- package/examples/trip/routes.ts +9 -5
- package/examples/trip/stays.css +12 -12
- package/examples/trip/stays.ts +15 -10
- package/examples/trip/stories.jsonl +2 -0
- package/examples/trip/told.ts +3 -26
- package/examples/trip/trip.css +16 -0
- package/examples/trips/generated/rows.ts +22 -0
- package/examples/trips/generated/rules.ts +9 -1
- package/examples/trips/index.html +10 -10
- package/examples/trips/map.ts +3 -14
- package/examples/trips/new-trip.ts +14 -16
- package/examples/weeks/generated/elements.ts +1 -1
- package/examples/weeks/generated/queries.ts +11 -0
- package/examples/weeks/generated/rows.ts +22 -0
- package/examples/weeks/generated/rules.ts +11 -5
- package/examples/weeks/routes.ts +3 -2
- package/examples/weeks/stories.jsonl +1 -0
- package/examples/welcome.css +7 -5
- package/package.json +8 -2
- package/src/awesome.ts +103 -0
- package/src/board.css +75 -0
- package/src/board.ts +173 -0
- package/src/cli.ts +15 -2
- package/src/compile.ts +569 -35
- package/src/definitions.ts +53 -15
- package/src/draft.ts +38 -23
- package/src/drawer.ts +222 -0
- package/src/engine.ts +240 -166
- package/src/fields.ts +268 -0
- package/src/files.ts +6 -4
- package/src/ground.ts +110 -0
- package/src/icon-names.ts +15 -2
- package/src/kit.ts +51 -0
- package/src/link.ts +3 -3
- package/src/map.css +133 -0
- package/src/map.ts +200 -0
- package/src/mcp.ts +106 -22
- package/src/members/demo.ts +13 -12
- package/src/members/generated/rows.ts +22 -0
- package/src/members/generated/rules.ts +3 -2
- package/src/members/group.ts +65 -39
- package/src/members/keys.ts +93 -77
- package/src/members/panel.css +23 -17
- package/src/members/panel.ts +49 -35
- package/src/migrate.ts +120 -104
- package/src/month.css +125 -0
- package/src/month.ts +179 -0
- package/src/page.css +8 -0
- package/src/page.ts +7 -4
- package/src/parts.css +462 -170
- package/src/parts.ts +209 -26
- package/src/plane.css +56 -0
- package/src/plane.ts +151 -0
- package/src/postgres-server.ts +60 -0
- package/src/reading.css +77 -0
- package/src/reading.ts +238 -0
- package/src/rows.css +308 -0
- package/src/rows.ts +780 -0
- package/src/search.css +80 -0
- package/src/search.ts +130 -0
- package/src/server.ts +205 -114
- package/src/settings.ts +9 -4
- package/src/sheet.ts +114 -0
- package/src/skill.ts +40 -0
- package/src/slots.css +94 -0
- package/src/slots.ts +213 -0
- package/src/specs.ts +38 -0
- package/src/starter.ts +5 -2
- package/src/store.ts +184 -143
- package/src/stories.ts +43 -11
- package/src/surface.ts +159 -0
- package/src/timeline.css +111 -0
- package/src/timeline.ts +226 -0
- package/src/toast.ts +21 -48
- package/src/together.ts +0 -7
- package/src/tokens.css +78 -1
- package/src/tokens.json +249 -0
- package/src/tool.ts +211 -0
- package/src/upkeep.ts +18 -20
- package/src/views.css +44 -0
- package/src/views.ts +94 -0
- package/src/week.css +151 -0
- package/src/week.ts +250 -0
- package/src/write.ts +202 -69
- package/starter/CLAUDE.md +3 -3
- package/starter/bunfig +4 -0
- package/starter/prettierignore +4 -0
- package/starter/tests/hello.test.ts +2 -0
- package/docs/learning.md +0 -76
- package/examples/cafe/trust.ts +0 -20
- package/examples/desk/trust.ts +0 -24
- package/examples/people/trust.ts +0 -14
- package/examples/trip/answer-rows.ts +0 -70
- package/examples/trip/bar.ts +0 -89
- package/examples/trip/calendar-map.css +0 -711
- package/examples/trip/calendar-map.ts +0 -249
- package/examples/trip/drags.ts +0 -143
- package/examples/trip/drawer.ts +0 -250
- package/examples/trip/event-form.ts +0 -200
- package/examples/trip/holding.ts +0 -61
- package/examples/trip/map.ts +0 -234
- package/examples/trip/month.ts +0 -87
- package/examples/trip/other-weeks.ts +0 -67
- package/examples/trip/peek.ts +0 -71
- package/examples/trip/people-chips.ts +0 -74
- package/examples/trip/shell.ts +0 -39
- package/examples/trip/trust.ts +0 -51
- package/examples/trip/week.ts +0 -237
- package/examples/trip/writes.ts +0 -91
- package/examples/trip/zones.ts +0 -16
- package/examples/weeks/derive.ts +0 -23
- package/src/scrim.ts +0 -81
package/src/reading.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// A reading (joined/kit): a collection read by one of its fields, as a month, a week, a timeline, a map or a board,
|
|
2
|
+
// each the way into its items. What they share is here, once: each is bound to its collection by name (`for`) and to
|
|
3
|
+
// the field it reads by its own attribute (`when`, `at`, `by`); it holds nothing, finding the collection's items
|
|
4
|
+
// wherever they are on the page, drawn again once a moment however much changed; it shows only what the page's search
|
|
5
|
+
// finds (<j-search for>); an item tapped opens the collection's sheet (<j-sheet for>), the one open marked; and a
|
|
6
|
+
// gesture is a write the item's `may` offers (moved, made longer, put in another lane), refused in the story's words
|
|
7
|
+
// and put back. The period it shows is the page's alone, kept in the address (?day=2026-11-15), as a search is.
|
|
8
|
+
|
|
9
|
+
import { follow, held } from "./follow.ts";
|
|
10
|
+
import { hueOf } from "./hues.ts";
|
|
11
|
+
import { el, reads, type Asked } from "./fields.ts";
|
|
12
|
+
|
|
13
|
+
export { el };
|
|
14
|
+
import type { Answer } from "./page.ts";
|
|
15
|
+
import { adopt } from "./parts.ts";
|
|
16
|
+
import type { Item, Spec } from "./rows.ts";
|
|
17
|
+
import { found, wordsOf } from "./search.ts";
|
|
18
|
+
import { titled, worded } from "./sheet.ts";
|
|
19
|
+
import { kindOf, specOf } from "./specs.ts";
|
|
20
|
+
import { DAY, dayOf, local, now } from "./time.ts";
|
|
21
|
+
import STYLE from "./reading.css" with { type: "text" };
|
|
22
|
+
|
|
23
|
+
const SHEET = new CSSStyleSheet();
|
|
24
|
+
SHEET.replaceSync(STYLE);
|
|
25
|
+
|
|
26
|
+
/** What a sheet of the page is to a reading: its drawer's open item, and a way to open one. */
|
|
27
|
+
type PageSheet = HTMLElement & {
|
|
28
|
+
drawer?: { open: Item | "new" | null };
|
|
29
|
+
show(it: Item | "new" | null, given?: Record<string, number>, filled?: Record<string, unknown>): void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export abstract class Reading extends HTMLElement {
|
|
33
|
+
static sheets: CSSStyleSheet[] = [];
|
|
34
|
+
root = this.attachShadow({ mode: "open" });
|
|
35
|
+
spec?: Spec;
|
|
36
|
+
/** A line that says a refusal, in the story's words. */
|
|
37
|
+
line = Object.assign(document.createElement("p"), { className: "said", role: "status" });
|
|
38
|
+
#items?: HTMLCollectionOf<Item>;
|
|
39
|
+
#words: string[] = [];
|
|
40
|
+
#watch = new MutationObserver(() => this.again());
|
|
41
|
+
#away = new AbortController();
|
|
42
|
+
#due = false;
|
|
43
|
+
|
|
44
|
+
get for() {
|
|
45
|
+
return this.getAttribute("for") ?? "";
|
|
46
|
+
}
|
|
47
|
+
/** The field an attribute names (`when="start"`), or the one of that name. */
|
|
48
|
+
field(attr: string) {
|
|
49
|
+
const name = this.getAttribute(attr) ?? attr;
|
|
50
|
+
return this.spec?.fields.find((f) => f.name === name);
|
|
51
|
+
}
|
|
52
|
+
/** A field as the page asks for it and says it: its label and its kind (its <j-field> in the sheet). */
|
|
53
|
+
asked(name: string): Asked | undefined {
|
|
54
|
+
const f = this.spec?.fields.find((f) => f.name === name);
|
|
55
|
+
return f && { ...f, ...kindOf(this.for, f.name) };
|
|
56
|
+
}
|
|
57
|
+
/** A field's words: its <j-field>'s label, or its name. */
|
|
58
|
+
label(name: string) {
|
|
59
|
+
const f = this.asked(name);
|
|
60
|
+
return f ? (f.label ?? worded(f)) : name;
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
this.#away = new AbortController();
|
|
64
|
+
const signal = this.#away.signal;
|
|
65
|
+
document.addEventListener(
|
|
66
|
+
"j-search",
|
|
67
|
+
(e) => {
|
|
68
|
+
const d = (e as CustomEvent).detail;
|
|
69
|
+
if (d.for === this.for) ((this.#words = d.words), this.again());
|
|
70
|
+
},
|
|
71
|
+
{ signal },
|
|
72
|
+
);
|
|
73
|
+
document.addEventListener("j-day", (e) => (e as CustomEvent).detail.param === this.param && this.again(), {
|
|
74
|
+
signal,
|
|
75
|
+
});
|
|
76
|
+
document.addEventListener("j-open", (e) => (e as CustomEvent).detail.for === this.for && this.again(), {
|
|
77
|
+
signal,
|
|
78
|
+
});
|
|
79
|
+
// a search there first has said its words already: they're read from it (as the rows do)
|
|
80
|
+
const search = document.querySelector<HTMLElement & { words?: string[] }>(`j-search[for="${this.for}"]`);
|
|
81
|
+
if (search)
|
|
82
|
+
this.#words =
|
|
83
|
+
search.words ?? wordsOf(new URLSearchParams(location.search).get(search.getAttribute("param") ?? "q") ?? "");
|
|
84
|
+
specOf(this.for, (s) => {
|
|
85
|
+
if (signal.aborted) return;
|
|
86
|
+
if (!this.spec) {
|
|
87
|
+
this.spec = s;
|
|
88
|
+
this.#items = document.getElementsByTagName(s.tag) as HTMLCollectionOf<Item>;
|
|
89
|
+
adopt(this.root, SHEET, ...(this.constructor as typeof Reading).sheets);
|
|
90
|
+
this.made();
|
|
91
|
+
this.root.append(this.line);
|
|
92
|
+
}
|
|
93
|
+
this.#watch.observe(document.body, { childList: true, subtree: true, attributes: true });
|
|
94
|
+
this.again();
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
disconnectedCallback() {
|
|
98
|
+
this.#watch.disconnect();
|
|
99
|
+
this.#away.abort();
|
|
100
|
+
}
|
|
101
|
+
/** Drawn again, once a moment however much changed; hidden, when it's shown again. */
|
|
102
|
+
again() {
|
|
103
|
+
if (this.#due || !this.spec) return;
|
|
104
|
+
this.#due = true;
|
|
105
|
+
queueMicrotask(() => ((this.#due = false), this.draw()));
|
|
106
|
+
}
|
|
107
|
+
/** Its collection's items on the page, as the search finds them. */
|
|
108
|
+
items(): Item[] {
|
|
109
|
+
return [...(this.#items ?? [])].filter(
|
|
110
|
+
(it) =>
|
|
111
|
+
it.isConnected &&
|
|
112
|
+
(!this.#words.length ||
|
|
113
|
+
found(
|
|
114
|
+
[this.named(it), ...Object.values(it.data ?? {}).filter((v) => typeof v === "string")].join(" "),
|
|
115
|
+
this.#words,
|
|
116
|
+
)),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
named(it: Item) {
|
|
120
|
+
return titled(it, this.spec?.title);
|
|
121
|
+
}
|
|
122
|
+
/** A field of an item said as its row says it (money as money), or nothing. */
|
|
123
|
+
says(it: Item, name: string) {
|
|
124
|
+
const f = this.asked(name),
|
|
125
|
+
v = it.data[name];
|
|
126
|
+
return f ? (reads(f, v) ?? (v === undefined || v === null ? "" : String(v))) : "";
|
|
127
|
+
}
|
|
128
|
+
/** The page's sheet of its collection. */
|
|
129
|
+
get sheet() {
|
|
130
|
+
return document.querySelector<PageSheet>(`j-sheet[for="${this.for}"]`);
|
|
131
|
+
}
|
|
132
|
+
open(it: Item) {
|
|
133
|
+
this.sheet?.show(it);
|
|
134
|
+
}
|
|
135
|
+
opened(it: Item) {
|
|
136
|
+
return this.sheet?.drawer?.open === it;
|
|
137
|
+
}
|
|
138
|
+
/** Whether this person may add to it. */
|
|
139
|
+
get adds() {
|
|
140
|
+
return !!this.spec && !!document.querySelector(`${this.spec.place}[may~="add"]`) && !!this.sheet;
|
|
141
|
+
}
|
|
142
|
+
/** A new item in its sheet, offered what's filled (the day and hour tapped), still asked. */
|
|
143
|
+
add(filled: Record<string, unknown>) {
|
|
144
|
+
this.sheet?.show("new", {}, filled);
|
|
145
|
+
}
|
|
146
|
+
/** Whether this person may change an item's field. */
|
|
147
|
+
may(it: Item, field: string | undefined) {
|
|
148
|
+
return !!field && (it.getAttribute("may") ?? "").split(" ").includes(`replace:${field}`);
|
|
149
|
+
}
|
|
150
|
+
/** A change made by a gesture: one write, its refusal said, and the reading drawn again as the document is. */
|
|
151
|
+
async change(it: Item, fields: Record<string, unknown>) {
|
|
152
|
+
this.line.textContent = "";
|
|
153
|
+
const why: Answer = await it.replace!(fields);
|
|
154
|
+
if (why) this.line.textContent = `Refused: ${why}`;
|
|
155
|
+
this.again();
|
|
156
|
+
return why;
|
|
157
|
+
}
|
|
158
|
+
/** An item's mark, the way into it, in the item's own colour: tapped (or Enter), its sheet opens; where `moves`, a
|
|
159
|
+
* press held follows the finger (a mouse's at once) and is let go with how far it went, a press that didn't move a
|
|
160
|
+
* tap. */
|
|
161
|
+
press(el: HTMLElement, it: Item, moves?: (dx: number, dy: number, done: boolean, e: PointerEvent | null) => void) {
|
|
162
|
+
el.style.setProperty("--hue", hueOf(it.key));
|
|
163
|
+
if (this.opened(it)) el.ariaCurrent = "true";
|
|
164
|
+
// a key's press (a click with no pointer's detail) opens it; a pointer's is told below
|
|
165
|
+
el.addEventListener("click", (e) => e.detail === 0 && this.open(it));
|
|
166
|
+
el.addEventListener("pointerdown", (down) => {
|
|
167
|
+
if (down.button !== 0) return;
|
|
168
|
+
const tap = () => this.open(it);
|
|
169
|
+
if (!moves) {
|
|
170
|
+
// nothing to move: a tap opens it, as a button does
|
|
171
|
+
el.addEventListener("pointerup", tap, { once: true });
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
held(
|
|
175
|
+
down,
|
|
176
|
+
() => {
|
|
177
|
+
let far = false;
|
|
178
|
+
el.toggleAttribute("dragged", true);
|
|
179
|
+
follow(
|
|
180
|
+
down,
|
|
181
|
+
(e) => {
|
|
182
|
+
const dx = e.clientX - down.clientX,
|
|
183
|
+
dy = e.clientY - down.clientY;
|
|
184
|
+
if (!far && Math.hypot(dx, dy) < 4) return;
|
|
185
|
+
far = true;
|
|
186
|
+
moves(dx, dy, false, e);
|
|
187
|
+
},
|
|
188
|
+
(e) => {
|
|
189
|
+
el.toggleAttribute("dragged", false);
|
|
190
|
+
if (!far) return (moves(0, 0, true, null), e && tap());
|
|
191
|
+
moves(e ? e.clientX - down.clientX : 0, e ? e.clientY - down.clientY : 0, true, e);
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
undefined,
|
|
196
|
+
tap,
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/** The time it reads its items by: the field `when` names, or its first date and time. */
|
|
201
|
+
get when() {
|
|
202
|
+
return this.field("when") ?? this.spec?.fields.find((f) => f.type === "date-time");
|
|
203
|
+
}
|
|
204
|
+
/** The day it shows: the address's, or its own attribute's; else today's where something is on or after it, or the
|
|
205
|
+
* last day something was (a trip planned ahead opens on its first day, one gone by on its last). */
|
|
206
|
+
get day() {
|
|
207
|
+
const said = new URLSearchParams(location.search).get(this.param) ?? this.getAttribute("day");
|
|
208
|
+
if (said && /^\d{4}-\d{2}-\d{2}/.test(said)) return dayOf(said);
|
|
209
|
+
const today = dayOf(now()),
|
|
210
|
+
f = this.when,
|
|
211
|
+
days = f
|
|
212
|
+
? this.items()
|
|
213
|
+
.map((it) => it.data[f.name])
|
|
214
|
+
.filter((w): w is string => typeof w === "string")
|
|
215
|
+
.map(dayOf)
|
|
216
|
+
.sort((a, b) => a - b)
|
|
217
|
+
: [];
|
|
218
|
+
if (!days.length || days.some((d) => d === today)) return today;
|
|
219
|
+
return days.find((d) => d >= today) ?? days.at(-1)!;
|
|
220
|
+
}
|
|
221
|
+
/** Another day shown: kept in the address (this page's alone). */
|
|
222
|
+
set day(d: number) {
|
|
223
|
+
const url = new URL(location.href);
|
|
224
|
+
url.searchParams.set(this.param, local(d * DAY).slice(0, 10));
|
|
225
|
+
history.replaceState(history.state, "", url);
|
|
226
|
+
// the readings of the same day follow it, and so may the page (what it holds of a window, ?month=)
|
|
227
|
+
document.dispatchEvent(
|
|
228
|
+
new CustomEvent("j-day", { detail: { param: this.param, day: local(d * DAY).slice(0, 10) } }),
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
get param() {
|
|
232
|
+
return this.getAttribute("param") ?? "day";
|
|
233
|
+
}
|
|
234
|
+
/** Made once: its parts in its shadow. */
|
|
235
|
+
protected abstract made(): void;
|
|
236
|
+
/** Drawn as the items are. */
|
|
237
|
+
protected abstract draw(): void;
|
|
238
|
+
}
|
package/src/rows.css
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/* A collection as rows (src/rows.ts). A row is its item's name, where it's got to beside it, and what else it holds
|
|
2
|
+
beneath, muted; at its end what its person may do there. What's under an item is set in from it, by a hairline. Every
|
|
3
|
+
size is a token, every type one of the styles (docs/design.md); under a finger a row's words and its deeds are 44px. */
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
/* a width of its own on a wide page, in the middle of it: what's done to a thing stays near it, and neither is
|
|
7
|
+
left at an edge */
|
|
8
|
+
max-width: var(--size-list);
|
|
9
|
+
margin-inline: auto;
|
|
10
|
+
margin-block-end: var(--space-24);
|
|
11
|
+
/* how far in from its edges everything in it is set: its rows' words, Add, what's said */
|
|
12
|
+
--inset: var(--space-12);
|
|
13
|
+
}
|
|
14
|
+
/* last in what holds it (a card), it leaves no room of its own under it: the card's edge is its foot */
|
|
15
|
+
:host(:last-child) {
|
|
16
|
+
margin-block-end: 0;
|
|
17
|
+
}
|
|
18
|
+
ul {
|
|
19
|
+
list-style: none;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
/* a list is two columns, shared by its rows: the words, and at the end of its width the deeds, in a line down the
|
|
24
|
+
list */
|
|
25
|
+
ul {
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-template-columns: minmax(0, 1fr) max-content;
|
|
28
|
+
column-gap: var(--space-24);
|
|
29
|
+
}
|
|
30
|
+
li[hidden] {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
li {
|
|
34
|
+
grid-column: 1 / -1;
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: subgrid;
|
|
37
|
+
}
|
|
38
|
+
ul[part="list"] > li {
|
|
39
|
+
border-top: 1px solid var(--line);
|
|
40
|
+
padding-block: var(--space-4);
|
|
41
|
+
padding-inline: var(--inset);
|
|
42
|
+
}
|
|
43
|
+
ul[part="list"] > li:last-child {
|
|
44
|
+
border-bottom: 1px solid var(--line);
|
|
45
|
+
}
|
|
46
|
+
.row {
|
|
47
|
+
grid-column: 1 / -1;
|
|
48
|
+
display: grid;
|
|
49
|
+
grid-template-columns: subgrid;
|
|
50
|
+
align-items: center;
|
|
51
|
+
row-gap: var(--space-4);
|
|
52
|
+
min-height: var(--size-finger);
|
|
53
|
+
}
|
|
54
|
+
/* a row with ticks: they stand before its words, in line with the words' first line, and take their room from them */
|
|
55
|
+
.ticked {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: flex-start;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
margin-left: calc(-1 * var(--space-12));
|
|
60
|
+
}
|
|
61
|
+
.ticked > .col {
|
|
62
|
+
flex: 1;
|
|
63
|
+
}
|
|
64
|
+
/* an item's words, and under them what of it pops: one column */
|
|
65
|
+
.col {
|
|
66
|
+
min-width: 0;
|
|
67
|
+
display: grid;
|
|
68
|
+
}
|
|
69
|
+
.pops {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: var(--space-6);
|
|
74
|
+
padding-block-end: var(--space-8);
|
|
75
|
+
}
|
|
76
|
+
.pops > .j-mention {
|
|
77
|
+
margin: 0;
|
|
78
|
+
max-width: 100%;
|
|
79
|
+
}
|
|
80
|
+
.places {
|
|
81
|
+
flex-basis: 100%;
|
|
82
|
+
}
|
|
83
|
+
.open {
|
|
84
|
+
justify-self: stretch;
|
|
85
|
+
min-width: 0;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: var(--space-6) 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
border-radius: var(--radius);
|
|
90
|
+
background: none;
|
|
91
|
+
color: var(--ink);
|
|
92
|
+
font: var(--font-row);
|
|
93
|
+
text-align: start;
|
|
94
|
+
}
|
|
95
|
+
/* a row is one target, a finger tall at least (docs/design.md, "A row") */
|
|
96
|
+
.open {
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
min-height: var(--size-finger);
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: var(--space-12);
|
|
102
|
+
}
|
|
103
|
+
.said-of {
|
|
104
|
+
flex: 1;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
}
|
|
107
|
+
button.open {
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
}
|
|
110
|
+
/* it says it opens: a chevron at its end, faint; ink under the pointer, and while its drawer is open */
|
|
111
|
+
button.open > svg.icon {
|
|
112
|
+
flex: none;
|
|
113
|
+
color: var(--edge);
|
|
114
|
+
}
|
|
115
|
+
button.open:is(:hover, [aria-current]) > svg.icon {
|
|
116
|
+
color: var(--ink);
|
|
117
|
+
}
|
|
118
|
+
/* the row whose drawer is open: a shade down, a stripe of accent at its start (docs/design.md, "A row") */
|
|
119
|
+
li:has(> .row .open[aria-current]) {
|
|
120
|
+
position: relative;
|
|
121
|
+
background: var(--card-hover);
|
|
122
|
+
}
|
|
123
|
+
li:has(> .row .open[aria-current])::before {
|
|
124
|
+
content: "";
|
|
125
|
+
position: absolute;
|
|
126
|
+
inset-block: 0;
|
|
127
|
+
inset-inline-start: 0;
|
|
128
|
+
width: var(--space-4);
|
|
129
|
+
background: var(--accent);
|
|
130
|
+
}
|
|
131
|
+
button.open:hover .name {
|
|
132
|
+
text-decoration: underline;
|
|
133
|
+
}
|
|
134
|
+
button.open:focus-visible {
|
|
135
|
+
outline: 2px solid var(--accent);
|
|
136
|
+
outline-offset: var(--space-4);
|
|
137
|
+
}
|
|
138
|
+
.name {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-wrap: wrap;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: var(--space-8);
|
|
143
|
+
font-weight: 600;
|
|
144
|
+
}
|
|
145
|
+
/* where it's got to: a tag, a pill, never a button */
|
|
146
|
+
.state {
|
|
147
|
+
padding: 0 var(--space-8);
|
|
148
|
+
border: 1px solid var(--edge);
|
|
149
|
+
border-radius: var(--radius-pill);
|
|
150
|
+
color: var(--muted);
|
|
151
|
+
font: var(--font-small);
|
|
152
|
+
}
|
|
153
|
+
small {
|
|
154
|
+
display: block;
|
|
155
|
+
margin-top: var(--space-4);
|
|
156
|
+
color: var(--muted);
|
|
157
|
+
font: var(--font-small);
|
|
158
|
+
}
|
|
159
|
+
.faces {
|
|
160
|
+
display: inline-flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
gap: var(--space-4);
|
|
163
|
+
vertical-align: middle;
|
|
164
|
+
}
|
|
165
|
+
.deeds {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-wrap: wrap;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: var(--space-6);
|
|
170
|
+
}
|
|
171
|
+
.deeds:empty {
|
|
172
|
+
display: none;
|
|
173
|
+
}
|
|
174
|
+
/* a list each member's own: its word, the faces of those in it, how many */
|
|
175
|
+
.mine {
|
|
176
|
+
gap: var(--space-6);
|
|
177
|
+
}
|
|
178
|
+
.mine > b {
|
|
179
|
+
min-width: 1ch;
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
}
|
|
182
|
+
.mine > .j-face {
|
|
183
|
+
margin-inline-end: calc(-1 * var(--space-10));
|
|
184
|
+
}
|
|
185
|
+
.mine > .j-face + b {
|
|
186
|
+
margin-inline-start: var(--space-10);
|
|
187
|
+
}
|
|
188
|
+
/* what's under an item: set in, each a row of its own */
|
|
189
|
+
.under {
|
|
190
|
+
grid-column: 1 / -1;
|
|
191
|
+
margin-inline-start: var(--space-16);
|
|
192
|
+
padding-inline-start: var(--space-12);
|
|
193
|
+
border-inline-start: 2px solid var(--line);
|
|
194
|
+
}
|
|
195
|
+
.under > li + li {
|
|
196
|
+
border-top: 1px solid var(--line);
|
|
197
|
+
}
|
|
198
|
+
.under .name {
|
|
199
|
+
font-weight: 400;
|
|
200
|
+
}
|
|
201
|
+
.adding {
|
|
202
|
+
grid-column: 1 / -1;
|
|
203
|
+
justify-self: start;
|
|
204
|
+
margin: var(--space-12) var(--inset);
|
|
205
|
+
}
|
|
206
|
+
li > .adding {
|
|
207
|
+
margin-inline-start: var(--space-16);
|
|
208
|
+
}
|
|
209
|
+
.none {
|
|
210
|
+
margin: 0;
|
|
211
|
+
padding: var(--space-12) var(--inset);
|
|
212
|
+
color: var(--muted);
|
|
213
|
+
font: var(--font-small);
|
|
214
|
+
}
|
|
215
|
+
.said:not(:empty) {
|
|
216
|
+
margin: var(--space-8) var(--inset);
|
|
217
|
+
}
|
|
218
|
+
/* a link's two ways of choosing: one is shown, by how many there are to choose from */
|
|
219
|
+
:is(wa-select, label)[hidden] {
|
|
220
|
+
display: none;
|
|
221
|
+
}
|
|
222
|
+
/* nothing under an item yet: said, where its list would be */
|
|
223
|
+
.under:empty {
|
|
224
|
+
border: 0;
|
|
225
|
+
}
|
|
226
|
+
.under:empty::before {
|
|
227
|
+
content: attr(data-none);
|
|
228
|
+
display: block;
|
|
229
|
+
padding-block: var(--space-6);
|
|
230
|
+
color: var(--muted);
|
|
231
|
+
font: var(--font-small);
|
|
232
|
+
}
|
|
233
|
+
@media (max-width: 40rem) {
|
|
234
|
+
.act.small {
|
|
235
|
+
min-height: var(--size-finger);
|
|
236
|
+
}
|
|
237
|
+
/* on a phone, one column: the deeds under the words they're of */
|
|
238
|
+
ul {
|
|
239
|
+
grid-template-columns: minmax(0, 1fr);
|
|
240
|
+
}
|
|
241
|
+
/* (a row's deeds beside its words where there's room, under them where there isn't) */
|
|
242
|
+
.row {
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-wrap: wrap;
|
|
245
|
+
justify-content: space-between;
|
|
246
|
+
column-gap: var(--space-12);
|
|
247
|
+
padding-block-end: var(--space-8);
|
|
248
|
+
}
|
|
249
|
+
/* its words take what room there is, half the row at least: a deed as small as a grip stays beside them */
|
|
250
|
+
.row > :first-child {
|
|
251
|
+
flex: 1 1 50%;
|
|
252
|
+
min-width: 0;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* whose order it's in, at its head */
|
|
257
|
+
.whose[hidden] {
|
|
258
|
+
display: none;
|
|
259
|
+
}
|
|
260
|
+
.whose {
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-wrap: wrap;
|
|
263
|
+
align-items: center;
|
|
264
|
+
gap: var(--space-8);
|
|
265
|
+
padding-block-end: var(--space-8);
|
|
266
|
+
color: var(--muted);
|
|
267
|
+
font: var(--font-small);
|
|
268
|
+
}
|
|
269
|
+
.whose .j-chips > button {
|
|
270
|
+
padding-left: var(--space-10);
|
|
271
|
+
}
|
|
272
|
+
.whose .j-chips > button:has(.j-face) {
|
|
273
|
+
padding-left: var(--space-4);
|
|
274
|
+
}
|
|
275
|
+
.whose .j-chips > [aria-pressed="true"] {
|
|
276
|
+
border: 1px solid var(--ink);
|
|
277
|
+
background: var(--card-hover);
|
|
278
|
+
color: var(--ink);
|
|
279
|
+
}
|
|
280
|
+
/* a row's grip, in my own order: a finger wide, at the row's end; dragged, its row stands over the others */
|
|
281
|
+
.grip {
|
|
282
|
+
width: var(--size-finger);
|
|
283
|
+
height: var(--size-finger);
|
|
284
|
+
cursor: grab;
|
|
285
|
+
touch-action: none;
|
|
286
|
+
}
|
|
287
|
+
li[dragged] {
|
|
288
|
+
z-index: 1;
|
|
289
|
+
position: relative;
|
|
290
|
+
background: var(--card);
|
|
291
|
+
outline: 1px solid var(--control-edge);
|
|
292
|
+
}
|
|
293
|
+
/* a name alone is added by a box on the page, the list's width */
|
|
294
|
+
form.adding.box {
|
|
295
|
+
justify-self: stretch;
|
|
296
|
+
display: flex;
|
|
297
|
+
flex-wrap: wrap;
|
|
298
|
+
gap: var(--space-8);
|
|
299
|
+
}
|
|
300
|
+
form.adding.box > input {
|
|
301
|
+
flex: 1;
|
|
302
|
+
}
|
|
303
|
+
form.adding.box > .said {
|
|
304
|
+
flex-basis: 100%;
|
|
305
|
+
}
|
|
306
|
+
form.adding[hidden] {
|
|
307
|
+
display: none;
|
|
308
|
+
}
|