effect-atom-svelte-devtools 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,7 +34,9 @@ The panel renders nothing in a production build, so leaving out the `DEV` check
|
|
|
34
34
|
|
|
35
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
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
|
|
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.
|
|
38
|
+
|
|
39
|
+
It's drawn in hairlines with mono labels, in your page's colors 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
40
|
|
|
39
41
|
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
42
|
|
|
@@ -49,9 +51,9 @@ It follows the registry of the nearest `RegistryProvider`, or a `registry` you p
|
|
|
49
51
|
|
|
50
52
|
### Theming
|
|
51
53
|
|
|
52
|
-
The panel takes its
|
|
54
|
+
The panel takes its colors 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
55
|
|
|
54
|
-
| Variable | What it
|
|
56
|
+
| Variable | What it colors or sets |
|
|
55
57
|
| --- | --- |
|
|
56
58
|
| `--background`, `--foreground` | The panel, and its text |
|
|
57
59
|
| `--muted-foreground`, `--subtle-foreground` | Quieter text: labels, notes, timestamps |
|
|
@@ -61,7 +63,7 @@ The panel takes its colours and fonts from CSS variables. It reads the ones a Ta
|
|
|
61
63
|
| `--font-mono` | Labels, names and values |
|
|
62
64
|
| `--font-serif` | The italic notes |
|
|
63
65
|
|
|
64
|
-
Any it doesn't find fall back to zinc and amber, a monospace and the system serif. To give the panel
|
|
66
|
+
Any it doesn't find fall back to zinc and amber, a monospace and the system serif. To give the panel colors or fonts of its own, different from the page's, set the variables on `[data-atom-devtools]`:
|
|
65
67
|
|
|
66
68
|
```css
|
|
67
69
|
[data-atom-devtools] {
|
|
@@ -77,7 +79,8 @@ Any it doesn't find fall back to zinc and amber, a monospace and the system seri
|
|
|
77
79
|
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.
|
|
78
80
|
|
|
79
81
|
- `layoutGraph({ atoms, links, readers }, width)` lays atoms, the links between them and the components that read them out on tracks.
|
|
80
|
-
- `<AtomGraph graph={
|
|
82
|
+
- `<AtomGraph graph={{ atoms, links, readers }} />` lays out and draws that input 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.
|
|
83
|
+
- `toneOf(state, waiting)` turns an atom's state into a pulse's tone: `"success"` for a `Success`, `"failure"` for a `Failure`, and none while it is waiting.
|
|
81
84
|
- `<FrameGraph nodes={…} edges={…} />` draws nodes and edges you place yourself, on a frame's 1px lines.
|
|
82
85
|
|
|
83
86
|
It reads the same variables as the panel ([Theming](#theming)) and falls back to a neutral palette.
|
|
@@ -102,17 +105,17 @@ export default defineConfig({
|
|
|
102
105
|
});
|
|
103
106
|
```
|
|
104
107
|
|
|
105
|
-
- Only the dev server applies it, unless you pass `builds: true`: then production builds are
|
|
108
|
+
- Only the dev server applies it, unless you pass `builds: true`: then production builds are labeled too (without keeping values across reloads, which builds don't have), for a page that shows atoms' names in production.
|
|
106
109
|
- Put it before `sveltekit()` or `svelte()`, so it sees components before they are compiled. It warns if it comes after.
|
|
107
110
|
- `include` and `exclude` pick the files it labels, as Vite filter patterns. By default it labels Svelte components and JavaScript and TypeScript modules, and leaves anything in `node_modules` alone.
|
|
108
|
-
- The atom is
|
|
111
|
+
- The atom is labeled in place and keeps its identity. `Atom.withLabel` would return a copy.
|
|
109
112
|
- 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.
|
|
110
|
-
- Members of an `Atom.family` are
|
|
113
|
+
- Members of an `Atom.family` are labeled with their argument, as `todoAtom(3)`.
|
|
111
114
|
- A call to a function whose name ends in `Atom` (`mapDraftAtom(key)`, `makeSessionAtom(user)`) names the atom it returns after the call and its arguments, as `mapDraftAtom({"doc":1})`. Every call's atom is named, so two atoms made for equal keys share a name: what a hand-rolled cache that keeps making new atoms looks like. A more specific label wins: a family's, a top-level variable's, or one your code set. Only plain calls count, not methods (`store.todoAtom(1)`).
|
|
112
|
-
- It wraps any top-level `const x = f(...)` and checks at run time whether the value is an atom, so `runtime.atom(...)`, `TodosRpc.query(...)` and your own helpers are
|
|
115
|
+
- It wraps any top-level `const x = f(...)` and checks at run time whether the value is an atom, so `runtime.atom(...)`, `TodosRpc.query(...)` and your own helpers are labeled too. Runes and `use*` hooks are left alone.
|
|
113
116
|
- An atom in a top-level object literal is named by its path: `const pair = { todosAtom: Atom.make(...) }` labels `pair.todosAtom`.
|
|
114
|
-
- Inside functions, only `Atom.*` calls are
|
|
115
|
-
- Atoms in mdsvex (`.md`) pages aren't
|
|
117
|
+
- Inside functions, only `Atom.*` calls are labeled, so a function that makes atoms names them without every other call in it being wrapped.
|
|
118
|
+
- Atoms in mdsvex (`.md`) pages aren't labeled.
|
|
116
119
|
- Each component's instance script also starts by naming the component (`Counter`, from `counter.svelte`), so an inspector scope (`provideInspectorScope` in `effect-atom-svelte/inspector`) can say which component reads each atom.
|
|
117
120
|
|
|
118
121
|
## State across hot reloads
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-atom-svelte-devtools",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Developer tools for effect-atom-svelte: atom names from your source, and a live view of the registry",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"devtools",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"effect": "~4.1.0",
|
|
72
|
-
"effect-atom-svelte": "^0.5.
|
|
72
|
+
"effect-atom-svelte": "^0.5.1",
|
|
73
73
|
"svelte": "^5.57.2",
|
|
74
74
|
"vite": ">=5.0.0"
|
|
75
75
|
},
|