@reopt-ai/opt-devtool 1.0.0 → 1.0.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.
Files changed (54) hide show
  1. package/README.md +7 -0
  2. package/dist/brandapp/index.cjs +455 -364
  3. package/dist/brandapp/index.d.cts +70 -68
  4. package/dist/brandapp/index.d.ts +70 -68
  5. package/dist/brandapp/index.js +448 -361
  6. package/dist/datagrid/index.cjs +171 -181
  7. package/dist/datagrid/index.d.cts +10 -9
  8. package/dist/datagrid/index.d.ts +10 -9
  9. package/dist/datagrid/index.js +167 -179
  10. package/dist/editor/index.cjs +210 -229
  11. package/dist/editor/index.d.cts +10 -9
  12. package/dist/editor/index.d.ts +10 -9
  13. package/dist/editor/index.js +206 -227
  14. package/dist/harness/index.cjs +5 -12
  15. package/dist/harness/index.d.cts +14 -14
  16. package/dist/harness/index.d.ts +14 -14
  17. package/dist/harness/index.js +2 -11
  18. package/dist/harness-CoRqiJWO.cjs +584 -0
  19. package/dist/harness-DU8hP98g.js +536 -0
  20. package/dist/index.cjs +3687 -3816
  21. package/dist/index.d.cts +13 -15
  22. package/dist/index.d.ts +13 -15
  23. package/dist/index.js +3679 -3815
  24. package/dist/provider-Bn7CAE_Y.js +116 -0
  25. package/dist/provider-CLRiXjfD.cjs +168 -0
  26. package/dist/theme/index.cjs +296 -12
  27. package/dist/theme/index.d.cts +25 -24
  28. package/dist/theme/index.d.ts +25 -24
  29. package/dist/theme/index.js +292 -11
  30. package/dist/theme-isolate-DgSS935z.cjs +54 -0
  31. package/dist/theme-isolate-F-oX2d4W.js +43 -0
  32. package/dist/types-B_abMm2B.cjs +10 -0
  33. package/dist/types-DvhcaPXA.js +5 -0
  34. package/dist/types-oHbLkgEH.d.cts +95 -0
  35. package/dist/types-oHbLkgEH.d.ts +95 -0
  36. package/dist/ui/index.cjs +4 -8
  37. package/dist/ui/index.d.cts +3 -2
  38. package/dist/ui/index.d.ts +3 -2
  39. package/dist/ui/index.js +2 -7
  40. package/package.json +2 -2
  41. package/dist/chunk-4MJKIAXH.cjs +0 -65
  42. package/dist/chunk-5HRIQSVF.js +0 -32
  43. package/dist/chunk-6AGUYGVT.cjs +0 -77
  44. package/dist/chunk-EQPETYJJ.cjs +0 -32
  45. package/dist/chunk-H3F2WACS.cjs +0 -568
  46. package/dist/chunk-N7YO56TN.cjs +0 -25
  47. package/dist/chunk-SQ3E3QLA.cjs +0 -253
  48. package/dist/chunk-SW2FF6EV.js +0 -568
  49. package/dist/chunk-UJSIQF3A.js +0 -25
  50. package/dist/chunk-UQY5I3WS.js +0 -253
  51. package/dist/chunk-YCYIUFB4.js +0 -65
  52. package/dist/chunk-Z2KFRHSI.js +0 -77
  53. package/dist/index-Bakx4o8Z.d.cts +0 -91
  54. package/dist/index-Bakx4o8Z.d.ts +0 -91
@@ -1,187 +1,175 @@
1
1
  "use client";
2
2
  "use client";
3
- import {
4
- useOptDevtoolPlugin
5
- } from "../chunk-Z2KFRHSI.js";
6
- import "../chunk-UJSIQF3A.js";
7
-
8
- // src/datagrid/index.tsx
3
+ import { n as useOptDevtoolPlugin } from "../provider-Bn7CAE_Y.js";
9
4
  import * as React from "react";
