@rindle/react-devtools 0.1.6
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/LICENSE +201 -0
- package/README.md +47 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +188 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
- package/src/index.ts +368 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @rindle/react-devtools
|
|
2
|
+
|
|
3
|
+
A floating, **dev-only** React panel for the [Rindle](https://github.com/rindle-sh/rindle) in-browser
|
|
4
|
+
devtools — the UI over [`@rindle/devtools`](../devtools). It renders the mutation **timeline** (the
|
|
5
|
+
fork/rebase loop, with the snap-back highlight), the **queries** inspector, and the live **delta**
|
|
6
|
+
stream ([`DEBUG-TOOLS-BROWSER-DESIGN.md`](../../designs/DEBUG-TOOLS-BROWSER-DESIGN.md) §4).
|
|
7
|
+
|
|
8
|
+
Pure React + inline styles — no CSS import, no build step beyond `tsc`.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Mount the panel once near your app root, and attach a client — both behind a dev flag so they
|
|
13
|
+
tree-shake out of production:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { RindleDevtools } from "@rindle/react-devtools";
|
|
17
|
+
|
|
18
|
+
function Root() {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<App />
|
|
22
|
+
{import.meta.env.DEV && <RindleDevtools />}
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// somewhere during dev bootstrap, after createRindleClient:
|
|
30
|
+
if (import.meta.env.DEV) {
|
|
31
|
+
const { attachDevtools } = await import("@rindle/devtools");
|
|
32
|
+
attachDevtools(app);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The panel auto-discovers the most recently attached client through the global hub. It starts as a
|
|
37
|
+
small `🌊 Rindle` launcher in the bottom-right; click to open.
|
|
38
|
+
|
|
39
|
+
### Props
|
|
40
|
+
|
|
41
|
+
| Prop | Type | Default | Description |
|
|
42
|
+
| ------------- | -------------- | ------- | ----------- |
|
|
43
|
+
| `core` | `DevtoolsCore` | — | Bind to a specific core instead of auto-discovering. |
|
|
44
|
+
| `defaultOpen` | `boolean` | `false` | Open the panel on first mount. |
|
|
45
|
+
|
|
46
|
+
You can also drive the core directly (`attachDevtools` is re-exported here for convenience). The data
|
|
47
|
+
logic lives in `@rindle/devtools`; this package is only the rendering.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type DevtoolsCore } from "@rindle/devtools";
|
|
3
|
+
export interface RindleDevtoolsProps {
|
|
4
|
+
/** Bind to a specific core. Omit to auto-discover the most recently attached client via the
|
|
5
|
+
* global hub (the common case). */
|
|
6
|
+
core?: DevtoolsCore;
|
|
7
|
+
/** Open the panel on first mount. Default false (starts as the launcher button). */
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** The floating Rindle devtools panel. Renders just a launcher until a client is attached via
|
|
11
|
+
* `attachDevtools(app)`. */
|
|
12
|
+
export declare function RindleDevtools({ core: explicit, defaultOpen }: RindleDevtoolsProps): ReactNode;
|
|
13
|
+
export { getDevtoolsCore, getDevtoolsHub, attachDevtools } from "@rindle/devtools";
|
|
14
|
+
export type { DevtoolsCore, DevtoolsState } from "@rindle/devtools";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAIL,KAAK,YAAY,EAMlB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,mBAAmB;IAClC;wCACoC;IACpC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,oFAAoF;IACpF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;6BAC6B;AAC7B,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAmB,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAWtG;AAgUD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACnF,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// @rindle/react-devtools — a floating, dev-only panel over `@rindle/devtools`
|
|
2
|
+
// (DEBUG-TOOLS-BROWSER-DESIGN.md §6.1). It discovers a running client through the global hub (or an
|
|
3
|
+
// explicit `core` prop) and renders the §4 panes: the mutation TIMELINE (the fork/rebase loop, with
|
|
4
|
+
// the snap-back highlight), the QUERIES inspector, and the live DELTA stream. Pure React + inline
|
|
5
|
+
// styles — no CSS import. Like `@rindle/react` it uses `createElement` rather than JSX (Node's test
|
|
6
|
+
// runner strips TS types but not JSX). Mount it once near your app root in development:
|
|
7
|
+
//
|
|
8
|
+
// {import.meta.env.DEV && createElement(RindleDevtools)}
|
|
9
|
+
//
|
|
10
|
+
// and attach a client in dev: `import("@rindle/devtools").then(d => d.attachDevtools(app))`.
|
|
11
|
+
import { createElement as h, useCallback, useMemo, useState, useSyncExternalStore } from "react";
|
|
12
|
+
import { getDevtoolsHub, } from "@rindle/devtools";
|
|
13
|
+
/** The floating Rindle devtools panel. Renders just a launcher until a client is attached via
|
|
14
|
+
* `attachDevtools(app)`. */
|
|
15
|
+
export function RindleDevtools({ core: explicit, defaultOpen = false }) {
|
|
16
|
+
const core = useDiscoveredCore(explicit);
|
|
17
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
18
|
+
if (!open) {
|
|
19
|
+
return h("div", { style: S.launcher }, h("button", { type: "button", style: S.launchBtn, onClick: () => setOpen(true), title: "Open Rindle devtools" }, "🌊 Rindle"));
|
|
20
|
+
}
|
|
21
|
+
return h(Panel, { core, onClose: () => setOpen(false) });
|
|
22
|
+
}
|
|
23
|
+
/** Discover the active core: an explicit prop wins; otherwise track the global hub's latest core,
|
|
24
|
+
* re-rendering when a client attaches/detaches (so the panel can be mounted before the app). */
|
|
25
|
+
function useDiscoveredCore(explicit) {
|
|
26
|
+
const hub = useMemo(() => getDevtoolsHub(), []);
|
|
27
|
+
const subscribe = useCallback((cb) => hub.subscribe(cb), [hub]);
|
|
28
|
+
const latest = useCallback(() => hub.cores[hub.cores.length - 1], [hub]);
|
|
29
|
+
const discovered = useSyncExternalStore(subscribe, latest, () => undefined);
|
|
30
|
+
return explicit ?? discovered;
|
|
31
|
+
}
|
|
32
|
+
function Panel({ core, onClose }) {
|
|
33
|
+
const [tab, setTab] = useState("timeline");
|
|
34
|
+
return h("div", { style: S.panel }, h("div", { style: S.header }, h("strong", { style: { fontSize: 12 } }, "🌊 Rindle devtools"), h("div", { style: { flex: 1 } }), h("button", { type: "button", style: S.iconBtn, onClick: onClose, title: "Close" }, "✕")), core
|
|
35
|
+
? h(CorePanel, { core, tab, setTab })
|
|
36
|
+
: h("div", { style: S.empty }, "No Rindle client attached. ", h("br"), "Call ", h("code", { style: S.code }, "attachDevtools(app)"), " from ", h("code", { style: S.code }, "@rindle/devtools"), " in dev."));
|
|
37
|
+
}
|
|
38
|
+
function CorePanel({ core, tab, setTab }) {
|
|
39
|
+
const subscribe = useCallback((cb) => core.subscribe(cb), [core]);
|
|
40
|
+
const getState = useCallback(() => core.getState(), [core]);
|
|
41
|
+
const state = useSyncExternalStore(subscribe, getState, getState);
|
|
42
|
+
const pendingCount = state.timeline.filter((t) => t.state === "pending").length;
|
|
43
|
+
return h("div", { style: { display: "contents" } }, h("div", { style: S.tabs }, h(TabButton, { active: tab === "timeline", onClick: () => setTab("timeline") }, "Timeline ", pendingCount > 0 ? h("span", { style: S.dot }, pendingCount) : null), h(TabButton, { active: tab === "queries", onClick: () => setTab("queries") }, "Queries ", h("span", { style: S.count }, state.queries.length)), h(TabButton, { active: tab === "deltas", onClick: () => setTab("deltas") }, "Deltas ", h("span", { style: S.count }, state.deltas.length))), h("div", { style: S.body }, tab === "timeline" ? h(TimelinePane, { state, core }) : null, tab === "queries" ? h(QueriesPane, { state }) : null, tab === "deltas" ? h(DeltasPane, { state, core }) : null));
|
|
44
|
+
}
|
|
45
|
+
// --- Timeline (§4.1) ---------------------------------------------------------
|
|
46
|
+
function TimelinePane({ state, core }) {
|
|
47
|
+
if (!state.capabilities.optimistic) {
|
|
48
|
+
return h("div", { style: S.empty }, "This backend has no optimistic loop — the mutation timeline is empty.");
|
|
49
|
+
}
|
|
50
|
+
const rows = [...state.timeline].reverse(); // newest first
|
|
51
|
+
const o = state.optimistic;
|
|
52
|
+
return h("div", null, h("div", { style: S.toolbar }, h("span", { style: S.muted }, `confirmed lmid ${o?.confirmedLmid ?? 0} · next mid ${o?.nextMid ?? 1}${o && o.bufferedFrames > 0 ? ` · ${o.bufferedFrames} buffered` : ""}`), h("div", { style: { flex: 1 } }), h("button", { type: "button", style: S.smallBtn, onClick: () => core.clearHistory() }, "clear settled")), rows.length === 0
|
|
53
|
+
? h("div", { style: S.empty }, "No mutations yet. Invoke a mutator to watch the fork/rebase loop.")
|
|
54
|
+
: rows.map((t) => h(TimelineRow, { key: t.id, t })));
|
|
55
|
+
}
|
|
56
|
+
function TimelineRow({ t }) {
|
|
57
|
+
const [open, setOpen] = useState(false);
|
|
58
|
+
const elapsed = (t.settledAt ?? Date.now()) - t.invokedAt;
|
|
59
|
+
return h("div", { style: S.row }, h("div", { style: S.rowHead, onClick: () => setOpen((v) => !v) }, h(StateBadge, { state: t.state }), h("span", { style: S.mono }, t.name), h("span", { style: S.muted }, t.mid != null ? `mid ${t.mid}` : t.folded ? "folding…" : "—"), t.folded ? h("span", { style: S.tag }, "folded") : null, t.reconciledWithChurn
|
|
60
|
+
? h("span", { style: S.warn, title: "View churn coincided with this confirmation — a possible snap-back (prediction diverged from the server)." }, "⚡ snap-back?")
|
|
61
|
+
: null, h("div", { style: { flex: 1 } }), h("span", { style: S.muted }, fmtMs(elapsed))), open
|
|
62
|
+
? h("div", { style: S.rowBody }, h(KV, { k: "args", v: h("pre", { style: S.pre }, safeJson(t.args)) }), h(KV, { k: "tables", v: t.tables.join(", ") || "—" }), h(KV, { k: "affects queries", v: t.affectedQueries.length ? t.affectedQueries.map((q) => `#${q}`).join(", ") : "—" }), t.fold
|
|
63
|
+
? h(KV, {
|
|
64
|
+
k: "fold",
|
|
65
|
+
v: `${t.fold.foldKey} — debounce ${t.fold.debounceMs}ms${t.fold.maxWaitMs ? `, maxWait ${t.fold.maxWaitMs}ms` : ""}${t.fold.deferAcrossWrites ? ", deferAcrossWrites" : ""}${t.fold.flushed ? " (flushed)" : ""}`,
|
|
66
|
+
})
|
|
67
|
+
: null)
|
|
68
|
+
: null);
|
|
69
|
+
}
|
|
70
|
+
// --- Queries (§4.2) ----------------------------------------------------------
|
|
71
|
+
function QueriesPane({ state }) {
|
|
72
|
+
if (state.queries.length === 0)
|
|
73
|
+
return h("div", { style: S.empty }, "No materialized views are mounted.");
|
|
74
|
+
return h("div", null, state.queries.map((q) => h(QueryRow, { key: q.qid, q })));
|
|
75
|
+
}
|
|
76
|
+
function QueryRow({ q }) {
|
|
77
|
+
const [open, setOpen] = useState(false);
|
|
78
|
+
return h("div", { style: S.row }, h("div", { style: S.rowHead, onClick: () => setOpen((v) => !v) }, h("span", { style: S.muted }, `#${q.qid}`), h(ResultBadge, { rt: q.resultType }), q.pending ? h("span", { style: S.tagPending }, "pending") : null, h("span", { style: S.mono, title: q.summary }, q.summary), h("div", { style: { flex: 1 } }), h("span", { style: S.muted }, `${q.rowCount} rows`)), open
|
|
79
|
+
? h("div", { style: S.rowBody }, h(KV, { k: "ast", v: h("pre", { style: S.pre }, safeJson(q.ast)) }), h(KV, { k: "reads tables", v: q.tables.join(", ") }), h(KV, { k: `sample (${q.sample.length}/${q.rowCount})`, v: h("pre", { style: S.pre }, safeJson(q.sample)) }))
|
|
80
|
+
: null);
|
|
81
|
+
}
|
|
82
|
+
// --- Delta stream (§4.3) -----------------------------------------------------
|
|
83
|
+
const DELTA_KINDS = ["hello", "snapshot", "add", "remove", "edit"];
|
|
84
|
+
function DeltasPane({ state, core }) {
|
|
85
|
+
const [paused, setPaused] = useState(false);
|
|
86
|
+
const [frozen, setFrozen] = useState([]);
|
|
87
|
+
const [hidden, setHidden] = useState(() => new Set());
|
|
88
|
+
const live = state.deltas;
|
|
89
|
+
const shown = paused ? frozen : live;
|
|
90
|
+
const rows = shown.filter((d) => !hidden.has(d.kind)).slice(-300).reverse();
|
|
91
|
+
const toggleKind = (k) => setHidden((prev) => {
|
|
92
|
+
const next = new Set(prev);
|
|
93
|
+
if (next.has(k))
|
|
94
|
+
next.delete(k);
|
|
95
|
+
else
|
|
96
|
+
next.add(k);
|
|
97
|
+
return next;
|
|
98
|
+
});
|
|
99
|
+
return h("div", null, h("div", { style: S.toolbar }, ...DELTA_KINDS.map((k) => h("button", {
|
|
100
|
+
key: k,
|
|
101
|
+
type: "button",
|
|
102
|
+
style: { ...S.chip, ...(hidden.has(k) ? S.chipOff : null) },
|
|
103
|
+
onClick: () => toggleKind(k),
|
|
104
|
+
title: hidden.has(k) ? `show ${k}` : `hide ${k}`,
|
|
105
|
+
}, k)), h("div", { style: { flex: 1 } }), h("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
style: S.smallBtn,
|
|
108
|
+
onClick: () => {
|
|
109
|
+
if (!paused)
|
|
110
|
+
setFrozen(live.slice());
|
|
111
|
+
setPaused((p) => !p);
|
|
112
|
+
},
|
|
113
|
+
}, paused ? "▶ resume" : "⏸ pause"), h("button", { type: "button", style: S.smallBtn, onClick: () => core.clearDeltas() }, "clear")), rows.length === 0
|
|
114
|
+
? h("div", { style: S.empty }, `No deltas${hidden.size ? " match the filter" : " yet"}.`)
|
|
115
|
+
: rows.map((d) => h("div", { key: d.seq, style: S.deltaRow }, h("span", { style: S.muted }, `#${d.qid}`), h(DeltaBadge, { kind: d.kind }), h("span", { style: S.mono }, d.label))));
|
|
116
|
+
}
|
|
117
|
+
// --- small components --------------------------------------------------------
|
|
118
|
+
function TabButton({ active, onClick, children }) {
|
|
119
|
+
return h("button", { type: "button", style: { ...S.tab, ...(active ? S.tabActive : null) }, onClick }, children);
|
|
120
|
+
}
|
|
121
|
+
function KV({ k, v }) {
|
|
122
|
+
return h("div", { style: S.kv }, h("span", { style: S.kvKey }, k), h("span", { style: S.kvVal }, v));
|
|
123
|
+
}
|
|
124
|
+
const STATE_COLOR = { pending: "#d9a106", confirmed: "#2ea043", dropped: "#cf3b3b" };
|
|
125
|
+
function StateBadge({ state }) {
|
|
126
|
+
return h("span", { style: { ...S.badge, background: STATE_COLOR[state] } }, state);
|
|
127
|
+
}
|
|
128
|
+
function ResultBadge({ rt }) {
|
|
129
|
+
const color = rt === "complete" ? "#2ea043" : rt === "error" ? "#cf3b3b" : "#6b7785";
|
|
130
|
+
return h("span", { style: { ...S.badge, background: color } }, rt);
|
|
131
|
+
}
|
|
132
|
+
const DELTA_COLOR = { hello: "#6b7785", snapshot: "#8957e5", add: "#2ea043", remove: "#cf3b3b", edit: "#1f6feb" };
|
|
133
|
+
function DeltaBadge({ kind }) {
|
|
134
|
+
return h("span", { style: { ...S.badge, background: DELTA_COLOR[kind] } }, kind);
|
|
135
|
+
}
|
|
136
|
+
// --- formatting --------------------------------------------------------------
|
|
137
|
+
function fmtMs(ms) {
|
|
138
|
+
if (ms < 1000)
|
|
139
|
+
return `${Math.round(ms)}ms`;
|
|
140
|
+
if (ms < 60000)
|
|
141
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
142
|
+
return `${Math.round(ms / 1000)}s`;
|
|
143
|
+
}
|
|
144
|
+
function safeJson(v) {
|
|
145
|
+
try {
|
|
146
|
+
return JSON.stringify(v, null, 2) ?? String(v);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return String(v);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// --- styles (inline; no CSS dependency) --------------------------------------
|
|
153
|
+
const mono = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
154
|
+
const S = {
|
|
155
|
+
launcher: { position: "fixed", bottom: 12, right: 12, zIndex: 2147483000 },
|
|
156
|
+
launchBtn: { font: `600 12px ${mono}`, color: "#e6edf3", background: "#161b22", border: "1px solid #30363d", borderRadius: 8, padding: "6px 10px", cursor: "pointer", boxShadow: "0 2px 8px rgba(0,0,0,.35)" },
|
|
157
|
+
panel: { position: "fixed", bottom: 12, right: 12, width: 440, maxWidth: "calc(100vw - 24px)", height: "60vh", maxHeight: 640, display: "flex", flexDirection: "column", font: `12px ${mono}`, color: "#e6edf3", background: "#0d1117", border: "1px solid #30363d", borderRadius: 10, boxShadow: "0 8px 32px rgba(0,0,0,.5)", zIndex: 2147483000, overflow: "hidden" },
|
|
158
|
+
header: { display: "flex", alignItems: "center", gap: 8, padding: "8px 10px", borderBottom: "1px solid #21262d" },
|
|
159
|
+
iconBtn: { background: "transparent", color: "#8b949e", border: "none", cursor: "pointer", fontSize: 13 },
|
|
160
|
+
tabs: { display: "flex", gap: 2, padding: "6px 8px 0", borderBottom: "1px solid #21262d" },
|
|
161
|
+
tab: { font: `600 11px ${mono}`, color: "#8b949e", background: "transparent", border: "none", borderBottom: "2px solid transparent", padding: "6px 10px", cursor: "pointer" },
|
|
162
|
+
tabActive: { color: "#e6edf3", borderBottom: "2px solid #1f6feb" },
|
|
163
|
+
body: { flex: 1, overflowY: "auto", padding: "6px 8px" },
|
|
164
|
+
toolbar: { display: "flex", alignItems: "center", gap: 6, padding: "4px 2px 8px", flexWrap: "wrap" },
|
|
165
|
+
row: { borderBottom: "1px solid #161b22" },
|
|
166
|
+
rowHead: { display: "flex", alignItems: "center", gap: 6, padding: "5px 4px", cursor: "pointer" },
|
|
167
|
+
rowBody: { padding: "2px 4px 8px 4px", display: "flex", flexDirection: "column", gap: 3 },
|
|
168
|
+
deltaRow: { display: "flex", alignItems: "center", gap: 6, padding: "3px 4px", borderBottom: "1px solid #161b22" },
|
|
169
|
+
badge: { font: `600 10px ${mono}`, color: "#fff", borderRadius: 4, padding: "1px 5px", textTransform: "uppercase" },
|
|
170
|
+
tag: { font: `10px ${mono}`, color: "#c9a0ff", border: "1px solid #3b2d57", borderRadius: 4, padding: "0 4px" },
|
|
171
|
+
tagPending: { font: `10px ${mono}`, color: "#f0c552", border: "1px solid #5a4a16", borderRadius: 4, padding: "0 4px" },
|
|
172
|
+
warn: { font: `600 10px ${mono}`, color: "#f0883e" },
|
|
173
|
+
mono: { fontFamily: mono, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
174
|
+
muted: { color: "#6e7681", fontSize: 11, whiteSpace: "nowrap" },
|
|
175
|
+
count: { color: "#6e7681" },
|
|
176
|
+
dot: { background: "#d9a106", color: "#0d1117", borderRadius: 8, padding: "0 5px", marginLeft: 2, fontWeight: 700 },
|
|
177
|
+
empty: { color: "#6e7681", padding: 16, textAlign: "center", lineHeight: 1.6 },
|
|
178
|
+
smallBtn: { font: `11px ${mono}`, color: "#c9d1d9", background: "#21262d", border: "1px solid #30363d", borderRadius: 5, padding: "2px 7px", cursor: "pointer" },
|
|
179
|
+
chip: { font: `10px ${mono}`, color: "#c9d1d9", background: "#161b22", border: "1px solid #30363d", borderRadius: 10, padding: "1px 8px", cursor: "pointer" },
|
|
180
|
+
chipOff: { color: "#484f58", textDecoration: "line-through" },
|
|
181
|
+
kv: { display: "flex", gap: 6, alignItems: "baseline" },
|
|
182
|
+
kvKey: { color: "#6e7681", minWidth: 96, flexShrink: 0 },
|
|
183
|
+
kvVal: { color: "#c9d1d9", wordBreak: "break-word", flex: 1 },
|
|
184
|
+
pre: { margin: 0, padding: "4px 6px", background: "#161b22", borderRadius: 5, maxHeight: 180, overflow: "auto", whiteSpace: "pre-wrap" },
|
|
185
|
+
code: { background: "#161b22", borderRadius: 4, padding: "0 4px" },
|
|
186
|
+
};
|
|
187
|
+
export { getDevtoolsCore, getDevtoolsHub, attachDevtools } from "@rindle/devtools";
|
|
188
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oGAAoG;AACpG,oGAAoG;AACpG,kGAAkG;AAClG,oGAAoG;AACpG,wFAAwF;AACxF,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,6FAA6F;AAE7F,OAAO,EAAE,aAAa,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEjG,OAAO,EACL,cAAc,GASf,MAAM,kBAAkB,CAAC;AAU1B;6BAC6B;AAC7B,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,GAAG,KAAK,EAAuB;IACzF,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,CACN,KAAK,E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mB,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE;IAC7J,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE;IAC7D,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE;IACvD,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;IACxD,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,EAAE;IAC7D,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE;IACxI,IAAI,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE;CACnE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rindle/react-devtools",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/rindle-sh/rindle.git",
|
|
8
|
+
"directory": "packages/react-devtools"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"description": "React floating panel for the Rindle in-browser devtools: mutation timeline, queries inspector, delta stream over @rindle/devtools (DEBUG-TOOLS-BROWSER-DESIGN.md). Dev-only; tree-shakes out of production.",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"@rindle/source": "./src/index.ts",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"src",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@rindle/devtools": "0.1.6"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.10.0",
|
|
35
|
+
"@types/react": "^19.0.0",
|
|
36
|
+
"@types/react-dom": "^19.0.0",
|
|
37
|
+
"@types/jsdom": "^21.1.0",
|
|
38
|
+
"jsdom": "^25.0.0",
|
|
39
|
+
"react": "^19.1.0",
|
|
40
|
+
"react-dom": "^19.1.0",
|
|
41
|
+
"typescript": "^5.7.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.build.json",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"test": "tsc --noEmit && node --conditions=@rindle/source --test test/*.test.ts"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
// @rindle/react-devtools — a floating, dev-only panel over `@rindle/devtools`
|
|
2
|
+
// (DEBUG-TOOLS-BROWSER-DESIGN.md §6.1). It discovers a running client through the global hub (or an
|
|
3
|
+
// explicit `core` prop) and renders the §4 panes: the mutation TIMELINE (the fork/rebase loop, with
|
|
4
|
+
// the snap-back highlight), the QUERIES inspector, and the live DELTA stream. Pure React + inline
|
|
5
|
+
// styles — no CSS import. Like `@rindle/react` it uses `createElement` rather than JSX (Node's test
|
|
6
|
+
// runner strips TS types but not JSX). Mount it once near your app root in development:
|
|
7
|
+
//
|
|
8
|
+
// {import.meta.env.DEV && createElement(RindleDevtools)}
|
|
9
|
+
//
|
|
10
|
+
// and attach a client in dev: `import("@rindle/devtools").then(d => d.attachDevtools(app))`.
|
|
11
|
+
|
|
12
|
+
import { createElement as h, useCallback, useMemo, useState, useSyncExternalStore } from "react";
|
|
13
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
14
|
+
import {
|
|
15
|
+
getDevtoolsHub,
|
|
16
|
+
type DeltaEntry,
|
|
17
|
+
type DeltaKind,
|
|
18
|
+
type DevtoolsCore,
|
|
19
|
+
type DevtoolsState,
|
|
20
|
+
type MutationState,
|
|
21
|
+
type QueryEntry,
|
|
22
|
+
type ResultType,
|
|
23
|
+
type TimelineEntry,
|
|
24
|
+
} from "@rindle/devtools";
|
|
25
|
+
|
|
26
|
+
export interface RindleDevtoolsProps {
|
|
27
|
+
/** Bind to a specific core. Omit to auto-discover the most recently attached client via the
|
|
28
|
+
* global hub (the common case). */
|
|
29
|
+
core?: DevtoolsCore;
|
|
30
|
+
/** Open the panel on first mount. Default false (starts as the launcher button). */
|
|
31
|
+
defaultOpen?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The floating Rindle devtools panel. Renders just a launcher until a client is attached via
|
|
35
|
+
* `attachDevtools(app)`. */
|
|
36
|
+
export function RindleDevtools({ core: explicit, defaultOpen = false }: RindleDevtoolsProps): ReactNode {
|
|
37
|
+
const core = useDiscoveredCore(explicit);
|
|
38
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
39
|
+
if (!open) {
|
|
40
|
+
return h(
|
|
41
|
+
"div",
|
|
42
|
+
{ style: S.launcher },
|
|
43
|
+
h("button", { type: "button", style: S.launchBtn, onClick: () => setOpen(true), title: "Open Rindle devtools" }, "🌊 Rindle"),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return h(Panel, { core, onClose: () => setOpen(false) });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Discover the active core: an explicit prop wins; otherwise track the global hub's latest core,
|
|
50
|
+
* re-rendering when a client attaches/detaches (so the panel can be mounted before the app). */
|
|
51
|
+
function useDiscoveredCore(explicit?: DevtoolsCore): DevtoolsCore | undefined {
|
|
52
|
+
const hub = useMemo(() => getDevtoolsHub(), []);
|
|
53
|
+
const subscribe = useCallback((cb: () => void) => hub.subscribe(cb), [hub]);
|
|
54
|
+
const latest = useCallback(() => hub.cores[hub.cores.length - 1], [hub]);
|
|
55
|
+
const discovered = useSyncExternalStore(subscribe, latest, () => undefined);
|
|
56
|
+
return explicit ?? discovered;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type Tab = "timeline" | "queries" | "deltas";
|
|
60
|
+
|
|
61
|
+
function Panel({ core, onClose }: { core: DevtoolsCore | undefined; onClose: () => void }): ReactNode {
|
|
62
|
+
const [tab, setTab] = useState<Tab>("timeline");
|
|
63
|
+
return h(
|
|
64
|
+
"div",
|
|
65
|
+
{ style: S.panel },
|
|
66
|
+
h(
|
|
67
|
+
"div",
|
|
68
|
+
{ style: S.header },
|
|
69
|
+
h("strong", { style: { fontSize: 12 } }, "🌊 Rindle devtools"),
|
|
70
|
+
h("div", { style: { flex: 1 } }),
|
|
71
|
+
h("button", { type: "button", style: S.iconBtn, onClick: onClose, title: "Close" }, "✕"),
|
|
72
|
+
),
|
|
73
|
+
core
|
|
74
|
+
? h(CorePanel, { core, tab, setTab })
|
|
75
|
+
: h(
|
|
76
|
+
"div",
|
|
77
|
+
{ style: S.empty },
|
|
78
|
+
"No Rindle client attached. ",
|
|
79
|
+
h("br"),
|
|
80
|
+
"Call ",
|
|
81
|
+
h("code", { style: S.code }, "attachDevtools(app)"),
|
|
82
|
+
" from ",
|
|
83
|
+
h("code", { style: S.code }, "@rindle/devtools"),
|
|
84
|
+
" in dev.",
|
|
85
|
+
),
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function CorePanel({ core, tab, setTab }: { core: DevtoolsCore; tab: Tab; setTab: (t: Tab) => void }): ReactNode {
|
|
90
|
+
const subscribe = useCallback((cb: () => void) => core.subscribe(cb), [core]);
|
|
91
|
+
const getState = useCallback(() => core.getState(), [core]);
|
|
92
|
+
const state = useSyncExternalStore(subscribe, getState, getState);
|
|
93
|
+
const pendingCount = state.timeline.filter((t) => t.state === "pending").length;
|
|
94
|
+
|
|
95
|
+
return h(
|
|
96
|
+
"div",
|
|
97
|
+
{ style: { display: "contents" } },
|
|
98
|
+
h(
|
|
99
|
+
"div",
|
|
100
|
+
{ style: S.tabs },
|
|
101
|
+
h(TabButton, { active: tab === "timeline", onClick: () => setTab("timeline") }, "Timeline ", pendingCount > 0 ? h("span", { style: S.dot }, pendingCount) : null),
|
|
102
|
+
h(TabButton, { active: tab === "queries", onClick: () => setTab("queries") }, "Queries ", h("span", { style: S.count }, state.queries.length)),
|
|
103
|
+
h(TabButton, { active: tab === "deltas", onClick: () => setTab("deltas") }, "Deltas ", h("span", { style: S.count }, state.deltas.length)),
|
|
104
|
+
),
|
|
105
|
+
h(
|
|
106
|
+
"div",
|
|
107
|
+
{ style: S.body },
|
|
108
|
+
tab === "timeline" ? h(TimelinePane, { state, core }) : null,
|
|
109
|
+
tab === "queries" ? h(QueriesPane, { state }) : null,
|
|
110
|
+
tab === "deltas" ? h(DeltasPane, { state, core }) : null,
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// --- Timeline (§4.1) ---------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
function TimelinePane({ state, core }: { state: DevtoolsState; core: DevtoolsCore }): ReactNode {
|
|
118
|
+
if (!state.capabilities.optimistic) {
|
|
119
|
+
return h("div", { style: S.empty }, "This backend has no optimistic loop — the mutation timeline is empty.");
|
|
120
|
+
}
|
|
121
|
+
const rows = [...state.timeline].reverse(); // newest first
|
|
122
|
+
const o = state.optimistic;
|
|
123
|
+
return h(
|
|
124
|
+
"div",
|
|
125
|
+
null,
|
|
126
|
+
h(
|
|
127
|
+
"div",
|
|
128
|
+
{ style: S.toolbar },
|
|
129
|
+
h(
|
|
130
|
+
"span",
|
|
131
|
+
{ style: S.muted },
|
|
132
|
+
`confirmed lmid ${o?.confirmedLmid ?? 0} · next mid ${o?.nextMid ?? 1}${o && o.bufferedFrames > 0 ? ` · ${o.bufferedFrames} buffered` : ""}`,
|
|
133
|
+
),
|
|
134
|
+
h("div", { style: { flex: 1 } }),
|
|
135
|
+
h("button", { type: "button", style: S.smallBtn, onClick: () => core.clearHistory() }, "clear settled"),
|
|
136
|
+
),
|
|
137
|
+
rows.length === 0
|
|
138
|
+
? h("div", { style: S.empty }, "No mutations yet. Invoke a mutator to watch the fork/rebase loop.")
|
|
139
|
+
: rows.map((t) => h(TimelineRow, { key: t.id, t })),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function TimelineRow({ t }: { t: TimelineEntry }): ReactNode {
|
|
144
|
+
const [open, setOpen] = useState(false);
|
|
145
|
+
const elapsed = (t.settledAt ?? Date.now()) - t.invokedAt;
|
|
146
|
+
return h(
|
|
147
|
+
"div",
|
|
148
|
+
{ style: S.row },
|
|
149
|
+
h(
|
|
150
|
+
"div",
|
|
151
|
+
{ style: S.rowHead, onClick: () => setOpen((v) => !v) },
|
|
152
|
+
h(StateBadge, { state: t.state }),
|
|
153
|
+
h("span", { style: S.mono }, t.name),
|
|
154
|
+
h("span", { style: S.muted }, t.mid != null ? `mid ${t.mid}` : t.folded ? "folding…" : "—"),
|
|
155
|
+
t.folded ? h("span", { style: S.tag }, "folded") : null,
|
|
156
|
+
t.reconciledWithChurn
|
|
157
|
+
? h(
|
|
158
|
+
"span",
|
|
159
|
+
{ style: S.warn, title: "View churn coincided with this confirmation — a possible snap-back (prediction diverged from the server)." },
|
|
160
|
+
"⚡ snap-back?",
|
|
161
|
+
)
|
|
162
|
+
: null,
|
|
163
|
+
h("div", { style: { flex: 1 } }),
|
|
164
|
+
h("span", { style: S.muted }, fmtMs(elapsed)),
|
|
165
|
+
),
|
|
166
|
+
open
|
|
167
|
+
? h(
|
|
168
|
+
"div",
|
|
169
|
+
{ style: S.rowBody },
|
|
170
|
+
h(KV, { k: "args", v: h("pre", { style: S.pre }, safeJson(t.args)) }),
|
|
171
|
+
h(KV, { k: "tables", v: t.tables.join(", ") || "—" }),
|
|
172
|
+
h(KV, { k: "affects queries", v: t.affectedQueries.length ? t.affectedQueries.map((q) => `#${q}`).join(", ") : "—" }),
|
|
173
|
+
t.fold
|
|
174
|
+
? h(KV, {
|
|
175
|
+
k: "fold",
|
|
176
|
+
v: `${t.fold.foldKey} — debounce ${t.fold.debounceMs}ms${t.fold.maxWaitMs ? `, maxWait ${t.fold.maxWaitMs}ms` : ""}${
|
|
177
|
+
t.fold.deferAcrossWrites ? ", deferAcrossWrites" : ""
|
|
178
|
+
}${t.fold.flushed ? " (flushed)" : ""}`,
|
|
179
|
+
})
|
|
180
|
+
: null,
|
|
181
|
+
)
|
|
182
|
+
: null,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// --- Queries (§4.2) ----------------------------------------------------------
|
|
187
|
+
|
|
188
|
+
function QueriesPane({ state }: { state: DevtoolsState }): ReactNode {
|
|
189
|
+
if (state.queries.length === 0) return h("div", { style: S.empty }, "No materialized views are mounted.");
|
|
190
|
+
return h("div", null, state.queries.map((q) => h(QueryRow, { key: q.qid, q })));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function QueryRow({ q }: { q: QueryEntry }): ReactNode {
|
|
194
|
+
const [open, setOpen] = useState(false);
|
|
195
|
+
return h(
|
|
196
|
+
"div",
|
|
197
|
+
{ style: S.row },
|
|
198
|
+
h(
|
|
199
|
+
"div",
|
|
200
|
+
{ style: S.rowHead, onClick: () => setOpen((v) => !v) },
|
|
201
|
+
h("span", { style: S.muted }, `#${q.qid}`),
|
|
202
|
+
h(ResultBadge, { rt: q.resultType }),
|
|
203
|
+
q.pending ? h("span", { style: S.tagPending }, "pending") : null,
|
|
204
|
+
h("span", { style: S.mono, title: q.summary }, q.summary),
|
|
205
|
+
h("div", { style: { flex: 1 } }),
|
|
206
|
+
h("span", { style: S.muted }, `${q.rowCount} rows`),
|
|
207
|
+
),
|
|
208
|
+
open
|
|
209
|
+
? h(
|
|
210
|
+
"div",
|
|
211
|
+
{ style: S.rowBody },
|
|
212
|
+
h(KV, { k: "ast", v: h("pre", { style: S.pre }, safeJson(q.ast)) }),
|
|
213
|
+
h(KV, { k: "reads tables", v: q.tables.join(", ") }),
|
|
214
|
+
h(KV, { k: `sample (${q.sample.length}/${q.rowCount})`, v: h("pre", { style: S.pre }, safeJson(q.sample)) }),
|
|
215
|
+
)
|
|
216
|
+
: null,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// --- Delta stream (§4.3) -----------------------------------------------------
|
|
221
|
+
|
|
222
|
+
const DELTA_KINDS: DeltaKind[] = ["hello", "snapshot", "add", "remove", "edit"];
|
|
223
|
+
|
|
224
|
+
function DeltasPane({ state, core }: { state: DevtoolsState; core: DevtoolsCore }): ReactNode {
|
|
225
|
+
const [paused, setPaused] = useState(false);
|
|
226
|
+
const [frozen, setFrozen] = useState<DeltaEntry[]>([]);
|
|
227
|
+
const [hidden, setHidden] = useState<Set<DeltaKind>>(() => new Set());
|
|
228
|
+
|
|
229
|
+
const live = state.deltas;
|
|
230
|
+
const shown = paused ? frozen : live;
|
|
231
|
+
const rows = shown.filter((d) => !hidden.has(d.kind)).slice(-300).reverse();
|
|
232
|
+
|
|
233
|
+
const toggleKind = (k: DeltaKind) =>
|
|
234
|
+
setHidden((prev) => {
|
|
235
|
+
const next = new Set(prev);
|
|
236
|
+
if (next.has(k)) next.delete(k);
|
|
237
|
+
else next.add(k);
|
|
238
|
+
return next;
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
return h(
|
|
242
|
+
"div",
|
|
243
|
+
null,
|
|
244
|
+
h(
|
|
245
|
+
"div",
|
|
246
|
+
{ style: S.toolbar },
|
|
247
|
+
...DELTA_KINDS.map((k) =>
|
|
248
|
+
h(
|
|
249
|
+
"button",
|
|
250
|
+
{
|
|
251
|
+
key: k,
|
|
252
|
+
type: "button",
|
|
253
|
+
style: { ...S.chip, ...(hidden.has(k) ? S.chipOff : null) },
|
|
254
|
+
onClick: () => toggleKind(k),
|
|
255
|
+
title: hidden.has(k) ? `show ${k}` : `hide ${k}`,
|
|
256
|
+
},
|
|
257
|
+
k,
|
|
258
|
+
),
|
|
259
|
+
),
|
|
260
|
+
h("div", { style: { flex: 1 } }),
|
|
261
|
+
h(
|
|
262
|
+
"button",
|
|
263
|
+
{
|
|
264
|
+
type: "button",
|
|
265
|
+
style: S.smallBtn,
|
|
266
|
+
onClick: () => {
|
|
267
|
+
if (!paused) setFrozen(live.slice());
|
|
268
|
+
setPaused((p) => !p);
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
paused ? "▶ resume" : "⏸ pause",
|
|
272
|
+
),
|
|
273
|
+
h("button", { type: "button", style: S.smallBtn, onClick: () => core.clearDeltas() }, "clear"),
|
|
274
|
+
),
|
|
275
|
+
rows.length === 0
|
|
276
|
+
? h("div", { style: S.empty }, `No deltas${hidden.size ? " match the filter" : " yet"}.`)
|
|
277
|
+
: rows.map((d) =>
|
|
278
|
+
h(
|
|
279
|
+
"div",
|
|
280
|
+
{ key: d.seq, style: S.deltaRow },
|
|
281
|
+
h("span", { style: S.muted }, `#${d.qid}`),
|
|
282
|
+
h(DeltaBadge, { kind: d.kind }),
|
|
283
|
+
h("span", { style: S.mono }, d.label),
|
|
284
|
+
),
|
|
285
|
+
),
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// --- small components --------------------------------------------------------
|
|
290
|
+
|
|
291
|
+
function TabButton({ active, onClick, children }: { active: boolean; onClick: () => void; children?: ReactNode }): ReactNode {
|
|
292
|
+
return h("button", { type: "button", style: { ...S.tab, ...(active ? S.tabActive : null) }, onClick }, children);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function KV({ k, v }: { k: string; v: ReactNode }): ReactNode {
|
|
296
|
+
return h("div", { style: S.kv }, h("span", { style: S.kvKey }, k), h("span", { style: S.kvVal }, v));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const STATE_COLOR: Record<MutationState, string> = { pending: "#d9a106", confirmed: "#2ea043", dropped: "#cf3b3b" };
|
|
300
|
+
function StateBadge({ state }: { state: MutationState }): ReactNode {
|
|
301
|
+
return h("span", { style: { ...S.badge, background: STATE_COLOR[state] } }, state);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function ResultBadge({ rt }: { rt: ResultType }): ReactNode {
|
|
305
|
+
const color = rt === "complete" ? "#2ea043" : rt === "error" ? "#cf3b3b" : "#6b7785";
|
|
306
|
+
return h("span", { style: { ...S.badge, background: color } }, rt);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const DELTA_COLOR: Record<DeltaKind, string> = { hello: "#6b7785", snapshot: "#8957e5", add: "#2ea043", remove: "#cf3b3b", edit: "#1f6feb" };
|
|
310
|
+
function DeltaBadge({ kind }: { kind: DeltaKind }): ReactNode {
|
|
311
|
+
return h("span", { style: { ...S.badge, background: DELTA_COLOR[kind] } }, kind);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// --- formatting --------------------------------------------------------------
|
|
315
|
+
|
|
316
|
+
function fmtMs(ms: number): string {
|
|
317
|
+
if (ms < 1000) return `${Math.round(ms)}ms`;
|
|
318
|
+
if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
|
|
319
|
+
return `${Math.round(ms / 1000)}s`;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function safeJson(v: unknown): string {
|
|
323
|
+
try {
|
|
324
|
+
return JSON.stringify(v, null, 2) ?? String(v);
|
|
325
|
+
} catch {
|
|
326
|
+
return String(v);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// --- styles (inline; no CSS dependency) --------------------------------------
|
|
331
|
+
|
|
332
|
+
const mono = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
333
|
+
const S: Record<string, CSSProperties> = {
|
|
334
|
+
launcher: { position: "fixed", bottom: 12, right: 12, zIndex: 2147483000 },
|
|
335
|
+
launchBtn: { font: `600 12px ${mono}`, color: "#e6edf3", background: "#161b22", border: "1px solid #30363d", borderRadius: 8, padding: "6px 10px", cursor: "pointer", boxShadow: "0 2px 8px rgba(0,0,0,.35)" },
|
|
336
|
+
panel: { position: "fixed", bottom: 12, right: 12, width: 440, maxWidth: "calc(100vw - 24px)", height: "60vh", maxHeight: 640, display: "flex", flexDirection: "column", font: `12px ${mono}`, color: "#e6edf3", background: "#0d1117", border: "1px solid #30363d", borderRadius: 10, boxShadow: "0 8px 32px rgba(0,0,0,.5)", zIndex: 2147483000, overflow: "hidden" },
|
|
337
|
+
header: { display: "flex", alignItems: "center", gap: 8, padding: "8px 10px", borderBottom: "1px solid #21262d" },
|
|
338
|
+
iconBtn: { background: "transparent", color: "#8b949e", border: "none", cursor: "pointer", fontSize: 13 },
|
|
339
|
+
tabs: { display: "flex", gap: 2, padding: "6px 8px 0", borderBottom: "1px solid #21262d" },
|
|
340
|
+
tab: { font: `600 11px ${mono}`, color: "#8b949e", background: "transparent", border: "none", borderBottom: "2px solid transparent", padding: "6px 10px", cursor: "pointer" },
|
|
341
|
+
tabActive: { color: "#e6edf3", borderBottom: "2px solid #1f6feb" },
|
|
342
|
+
body: { flex: 1, overflowY: "auto", padding: "6px 8px" },
|
|
343
|
+
toolbar: { display: "flex", alignItems: "center", gap: 6, padding: "4px 2px 8px", flexWrap: "wrap" },
|
|
344
|
+
row: { borderBottom: "1px solid #161b22" },
|
|
345
|
+
rowHead: { display: "flex", alignItems: "center", gap: 6, padding: "5px 4px", cursor: "pointer" },
|
|
346
|
+
rowBody: { padding: "2px 4px 8px 4px", display: "flex", flexDirection: "column", gap: 3 },
|
|
347
|
+
deltaRow: { display: "flex", alignItems: "center", gap: 6, padding: "3px 4px", borderBottom: "1px solid #161b22" },
|
|
348
|
+
badge: { font: `600 10px ${mono}`, color: "#fff", borderRadius: 4, padding: "1px 5px", textTransform: "uppercase" },
|
|
349
|
+
tag: { font: `10px ${mono}`, color: "#c9a0ff", border: "1px solid #3b2d57", borderRadius: 4, padding: "0 4px" },
|
|
350
|
+
tagPending: { font: `10px ${mono}`, color: "#f0c552", border: "1px solid #5a4a16", borderRadius: 4, padding: "0 4px" },
|
|
351
|
+
warn: { font: `600 10px ${mono}`, color: "#f0883e" },
|
|
352
|
+
mono: { fontFamily: mono, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
353
|
+
muted: { color: "#6e7681", fontSize: 11, whiteSpace: "nowrap" },
|
|
354
|
+
count: { color: "#6e7681" },
|
|
355
|
+
dot: { background: "#d9a106", color: "#0d1117", borderRadius: 8, padding: "0 5px", marginLeft: 2, fontWeight: 700 },
|
|
356
|
+
empty: { color: "#6e7681", padding: 16, textAlign: "center", lineHeight: 1.6 },
|
|
357
|
+
smallBtn: { font: `11px ${mono}`, color: "#c9d1d9", background: "#21262d", border: "1px solid #30363d", borderRadius: 5, padding: "2px 7px", cursor: "pointer" },
|
|
358
|
+
chip: { font: `10px ${mono}`, color: "#c9d1d9", background: "#161b22", border: "1px solid #30363d", borderRadius: 10, padding: "1px 8px", cursor: "pointer" },
|
|
359
|
+
chipOff: { color: "#484f58", textDecoration: "line-through" },
|
|
360
|
+
kv: { display: "flex", gap: 6, alignItems: "baseline" },
|
|
361
|
+
kvKey: { color: "#6e7681", minWidth: 96, flexShrink: 0 },
|
|
362
|
+
kvVal: { color: "#c9d1d9", wordBreak: "break-word", flex: 1 },
|
|
363
|
+
pre: { margin: 0, padding: "4px 6px", background: "#161b22", borderRadius: 5, maxHeight: 180, overflow: "auto", whiteSpace: "pre-wrap" },
|
|
364
|
+
code: { background: "#161b22", borderRadius: 4, padding: "0 4px" },
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export { getDevtoolsCore, getDevtoolsHub, attachDevtools } from "@rindle/devtools";
|
|
368
|
+
export type { DevtoolsCore, DevtoolsState } from "@rindle/devtools";
|