@reopt-ai/opt-devtool 1.0.0 → 1.0.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +11 -2
  3. package/dist/brandapp/index.cjs +457 -363
  4. package/dist/brandapp/index.d.cts +80 -81
  5. package/dist/brandapp/index.d.ts +80 -81
  6. package/dist/brandapp/index.js +451 -361
  7. package/dist/datagrid/index.cjs +170 -180
  8. package/dist/datagrid/index.d.cts +9 -11
  9. package/dist/datagrid/index.d.ts +9 -11
  10. package/dist/datagrid/index.js +167 -179
  11. package/dist/editor/index.cjs +209 -228
  12. package/dist/editor/index.d.cts +9 -11
  13. package/dist/editor/index.d.ts +9 -11
  14. package/dist/editor/index.js +206 -227
  15. package/dist/harness/index.cjs +5 -12
  16. package/dist/harness/index.d.cts +14 -16
  17. package/dist/harness/index.d.ts +14 -16
  18. package/dist/harness/index.js +1 -11
  19. package/dist/harness-CJZXBH3w.js +528 -0
  20. package/dist/harness-CPOp9Wlj.cjs +582 -0
  21. package/dist/index.cjs +3619 -3782
  22. package/dist/index.d.cts +9 -17
  23. package/dist/index.d.ts +9 -17
  24. package/dist/index.js +3611 -3781
  25. package/dist/provider-Cjg2rSYG.js +110 -0
  26. package/dist/provider-H53ZWHCo.cjs +161 -0
  27. package/dist/theme/index.cjs +298 -12
  28. package/dist/theme/index.d.cts +26 -28
  29. package/dist/theme/index.d.ts +26 -28
  30. package/dist/theme/index.js +294 -11
  31. package/dist/theme-isolate-BOo3J259.js +42 -0
  32. package/dist/theme-isolate-D9AMkYrD.cjs +53 -0
  33. package/dist/types-BKmW0EBr.js +4 -0
  34. package/dist/types-Bz4DijhU.cjs +9 -0
  35. package/dist/types-D_lNT2Nr.d.cts +91 -0
  36. package/dist/types-D_lNT2Nr.d.ts +91 -0
  37. package/dist/ui/index.cjs +4 -8
  38. package/dist/ui/index.d.cts +3 -2
  39. package/dist/ui/index.d.ts +3 -2
  40. package/dist/ui/index.js +1 -7
  41. package/package.json +4 -4
  42. package/dist/chunk-4MJKIAXH.cjs +0 -65
  43. package/dist/chunk-5HRIQSVF.js +0 -32
  44. package/dist/chunk-6AGUYGVT.cjs +0 -77
  45. package/dist/chunk-EQPETYJJ.cjs +0 -32
  46. package/dist/chunk-H3F2WACS.cjs +0 -568
  47. package/dist/chunk-N7YO56TN.cjs +0 -25
  48. package/dist/chunk-SQ3E3QLA.cjs +0 -253
  49. package/dist/chunk-SW2FF6EV.js +0 -568
  50. package/dist/chunk-UJSIQF3A.js +0 -25
  51. package/dist/chunk-UQY5I3WS.js +0 -253
  52. package/dist/chunk-YCYIUFB4.js +0 -65
  53. package/dist/chunk-Z2KFRHSI.js +0 -77
  54. package/dist/index-Bakx4o8Z.d.cts +0 -91
  55. 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-Cjg2rSYG.js";
9
4
  import * as React from "react";
10
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ // 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
+ const plugin = 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
+ useOptDevtoolPlugin(plugin);
173
+ return { inspect };
184
174
  }
185
- export {
186
- useDataGridDevtoolBridge
187
- };
175
+ export { useDataGridDevtoolBridge };