@blueshed/joined 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/joined/SKILL.md +9 -1
- package/.claude/skills/joined/reference.md +270 -55
- package/.claude/skills/joined-door/SKILL.md +57 -0
- package/README.md +19 -50
- package/docs/design.md +76 -10
- package/docs/introduction.md +18 -18
- package/docs/light-and-shadow.svg +1 -1
- package/examples/README.md +20 -0
- package/examples/account/account.json +1 -0
- package/examples/account/derive.ts +41 -0
- package/examples/account/generated/elements.ts +52 -0
- package/examples/account/generated/rows.ts +22 -0
- package/examples/account/generated/rules.ts +32 -0
- package/examples/account/routes.ts +5 -0
- package/examples/app.css +2 -1
- package/examples/cafe/books.html +2 -2
- package/examples/cafe/cafe.css +9 -16
- package/examples/cafe/generated/books.rows.ts +22 -0
- package/examples/cafe/generated/books.rules.ts +3 -2
- package/examples/cafe/generated/kitchen.rows.ts +27 -0
- package/examples/cafe/generated/kitchen.rules.ts +11 -1
- package/examples/cafe/generated/menu.rows.ts +22 -0
- package/examples/cafe/generated/menu.rules.ts +3 -2
- package/examples/cafe/generated/order.rows.ts +27 -0
- package/examples/cafe/generated/order.rules.ts +11 -1
- package/examples/cafe/generated/staff.rows.ts +22 -0
- package/examples/cafe/generated/staff.rules.ts +6 -1
- package/examples/cafe/generated/supplies.queries.ts +4 -2
- package/examples/cafe/generated/supplies.rows.ts +22 -0
- package/examples/cafe/generated/supplies.rules.ts +12 -1
- package/examples/cafe/generated/till.queries.ts +2 -0
- package/examples/cafe/generated/till.rows.ts +27 -0
- package/examples/cafe/generated/till.rules.ts +11 -1
- package/examples/cafe/index.html +14 -15
- package/examples/cafe/kitchen.ts +1 -1
- package/examples/cafe/look.ts +30 -0
- package/examples/cafe/menu.html +10 -26
- package/examples/cafe/menu.ts +8 -80
- package/examples/cafe/order.html +6 -6
- package/examples/cafe/order.ts +5 -1
- package/examples/cafe/routes.ts +0 -1
- package/examples/cafe/stories.jsonl +3 -1
- package/examples/cafe/supplies.html +34 -34
- package/examples/cafe/supplies.ts +14 -11
- package/examples/cafe/till.ts +5 -1
- package/examples/chart/arches.ts +148 -0
- package/examples/chart/chart.css +6 -0
- package/examples/chart/chart.json +87 -0
- package/examples/chart/generated/elements.ts +105 -0
- package/examples/chart/generated/queries.ts +36 -0
- package/examples/chart/generated/rows.ts +27 -0
- package/examples/chart/generated/rules.ts +111 -0
- package/examples/chart/grid.ts +118 -0
- package/examples/chart/index.html +78 -0
- package/examples/chart/migrations/001-chart.ts +6 -0
- package/examples/chart/migrations/002-create-conditions.ts +6 -0
- package/examples/chart/page.ts +20 -0
- package/examples/chart/routes.ts +7 -0
- package/examples/chart/stories.jsonl +14 -0
- package/examples/chart/teeth.ts +57 -0
- package/examples/desk/generated/rows.ts +22 -0
- package/examples/desk/generated/rules.ts +34 -1
- package/examples/desk/index.html +9 -2
- package/examples/desk/routes.ts +0 -2
- package/examples/desk/stories.jsonl +3 -2
- package/examples/desk/thumbs.ts +2 -2
- package/examples/hello/generated/elements.ts +2 -2
- package/examples/hello/generated/rules.ts +3 -2
- package/examples/hello/hello.css +2 -4
- package/examples/hello/index.html +10 -3
- package/examples/hello/page.ts +4 -4
- package/examples/index.html +4 -5
- package/examples/notes/generated/elements.ts +112 -0
- package/examples/notes/generated/queries.ts +36 -0
- package/examples/notes/generated/rows.ts +27 -0
- package/examples/notes/generated/rules.ts +133 -0
- package/examples/notes/index.html +32 -0
- package/examples/notes/look.ts +41 -0
- package/examples/notes/migrations/001-notes.ts +7 -0
- package/examples/notes/notes.json +78 -0
- package/examples/notes/page.ts +21 -0
- package/examples/notes/routes.ts +6 -0
- package/examples/notes/stories.jsonl +21 -0
- package/examples/people/generated/rows.ts +22 -0
- package/examples/people/generated/rules.ts +11 -1
- package/examples/people/links.ts +2 -1
- package/examples/people/routes.ts +1 -3
- package/examples/people/stories.jsonl +1 -0
- package/examples/people/view.ts +5 -2
- package/examples/trip/generated/elements.ts +4 -2
- package/examples/trip/generated/queries.ts +12 -1
- package/examples/trip/generated/rows.ts +27 -0
- package/examples/trip/generated/rules.ts +56 -2
- package/examples/trip/index.html +58 -12
- package/examples/trip/line.css +186 -0
- package/examples/trip/line.ts +51 -40
- package/examples/trip/page.ts +65 -71
- package/examples/trip/routes.ts +9 -5
- package/examples/trip/stays.css +12 -12
- package/examples/trip/stays.ts +15 -10
- package/examples/trip/stories.jsonl +2 -0
- package/examples/trip/told.ts +3 -26
- package/examples/trip/trip.css +16 -0
- package/examples/trips/generated/rows.ts +22 -0
- package/examples/trips/generated/rules.ts +9 -1
- package/examples/trips/index.html +10 -10
- package/examples/trips/map.ts +3 -14
- package/examples/trips/new-trip.ts +14 -16
- package/examples/weeks/generated/elements.ts +1 -1
- package/examples/weeks/generated/queries.ts +11 -0
- package/examples/weeks/generated/rows.ts +22 -0
- package/examples/weeks/generated/rules.ts +11 -5
- package/examples/weeks/routes.ts +3 -2
- package/examples/weeks/stories.jsonl +1 -0
- package/examples/welcome.css +7 -5
- package/package.json +8 -2
- package/src/awesome.ts +103 -0
- package/src/board.css +75 -0
- package/src/board.ts +173 -0
- package/src/cli.ts +15 -2
- package/src/compile.ts +569 -35
- package/src/definitions.ts +53 -15
- package/src/draft.ts +38 -23
- package/src/drawer.ts +222 -0
- package/src/engine.ts +240 -166
- package/src/fields.ts +268 -0
- package/src/files.ts +6 -4
- package/src/ground.ts +110 -0
- package/src/icon-names.ts +15 -2
- package/src/kit.ts +51 -0
- package/src/link.ts +3 -3
- package/src/map.css +133 -0
- package/src/map.ts +200 -0
- package/src/mcp.ts +176 -38
- package/src/members/demo.ts +13 -12
- package/src/members/generated/rows.ts +22 -0
- package/src/members/generated/rules.ts +3 -2
- package/src/members/group.ts +65 -39
- package/src/members/keys.ts +93 -77
- package/src/members/panel.css +23 -17
- package/src/members/panel.ts +49 -35
- package/src/migrate.ts +120 -104
- package/src/month.css +125 -0
- package/src/month.ts +179 -0
- package/src/page.css +8 -0
- package/src/page.ts +11 -7
- package/src/parts.css +462 -170
- package/src/parts.ts +209 -26
- package/src/plane.css +56 -0
- package/src/plane.ts +151 -0
- package/src/postgres-server.ts +60 -0
- package/src/reading.css +77 -0
- package/src/reading.ts +238 -0
- package/src/rows.css +308 -0
- package/src/rows.ts +780 -0
- package/src/search.css +80 -0
- package/src/search.ts +130 -0
- package/src/server.ts +211 -114
- package/src/settings.ts +9 -4
- package/src/sheet.ts +114 -0
- package/src/skill.ts +40 -0
- package/src/slots.css +94 -0
- package/src/slots.ts +213 -0
- package/src/specs.ts +38 -0
- package/src/starter.ts +5 -2
- package/src/store.ts +184 -143
- package/src/stories.ts +43 -11
- package/src/surface.ts +159 -0
- package/src/timeline.css +111 -0
- package/src/timeline.ts +226 -0
- package/src/toast.ts +21 -48
- package/src/together.ts +0 -7
- package/src/tokens.css +78 -1
- package/src/tokens.json +249 -0
- package/src/tool.ts +211 -0
- package/src/upkeep.ts +18 -20
- package/src/views.css +44 -0
- package/src/views.ts +94 -0
- package/src/week.css +151 -0
- package/src/week.ts +250 -0
- package/src/write.ts +219 -73
- package/starter/CLAUDE.md +3 -3
- package/starter/bunfig +4 -0
- package/starter/prettierignore +4 -0
- package/starter/tests/hello.test.ts +2 -0
- package/docs/learning.md +0 -76
- package/examples/cafe/trust.ts +0 -20
- package/examples/desk/trust.ts +0 -24
- package/examples/people/trust.ts +0 -14
- package/examples/trip/answer-rows.ts +0 -70
- package/examples/trip/bar.ts +0 -89
- package/examples/trip/calendar-map.css +0 -711
- package/examples/trip/calendar-map.ts +0 -249
- package/examples/trip/drags.ts +0 -143
- package/examples/trip/drawer.ts +0 -250
- package/examples/trip/event-form.ts +0 -200
- package/examples/trip/holding.ts +0 -61
- package/examples/trip/map.ts +0 -234
- package/examples/trip/month.ts +0 -87
- package/examples/trip/other-weeks.ts +0 -67
- package/examples/trip/peek.ts +0 -71
- package/examples/trip/people-chips.ts +0 -74
- package/examples/trip/shell.ts +0 -39
- package/examples/trip/trust.ts +0 -51
- package/examples/trip/week.ts +0 -237
- package/examples/trip/writes.ts +0 -91
- package/examples/trip/zones.ts +0 -16
- package/examples/weeks/derive.ts +0 -23
- package/src/scrim.ts +0 -81
package/src/stories.ts
CHANGED
|
@@ -12,11 +12,26 @@ import type { Op } from "./ops.ts";
|
|
|
12
12
|
import { madeBy, partsOf, type Part, type Told } from "./together.ts";
|
|
13
13
|
|
|
14
14
|
const folderOf = (doc: string, dir: string) => (doc === "members" ? OWN : `${dir}/${doc}`);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/** An app's story lines, by its folder's name. A document's name that's no folder's (an app's stories may write
|
|
16
|
+
* several documents: a race's entries) is refused, saying whose stories write it. */
|
|
17
|
+
const lines = async (app: string, dir: string) => {
|
|
18
|
+
const file = Bun.file(`${folderOf(app, dir)}/stories.jsonl`);
|
|
19
|
+
if (!(await file.exists())) {
|
|
20
|
+
const whose: string[] = [];
|
|
21
|
+
for await (const path of new Bun.Glob("*/stories.jsonl").scan(dir))
|
|
22
|
+
if (new RegExp(`"doc":\\s*"${app}[":?]`).test(await Bun.file(`${dir}/${path}`).text()))
|
|
23
|
+
whose.push(path.split("/")[0]!);
|
|
24
|
+
throw new Error(
|
|
25
|
+
whose.length
|
|
26
|
+
? `${app} is a document of ${whose.join(" and ")}'s stories, not an app's folder: tell("${whose[0]}") tells them, every document they write`
|
|
27
|
+
: `${app} is no app's folder (${dir}/${app}/stories.jsonl isn't there): the stories are told by their app's folder`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return (await file.text())
|
|
17
31
|
.split("\n")
|
|
18
32
|
.filter((l) => l.trim())
|
|
19
33
|
.map((l) => JSON.parse(l));
|
|
34
|
+
};
|
|
20
35
|
|
|
21
36
|
/** A document's stories, from its app's folder (the members': joined's own). */
|
|
22
37
|
export const storiesOf = async (doc: string, dir = APPS) => (await lines(doc, dir)).filter((l) => l.story) as Story[];
|
|
@@ -52,7 +67,9 @@ export async function fresh({
|
|
|
52
67
|
const tokenFor = async (name: string, cast: Record<string, string | null> = {}) => {
|
|
53
68
|
const as = name in cast ? cast[name] : name;
|
|
54
69
|
if (as === null) return undefined;
|
|
55
|
-
const m = (server.read("members").members as Member[]).find(
|
|
70
|
+
const m = ((await server.read("members")).members as Member[]).find(
|
|
71
|
+
(x) => x.name.toLowerCase() === as!.toLowerCase(),
|
|
72
|
+
);
|
|
56
73
|
if (!m) throw new Error(`no member named ${as}`);
|
|
57
74
|
return (await server.tokenOf(m.id))!;
|
|
58
75
|
};
|
|
@@ -64,8 +81,8 @@ export async function fresh({
|
|
|
64
81
|
root,
|
|
65
82
|
tokenFor,
|
|
66
83
|
stop: async () => {
|
|
67
|
-
server.stop(true);
|
|
68
|
-
server.store.close();
|
|
84
|
+
await server.stop(true);
|
|
85
|
+
await server.store.close();
|
|
69
86
|
rmSync(files, { recursive: true, force: true });
|
|
70
87
|
await gone();
|
|
71
88
|
},
|
|
@@ -122,7 +139,8 @@ const QUIET = 100,
|
|
|
122
139
|
* holds its value as the teller's page holds the document after (another document's, named before it); one that cannot
|
|
123
140
|
* is refused, in its refused words where it has them, at the door when its teller is nobody, and the document
|
|
124
141
|
* is as it was. A story with no `as` is anonymous: told on a server that's open, by a page signed in as nobody,
|
|
125
|
-
* its premise a list of writes.
|
|
142
|
+
* its premise a list of writes. It's by app folder, not by document: an app of several documents (a race and its
|
|
143
|
+
* entries) is told whole by its folder's name, and a document's name that's no folder's is refused, saying whose. */
|
|
126
144
|
export async function tell(doc: string, dir = APPS, engine = ENGINE) {
|
|
127
145
|
const cast = await castOf(doc, dir);
|
|
128
146
|
// whether a story's document is sent as each person sees it: its own rules, of an app of one document or several
|
|
@@ -141,6 +159,8 @@ export async function tell(doc: string, dir = APPS, engine = ENGINE) {
|
|
|
141
159
|
return r.sees ? "some" : r.view ? "whole" : null;
|
|
142
160
|
};
|
|
143
161
|
const wrong: string[] = [];
|
|
162
|
+
// how many writes the app's own rules (its trust.ts) refuse as its stories are told: none of an app with none
|
|
163
|
+
let ruled: number | undefined;
|
|
144
164
|
for (const s of await toldOf(doc, dir)) {
|
|
145
165
|
const anonymous = s.as === undefined,
|
|
146
166
|
as = s.as ?? ANYONE;
|
|
@@ -195,11 +215,19 @@ export async function tell(doc: string, dir = APPS, engine = ENGINE) {
|
|
|
195
215
|
for (const n of names)
|
|
196
216
|
for (const d of docs)
|
|
197
217
|
if (!pages[n]!.refused && !joined.has(`${n} ${d}`)) (joined.add(`${n} ${d}`), await pages[n]!.subscribe(d));
|
|
198
|
-
const
|
|
199
|
-
|
|
218
|
+
const versions = async () => {
|
|
219
|
+
const v = new Map<string, number>();
|
|
220
|
+
for (const d of docs) v.set(d, (await server.read(d)).version);
|
|
221
|
+
return v;
|
|
222
|
+
};
|
|
223
|
+
const before = await versions();
|
|
224
|
+
const unchanged = async () => {
|
|
225
|
+
const now = await versions();
|
|
226
|
+
return docs.every((d) => now.get(d) === before.get(d));
|
|
227
|
+
};
|
|
200
228
|
if (pages[as]!.refused) {
|
|
201
229
|
if (!s.cannot) wrong.push(`${s.story}: refused at the door`);
|
|
202
|
-
if (!unchanged()) wrong.push(`${s.story}: refused at the door, and the document changed`);
|
|
230
|
+
if (!(await unchanged())) wrong.push(`${s.story}: refused at the door, and the document changed`);
|
|
203
231
|
// in the words it's refused in there, where the server says them (No access)
|
|
204
232
|
const why = pages[as]!.heard.find((m) => m.doc === at && m.refused === true)?.why;
|
|
205
233
|
if (s.refused && why !== s.refused)
|
|
@@ -209,7 +237,7 @@ export async function tell(doc: string, dir = APPS, engine = ENGINE) {
|
|
|
209
237
|
// the member it's by: an anonymous story's is nobody's
|
|
210
238
|
const writer = anonymous
|
|
211
239
|
? null
|
|
212
|
-
: (server.read("members").members as Member[]).find(
|
|
240
|
+
: ((await server.read("members")).members as Member[]).find(
|
|
213
241
|
(x) => x.name.toLowerCase() === (cast[as] ?? as).toLowerCase(),
|
|
214
242
|
)!.id;
|
|
215
243
|
// each part a page hears: its document's change, at the version it makes there or later (a document told as each
|
|
@@ -237,7 +265,7 @@ export async function tell(doc: string, dir = APPS, engine = ENGINE) {
|
|
|
237
265
|
);
|
|
238
266
|
const said = await send(as, write);
|
|
239
267
|
if (s.cannot && !said.refused) wrong.push(`${s.story}: let through`);
|
|
240
|
-
if (s.cannot && !unchanged()) wrong.push(`${s.story}: refused, and the document changed`);
|
|
268
|
+
if (s.cannot && !(await unchanged())) wrong.push(`${s.story}: refused, and the document changed`);
|
|
241
269
|
if (s.cannot && said.refused && s.refused && said.why !== s.refused)
|
|
242
270
|
wrong.push(`${s.story}: refused as "${said.why}", not "${s.refused}"`);
|
|
243
271
|
if (s.does && !said.done) wrong.push(`${s.story}: refused: ${said.why}`);
|
|
@@ -282,9 +310,13 @@ export async function tell(doc: string, dir = APPS, engine = ENGINE) {
|
|
|
282
310
|
}
|
|
283
311
|
for (const p of Object.values(pages)) p.ws.close();
|
|
284
312
|
} finally {
|
|
313
|
+
if (server.ruled.has(doc)) ruled = (ruled ?? 0) + server.ruled.get(doc)!;
|
|
285
314
|
await stop();
|
|
286
315
|
}
|
|
287
316
|
}
|
|
317
|
+
// rules no story reaches are a guess, as a definition no story checks is: the compiler can't read them, so here
|
|
318
|
+
if (ruled === 0)
|
|
319
|
+
wrong.push(`${doc}'s trust.ts refuses nothing its stories tell: a cannot story for each of its rules`);
|
|
288
320
|
return wrong;
|
|
289
321
|
}
|
|
290
322
|
|
package/src/surface.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// A drawer or a sheet (design.md, "Three surfaces"), one surface drawn as the screen is: wider, joined's own, a drawer
|
|
2
|
+
// docked at the right with the page beside it as it was (nothing dimmed; a row still tapped beside it), or a sheet
|
|
3
|
+
// popped beside the page; on a phone, Web Awesome's wa-drawer risen from the foot, the page dimmed behind it, a tap
|
|
4
|
+
// there closing it. Its title, what it holds and its foot are moved between the two as the screen changes, so a
|
|
5
|
+
// display builds them once. Its ×, Escape (wherever you are, unless a modal or something before it took it) and,
|
|
6
|
+
// on a phone, a tap on the dimmed page close it, each told to `closed`.
|
|
7
|
+
|
|
8
|
+
import { iconButton } from "./icons.ts";
|
|
9
|
+
import { phone } from "./parts.ts";
|
|
10
|
+
|
|
11
|
+
type Wa = HTMLElement & { open: boolean };
|
|
12
|
+
|
|
13
|
+
/** The docked drawers open, in the order they opened: Escape closes the last. */
|
|
14
|
+
const docked: Surface[] = [];
|
|
15
|
+
document.addEventListener("keydown", (e) => {
|
|
16
|
+
if (e.key !== "Escape" || e.defaultPrevented || document.querySelector("wa-dialog[open]")) return;
|
|
17
|
+
const top = docked.at(-1);
|
|
18
|
+
if (top) (e.preventDefault(), top.closed());
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export class Surface {
|
|
22
|
+
/** Joined's, wider: a drawer docked at the right (hidden while closed), or a sheet that pops (a popover). */
|
|
23
|
+
readonly wide: HTMLElement;
|
|
24
|
+
/** Web Awesome's, on a phone: risen from the foot. */
|
|
25
|
+
readonly phone = Object.assign(document.createElement("wa-drawer"), { placement: "bottom" }) as Wa;
|
|
26
|
+
/** Its title, the thing's name or the list's. */
|
|
27
|
+
readonly title = document.createElement("h2");
|
|
28
|
+
readonly close = Object.assign(iconButton("close", "Close"), { name: "close" });
|
|
29
|
+
#head = document.createElement("header");
|
|
30
|
+
#open = false;
|
|
31
|
+
#bare = false;
|
|
32
|
+
constructor(
|
|
33
|
+
readonly kind: "drawer" | "sheet",
|
|
34
|
+
/** What it holds, between its head and its foot. */
|
|
35
|
+
readonly body: HTMLElement,
|
|
36
|
+
/** Its deeds, at its foot (none, for a sheet that has none). */
|
|
37
|
+
readonly foot: HTMLElement | null,
|
|
38
|
+
/** Told as it's closed by a person (its ×, Escape, a tap away): never by `open = false`. */
|
|
39
|
+
readonly closed: () => void,
|
|
40
|
+
/** `head: false`: what it holds has its own head (its title, and this surface's × put there by its maker). */
|
|
41
|
+
{
|
|
42
|
+
part = kind,
|
|
43
|
+
label = "",
|
|
44
|
+
head = true,
|
|
45
|
+
wide,
|
|
46
|
+
}: { part?: string; label?: string; head?: boolean; wide?: HTMLElement } = {},
|
|
47
|
+
) {
|
|
48
|
+
this.#bare = !head;
|
|
49
|
+
if (!head) this.phone.setAttribute("without-header", "");
|
|
50
|
+
this.wide =
|
|
51
|
+
wide ??
|
|
52
|
+
(kind === "drawer"
|
|
53
|
+
? Object.assign(document.createElement("aside"), { className: "drawer", hidden: true })
|
|
54
|
+
: Object.assign(document.createElement("div"), { className: "sheet", popover: "auto" }));
|
|
55
|
+
for (const el of [this.wide, this.phone]) {
|
|
56
|
+
if (!el.hasAttribute("part")) el.setAttribute("part", part);
|
|
57
|
+
if (label) el.ariaLabel = label;
|
|
58
|
+
}
|
|
59
|
+
this.phone.setAttribute("light-dismiss", "");
|
|
60
|
+
this.close.addEventListener("click", () => this.closed());
|
|
61
|
+
// what's in it asks it to close (a link chosen in it): j-close, from anything inside
|
|
62
|
+
for (const el of [this.wide, this.phone]) el.addEventListener("j-close", () => this.#open && this.closed());
|
|
63
|
+
// a person's close, told once: the phone's (its ×, a tap away, Escape), a sheet's tap away
|
|
64
|
+
this.phone.addEventListener("wa-hide", (e) => e.target === this.phone && this.#open && this.closed());
|
|
65
|
+
this.wide.addEventListener("toggle", (e) => {
|
|
66
|
+
if ((e as ToggleEvent).newState === "closed" && this.#open && !phone.matches) this.closed();
|
|
67
|
+
});
|
|
68
|
+
phone.addEventListener("change", () => this.#place());
|
|
69
|
+
this.#place();
|
|
70
|
+
}
|
|
71
|
+
/** Each element it may be drawn as, to put where it lives (a display's shadow, the page). */
|
|
72
|
+
get els() {
|
|
73
|
+
return [this.wide, this.phone];
|
|
74
|
+
}
|
|
75
|
+
get open() {
|
|
76
|
+
return this.#open;
|
|
77
|
+
}
|
|
78
|
+
set open(open: boolean) {
|
|
79
|
+
if (this.#open === open) return;
|
|
80
|
+
this.#open = open;
|
|
81
|
+
const i = docked.indexOf(this);
|
|
82
|
+
if (i >= 0) docked.splice(i, 1);
|
|
83
|
+
if (open && this.kind === "drawer" && !phone.matches) docked.push(this);
|
|
84
|
+
this.#show();
|
|
85
|
+
}
|
|
86
|
+
/** What it holds and its foot put back in it, once a modal has borrowed them (one asking for a new thing). */
|
|
87
|
+
hold() {
|
|
88
|
+
const foot = this.foot ? [this.foot] : [];
|
|
89
|
+
if (phone.matches) (this.foot && (this.foot.slot = "footer"), this.phone.append(this.body, ...foot));
|
|
90
|
+
else (this.foot?.removeAttribute("slot"), this.wide.append(this.body, ...foot));
|
|
91
|
+
}
|
|
92
|
+
/** Its title, what it holds and its foot, in the one the screen draws. */
|
|
93
|
+
#place() {
|
|
94
|
+
const was = this.#open;
|
|
95
|
+
this.#open = false;
|
|
96
|
+
this.#show();
|
|
97
|
+
const title = this.#bare ? [] : [this.title];
|
|
98
|
+
if (phone.matches) {
|
|
99
|
+
this.title.slot = "label";
|
|
100
|
+
if (this.foot) this.foot.slot = "footer";
|
|
101
|
+
this.phone.append(...title, this.body, ...(this.foot ? [this.foot] : []));
|
|
102
|
+
} else {
|
|
103
|
+
this.title.removeAttribute("slot");
|
|
104
|
+
this.foot?.removeAttribute("slot");
|
|
105
|
+
if (!this.#bare) this.#head.append(this.title, this.close);
|
|
106
|
+
this.wide.append(...(this.#bare ? [] : [this.#head]), this.body, ...(this.foot ? [this.foot] : []));
|
|
107
|
+
}
|
|
108
|
+
this.open = was;
|
|
109
|
+
this.#show();
|
|
110
|
+
}
|
|
111
|
+
#show() {
|
|
112
|
+
const on = this.#open;
|
|
113
|
+
if (phone.matches) {
|
|
114
|
+
this.phone.open = on;
|
|
115
|
+
return this.#hideWide();
|
|
116
|
+
}
|
|
117
|
+
this.phone.open = false;
|
|
118
|
+
if (this.kind === "drawer") this.wide.hidden = !on;
|
|
119
|
+
else if (this.wide.isConnected && this.wide.matches(":popover-open") !== on) this.wide.togglePopover(on);
|
|
120
|
+
}
|
|
121
|
+
#hideWide() {
|
|
122
|
+
if (this.kind === "drawer") this.wide.hidden = true;
|
|
123
|
+
else if (this.wide.isConnected && this.wide.matches(":popover-open")) this.wide.hidePopover();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** A page's sheets, written in its markup as joined's (`<div id="people" class="sheet" popover>`, its head an h2 and a
|
|
128
|
+
* × that hides it, then what it holds), each made a Surface: wider, that popover still; on a phone, a wa-drawer. Each
|
|
129
|
+
* button that opens one (popovertarget) opens it, and says so while it's open (aria-expanded). */
|
|
130
|
+
export function sheets(root: ParentNode = document) {
|
|
131
|
+
for (const el of root.querySelectorAll<HTMLElement>(".sheet[popover]")) {
|
|
132
|
+
const head = el.querySelector(":scope > header"),
|
|
133
|
+
body = document.createElement("div");
|
|
134
|
+
body.className = "j-sheet-body";
|
|
135
|
+
body.append(...[...el.childNodes].filter((n) => n !== head));
|
|
136
|
+
const by = [...root.querySelectorAll<HTMLButtonElement>(`[popovertarget="${el.id}"]`)],
|
|
137
|
+
shown = (open: boolean) => {
|
|
138
|
+
sheet.open = open;
|
|
139
|
+
for (const b of by)
|
|
140
|
+
if (b.getAttribute("popovertargetaction") !== "hide") b.setAttribute("aria-expanded", String(open));
|
|
141
|
+
},
|
|
142
|
+
sheet: Surface = new Surface("sheet", body, null, () => shown(false), {
|
|
143
|
+
wide: el,
|
|
144
|
+
label: el.ariaLabel ?? head?.querySelector("h2")?.textContent ?? "",
|
|
145
|
+
});
|
|
146
|
+
sheet.title.textContent = head?.querySelector("h2")?.textContent ?? "";
|
|
147
|
+
head?.remove();
|
|
148
|
+
el.after(sheet.phone);
|
|
149
|
+
for (const b of by) {
|
|
150
|
+
// pressed while it's open, it closes: as it was when the press began (a tap away closes a popover first)
|
|
151
|
+
let was = false;
|
|
152
|
+
b.addEventListener("pointerdown", () => (was = sheet.open));
|
|
153
|
+
b.addEventListener("click", (e) => {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
shown(b.getAttribute("popovertargetaction") === "hide" ? false : !(e.detail ? was : sheet.open));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
package/src/timeline.css
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* <j-timeline> (./timeline.ts), in its shadow: its head, and a chart that scrolls sideways within itself, the lanes'
|
|
2
|
+
names a column that stays put; the ticks along its top; each bar placed by --x and --w, in units (an hour or a
|
|
3
|
+
day, each --unit wide) from its start, and --row among those at once in its lane. */
|
|
4
|
+
:host {
|
|
5
|
+
--unit: calc(var(--space-64) * 2);
|
|
6
|
+
--row: var(--space-32);
|
|
7
|
+
--names: calc(var(--space-64) * 2);
|
|
8
|
+
}
|
|
9
|
+
.scroll {
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
overscroll-behavior-x: contain;
|
|
12
|
+
border-top: 1px solid var(--line);
|
|
13
|
+
}
|
|
14
|
+
.chart {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: max-content;
|
|
17
|
+
}
|
|
18
|
+
/* a row: its name, which stays put as the chart scrolls under it, then its track */
|
|
19
|
+
.row {
|
|
20
|
+
display: flex;
|
|
21
|
+
}
|
|
22
|
+
.corner,
|
|
23
|
+
.lane {
|
|
24
|
+
flex: none;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
width: var(--names);
|
|
27
|
+
}
|
|
28
|
+
.ticks,
|
|
29
|
+
.track {
|
|
30
|
+
flex: none;
|
|
31
|
+
width: calc(var(--unit) * var(--units));
|
|
32
|
+
}
|
|
33
|
+
.chart[hours] {
|
|
34
|
+
--unit: var(--space-48);
|
|
35
|
+
}
|
|
36
|
+
.corner,
|
|
37
|
+
.lane {
|
|
38
|
+
position: sticky;
|
|
39
|
+
left: 0;
|
|
40
|
+
z-index: 3;
|
|
41
|
+
background: var(--card);
|
|
42
|
+
border-inline-end: 1px solid var(--line);
|
|
43
|
+
}
|
|
44
|
+
.ticks {
|
|
45
|
+
display: grid;
|
|
46
|
+
grid-template-columns: repeat(var(--units), var(--unit));
|
|
47
|
+
color: var(--muted);
|
|
48
|
+
font: var(--font-tiny);
|
|
49
|
+
font-variant-numeric: tabular-nums;
|
|
50
|
+
}
|
|
51
|
+
.ticks span {
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
padding: var(--space-6) var(--space-6);
|
|
54
|
+
border-inline-start: 1px solid var(--line);
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
.ticks span[weekend] {
|
|
58
|
+
background: var(--well);
|
|
59
|
+
}
|
|
60
|
+
.ticks span[named] {
|
|
61
|
+
overflow: visible;
|
|
62
|
+
z-index: 1;
|
|
63
|
+
color: var(--ink);
|
|
64
|
+
}
|
|
65
|
+
.ticks span[midnight] {
|
|
66
|
+
color: var(--ink);
|
|
67
|
+
border-inline-start-color: var(--edge);
|
|
68
|
+
}
|
|
69
|
+
.lane {
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
padding: var(--space-8) var(--space-12);
|
|
72
|
+
border-top: 1px solid var(--line);
|
|
73
|
+
font: var(--font-small);
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
}
|
|
77
|
+
.track {
|
|
78
|
+
position: relative;
|
|
79
|
+
min-height: calc(var(--row) * var(--rows) + var(--space-8));
|
|
80
|
+
border-top: 1px solid var(--line);
|
|
81
|
+
background: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px var(--unit));
|
|
82
|
+
}
|
|
83
|
+
.bar {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: calc(var(--row) * var(--row-at, 0) + var(--space-4));
|
|
86
|
+
left: calc(var(--unit) * var(--x));
|
|
87
|
+
width: max(var(--space-24), calc(var(--unit) * var(--w) - var(--space-4) / 2));
|
|
88
|
+
height: calc(var(--row) - var(--space-4));
|
|
89
|
+
line-height: calc(var(--row) - var(--space-4) * 3);
|
|
90
|
+
}
|
|
91
|
+
.end {
|
|
92
|
+
position: absolute;
|
|
93
|
+
inset: 0 0 0 auto;
|
|
94
|
+
width: var(--size-grip);
|
|
95
|
+
cursor: ew-resize;
|
|
96
|
+
}
|
|
97
|
+
.now {
|
|
98
|
+
position: absolute;
|
|
99
|
+
top: 0;
|
|
100
|
+
bottom: 0;
|
|
101
|
+
left: calc(var(--names) + var(--unit) * var(--x));
|
|
102
|
+
z-index: 2;
|
|
103
|
+
border-inline-start: calc(var(--space-4) / 2) solid var(--danger);
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
}
|
|
106
|
+
@media (max-width: 40rem) {
|
|
107
|
+
:host {
|
|
108
|
+
--names: calc(var(--space-64) + var(--space-24));
|
|
109
|
+
--row: var(--size-finger);
|
|
110
|
+
}
|
|
111
|
+
}
|
package/src/timeline.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// <j-timeline for="plans" when="when" length="length" lane="who"> (joined/kit): a collection along time, a Gantt. Each
|
|
2
|
+
// item a bar from its time for its length, in its lane: a row for each value of the field `lane` names (each person
|
|
3
|
+
// of a list of people, each item a link is to, yes or no, each word), or, without one, a row for each item, named.
|
|
4
|
+
// Bars at once in a lane stack. Its scale is hours where everything lasts less than a day, else days (`scale`).
|
|
5
|
+
// A bar tapped opens its sheet; dragged, it moves (by quarter hours, or days), and by its end it lasts longer or
|
|
6
|
+
// shorter, where its `may` lets it. It scrolls sideways within itself, its lanes' names staying put, and opens on now
|
|
7
|
+
// where now is in it; now is a line down it.
|
|
8
|
+
|
|
9
|
+
import { follow } from "./follow.ts";
|
|
10
|
+
import { icon } from "./icons.ts";
|
|
11
|
+
import { el, Reading } from "./reading.ts";
|
|
12
|
+
import type { Item } from "./rows.ts";
|
|
13
|
+
import { DAY, MIN, SNAP, dated, dayOf, iso, local, now, seconds, wall } from "./time.ts";
|
|
14
|
+
import STYLE from "./timeline.css" with { type: "text" };
|
|
15
|
+
|
|
16
|
+
const SHEET = new CSSStyleSheet();
|
|
17
|
+
SHEET.replaceSync(STYLE);
|
|
18
|
+
const HOUR = 60 * MIN;
|
|
19
|
+
type Bar = { it: Item; from: number; to: number; row: number };
|
|
20
|
+
type Lane = { key: string; words: string; bars: Bar[]; rows: number };
|
|
21
|
+
|
|
22
|
+
export class JTimeline extends Reading {
|
|
23
|
+
static override sheets = [SHEET];
|
|
24
|
+
#name = el("h3");
|
|
25
|
+
#adding = el("button", { type: "button", className: "act small adding" }, icon("add"), "Add");
|
|
26
|
+
#scroll = el("div", { className: "scroll" });
|
|
27
|
+
#shown = "";
|
|
28
|
+
#placed = false;
|
|
29
|
+
|
|
30
|
+
get #length() {
|
|
31
|
+
return this.field("length") ?? this.spec?.fields.find((f) => f.type === "duration");
|
|
32
|
+
}
|
|
33
|
+
protected made() {
|
|
34
|
+
this.#adding.addEventListener("click", () => this.add({}));
|
|
35
|
+
this.root.append(el("header", { className: "head" }, this.#name, this.#adding), this.#scroll);
|
|
36
|
+
}
|
|
37
|
+
protected draw() {
|
|
38
|
+
const when = this.when;
|
|
39
|
+
if (!when) return;
|
|
40
|
+
const length = this.#length,
|
|
41
|
+
bars: Bar[] = [];
|
|
42
|
+
for (const it of this.items()) {
|
|
43
|
+
const w = it.data[when.name];
|
|
44
|
+
if (typeof w !== "string") continue;
|
|
45
|
+
const from = wall(w),
|
|
46
|
+
len = length && typeof it.data[length.name] === "string" ? seconds(it.data[length.name]) * 1000 : 0;
|
|
47
|
+
bars.push({ it, from, to: from + (len || HOUR), row: 0 });
|
|
48
|
+
}
|
|
49
|
+
this.#adding.hidden = !this.adds;
|
|
50
|
+
if (!bars.length) {
|
|
51
|
+
this.#name.textContent = "Nothing in time yet";
|
|
52
|
+
this.#scroll.replaceChildren();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const first = Math.min(...bars.map((b) => b.from)),
|
|
56
|
+
last = Math.max(...bars.map((b) => b.to)),
|
|
57
|
+
hours = (this.getAttribute("scale") ?? (bars.every((b) => b.to - b.from < DAY) ? "hour" : "day")) === "hour",
|
|
58
|
+
unit = hours ? HOUR : DAY,
|
|
59
|
+
start = hours ? Math.floor(first / HOUR) * HOUR - HOUR : dayOf(local(first)) * DAY,
|
|
60
|
+
end = hours ? Math.ceil(last / HOUR) * HOUR + HOUR : (dayOf(local(last - 1)) + 1) * DAY,
|
|
61
|
+
lanes = this.#lanes(bars);
|
|
62
|
+
this.#name.textContent = `${dated(start / DAY, { day: "numeric", month: "short" })} – ${dated((end - 1) / DAY, { day: "numeric", month: "short", year: "numeric" })}`;
|
|
63
|
+
const shows = JSON.stringify([
|
|
64
|
+
start,
|
|
65
|
+
end,
|
|
66
|
+
hours,
|
|
67
|
+
Math.round(wall(now()) / (15 * MIN)),
|
|
68
|
+
lanes.map((l) => [
|
|
69
|
+
l.key,
|
|
70
|
+
l.words,
|
|
71
|
+
l.bars.map((b) => [
|
|
72
|
+
b.it.key,
|
|
73
|
+
this.named(b.it),
|
|
74
|
+
b.from,
|
|
75
|
+
b.to,
|
|
76
|
+
b.row,
|
|
77
|
+
this.opened(b.it),
|
|
78
|
+
b.it.getAttribute("may"),
|
|
79
|
+
]),
|
|
80
|
+
]),
|
|
81
|
+
]);
|
|
82
|
+
// a display moves only what changed: drawn again only when what it shows has
|
|
83
|
+
if (shows === this.#shown) return;
|
|
84
|
+
this.#shown = shows;
|
|
85
|
+
const was = this.#scroll.scrollLeft,
|
|
86
|
+
chart = el("div", { className: "chart" });
|
|
87
|
+
chart.style.setProperty("--units", String((end - start) / unit));
|
|
88
|
+
chart.toggleAttribute("hours", hours);
|
|
89
|
+
// the ticks: each day (or hour), its words
|
|
90
|
+
const ticks = el("div", { className: "ticks", ariaHidden: "true" });
|
|
91
|
+
for (let t = start; t < end; t += unit) {
|
|
92
|
+
// by hours: each day named where it starts (and at the start), over the hour after it too; the rest each hour
|
|
93
|
+
const d = Math.floor(t / DAY),
|
|
94
|
+
named = t === start || t % DAY === 0,
|
|
95
|
+
tick = el(
|
|
96
|
+
"span",
|
|
97
|
+
{},
|
|
98
|
+
!hours || named
|
|
99
|
+
? dated(d, { weekday: "short", day: "numeric" })
|
|
100
|
+
: t - HOUR === start || (t - HOUR) % DAY === 0
|
|
101
|
+
? ""
|
|
102
|
+
: local(t).slice(11, 13),
|
|
103
|
+
);
|
|
104
|
+
tick.toggleAttribute("named", hours && named);
|
|
105
|
+
tick.toggleAttribute("weekend", !hours && [0, 6].includes(new Date(t).getUTCDay()));
|
|
106
|
+
tick.toggleAttribute("midnight", hours && t % DAY === 0);
|
|
107
|
+
ticks.append(tick);
|
|
108
|
+
}
|
|
109
|
+
// each row a line of its own, so its name stays put as the chart scrolls under it
|
|
110
|
+
chart.append(el("div", { className: "row" }, el("div", { className: "corner" }), ticks));
|
|
111
|
+
for (const lane of lanes) {
|
|
112
|
+
const track = el("div", { className: "track" });
|
|
113
|
+
track.style.setProperty("--rows", String(lane.rows));
|
|
114
|
+
for (const b of lane.bars) track.append(this.#bar(b, start, unit, hours));
|
|
115
|
+
chart.append(
|
|
116
|
+
el("div", { className: "row" }, el("div", { className: "lane", title: lane.words }, lane.words), track),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const nowMs = wall(now());
|
|
120
|
+
if (nowMs >= start && nowMs < end) {
|
|
121
|
+
const line = el("i", { className: "now", ariaHidden: "true" });
|
|
122
|
+
line.style.setProperty("--x", String((nowMs - start) / unit));
|
|
123
|
+
chart.append(line);
|
|
124
|
+
}
|
|
125
|
+
this.#scroll.replaceChildren(chart);
|
|
126
|
+
// opened on now, where now is in it; after, where it was scrolled to
|
|
127
|
+
if (this.#placed) this.#scroll.scrollLeft = was;
|
|
128
|
+
else {
|
|
129
|
+
this.#placed = true;
|
|
130
|
+
requestAnimationFrame(() => {
|
|
131
|
+
const at = (Math.max(start, Math.min(nowMs, end)) - start) / (end - start);
|
|
132
|
+
if (nowMs > start && nowMs < end)
|
|
133
|
+
this.#scroll.scrollLeft = at * chart.scrollWidth - this.#scroll.clientWidth / 3;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Its lanes: a row for each value of `lane` (an item in each it has), or each item its own; bars at once stacked. */
|
|
138
|
+
#lanes(bars: Bar[]): Lane[] {
|
|
139
|
+
const name = this.getAttribute("lane"),
|
|
140
|
+
f = name ? this.spec?.fields.find((f) => f.name === name) : undefined;
|
|
141
|
+
if (!f)
|
|
142
|
+
return bars
|
|
143
|
+
.sort((a, b) => a.from - b.from)
|
|
144
|
+
.map((b) => ({ key: String(b.it.key), words: this.named(b.it), bars: [b], rows: 1 }));
|
|
145
|
+
const lanes = new Map<string, Lane>(),
|
|
146
|
+
to = (key: string, words: string, b: Bar) =>
|
|
147
|
+
(lanes.get(key) ?? lanes.set(key, { key, words, bars: [], rows: 1 }).get(key)!).bars.push({ ...b });
|
|
148
|
+
const linked = (k: unknown) =>
|
|
149
|
+
f.to
|
|
150
|
+
? (document.querySelector(`${f.to.tag}[key="${k}"]`)?.getAttribute(f.to.title ?? "name") ?? `#${k}`)
|
|
151
|
+
: String(k);
|
|
152
|
+
for (const b of bars) {
|
|
153
|
+
const v = b.it.data[f.name];
|
|
154
|
+
if (Array.isArray(v) && v.length) for (const k of v) to(`v${k}`, linked(k), b);
|
|
155
|
+
else if (typeof v === "boolean")
|
|
156
|
+
to(`b${v}`, v ? this.label(f.name) : `Not ${this.label(f.name).toLowerCase()}`, b);
|
|
157
|
+
else if (v !== undefined && v !== null && v !== "" && !Array.isArray(v)) to(`v${v}`, linked(v), b);
|
|
158
|
+
else to("none", f.to?.people ? "No one" : `No ${this.label(f.name).toLowerCase()}`, b);
|
|
159
|
+
}
|
|
160
|
+
const all = [...lanes.values()].sort((a, b) =>
|
|
161
|
+
a.key === "none" ? 1 : b.key === "none" ? -1 : a.words.localeCompare(b.words),
|
|
162
|
+
);
|
|
163
|
+
for (const lane of all) {
|
|
164
|
+
lane.bars.sort((a, b) => a.from - b.from);
|
|
165
|
+
const ends: number[] = [];
|
|
166
|
+
for (const b of lane.bars) {
|
|
167
|
+
let r = ends.findIndex((e) => e <= b.from);
|
|
168
|
+
if (r < 0) r = ends.push(0) - 1;
|
|
169
|
+
ends[r] = b.to;
|
|
170
|
+
b.row = r;
|
|
171
|
+
}
|
|
172
|
+
lane.rows = Math.max(1, ends.length);
|
|
173
|
+
}
|
|
174
|
+
return all;
|
|
175
|
+
}
|
|
176
|
+
/** A bar: its words; dragged, moved; by its end, longer or shorter. */
|
|
177
|
+
#bar(b: Bar, start: number, unit: number, hours: boolean) {
|
|
178
|
+
const when = this.when!.name,
|
|
179
|
+
length = this.#length?.name,
|
|
180
|
+
w = String(b.it.data[when]),
|
|
181
|
+
bar = el("button", { type: "button", className: "item bar", title: this.named(b.it) }, this.named(b.it));
|
|
182
|
+
bar.style.setProperty("--x", String((b.from - start) / unit));
|
|
183
|
+
bar.style.setProperty("--w", String((b.to - b.from) / unit));
|
|
184
|
+
bar.style.setProperty("--row-at", String(b.row));
|
|
185
|
+
const unitPx = () =>
|
|
186
|
+
(bar.parentElement!.getBoundingClientRect().width || 1) /
|
|
187
|
+
Number(bar.closest<HTMLElement>(".chart")!.style.getPropertyValue("--units")),
|
|
188
|
+
step = hours ? SNAP * MIN : DAY;
|
|
189
|
+
this.press(
|
|
190
|
+
bar,
|
|
191
|
+
b.it,
|
|
192
|
+
this.may(b.it, when)
|
|
193
|
+
? (dx, _dy, done) => {
|
|
194
|
+
const by = Math.round(((dx / unitPx()) * unit) / step) * step;
|
|
195
|
+
bar.style.translate = done ? "" : `${(by / unit) * unitPx()}px 0`;
|
|
196
|
+
if (done && by) void this.change(b.it, { [when]: local(wall(w) + by) });
|
|
197
|
+
}
|
|
198
|
+
: undefined,
|
|
199
|
+
);
|
|
200
|
+
if (length && this.may(b.it, length)) {
|
|
201
|
+
const end = el("span", { className: "end", ariaHidden: "true" });
|
|
202
|
+
end.addEventListener("pointerdown", (down) => {
|
|
203
|
+
down.stopPropagation();
|
|
204
|
+
const was = b.to - b.from;
|
|
205
|
+
let len = was;
|
|
206
|
+
follow(
|
|
207
|
+
down,
|
|
208
|
+
(e) => {
|
|
209
|
+
len = Math.max(step, Math.round((was + ((e.clientX - down.clientX) / unitPx()) * unit) / step) * step);
|
|
210
|
+
bar.style.setProperty("--w", String(len / unit));
|
|
211
|
+
},
|
|
212
|
+
(e) => {
|
|
213
|
+
const m = Math.round(len / MIN);
|
|
214
|
+
if (e && len !== was)
|
|
215
|
+
void this.change(b.it, {
|
|
216
|
+
[length]: iso(m),
|
|
217
|
+
});
|
|
218
|
+
else this.again();
|
|
219
|
+
},
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
bar.append(end);
|
|
223
|
+
}
|
|
224
|
+
return bar;
|
|
225
|
+
}
|
|
226
|
+
}
|