10
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/datagrid/index.tsx
11
7
  function StatusDot({ active, label }) {
12
- return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
13
- /* @__PURE__ */ jsx(
14
- "span",
15
- {
16
- className: `inline-block h-1.5 w-1.5 rounded-full ${active ? "bg-emerald-400" : "bg-white/20"}`
17
- }
18
- ),
19
- label
20
- ] });
8
+ return /* @__PURE__ */ jsxs("span", {
9
+ className: "inline-flex items-center gap-1",
10
+ children: [/* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${active ? "bg-emerald-400" : "bg-white/20"}` }), label]
11
+ });
21
12
  }
22
- function DataGridDevtoolPanel({
23
- snapshot,
24
- telemetry
25
- }) {
26
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
27
- if (!snapshot) {
28
- return /* @__PURE__ */ jsx("div", { className: "text-[11px] text-white/55", children: "Waiting for DataGrid snapshot." });
29
- }
30
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 text-[11px]", children: [
31
- /* @__PURE__ */ jsxs("section", { children: [
32
- /* @__PURE__ */ jsx("p", { className: "mb-1 text-[10px] font-semibold text-emerald-400", children: "Runtime" }),
33
- /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5 text-white/70 md:grid-cols-2", children: [
34
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
35
- /* @__PURE__ */ jsx(
36
- "span",
37
- {
38
- className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot.activeCell ? "bg-emerald-400" : "bg-white/20"}`
39
- }
40
- ),
41
- "Active cell: r",
42
- snapshot.activeCell.row + 1,
43
- " c",
44
- snapshot.activeCell.col + 1
45
- ] }),
46
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
47
- /* @__PURE__ */ jsx(
48
- "span",
49
- {
50
- className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot.editingCell ? "animate-pulse bg-emerald-400" : "bg-white/20"}`
51
- }
52
- ),
53
- "Editing:",
54
- " ",
55
- snapshot.editingCell ? `r${snapshot.editingCell.row + 1} c${snapshot.editingCell.col + 1}` : "Closed"
56
- ] }),
57
- /* @__PURE__ */ jsxs("div", { children: [
58
- "Rows: ",
59
- snapshot.rowCount.toLocaleString()
60
- ] }),
61
- /* @__PURE__ */ jsxs("div", { children: [
62
- "Columns: ",
63
- snapshot.columnCount.toLocaleString()
64
- ] }),
65
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(StatusDot, { active: snapshot.overlayOpen, label: "Overlay" }) }),
66
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
67
- "History:",
68
- " ",
69
- /* @__PURE__ */ jsx(StatusDot, { active: snapshot.history.canUndo, label: "undo" }),
70
- /* @__PURE__ */ jsx(StatusDot, { active: snapshot.history.canRedo, label: "redo" })
71
- ] })
72
- ] })
73
- ] }),
74
- /* @__PURE__ */ jsxs("section", { children: [
75
- /* @__PURE__ */ jsx("p", { className: "mb-1 text-[10px] font-semibold text-emerald-400", children: "Selection" }),
76
- /* @__PURE__ */ jsxs("div", { className: "text-white/70", children: [
77
- /* @__PURE__ */ jsxs("div", { children: [
78
- "Range: r",
79
- snapshot.selection.start.row + 1,
80
- " c",
81
- snapshot.selection.start.col + 1,
82
- " \u2192 r",
83
- snapshot.selection.end.row + 1,
84
- " c",
85
- snapshot.selection.end.col + 1
86
- ] }),
87
- /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
88
- "Row picks: ",
89
- ((_a = snapshot.selection.rows) != null ? _a : []).length,
90
- " / Column picks:",
91
- " ",
92
- ((_b = snapshot.selection.columns) != null ? _b : []).length
93
- ] }),
94
- /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
95
- "Visible region: r",
96
- (_d = (_c = snapshot.visibleRegion) == null ? void 0 : _c.startRow) != null ? _d : 0,
97
- "-",
98
- (_f = (_e = snapshot.visibleRegion) == null ? void 0 : _e.endRow) != null ? _f : 0,
99
- ", c",
100
- (_h = (_g = snapshot.visibleRegion) == null ? void 0 : _g.startCol) != null ? _h : 0,
101
- "-",
102
- (_j = (_i = snapshot.visibleRegion) == null ? void 0 : _i.endCol) != null ? _j : 0
103
- ] }),
104
- snapshot.draftError ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-1 text-rose-300", children: [
105
- /* @__PURE__ */ jsx("span", { className: "inline-block h-1.5 w-1.5 rounded-full bg-red-400" }),
106
- "Draft error: ",
107
- snapshot.draftError
108
- ] }) : null
109
- ] })
110
- ] }),
111
- telemetry ? /* @__PURE__ */ jsxs("section", { children: [
112
- /* @__PURE__ */ jsx("p", { className: "mb-1 text-[10px] font-semibold text-emerald-400", children: "Remote telemetry" }),
113
- /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5 text-white/70 md:grid-cols-2", children: [
114
- /* @__PURE__ */ jsxs("div", { children: [
115
- "Open views: ",
116
- telemetry.viewOpenCount
117
- ] }),
118
- /* @__PURE__ */ jsxs("div", { children: [
119
- "Loads: ",
120
- telemetry.loadCount
121
- ] }),
122
- /* @__PURE__ */ jsxs("div", { children: [
123
- "Saves: ",
124
- telemetry.saveCount
125
- ] }),
126
- /* @__PURE__ */ jsxs("div", { children: [
127
- "Push invalidations: ",
128
- telemetry.pushInvalidationCount
129
- ] }),
130
- /* @__PURE__ */ jsxs("div", { children: [
131
- "Rejected edits: ",
132
- telemetry.rejectedEditCount
133
- ] }),
134
- /* @__PURE__ */ jsxs("div", { children: [
135
- "Page retries: ",
136
- telemetry.pageRetryCount
137
- ] }),
138
- /* @__PURE__ */ jsxs("div", { children: [
139
- "Last open: ",
140
- (_k = telemetry.lastViewOpenDurationMs) != null ? _k : "-",
141
- " ms"
142
- ] }),
143
- /* @__PURE__ */ jsxs("div", { children: [
144
- "Last load: ",
145
- (_l = telemetry.lastLoadDurationMs) != null ? _l : "-",
146
- " ms"
147
- ] }),
148
- /* @__PURE__ */ jsxs("div", { children: [
149
- "Last save: ",
150
- (_m = telemetry.lastSaveDurationMs) != null ? _m : "-",
151
- " ms"
152
- ] }),
153
- /* @__PURE__ */ jsxs("div", { children: [
154
- "Invalidated pages: ",
155
- telemetry.invalidatedPageCount
156
- ] })
157
- ] })
158
- ] }) : null
159
- ] });
13
+ function DataGridDevtoolPanel({ snapshot, telemetry }) {
14
+ var _snapshot$selection$r, _snapshot$selection$c, _snapshot$visibleRegi, _snapshot$visibleRegi2, _snapshot$visibleRegi3, _snapshot$visibleRegi4, _snapshot$visibleRegi5, _snapshot$visibleRegi6, _snapshot$visibleRegi7, _snapshot$visibleRegi8, _telemetry$lastViewOp, _telemetry$lastLoadDu, _telemetry$lastSaveDu;
15
+ if (!snapshot) return /* @__PURE__ */ jsx("div", {
16
+ className: "text-[11px] text-white/55",
17
+ children: "Waiting for DataGrid snapshot."
18
+ });
19
+ return /* @__PURE__ */ jsxs("div", {
20
+ className: "flex flex-col gap-3 text-[11px]",
21
+ children: [
22
+ /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("p", {
23
+ className: "mb-1 text-[10px] font-semibold text-emerald-400",
24
+ children: "Runtime"
25
+ }), /* @__PURE__ */ jsxs("div", {
26
+ className: "grid gap-1.5 text-white/70 md:grid-cols-2",
27
+ children: [
28
+ /* @__PURE__ */ jsxs("div", {
29
+ className: "flex items-center gap-1",
30
+ children: [
31
+ /* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot.activeCell ? "bg-emerald-400" : "bg-white/20"}` }),
32
+ "Active cell: r",
33
+ snapshot.activeCell.row + 1,
34
+ " c",
35
+ snapshot.activeCell.col + 1
36
+ ]
37
+ }),
38
+ /* @__PURE__ */ jsxs("div", {
39
+ className: "flex items-center gap-1",
40
+ children: [
41
+ /* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot.editingCell ? "animate-pulse bg-emerald-400" : "bg-white/20"}` }),
42
+ "Editing:",
43
+ " ",
44
+ snapshot.editingCell ? `r${snapshot.editingCell.row + 1} c${snapshot.editingCell.col + 1}` : "Closed"
45
+ ]
46
+ }),
47
+ /* @__PURE__ */ jsxs("div", { children: ["Rows: ", snapshot.rowCount.toLocaleString()] }),
48
+ /* @__PURE__ */ jsxs("div", { children: ["Columns: ", snapshot.columnCount.toLocaleString()] }),
49
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(StatusDot, {
50
+ active: snapshot.overlayOpen,
51
+ label: "Overlay"
52
+ }) }),
53
+ /* @__PURE__ */ jsxs("div", {
54
+ className: "flex gap-2",
55
+ children: [
56
+ "History:",
57
+ " ",
58
+ /* @__PURE__ */ jsx(StatusDot, {
59
+ active: snapshot.history.canUndo,
60
+ label: "undo"
61
+ }),
62
+ /* @__PURE__ */ jsx(StatusDot, {
63
+ active: snapshot.history.canRedo,
64
+ label: "redo"
65
+ })
66
+ ]
67
+ })
68
+ ]
69
+ })] }),
70
+ /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("p", {
71
+ className: "mb-1 text-[10px] font-semibold text-emerald-400",
72
+ children: "Selection"
73
+ }), /* @__PURE__ */ jsxs("div", {
74
+ className: "text-white/70",
75
+ children: [
76
+ /* @__PURE__ */ jsxs("div", { children: [
77
+ "Range: r",
78
+ snapshot.selection.start.row + 1,
79
+ " c",
80
+ snapshot.selection.start.col + 1,
81
+ " → r",
82
+ snapshot.selection.end.row + 1,
83
+ " c",
84
+ snapshot.selection.end.col + 1
85
+ ] }),
86
+ /* @__PURE__ */ jsxs("div", {
87
+ className: "mt-1",
88
+ children: [
89
+ "Row picks: ",
90
+ ((_snapshot$selection$r = snapshot.selection.rows) !== null && _snapshot$selection$r !== void 0 ? _snapshot$selection$r : []).length,
91
+ " / Column picks:",
92
+ " ",
93
+ ((_snapshot$selection$c = snapshot.selection.columns) !== null && _snapshot$selection$c !== void 0 ? _snapshot$selection$c : []).length
94
+ ]
95
+ }),
96
+ /* @__PURE__ */ jsxs("div", {
97
+ className: "mt-1",
98
+ children: [
99
+ "Visible region: r",
100
+ (_snapshot$visibleRegi = (_snapshot$visibleRegi2 = snapshot.visibleRegion) === null || _snapshot$visibleRegi2 === void 0 ? void 0 : _snapshot$visibleRegi2.startRow) !== null && _snapshot$visibleRegi !== void 0 ? _snapshot$visibleRegi : 0,
101
+ "-",
102
+ (_snapshot$visibleRegi3 = (_snapshot$visibleRegi4 = snapshot.visibleRegion) === null || _snapshot$visibleRegi4 === void 0 ? void 0 : _snapshot$visibleRegi4.endRow) !== null && _snapshot$visibleRegi3 !== void 0 ? _snapshot$visibleRegi3 : 0,
103
+ ", c",
104
+ (_snapshot$visibleRegi5 = (_snapshot$visibleRegi6 = snapshot.visibleRegion) === null || _snapshot$visibleRegi6 === void 0 ? void 0 : _snapshot$visibleRegi6.startCol) !== null && _snapshot$visibleRegi5 !== void 0 ? _snapshot$visibleRegi5 : 0,
105
+ "-",
106
+ (_snapshot$visibleRegi7 = (_snapshot$visibleRegi8 = snapshot.visibleRegion) === null || _snapshot$visibleRegi8 === void 0 ? void 0 : _snapshot$visibleRegi8.endCol) !== null && _snapshot$visibleRegi7 !== void 0 ? _snapshot$visibleRegi7 : 0
107
+ ]
108
+ }),
109
+ snapshot.draftError ? /* @__PURE__ */ jsxs("div", {
110
+ className: "mt-1 flex items-center gap-1 text-rose-300",
111
+ children: [
112
+ /* @__PURE__ */ jsx("span", { className: "inline-block h-1.5 w-1.5 rounded-full bg-red-400" }),
113
+ "Draft error: ",
114
+ snapshot.draftError
115
+ ]
116
+ }) : null
117
+ ]
118
+ })] }),
119
+ telemetry ? /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("p", {
120
+ className: "mb-1 text-[10px] font-semibold text-emerald-400",
121
+ children: "Remote telemetry"
122
+ }), /* @__PURE__ */ jsxs("div", {
123
+ className: "grid gap-1.5 text-white/70 md:grid-cols-2",
124
+ children: [
125
+ /* @__PURE__ */ jsxs("div", { children: ["Open views: ", telemetry.viewOpenCount] }),
126
+ /* @__PURE__ */ jsxs("div", { children: ["Loads: ", telemetry.loadCount] }),
127
+ /* @__PURE__ */ jsxs("div", { children: ["Saves: ", telemetry.saveCount] }),
128
+ /* @__PURE__ */ jsxs("div", { children: ["Push invalidations: ", telemetry.pushInvalidationCount] }),
129
+ /* @__PURE__ */ jsxs("div", { children: ["Rejected edits: ", telemetry.rejectedEditCount] }),
130
+ /* @__PURE__ */ jsxs("div", { children: ["Page retries: ", telemetry.pageRetryCount] }),
131
+ /* @__PURE__ */ jsxs("div", { children: [
132
+ "Last open: ",
133
+ (_telemetry$lastViewOp = telemetry.lastViewOpenDurationMs) !== null && _telemetry$lastViewOp !== void 0 ? _telemetry$lastViewOp : "-",
134
+ " ms"
135
+ ] }),
136
+ /* @__PURE__ */ jsxs("div", { children: [
137
+ "Last load: ",
138
+ (_telemetry$lastLoadDu = telemetry.lastLoadDurationMs) !== null && _telemetry$lastLoadDu !== void 0 ? _telemetry$lastLoadDu : "-",
139
+ " ms"
140
+ ] }),
141
+ /* @__PURE__ */ jsxs("div", { children: [
142
+ "Last save: ",
143
+ (_telemetry$lastSaveDu = telemetry.lastSaveDurationMs) !== null && _telemetry$lastSaveDu !== void 0 ? _telemetry$lastSaveDu : "-",
144
+ " ms"
145
+ ] }),
146
+ /* @__PURE__ */ jsxs("div", { children: ["Invalidated pages: ", telemetry.invalidatedPageCount] })
147
+ ]
148
+ })] }) : null
149
+ ]
150
+ });
160
151
  }
