effect-atom-svelte-devtools 0.2.0 → 0.2.2

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/README.md CHANGED
@@ -26,16 +26,52 @@ It reads effect-atom-svelte's inspector, which is new in effect-atom-svelte 0.2:
26
26
 
27
27
  Use `import.meta.env.DEV` rather than SvelteKit's `dev`: Vite replaces it with `false` in a build, so the import is dropped, where `dev` leaves the panel's code in the build unused.
28
28
 
29
- Closed, it's a small "Atoms" button in the corner with the registry's count. Open, drag its top line to make it taller or shorter (double-click to reset; with the keyboard, focus it and use the arrow keys), or enlarge it to most of the window; the page gets room below it while it's open, and Escape closes it while focus is inside it. It's drawn in hairlines with mono labels, in the page's own colours where your app has shadcn-style tokens (`--background`, `--foreground`, `--border`, `--brand`), and in zinc and amber, light or dark, where it doesn't. Its bar counts the registry's atoms, readers, updates and interruptions.
29
+ The panel renders nothing in a production build, so leaving out the `DEV` check only costs the download. To show it in production on purpose, say for a demo that lets its visitors watch its atoms (as the effect-atom-svelte docs do), render it without the check and set `production`:
30
30
 
31
- It has three views:
31
+ ```svelte
32
+ <AtomDevtools production />
33
+ ```
34
+
35
+ In production it shows the registry of the nearest `RegistryProvider`, or the one you pass, with no picker: only development keeps the list of every provider's registry. Declarations aren't links to your editor, which only the dev server can open, and atoms have names only if `atomLabels({ builds: true })` labels the build.
36
+
37
+ Closed, it's a small "Atoms" button in the corner with the registry's count. Open, drag its top line to make it taller or shorter (double-click to reset; with the keyboard, focus it and use the arrow keys), or enlarge it to most of the window; the page gets room below it while it's open, and Escape closes it while focus is inside it. It's drawn in hairlines with mono labels, in your page's colours and fonts where it has them (see [Theming](#theming)), and in zinc and amber, light or dark, where it doesn't. Its bar counts the registry's atoms, readers, updates and interruptions.
38
+
39
+ Alt+Shift+A opens and closes it from anywhere on the page. Set the app's own with the `shortcut` prop (`<AtomDevtools shortcut="ctrl+shift+f2" />`); whoever uses the panel can change it in its settings.
40
+
41
+ It has three views, and settings:
32
42
 
33
43
  - **Graph**: the atoms and what reads what, laid out on tracks with sources on the left, as the effect-atom-svelte docs draw their examples. A value that changes rings, in green when it's a `Success` and red when it's a `Failure`; a cross marks an interrupted effect or a removed atom; a family's atoms share a row of dots. Click an atom to open its sheet. "Plumbing" shows the atoms runtimes, mutations and stores make, which are hidden by default; an atom that reads one is linked to whatever is upstream of it.
34
44
  - **Sheets**: a cover sheet with the registry's totals, then one sheet per atom: its value or `AsyncResult` state, what it reads and what reads it, what happened to it lately, and a title block with where it was declared (click to open it in your editor), keep-alive, idle TTL and readers.
35
45
  - **Timeline**: every computation, update, interruption and finalizer, newest first. A computation says why it ran: its first read, a refresh, or which atoms it reads changed. Click an atom to see only its rows.
