causal-inspector 0.2.0 → 0.2.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 +71 -0
- package/dist/causal-inspector.css +2899 -0
- package/dist/events.d.ts +1 -0
- package/dist/panes/CausalFlowPane.js +21 -9
- package/dist/panes/LogsPane.js +2 -1
- package/dist/panes/WorkflowExplorerPane.js +4 -1
- package/dist/reducer.js +37 -2
- package/dist/state.d.ts +3 -0
- package/dist/state.js +1 -0
- package/package.json +18 -3
- package/dist/panes/CorrelationExplorerPane.d.ts +0 -2
- package/dist/panes/CorrelationExplorerPane.js +0 -46
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# causal-inspector
|
|
2
|
+
|
|
3
|
+
React UI for inspecting causal-rs event streams, workflows, and reactor logs.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install causal-inspector
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer deps (provide the ones you use): `react`, `react-dom`, and — for the flow /
|
|
12
|
+
layout panes — `@xyflow/react`, `@dagrejs/dagre`, `flexlayout-react`.
|
|
13
|
+
|
|
14
|
+
## Embedding
|
|
15
|
+
|
|
16
|
+
The inspector ships **self-contained, isolated styles** — it does not require
|
|
17
|
+
Tailwind (or anything else) in the host app. Two imports:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { CausalInspector } from "causal-inspector";
|
|
21
|
+
import "causal-inspector/styles.css"; // utilities + tokens + flow/layout CSS, all scoped
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
That's it. Render it anywhere:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<CausalInspector transport={transport} />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Style isolation
|
|
31
|
+
|
|
32
|
+
All shipped CSS is confined to the `.causal-inspector` root the component renders:
|
|
33
|
+
|
|
34
|
+
- **Nothing leaks out** — every selector in `dist/causal-inspector.css` is namespaced
|
|
35
|
+
under `.causal-inspector`, so the inspector can't restyle the host app. The
|
|
36
|
+
third-party flow/layout CSS (`@xyflow/react`, `flexlayout-react`) is bundled and
|
|
37
|
+
scoped too, instead of polluting the global stylesheet.
|
|
38
|
+
- **The host doesn't leak in** — the bundle carries its own preflight reset and
|
|
39
|
+
design tokens (defined on `.causal-inspector`), and is emitted **without cascade
|
|
40
|
+
layers** so its scoped rules win on specificity over a host's global resets,
|
|
41
|
+
element styles, and `body`/reset CSS.
|
|
42
|
+
|
|
43
|
+
**Known limit:** scope-based isolation can't override a host rule that targets the
|
|
44
|
+
*same* Tailwind class name with `!important` (only possible if the host also runs
|
|
45
|
+
Tailwind), nor a pathological `* { font-family }`. If you embed inside a Tailwind
|
|
46
|
+
host, build with a class prefix (see below) to eliminate name collisions entirely.
|
|
47
|
+
|
|
48
|
+
### Re-theming
|
|
49
|
+
|
|
50
|
+
Override the design tokens on the root from the host:
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
.causal-inspector {
|
|
54
|
+
--color-background: #101014;
|
|
55
|
+
--color-foreground: #e7e7ef;
|
|
56
|
+
/* …any of the --color-* / --radius tokens… */
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Build
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
npm run build # tsc → dist, copy scoped overrides, compile the CSS bundle
|
|
64
|
+
npm run build:css # just recompile dist/causal-inspector.css
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The CSS bundle is produced by `postcss.config.mjs`: Tailwind v4 compiles
|
|
68
|
+
`src/styles.css` (scanning `src/**/*.{ts,tsx}` for the utilities actually used),
|
|
69
|
+
then every selector is scoped under `.causal-inspector` and the cascade layers are
|
|
70
|
+
flattened. To harden for a Tailwind host, add a Tailwind `prefix(...)` in
|
|
71
|
+
`src/styles.css` and the matching prefix to component class names.
|