161
- function useDataGridDevtoolBridge({
162
- id,
163
- label,
164
- order = 20,
165
- telemetry
166
- }) {
167
- const [snapshot, setSnapshot] = React.useState(null);
168
- const inspect = React.useCallback((nextSnapshot) => {
169
- setSnapshot(nextSnapshot);
170
- }, []);
171
- const plugin = React.useMemo(
172
- () => ({
173
- id,
174
- label,
175
- order,
176
- renderPanel: () => /* @__PURE__ */ jsx(DataGridDevtoolPanel, { snapshot, telemetry })
177
- }),
178
- [id, label, order, snapshot, telemetry]
179
- );
180
- useOptDevtoolPlugin(plugin);
181
- return {
182
- inspect
183
- };
152
+ function useDataGridDevtoolBridge({ id, label, order = 20, telemetry }) {
153
+ const [snapshot, setSnapshot] = React.useState(null);
154
+ const inspect = React.useCallback((nextSnapshot) => {
155
+ setSnapshot(nextSnapshot);
156
+ }, []);
157
+ useOptDevtoolPlugin(React.useMemo(() => ({
158
+ id,
159
+ label,
160
+ order,
161
+ renderPanel: () => /* @__PURE__ */ jsx(DataGridDevtoolPanel, {
162
+ snapshot,
163
+ telemetry
164
+ })
165
+ }), [
166
+ id,
167
+ label,
168
+ order,
169
+ snapshot,
170
+ telemetry
171
+ ]));
172
+ return { inspect };
184
173
  }
185
- export {
186
- useDataGridDevtoolBridge
187
- };
174
+ //#endregion
175
+ export { useDataGridDevtoolBridge };