46
+ - **Settings**: the shortcut (click Change and press a new one: it needs Ctrl, Alt or Meta, or a function key, so it can't catch typing), and the button's corner, opacity and size. Drag the button to move it, too: it settles in the nearest corner. A faded button is opaque again while you point at it or focus it. The panel saves its settings in `localStorage`.
36
47
 
37
48
  It follows the registry of the nearest `RegistryProvider`, or a `registry` you pass it. With more than one provider mounted, a picker switches between them. It reads what the registry does through `effect-atom-svelte/inspector`, which starts watching when the panel mounts and costs nothing before.
38
49
 
50
+ ### Theming
51
+
52
+ The panel takes its colours and fonts from CSS variables. It reads the ones a Tailwind or shadcn app already has, so it often matches your app with no setup:
53
+
54
+ | Variable | What it colours or sets |
55
+ | --- | --- |
56
+ | `--background`, `--foreground` | The panel, and its text |
57
+ | `--muted-foreground`, `--subtle-foreground` | Quieter text: labels, notes, timestamps |
58
+ | `--border` | Its hairlines |
59
+ | `--brand`, `--brand-text` | The accent: atoms' rings, the current tab, numbers |
60
+ | `--tone-success`, `--tone-failure` | A success's green ring, a failure's red one |
61
+ | `--font-mono` | Labels, names and values |
62
+ | `--font-serif` | The italic notes |
63
+
64
+ Any it doesn't find fall back to zinc and amber, a monospace and the system serif. To give the panel colours or fonts of its own, different from the page's, set the variables on `[data-atom-devtools]`:
65
+
66
+ ```css
67
+ [data-atom-devtools] {
68
+ --brand: oklch(0.6 0.2 300);
69
+ --font-serif: "Iowan Old Style", Georgia, serif;
70
+ }
71
+ ```
72
+
73
+ `theme` picks light or dark (`auto`, the default, follows a `dark` class on `<html>`, or the system's setting). The graph module reads the same variables.
74
+
39
75
  ## The graph
40
76
 
41
77
  The graph the panel draws is also yours to use, from `effect-atom-svelte-devtools/graph`. It has no dependencies beyond Svelte, so unlike the panel it can go in production pages: the effect-atom-svelte docs draw each example's atoms with it, from an inspector scope.
@@ -44,7 +80,7 @@ The graph the panel draws is also yours to use, from `effect-atom-svelte-devtool
44
80
  - `<AtomGraph graph={…} />` draws a layout live. Call its `pulse(id, tone)` when an atom's value changes and `interrupt(id)` when its effect is interrupted; give it `onselect` to make atoms clickable.
45
81
  - `<FrameGraph nodes={…} edges={…} />` draws nodes and edges you place yourself, on a frame's 1px lines.
46
82
 
47
- It reads your page's design tokens where it has them and falls back to a neutral palette.
83
+ It reads the same variables as the panel ([Theming](#theming)) and falls back to a neutral palette.
48
84
 
49
85
  ## Atom names
50
86
 
@@ -66,7 +102,7 @@ export default defineConfig({
66
102
  });
67
103
  ```
68
104
 
69
- - Only the dev server applies it. Production builds are left as they are.
105
+ - Only the dev server applies it, unless you pass `builds: true`: then production builds are labelled too (without keeping values across reloads, which builds don't have), for a page that shows atoms' names in production.
70
106
  - Put it before `sveltekit()` or `svelte()`, so it sees components before they are compiled. It warns if it comes after.
71
107
  - The atom is labelled in place and keeps its identity. `Atom.withLabel` would return a copy.
72
108
  - A label your code sets with `Atom.withLabel` wins. The one an `Atom.serializable` atom takes from its key (an RPC query's `AtomRpc:listTodos:home-todos`) gives way to the variable's name.
@@ -1,8 +1,8 @@
1
1
  <!--
2
2
  @component
3
3
  A panel docked along the bottom of the window that shows the atom registry live: its dependency
4
- graph, a sheet per atom and a timeline of everything it does. Development only: in a production
5
- build, or on the server, it renders nothing.
4
+ graph, a sheet per atom and a timeline of everything it does. Development only unless you set
5
+ `production`: in a production build without it, or on the server, it renders nothing.
6
6
 
7
7
  It's drawn like the effect-atom-svelte docs: ruled in hairlines, with mono labels, numbered views
8
8
  and an amber accent, in the page's own colours where it has them (--background, --foreground,
@@ -13,7 +13,7 @@
13
13
  the app has several, a picker in the panel switches between them.
14
14
 
15
15
  Render it only in development, behind Vite's `DEV` flag, so a build leaves it out: the README
16
- shows how.
16
+ shows how. To show it in production too, as the effect-atom-svelte docs do, set `production`.
17
17
  -->
18
18
  <script lang="ts">
19
19
  import { BROWSER, DEV } from "esm-env";
@@ -24,6 +24,9 @@
24
24
 
25
25
  import GraphView from "./internal/graph-view.svelte";
26
26
  import { Model } from "./internal/model.svelte.js";
27
+ import SettingsView from "./internal/settings-view.svelte";
28
+ import type { Corner } from "./internal/settings-view.svelte";
29
+ import { defaultShortcut, formatShortcut, matchesShortcut, parseShortcut } from "./internal/shortcut.js";
27
30
  import SheetsView from "./internal/sheets-view.svelte";
28
31
  import TimelineView from "./internal/timeline-view.svelte";
29
32
 
@@ -34,17 +37,41 @@
34
37
  readonly open?: boolean | undefined;
35
38
  /** Light paper, a dark blueprint, or the page's own (`auto`: a `dark` class on `<html>`, or the system's). */
36
39
  readonly theme?: "auto" | "light" | "dark" | undefined;
40
+ /**
41
+ * Shows the panel in production builds too, for a site that lets its visitors watch its atoms.
42
+ * Without it the panel renders nothing outside development. In production it follows the
43
+ * nearest provider's registry, or `registry`, with no picker: only development lists the rest.
44
+ */
45
+ readonly production?: boolean | undefined;
46
+ /**
47
+ * The keyboard shortcut that opens and closes the panel, as "alt+shift+a" (the default) or
48
+ * "ctrl+shift+f2". Whoever uses the panel can change it in its settings.
49
+ */
50
+ readonly shortcut?: string | undefined;
37
51
  }
38
52
 
39
- const { registry, open: startOpen, theme = "auto" }: Props = $props();
53
+ const {
54
+ registry,
55
+ open: startOpen,
56
+ production = false,
57
+ shortcut: appShortcut = defaultShortcut,
58
+ theme = "auto",
59
+ }: Props = $props();
40
60
 
41
- type Tab = "graph" | "sheets" | "timeline";
61
+ type Tab = "graph" | "sheets" | "timeline" | "settings";
42
62
  interface Saved {
43
63
  readonly open: boolean;
44
64
  readonly tab: Tab;
45
65
  readonly plumbing: boolean;
46
66
  readonly expanded: boolean;
47
67
  readonly height: number;
68
+ /** Only one changed in the settings: otherwise the app's, which may change. */
69
+ readonly shortcut: string | undefined;
70
+ readonly corner: Corner;
71
+ readonly opacity: number;
72
+ readonly scale: number;
73
+ /** Set from 0.2.2, whose `shortcut` is only one chosen in the settings; 0.2.1 saved the default. */
74
+ readonly shortcutChosen: true;
48
75
  }
49
76
  const storageKey = "effect-atom-svelte-devtools";
50
77
  const load = (): Partial<Saved> => {
@@ -55,7 +82,8 @@
55
82
  }
56
83
  };
57
84
 
58
- const enabled = DEV && BROWSER;
85
+ // svelte-ignore state_referenced_locally
86
+ const enabled = BROWSER && (DEV || production);
59
87
  // The registry in context, read while the component sets up, as context must be.
60
88
  // svelte-ignore state_referenced_locally
61
89
  const nearest = enabled ? (registry ?? getRegistry()) : undefined;
@@ -67,7 +95,14 @@
67
95
  let expanded = $state(false);
68
96
  // The dock's height, in pixels, when not enlarged; dragging its top line changes it.
69
97
  let height = $state(320);
98
+ // svelte-ignore state_referenced_locally
99
+ let shortcut = $state(appShortcut);
100
+ let corner = $state<Corner>("bottom-right");
101
+ // The launcher's opacity while nothing points at it, and its size.
102
+ let opacity = $state(1);
103
+ let scale = $state(1);
70
104
  let innerHeight = $state(800);
105
+ let innerWidth = $state(1200);
71
106
  let selected = $state<number>();
72
107
  let dark = $state(false);
73
108
  let registries = $state.raw<readonly AtomRegistry.AtomRegistry[]>([]);
@@ -88,6 +123,16 @@
88
123
  showPlumbing = saved.plumbing ?? false;
89
124
  expanded = saved.expanded ?? false;
90
125
  height = saved.height ?? 320;
126
+ // Settings saved by 0.2.1, without `shortcutChosen`, hold the default even when nobody chose it,
127
+ // which would hide a shortcut the app sets: there the default counts as unset.
128
+ shortcut =
129
+ saved.shortcut === undefined ||
130
+ (saved.shortcutChosen !== true && saved.shortcut === defaultShortcut)
131
+ ? appShortcut
132
+ : saved.shortcut;
133
+ corner = saved.corner ?? "bottom-right";
134
+ opacity = saved.opacity ?? 1;
135
+ scale = saved.scale ?? 1;
91
136
  mounted = true;
92
137
 
93
138
  const stopWatching = watchRegistries((list) => {
@@ -135,7 +180,18 @@
135
180
  if (!enabled || !mounted) {
136
181
  return;
137
182
  }
138
- const saved: Saved = { expanded, height, open, plumbing: showPlumbing, tab };
183
+ const saved: Saved = {
184
+ corner,
185
+ expanded,
186
+ height,
187
+ opacity,
188
+ open,
189
+ plumbing: showPlumbing,
190
+ scale,
191
+ shortcut: shortcut === appShortcut ? undefined : shortcut,
192
+ shortcutChosen: true,
193
+ tab,
194
+ };
139
195
  try {
140
196
  localStorage.setItem(storageKey, JSON.stringify(saved));
141
197
  } catch {
@@ -219,6 +275,82 @@
219
275
  }
220
276
  };
221
277
 
278
+ const mac = BROWSER && /Mac|iPhone|iPad/u.test(navigator.platform);
279
+ const shortcutLabel = $derived.by(() => {
280
+ const parsed = parseShortcut(shortcut);
281
+ return parsed === undefined ? "no shortcut" : formatShortcut(parsed, mac);
282
+ });
283
+ // As aria-keyshortcuts writes it: "Alt+Shift+A".
284
+ const keyShortcuts = $derived.by(() => {
285
+ const parsed = parseShortcut(shortcut);
286
+ return parsed === undefined ? undefined : formatShortcut(parsed, false).replaceAll(" ", "+").replace("Ctrl", "Control");
287
+ });
288
+
289
+ /** The shortcut, from anywhere on the page: opens the panel, or closes it. */
290
+ const onShortcut = (event: KeyboardEvent) => {
291
+ const parsed = parseShortcut(shortcut);
292
+ if (!enabled || !mounted || parsed === undefined || !matchesShortcut(event, parsed)) {
293
+ return;
294
+ }
295
+ event.preventDefault();
296
+ if (open) {
297
+ void closePanel();
298
+ } else {
299
+ openPanel();
300
+ }
301
+ };
302
+
303
+ // Dragging the launcher: it follows the pointer, then settles in the corner nearest where it was
304
+ // let go. A press that barely moves is a click.
305
+ let dragAt = $state<{ readonly x: number; readonly y: number }>();
306
+ let dragged = false;
307
+ const drag = (event: PointerEvent) => {
308
+ if (event.button !== 0) {
309
+ return;
310
+ }
311
+ const button = event.currentTarget as HTMLElement;
312
+ const box = button.getBoundingClientRect();
313
+ const offsetX = event.clientX - box.left;
314
+ const offsetY = event.clientY - box.top;
315
+ const startX = event.clientX;
316
+ const startY = event.clientY;
317
+ dragged = false;
318
+ // No text selection: a selection would make the next press start the browser's own drag of
319
+ // it, which cancels the pointer.
320
+ event.preventDefault();
321
+ // From the press on, so a quick drag that leaves the button still moves it.
322
+ button.setPointerCapture(event.pointerId);
323
+ const move = (next: PointerEvent) => {
324
+ if (!dragged && Math.hypot(next.clientX - startX, next.clientY - startY) < 5) {
325
+ return;
326
+ }
327
+ dragged = true;
328
+ dragAt = { x: next.clientX - offsetX, y: next.clientY - offsetY };
329
+ };
330
+ const stop = (last: PointerEvent) => {
331
+ button.removeEventListener("pointermove", move);
332
+ button.removeEventListener("pointerup", stop);
333
+ button.removeEventListener("pointercancel", stop);
334
+ if (dragged) {
335
+ const top = last.clientY < innerHeight / 2;
336
+ const left = last.clientX < innerWidth / 2;
337
+ corner = `${top ? "top" : "bottom"}-${left ? "left" : "right"}`;
338
+ }
339
+ dragAt = undefined;
340
+ };
341
+ button.addEventListener("pointermove", move);
342
+ button.addEventListener("pointerup", stop);
343
+ button.addEventListener("pointercancel", stop);
344
+ };
345
+ const launch = () => {
346
+ // The click that ends a drag doesn't open the panel.
347
+ if (dragged) {
348
+ dragged = false;
349
+ return;
350
+ }
351
+ openPanel();
352
+ };
353
+
222
354
  const pad = (count: number) => String(count).padStart(2, "0");
223
355
 
224
356
  const select = (id: number | undefined) => {
@@ -230,13 +362,15 @@
230
362
  { id: "graph", label: "Graph" },
231
363
  { id: "sheets", label: "Sheets" },
232
364
  { id: "timeline", label: "Timeline" },
365
+ { id: "settings", label: "Settings" },
233
366
  ];
234
367
  </script>
235
368
 
236
- <svelte:window bind:innerHeight />
369
+ <svelte:window bind:innerHeight bind:innerWidth onkeydown={onShortcut} />
237
370
 
238
371
  {#if enabled && mounted && model}
239
- <div class="devtools" class:dark>
372
+ <!-- data-atom-devtools: where an app sets the panel's own colours and fonts (README, Theming). -->
373
+ <div class="devtools" class:dark data-atom-devtools>
240
374
  {#if open}
241
375
  <!-- A region of the page, not a modal: the page stays usable with it open. Escape from anything
242
376
  in it closes it. -->
@@ -331,13 +465,27 @@
331
465
  </div>
332
466
  {:else if tab === "sheets"}
333
467
  <SheetsView {model} onselect={select} {selected} {showPlumbing} />
334
- {:else}
468
+ {:else if tab === "timeline"}
335
469
  <TimelineView {model} onselect={select} {showPlumbing} />
470
+ {:else}
471
+ <SettingsView bind:corner bind:opacity bind:scale bind:shortcut defaultShortcut={appShortcut} />
336
472
  {/if}
337
473
  </div>
338
474
  </section>
339
475
  {:else}
340
- <button bind:this={launcher} aria-label="Open the atom devtools" class="launcher" onclick={openPanel} type="button">
476
+ <button
477
+ bind:this={launcher}
478
+ style:--launcher-opacity={opacity}
479
+ style:--launcher-scale={scale}
480
+ style:left={dragAt ? `${dragAt.x}px` : undefined}
481
+ style:top={dragAt ? `${dragAt.y}px` : undefined}
482
+ aria-keyshortcuts={keyShortcuts}
483
+ aria-label="Open the atom devtools"
484
+ class={["launcher", corner, dragAt && "dragging"]}
485
+ onclick={launch}
486
+ onpointerdown={drag}
487
+ title="Atom devtools ({shortcutLabel}). Drag to move."
488
+ type="button">
341
489
  <b aria-hidden="true">◎</b> Atoms <span class="n">{pad(model.totals.atoms)}</span>
342
490
  </button>
343
491
  {/if}
@@ -364,8 +512,7 @@
364
512
  --success: var(--tone-success, #16a34a);
365
513
  --alert: var(--tone-failure, #dc2626);
366
514
  --mono: var(--font-mono, ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace);
367
- --serif: "Libron", ui-serif, Georgia, "Times New Roman", serif;
368
- --sans: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
515
+ --serif: var(--font-serif, ui-serif, Georgia, "Times New Roman", serif);
369
516
  --radius: 6px;
370
517
  color: var(--ink);
371
518
  font-family: var(--mono);
@@ -392,21 +539,51 @@
392
539
  background: var(--paper);
393
540
  border: 1px solid var(--line);
394
541
  border-radius: var(--radius);
395
- bottom: 16px;
396
542
  color: var(--muted);
397
543
  cursor: pointer;
398
544
  display: inline-flex;
399
545
  font-family: var(--mono);
400
- font-size: 10.5px;
401
- gap: 0.5rem;
402
- height: 32px;
546
+ font-size: calc(10.5px * var(--launcher-scale, 1));
547
+ gap: calc(0.5rem * var(--launcher-scale, 1));
548
+ height: calc(32px * var(--launcher-scale, 1));
403
549
  letter-spacing: 0.08em;
404
- padding: 0 0.75rem;
550
+ opacity: var(--launcher-opacity, 1);
551
+ padding: 0 calc(0.75rem * var(--launcher-scale, 1));
405
552
  position: fixed;
406
- right: 16px;
407
553
  text-transform: uppercase;
554
+ touch-action: none;
555
+ transition: opacity 0.15s;
556
+ user-select: none;
408
557
  z-index: 2147483000;
409
558
  }
559
+ .launcher.bottom-right {
560
+ bottom: 16px;
561
+ right: 16px;
562
+ }
563
+ .launcher.bottom-left {
564
+ bottom: 16px;
565
+ left: 16px;
566
+ }
567
+ .launcher.top-right {
568
+ right: 16px;
569
+ top: 16px;
570
+ }
571
+ .launcher.top-left {
572
+ left: 16px;
573
+ top: 16px;
574
+ }
575
+ /* While dragged, it's placed by its left and top alone. */
576
+ .launcher.dragging {
577
+ bottom: auto;
578
+ cursor: grabbing;
579
+ right: auto;
580
+ }
581
+ /* Faded or not, it's opaque while pointed at, focused or dragged. */
582
+ .launcher:hover,
583
+ .launcher:focus-visible,
584
+ .launcher.dragging {
585
+ opacity: 1;
586
+ }
410
587
  .launcher:hover {
411
588
  border-color: var(--accent);
412
589
  color: var(--ink);
@@ -431,6 +608,7 @@
431
608
  --tone-success: var(--success);
432
609
  --tone-failure: var(--alert);
433
610
  --font-mono: var(--mono);
611
+ --font-serif: var(--serif);
434
612
  background: var(--paper);
435
613
  border-top: 1px solid var(--line);
436
614
  bottom: 0;
@@ -6,11 +6,22 @@ interface Props {
6
6
  readonly open?: boolean | undefined;
7
7
  /** Light paper, a dark blueprint, or the page's own (`auto`: a `dark` class on `<html>`, or the system's). */
8
8
  readonly theme?: "auto" | "light" | "dark" | undefined;
9
+ /**
10
+ * Shows the panel in production builds too, for a site that lets its visitors watch its atoms.
11
+ * Without it the panel renders nothing outside development. In production it follows the
12
+ * nearest provider's registry, or `registry`, with no picker: only development lists the rest.
13
+ */
14
+ readonly production?: boolean | undefined;
15
+ /**
16
+ * The keyboard shortcut that opens and closes the panel, as "alt+shift+a" (the default) or
17
+ * "ctrl+shift+f2". Whoever uses the panel can change it in its settings.
18
+ */
19
+ readonly shortcut?: string | undefined;
9
20
  }
10
21
  /**
11
22
  * A panel docked along the bottom of the window that shows the atom registry live: its dependency
12
- * graph, a sheet per atom and a timeline of everything it does. Development only: in a production
13
- * build, or on the server, it renders nothing.
23
+ * graph, a sheet per atom and a timeline of everything it does. Development only unless you set
24
+ * `production`: in a production build without it, or on the server, it renders nothing.
14
25
  *
15
26
  * It's drawn like the effect-atom-svelte docs: ruled in hairlines, with mono labels, numbered views
16
27
  * and an amber accent, in the page's own colours where it has them (--background, --foreground,
@@ -21,7 +32,7 @@ interface Props {
21
32
  * the app has several, a picker in the panel switches between them.
22
33
  *
23
34
  * Render it only in development, behind Vite's `DEV` flag, so a build leaves it out: the README
24
- * shows how.
35
+ * shows how. To show it in production too, as the effect-atom-svelte docs do, set `production`.
25
36
  */
26
37
  declare const AtomDevtools: import("svelte").Component<Props, {}, "">;
27
38
  type AtomDevtools = ReturnType<typeof AtomDevtools>;
@@ -82,6 +82,9 @@
82
82
  };
83
83
 
84
84
  $effect(() => {
85
+ // Again after each new layout: a node whose kind or side changes has its classes written over,
86
+ // and a node drawn later has none.
87
+ void layout;
85
88
  for (const element of host?.querySelectorAll("[data-node].selected") ?? []) {
86
89
  element.classList.remove("selected");
87
90
  }
@@ -271,7 +271,7 @@
271
271
  .label em {
272
272
  color: var(--muted-foreground, #52525b);
273
273
  display: block;
274
- font-family: "Libron", ui-serif, Georgia, serif;
274
+ font-family: var(--font-serif, ui-serif, Georgia, serif);
275
275
  font-size: 0.72rem;
276
276
  font-style: italic;
277
277
  }
@@ -100,6 +100,9 @@ const depthsOf = (atoms, parents) => {
100
100
  seen.add(id);
101
101
  const from = (parents.get(id) ?? []).filter((parent) => !seen.has(parent));
102
102
  const value = from.length === 0 ? 0 : 1 + Math.max(...from.map((p) => depth(p, seen)));
103
+ // Only the atoms on the path here are skipped: another child's path may reach this atom's
104
+ // parents too, as in a diamond.
105
+ seen.delete(id);
103
106
  depths.set(id, value);
104
107
  return value;
105
108
  };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  */
6
6
  /**
7
7
  * A panel docked along the bottom of the window, with the registry's dependency graph, a sheet per
8
- * atom and a timeline of everything the registry does. Development only.
8
+ * atom and a timeline of everything the registry does. Development only, unless `production` is
9
+ * set.
9
10
  *
10
11
  * @since 0.2.0
11
12
  * @category components
package/dist/index.js CHANGED
@@ -5,7 +5,8 @@
5
5
  */
6
6
  /**
7
7
  * A panel docked along the bottom of the window, with the registry's dependency graph, a sheet per
8
- * atom and a timeline of everything the registry does. Development only.
8
+ * atom and a timeline of everything the registry does. Development only, unless `production` is
9
+ * set.
9
10
  *
10
11
  * @since 0.2.0
11
12
  * @category components
@@ -1,3 +1,4 @@
1
+ import { Cause } from "effect";
1
2
  /** The state of an atom's value, for its marks and its sheet. */
2
3
  export type ValueState = {
3
4
  readonly _tag: "Value";
@@ -8,6 +9,12 @@ export type ValueState = {
8
9
  export declare const valueState: (value: unknown) => ValueState;
9
10
  /** A short description of the state: `Success, waiting`. */
10
11
  export declare const stateText: (state: ValueState) => string;
12
+ /**
13
+ * What a failure failed with, from its first reason: a typed error by its name (`CityNotFound`),
14
+ * or with its fields, each written by `write`, when given; a defect as `defect: TypeError`; an
15
+ * interruption as `interrupted`.
16
+ */
17
+ export declare const failureText: (cause: Cause.Cause<unknown>, write?: (field: unknown) => string) => string;
11
18
  /**
12
19
  * Turns a value into plain data to print: an `AsyncResult` as its tag and contents, a failure's
13
20
  * cause pretty-printed, Effect's data types through their own `toJSON`, maps and sets as entries,